refactoring for model-config
authorNam KwanWoo <kw46.nam@samsung.com>
Thu, 13 Jun 2013 06:52:30 +0000 (15:52 +0900)
committerNam KwanWoo <kw46.nam@samsung.com>
Thu, 13 Jun 2013 06:52:30 +0000 (15:52 +0900)
Change-Id: Ia2b481537f2ba98fc0797d6e7f16da66b95e12a3

12 files changed:
CMakeLists.txt [changed mode: 0755->0644]
LICENSE.RFC4122 [deleted file]
configuration/sys-info.xml [deleted file]
include/system_info.h
include/system_info_private.h
packaging/capi-system-info.spec
src/system_info.c
src/system_info_device.c
src/system_info_network.c
src/system_info_parse.c
src/system_info_platform.c
src/system_info_screen.c

old mode 100755 (executable)
new mode 100644 (file)
index 91bd0fd..f55ff35
@@ -10,7 +10,7 @@ SET(PREFIX ${CMAKE_INSTALL_PREFIX})
 SET(INC_DIR include)
 INCLUDE_DIRECTORIES(${INC_DIR})
 
-SET(requires "dlog capi-base-common capi-media-sound-manager vconf x11 xi xrandr tapi haptic xproto openssl nfc location bluetooth-api mm-radio sensor iniparser libxml-2.0")
+SET(requires "dlog capi-base-common vconf iniparser libxml-2.0")
 SET(pc_requires "capi-base-common")
 
 INCLUDE(FindPkgConfig)
diff --git a/LICENSE.RFC4122 b/LICENSE.RFC4122
deleted file mode 100644 (file)
index e0e32fa..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
- Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc.
- Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. &
- Digital Equipment Corporation, Maynard, Mass.
- Copyright (c) 1998 Microsoft.
- To anyone who acknowledges that this file is provided "AS IS"
- without any express or implied warranty: permission to use, copy,
- modify, and distribute this file for any purpose is hereby
- granted without fee, provided that the above copyright notices and
- this notice appears in all source code copies, and that none of
- the names of Open Software Foundation, Inc., Hewlett-Packard
- Company, Microsoft, or Digital Equipment Corporation be used in
- advertising or publicity pertaining to distribution of the software
- without specific, written prior permission. Neither Open Software
- Foundation, Inc., Hewlett-Packard Company, Microsoft, nor Digital
- Equipment Corporation makes any representations about the
- suitability of this software for any purpose.
-
diff --git a/configuration/sys-info.xml b/configuration/sys-info.xml
deleted file mode 100644 (file)
index ccda91f..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0"?>
-<sys-info>
-       <default>
-         <key id="MANUFACTURER" string="samsung"/>
-         <key id="CP_Interface" string="svnet2"/>
-         <key id="Keyboad_type" string="NULL"/>
-         <key id="sip_voip_support" string="FALSE"/>
-         <key id="tv_out_support" string="TRUE"/>
-         <key id="wifi_support" string="TRUE"/>
-         <key id="wifi_direct_support" string="TRUE"/>
-       </default>
-</sys-info>
index 6b6f1a5..80b5dd4 100644 (file)
@@ -54,12 +54,9 @@ typedef enum {
        SYSTEM_INFO_KEY_SCREEN_BITS_PER_PIXEL, /**< The number of bits per pixel */
        SYSTEM_INFO_KEY_SCREEN_HEIGHT, /**< The height of the screen in pixels */
        SYSTEM_INFO_KEY_SCREEN_WIDTH, /**< The width of the screen in pixels */
-       SYSTEM_INFO_KEY_MOBILE_DEVICE_ID, /**< The unique ID to identify GSM, UMTS and CDMA mobile devices */
-       SYSTEM_INFO_KEY_CSC_SALES_CODE, /**< The sales code of CSC */
        SYSTEM_INFO_KEY_PLATFORM_NAME, /**< The name of platform */
        SYSTEM_INFO_KEY_TIZEN_VERSION_NAME, /**< The name of tizen version  */
        SYSTEM_INFO_KEY_SCREEN_DPI, /**< The width of the screen DPI */
-       SYSTEM_INFO_KEY_DEVICE_UUID, /**< The Device unique ID to identify */
        SYSTEM_INFO_KEY_CORE_CPU_ARCH, /**< The CORE CPU architecture of model */
        SYSTEM_INFO_KEY_CORE_FPU_ARCH, /**< The CORE FPU architecture of model */
        SYSTEM_INFO_KEY_OPENGLES_TEXTURE_FORMAT, /**< The supported texture format of the OpenGL ES */
@@ -73,19 +70,14 @@ typedef enum {
        SYSTEM_INFO_KEY_FMRADIO_SUPPORTED, /**< Indicates whether the device supports FM radio */
        SYSTEM_INFO_KEY_GPS_SUPPORTED, /**< Indicates whether the device supports GPS */
        SYSTEM_INFO_KEY_NFC_SUPPORTED, /**< Indicates whether the device supports NFC */
-       SYSTEM_INFO_KEY_TVOUT_SUPPORTED, /**< Indicates whether the device supports TV-out */
        SYSTEM_INFO_KEY_WIFI_SUPPORTED, /**< Indicates whether the device supports Wi-Fi */
-       SYSTEM_INFO_KEY_HAPTIC_SUPPORTED, /**< Indicates whether the device supports Haptic */
        SYSTEM_INFO_KEY_WIFI_DIRECT_SUPPORTED, /**< Indicates whether the device supports Wi-Fi Direct */
-       SYSTEM_INFO_KEY_CPS_SUPPORTED, /**< Indicates whether the device supports CPS */
        SYSTEM_INFO_KEY_WPS_SUPPORTED, /**< Indicates whether the device supports WPS */
        SYSTEM_INFO_KEY_USB_HOST_SUPPORTED, /**< Indicates whether the device supports USB host */
        SYSTEM_INFO_KEY_USB_ACCESSORY_SUPPORTED, /**< Indicates whether the device supports USB accessory */
        SYSTEM_INFO_KEY_FRONT_CAMERA_SUPPORTED, /**< Indicates whether the device supports front camera */
-       SYSTEM_INFO_KEY_FRONT_CAMERA_AF_SUPPORTED, /**< Indicates whether the device supports front camera auto focus */
        SYSTEM_INFO_KEY_FRONT_CAMERA_FLASH_SUPPORTED, /**< Indicates whether the device supports front camera flash */
        SYSTEM_INFO_KEY_BACK_CAMERA_SUPPORTED, /**< Indicates whether the device supports back camera */
-       SYSTEM_INFO_KEY_BACK_CAMERA_AF_SUPPORTED, /**< Indicates whether the device supports back camera auto focus */
        SYSTEM_INFO_KEY_BACK_CAMERA_FLASH_SUPPORTED, /**< Indicates whether the device supports back camera flash */
        SYSTEM_INFO_KEY_HDMI_SUPPORTED, /**< Indicates whether the device supports HDMI */
        SYSTEM_INFO_KEY_RCA_SUPPORTED, /**< Indicates whether the device supports RCA */
@@ -93,8 +85,6 @@ typedef enum {
        SYSTEM_INFO_KEY_MICROPHONE_SUPPORTED, /**< Indicates whether the device supports Microphone */
        SYSTEM_INFO_KEY_SPEECH_RECOGNITION_SUPPORTED, /**< Indicates whether the device supports stt */
        SYSTEM_INFO_KEY_BAROMETER_SENSOR_SUPPORTED, /**< Indicates whether the device supports barometer sensor */
-       SYSTEM_INFO_KEY_MANUFACTURER, /**< The manufacturer of the device */
-       SYSTEM_INFO_KEY_CP_INTERFACE, /**< The method of interface with CP */
        SYSTEM_INFO_KEY_MMS_SUPPORTED, /**< Indicates whether the device supports MMS */
        SYSTEM_INFO_KEY_SMS_SUPPORTED, /**< Indicates whether the device supports SMS */
        SYSTEM_INFO_KEY_CBS_SUPPORTED, /**< Indicates whether the device supports CBS */
@@ -104,6 +94,7 @@ typedef enum {
        SYSTEM_INFO_KEY_GRAPHICS_HWACCEL_SUPPORTED, /**< Indicates whether the device supports graphics hardware acceleration */
        SYSTEM_INFO_KEY_FEATURE_AUTO_ROTATION_SUPPORTED, /**< Indicates whether the device supports native auto rotation feature */
        SYSTEM_INFO_KEY_FEATURE_PINCH_ZOOM_SUPPORTED, /**< Indicates whether the device supports pinch zoom feature */
+       SYSTEM_INFO_KEY_MANUFACTURER, /**< The manufacturer of the device */
 } system_info_key_e;
 
 /**
@@ -254,6 +245,54 @@ int system_info_get_custom_double(const char *key, double *value);
 int system_info_get_custom_string(const char *key, char **value);
 
 /**
+ * @brief   Gets the boolean value of the internal feature
+ * @param[in] key The name of the custom feature to get
+ * @param[out] value The value of the given internal feature
+ * @return  0 on success, otherwise a negative error value.
+ * @retval  #SYSTEM_INFO_ERROR_NONE Successful
+ * @retval  #SYSTEM_INFO_ERROR_INVALID_PARAMETER cannot find key in model config file
+ * @retval  #SYSTEM_INFO_ERROR_IO_ERROR An input/output error occurred when read value from model config file
+ */
+int system_info_get_internal_bool(const char *key, bool *value);
+
+/**
+ * @brief   Gets the string value of the internal feature
+ * @remarks The @a value must be released with free() by you.
+ * @param[in] key The name of the custom feature to get
+ * @param[out] value The value of the given internal feature
+ * @return  0 on success, otherwise a negative error value.
+ * @retval  #SYSTEM_INFO_ERROR_NONE Successful
+ * @retval  #SYSTEM_INFO_ERROR_INVALID_PARAMETER cannot find key in model config file
+ * @retval  #SYSTEM_INFO_ERROR_IO_ERROR An input/output error occurred when read value from model config file
+ */
+int system_info_get_internal_int(const char *key, int *value);
+
+/**
+ * @brief   Gets the string value of the internal feature
+ * @remarks The @a value must be released with free() by you.
+ * @param[in] key The name of the custom feature to get
+ * @param[out] value The value of the given internal feature
+ * @return  0 on success, otherwise a negative error value.
+ * @retval  #SYSTEM_INFO_ERROR_NONE Successful
+ * @retval  #SYSTEM_INFO_ERROR_INVALID_PARAMETER cannot find key in model config file
+ * @retval  #SYSTEM_INFO_ERROR_IO_ERROR An input/output error occurred when read value from model config file
+ */
+int system_info_get_internal_double(const char *key, double *value);
+
+/**
+ * @brief   Gets the string value of the internal feature
+ * @remarks The @a value must be released with free() by you.
+ * @param[in] key The name of the internal feature to get
+ * @param[out] value The value of the given internal feature
+ * @return  0 on success, otherwise a negative error value.
+ * @retval  #SYSTEM_INFO_ERROR_NONE Successful
+ * @retval  #SYSTEM_INFO_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval  #SYSTEM_INFO_ERROR_INVALID_PARAMETER cannot find key in model config file
+ * @retval  #SYSTEM_INFO_ERROR_IO_ERROR An input/output error occurred when read value from model config file
+ */
+int system_info_get_internal_string(const char *key, char **value);
+
+/**
  * @}
  */
 
index 799e7b8..a01a821 100644 (file)
@@ -27,8 +27,6 @@ extern "C"
 #define OS_RELEASE_FILE_PATH "/etc/os-release"
 #define CPU_INFO_FILE_PATH "/proc/cpuinfo"
 #define CPU_INFO_MAX_FREQ_PATH "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq"
-#define CMDLINE_PATH "/proc/cmdline"
-#define XML_FILE_PATH "/etc/config/sys-info.xml"
 #define CONFIG_FILE_PATH "/etc/config/model-config.xml"
 #define MAXBUFSIZE 512
 
@@ -36,6 +34,7 @@ extern "C"
 
 #define PLATFORM_TAG   "platform"
 #define CUSTOM_TAG     "custom"
+#define INTERNAL_TAG   "internal"
 
 #define BOOL_TYPE      "bool"
 #define INT_TYPE       "int"
@@ -85,7 +84,6 @@ int system_info_get_bluetooth_supported(system_info_key_e key, system_info_data_
 int system_info_get_camera_count(system_info_key_e key, system_info_data_type_e data_type, void **value);
 int system_info_get_fmradio_supported(system_info_key_e key, system_info_data_type_e data_type, void **value);
 int system_info_get_gps_supported(system_info_key_e key, system_info_data_type_e data_type, void **value);
-int system_info_get_cps_supported(system_info_key_e key, system_info_data_type_e data_type, void **value);
 int system_info_get_wps_supported(system_info_key_e key, system_info_data_type_e data_type, void **value);
 int system_info_get_keyboard_type(system_info_key_e key, system_info_data_type_e data_type, void **value);
 int system_info_get_usb_host_supported(system_info_key_e key, system_info_data_type_e data_type, void **value);
@@ -95,10 +93,8 @@ int system_info_get_network_type(system_info_key_e key, system_info_data_type_e
 int system_info_get_mobile_device_id(system_info_key_e key, system_info_data_type_e data_type, void **value);
 int system_info_get_nfc_supported(system_info_key_e key, system_info_data_type_e data_type, void **value);
 int system_info_get_front_camera_supported(system_info_key_e key, system_info_data_type_e data_type, void **value);
-int system_info_get_front_camera_af_supported(system_info_key_e key, system_info_data_type_e data_type, void **value);
 int system_info_get_front_camera_flash_supported(system_info_key_e key, system_info_data_type_e data_type, void **value);
 int system_info_get_back_camera_supported(system_info_key_e key, system_info_data_type_e data_type, void **value);
-int system_info_get_back_camera_af_supported(system_info_key_e key, system_info_data_type_e data_type, void **value);
 int system_info_get_back_camera_flash_supported(system_info_key_e key, system_info_data_type_e data_type, void **value);
 int system_info_get_opengles_version(system_info_key_e key, system_info_data_type_e data_type, void **value);
 int system_info_get_screen_bits_per_pixel(system_info_key_e key, system_info_data_type_e data_type, void **value);
@@ -109,20 +105,14 @@ int system_info_get_hdmi_supported(system_info_key_e key, system_info_data_type_
 int system_info_get_rca_supported(system_info_key_e key, system_info_data_type_e data_type, void **value);
 int system_info_get_physical_screen_height(system_info_key_e key, system_info_data_type_e data_type, void **value);
 int system_info_get_physical_screen_width(system_info_key_e key, system_info_data_type_e data_type, void **value);
-int system_info_get_tvout_supported(system_info_key_e key, system_info_data_type_e data_type, void **value);
 int system_info_get_wifi_supported(system_info_key_e key, system_info_data_type_e data_type, void **value);
 int system_info_get_wifi_direct_supported(system_info_key_e key, system_info_data_type_e data_type, void **value);
-int system_info_get_haptic_supproted(system_info_key_e key, system_info_data_type_e data_type, void **value);
-int system_info_get_mobile_device_id(system_info_key_e key, system_info_data_type_e data_type, void **value);
-int system_info_get_csc_sales_code(system_info_key_e key, system_info_data_type_e data_type, void **value);
-int system_info_get_device_uuid(system_info_key_e key, system_info_data_type_e data_type, void **value);
 int system_info_get_sip_voip_supported(system_info_key_e key, system_info_data_type_e data_type, void **value);
 int system_info_get_microphone_supported(system_info_key_e key, system_info_data_type_e data_type, void **value);
 int system_info_get_speech_recognition_supported(system_info_key_e key, system_info_data_type_e data_type, void **value);
 int system_info_get_speech_synthesis_supported(system_info_key_e key, system_info_data_type_e data_type, void **value);
 int system_info_get_barometer_sensor_supported(system_info_key_e key, system_info_data_type_e data_type, void **value);
 int system_info_get_manufacturer(system_info_key_e key, system_info_data_type_e data_type, void **value);
-int system_info_get_cp_interface(system_info_key_e key, system_info_data_type_e data_type, void **value);
 int system_info_get_build_string(system_info_key_e key, system_info_data_type_e data_type, void **value);
 int system_info_get_build_date(system_info_key_e key, system_info_data_type_e data_type, void **value);
 int system_info_get_build_time(system_info_key_e key, system_info_data_type_e data_type, void **value);
@@ -134,7 +124,6 @@ int system_info_get_nfc_reserved_push_supported(system_info_key_e key, system_in
 int system_info_get_graphics_hwaccel_supported(system_info_key_e key, system_info_data_type_e data_type, void **value);
 int system_info_get_feature_auto_rotation_supported(system_info_key_e key, system_info_data_type_e data_type, void **value);
 int system_info_get_feature_pinch_zoom_supported(system_info_key_e key, system_info_data_type_e data_type, void **value);
-
 #ifdef __cplusplus
 }
 #endif
index d7c879f..10b0cdd 100644 (file)
@@ -8,22 +8,8 @@ License:       Apache License, Version 2.0 and IEFT RFC Collection
 Source0:       %{name}-%{version}.tar.gz
 BuildRequires: cmake
 BuildRequires: pkgconfig(dlog)
-BuildRequires: pkgconfig(vconf)
 BuildRequires: pkgconfig(capi-base-common)
-BuildRequires: pkgconfig(capi-media-sound-manager)
-BuildRequires: pkgconfig(x11)
-BuildRequires: pkgconfig(xi)
-BuildRequires: pkgconfig(xrandr)
-BuildRequires: pkgconfig(tapi)
-BuildRequires: pkgconfig(haptic)
-BuildRequires: pkgconfig(xproto)
-BuildRequires: pkgconfig(openssl)
-BuildRequires: pkgconfig(nfc)
-BuildRequires: pkgconfig(location)
-BuildRequires: pkgconfig(bluetooth-api)
-BuildRequires: pkgconfig(mm-radio)
-BuildRequires: pkgconfig(sensor)
-BuildRequires: pkgconfig(gles11)
+BuildRequires: pkgconfig(vconf)
 BuildRequires: pkgconfig(iniparser)
 BuildRequires:         pkgconfig(libxml-2.0)
 
@@ -55,14 +41,10 @@ rm -rf %{buildroot}
 
 mkdir -p %{buildroot}/usr/share/license
 cp -f LICENSE.APLv2 %{buildroot}/usr/share/license/%{name}
-cat LICENSE.RFC4122 >> %{buildroot}/usr/share/license/%{name}
 
 mkdir -p %{buildroot}/etc
 cp -f script/make_info_file.sh %{buildroot}/etc/make_info_file.sh
 
-mkdir -p %{buildroot}/etc/config
-cp -f configuration/sys-info.xml %{buildroot}/etc/config/sys-info.xml
-
 %make_install
 
 %post -p /sbin/ldconfig
@@ -74,7 +56,6 @@ cp -f configuration/sys-info.xml %{buildroot}/etc/config/sys-info.xml
 %{_libdir}/libcapi-system-info.so.*
 /usr/share/license/%{name}
 %attr(0744,root,-) /etc/make_info_file.sh
-/etc/config/sys-info.xml
 %manifest system-info.manifest
 
 %files devel
index 24776e8..cfe546f 100644 (file)
@@ -20,7 +20,6 @@
 #include <string.h>
 #include <unistd.h>
 
-#include <vconf.h>
 #include <dlog.h>
 
 #include <system_info.h>
@@ -145,13 +144,6 @@ system_info_s system_info_table[] = {
 },
 
 {
-       /**< Indicates whether the device supports TV-out */
-       SYSTEM_INFO_KEY_TVOUT_SUPPORTED,
-       SYSTEM_INFO_DATA_TYPE_BOOL,
-       system_info_get_tvout_supported
-},
-
-{
         /**< Indicates whether the device supports Wi-Fi */
        SYSTEM_INFO_KEY_WIFI_SUPPORTED,
        SYSTEM_INFO_DATA_TYPE_BOOL,
@@ -159,20 +151,6 @@ system_info_s system_info_table[] = {
 },
 
 {
-        /**< The unique ID to identify GSM, and UMTS mobile devices */
-       SYSTEM_INFO_KEY_MOBILE_DEVICE_ID,
-       SYSTEM_INFO_DATA_TYPE_STRING,
-       system_info_get_mobile_device_id
-},
-
-{
-       /**< The sales code of the CSC */
-       SYSTEM_INFO_KEY_CSC_SALES_CODE,
-       SYSTEM_INFO_DATA_TYPE_STRING,
-       system_info_get_csc_sales_code
-},
-
-{
        /**< The Name of the Platform */
        SYSTEM_INFO_KEY_PLATFORM_NAME,
        SYSTEM_INFO_DATA_TYPE_STRING,
@@ -187,14 +165,7 @@ system_info_s system_info_table[] = {
 },
 
 {
-       /**< Indicates whether the device supports HAPTIC */
-       SYSTEM_INFO_KEY_HAPTIC_SUPPORTED,
-       SYSTEM_INFO_DATA_TYPE_BOOL,
-       system_info_get_haptic_supproted
-},
-
-{
-       /**< Indicates whether the device supports HAPTIC */
+       /**< Indicates whether the device supports wifi direct */
        SYSTEM_INFO_KEY_WIFI_DIRECT_SUPPORTED,
        SYSTEM_INFO_DATA_TYPE_BOOL,
        system_info_get_wifi_direct_supported
@@ -208,20 +179,6 @@ system_info_s system_info_table[] = {
 },
 
 {
-       /**< The Device unique ID to identify */
-       SYSTEM_INFO_KEY_DEVICE_UUID,
-       SYSTEM_INFO_DATA_TYPE_STRING,
-       system_info_get_device_uuid
-},
-
-{
-       /**< Indicates whether the device supports GPS */
-       SYSTEM_INFO_KEY_CPS_SUPPORTED,
-       SYSTEM_INFO_DATA_TYPE_BOOL,
-       system_info_get_cps_supported
-},
-
-{
        /**< Indicates whether the device supports GPS */
        SYSTEM_INFO_KEY_WPS_SUPPORTED,
        SYSTEM_INFO_DATA_TYPE_BOOL,
@@ -264,13 +221,6 @@ system_info_s system_info_table[] = {
 },
 
 {
-       /**< Indicates whether the device supports front camera auto focus */
-       SYSTEM_INFO_KEY_FRONT_CAMERA_AF_SUPPORTED,
-       SYSTEM_INFO_DATA_TYPE_BOOL,
-       system_info_get_front_camera_af_supported
-},
-
-{
        /**< Indicates whether the device supports front camera flash */
        SYSTEM_INFO_KEY_FRONT_CAMERA_FLASH_SUPPORTED,
        SYSTEM_INFO_DATA_TYPE_BOOL,
@@ -285,13 +235,6 @@ system_info_s system_info_table[] = {
 },
 
 {
-       /**< Indicates whether the device supports back camera auto focus */
-       SYSTEM_INFO_KEY_BACK_CAMERA_AF_SUPPORTED,
-       SYSTEM_INFO_DATA_TYPE_BOOL,
-       system_info_get_back_camera_af_supported
-},
-
-{
        /**< Indicates whether the device supports back camera flash */
        SYSTEM_INFO_KEY_BACK_CAMERA_FLASH_SUPPORTED,
        SYSTEM_INFO_DATA_TYPE_BOOL,
@@ -397,13 +340,6 @@ system_info_s system_info_table[] = {
 },
 
 {
-       /**< The method of interface with CP */
-       SYSTEM_INFO_KEY_CP_INTERFACE,
-       SYSTEM_INFO_DATA_TYPE_STRING,
-       system_info_get_cp_interface
-},
-
-{
        /**< Indicates whether the device supports MMS */
        SYSTEM_INFO_KEY_MMS_SUPPORTED,
        SYSTEM_INFO_DATA_TYPE_BOOL,
@@ -655,8 +591,7 @@ int system_info_get_platform_bool(const char *key, bool *value)
                return SYSTEM_INFO_ERROR_IO_ERROR;
        }
 
-       ret = system_info_get_value_from_config_xml(PLATFORM_TAG, key, BOOL_TYPE, &
-string);
+       ret = system_info_get_value_from_config_xml(PLATFORM_TAG, key, BOOL_TYPE, &string);
        if (ret) {
                LOGE("cannot get %s", key);
                return ret;
@@ -685,8 +620,7 @@ int system_info_get_platform_int(const char *key, int *value)
                return SYSTEM_INFO_ERROR_IO_ERROR;
        }
 
-       ret = system_info_get_value_from_config_xml(PLATFORM_TAG, key, INT_TYPE, &
-string);
+       ret = system_info_get_value_from_config_xml(PLATFORM_TAG, key, INT_TYPE, &string);
        if (ret) {
                LOGE("cannot get %s", key);
                return ret;
@@ -712,8 +646,7 @@ int system_info_get_platform_double(const char *key, double *value)
                return SYSTEM_INFO_ERROR_IO_ERROR;
        }
 
-       ret = system_info_get_value_from_config_xml(PLATFORM_TAG, key, DBL_TYPE, &
-string);
+       ret = system_info_get_value_from_config_xml(PLATFORM_TAG, key, DBL_TYPE, &string);
        if (ret) {
                LOGE("cannot get %s", key);
                return ret;
@@ -736,8 +669,7 @@ int system_info_get_platform_string(const char *key, char **value)
                return SYSTEM_INFO_ERROR_IO_ERROR;
        }
 
-       ret = system_info_get_value_from_config_xml(PLATFORM_TAG, key, STR_TYPE, &
-string);
+       ret = system_info_get_value_from_config_xml(PLATFORM_TAG, key, STR_TYPE, &string);
        if (ret) {
                LOGE("cannot get %s", key);
                return ret;
@@ -761,8 +693,7 @@ int system_info_get_custom_bool(const char *key, bool *value)
                return SYSTEM_INFO_ERROR_IO_ERROR;
        }
 
-       ret = system_info_get_value_from_config_xml(CUSTOM_TAG, key, BOOL_TYPE, &
-string);
+       ret = system_info_get_value_from_config_xml(CUSTOM_TAG, key, BOOL_TYPE, &string);
        if (ret) {
                LOGI("cannot get %s", key);
                *supported = false;
@@ -792,8 +723,7 @@ int system_info_get_custom_int(const char *key, int *value)
                return SYSTEM_INFO_ERROR_IO_ERROR;
        }
 
-       ret = system_info_get_value_from_config_xml(CUSTOM_TAG, key, INT_TYPE, &
-string);
+       ret = system_info_get_value_from_config_xml(CUSTOM_TAG, key, INT_TYPE, &string);
        if (ret) {
                LOGI("cannot get %s", key);
                *ret_val = 0;
@@ -820,8 +750,7 @@ int system_info_get_custom_double(const char *key, double *value)
                return SYSTEM_INFO_ERROR_IO_ERROR;
        }
 
-       ret = system_info_get_value_from_config_xml(CUSTOM_TAG, key, DBL_TYPE, &
-string);
+       ret = system_info_get_value_from_config_xml(CUSTOM_TAG, key, DBL_TYPE, &string);
        if (ret) {
                LOGI("cannot get %s", key);
                *ret_val = 0;
@@ -845,8 +774,112 @@ int system_info_get_custom_string(const char *key, char **value)
                return SYSTEM_INFO_ERROR_IO_ERROR;
        }
 
-       ret = system_info_get_value_from_config_xml(CUSTOM_TAG, key, STR_TYPE, &
-string);
+       ret = system_info_get_value_from_config_xml(CUSTOM_TAG, key, STR_TYPE, &string);
+       if (ret) {
+               LOGE("cannot get %s info from %s!!!", key, CONFIG_FILE_PATH);
+               return ret;
+       }
+
+       *value = string;
+
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+int system_info_get_internal_bool(const char *key, bool *value)
+{
+       int ret;
+       bool *supported;
+       char *string = NULL;
+
+       supported = (bool *)value;
+
+       if (access(CONFIG_FILE_PATH, R_OK)) {
+               LOGE("cannot find file %s!!!", CONFIG_FILE_PATH);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       ret = system_info_get_value_from_config_xml(INTERNAL_TAG, key, BOOL_TYPE, &string);
+       if (ret) {
+               LOGI("cannot get %s", key);
+               *supported = false;
+               return SYSTEM_INFO_ERROR_NONE;
+       }
+
+       if (!strcmp(string, "true") || !strcmp(string, "TRUE"))
+               *supported = true;
+       else
+               *supported = false;
+
+       free(string);
+
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+int system_info_get_internal_int(const char *key, int *value)
+{
+       int ret;
+       int *ret_val;
+       char *string = NULL;
+
+       ret_val = (int *)value;
+
+       if (access(CONFIG_FILE_PATH, R_OK)) {
+               LOGE("cannot find file %s!!!", CONFIG_FILE_PATH);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       ret = system_info_get_value_from_config_xml(INTERNAL_TAG, key, INT_TYPE, &string);
+       if (ret) {
+               LOGI("cannot get %s", key);
+               *ret_val = 0;
+               return SYSTEM_INFO_ERROR_NONE;
+       }
+
+       *ret_val = atoi(string);
+
+       free(string);
+
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+int system_info_get_internal_double(const char *key, double *value)
+{
+       int ret;
+       double *ret_val;
+       char *string = NULL;
+
+       ret_val = (double *)value;
+
+       if (access(CONFIG_FILE_PATH, R_OK)) {
+               LOGE("cannot find file %s!!!", CONFIG_FILE_PATH);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       ret = system_info_get_value_from_config_xml(INTERNAL_TAG, key, DBL_TYPE, &string);
+       if (ret) {
+               LOGI("cannot get %s", key);
+               *ret_val = 0;
+               return SYSTEM_INFO_ERROR_NONE;
+       }
+
+       *ret_val = atof(string);
+
+       free(string);
+
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+int system_info_get_internal_string(const char *key, char **value)
+{
+       int ret;
+       char *string = NULL;
+
+       if (access(CONFIG_FILE_PATH, R_OK)) {
+               LOGE("cannot find file %s!!!", CONFIG_FILE_PATH);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       ret = system_info_get_value_from_config_xml(INTERNAL_TAG, key, STR_TYPE, &string);
        if (ret) {
                LOGE("cannot get %s info from %s!!!", key, CONFIG_FILE_PATH);
                return ret;
index c8c6770..35d4b0d 100644 (file)
  * limitations under the License.
  */
 
-/*
-** Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc.
-** Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. &
-** Digital Equipment Corporation, Maynard, Mass.
-** Copyright (c) 1998 Microsoft.
-** To anyone who acknowledges that this file is provided "AS IS"
-** without any express or implied warranty: permission to use, copy,
-** modify, and distribute this file for any purpose is hereby
-** granted without fee, provided that the above copyright notices and
-** this notice appears in all source code copies, and that none of
-** the names of Open Software Foundation, Inc., Hewlett-Packard
-** Company, Microsoft, or Digital Equipment Corporation be used in
-** advertising or publicity pertaining to distribution of the software
-** without specific, written prior permission. Neither Open Software
-** Foundation, Inc., Hewlett-Packard Company, Microsoft, nor Digital
-** Equipment Corporation makes any representations about the
-** suitability of this software for any purpose.
-**
-** This license applies to all the permissions of the below mentioned functions.
-** Functions: format_uuid_v3or5, uuid_create_sha1_from_name
-*/
-
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <stdint.h>
+#include <unistd.h>
 
-#include <vconf.h>
-#include <vconf-internal-csc-keys.h>
 #include <dlog.h>
 
 #include <system_info.h>
 #include <system_info_private.h>
 
-#include <haptic.h>
-
-#include <X11/extensions/XI2.h>
-#include <X11/extensions/XI2proto.h>
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-#include <X11/extensions/XInput2.h>
-
-#include <openssl/sha.h>
-#include <arpa/inet.h>
-
-#include <net_nfc.h>
-#include <net_nfc_typedef.h>
-
-#include <location.h>
-#include <location-types.h>
-
-#include <bluetooth-api.h>
-
-#include <mm_radio.h>
-#include <mm_types.h>
-
-#include <sound_manager.h>
-#include <sensor.h>
-
-#define PROP_MULTITOUCH        "EvdevMultitouch MultiTouch"
-#define DEVICE_UUID_STRING_SIZE 37
-
 #ifdef LOG_TAG
 #undef LOG_TAG
 #endif
 
 #define LOG_TAG "CAPI_SYSTEM_INFO"
 
-#define CAM_INI_FILE_PATH "/usr/etc/mmfw_camcorder.ini"
-#define CAM_VIDEO_PRI_FILE_PATH "/usr/etc/mmfw_camcorder_dev_video_pri.ini"
-#define CAM_VIDEO_SEC_FILE_PATH "/usr/etc/mmfw_camcorder_dev_video_sec.ini"
-
-#define NFC_INFO_FILE_PATH "/etc/config/nfc/sysinfo-nfc-ug.xml"
 #define TETHERING_INFO_FILE_PATH "/etc/config/connectivity/sysinfo-tethering.xml"
-#define TTS_INFO_FILE_PATH "/etc/config/sysinfo-tts.xml"
-#define STT_INFO_FILE_PATH "/etc/config/sysinfo-stt.xml"
-
-static char *FRONT_CAM_PATH;
-static char *BACK_CAM_PATH;
-
-typedef struct {
-       uint32_t  time_low;
-       uint16_t  time_mid;
-       uint16_t  time_hi_and_version;
-       uint8_t  clock_seq_hi_and_reserved;
-       uint8_t  clock_seq_low;
-       uint8_t node[6];
-} _UUID_OBJECT;
 
-/*
-    Tizen Default vender key = f7884739-3c9f-5f7c-af-e1-fc9f5da56003
-     This value should be modified by each venders.
-*/
-_UUID_OBJECT VenderKey = {0xf7884739, 0x3c9f, 0x5f7c, 0xaf, 0xe1, {0xfc, 0x9f, 0x5d, 0xa5, 0x60, 0x3} };
-/*
-    format_uuid_v3or5 -- make a UUID from a (pseudo)random 128-bit
-    number
-*/
-void format_uuid_v3or5(_UUID_OBJECT *uuid, unsigned char hash[16], int v)
-{
-       /* convert UUID to local byte order */
-       memcpy(uuid, hash, sizeof(*uuid));
-       uuid->time_low = ntohl(uuid->time_low);
-       uuid->time_mid = ntohs(uuid->time_mid);
-       uuid->time_hi_and_version = ntohs(uuid->time_hi_and_version);
-
-       /* put in the variant and version bits */
-       uuid->time_hi_and_version &= 0x0FFF;
-       uuid->time_hi_and_version |= (v << 12);
-       uuid->clock_seq_hi_and_reserved &= 0x3F;
-       uuid->clock_seq_hi_and_reserved |= 0x80;
-}
-
-void uuid_create_sha1_from_name(_UUID_OBJECT *uuid, _UUID_OBJECT nsid, void *name, int namelen)
-{
-       SHA_CTX c;
-       unsigned char hash[20];
-       _UUID_OBJECT net_nsid;
-
-       /* put name space ID in network byte order so it hashes the same
-          no matter what endian machine we're on */
-       net_nsid = nsid;
-       net_nsid.time_low = htonl(net_nsid.time_low);
-       net_nsid.time_mid = htons(net_nsid.time_mid);
-       net_nsid.time_hi_and_version = htons(net_nsid.time_hi_and_version);
-
-       SHA1_Init(&c);
-       SHA1_Update(&c, &net_nsid, sizeof(net_nsid));
-       SHA1_Update(&c, name, namelen);
-       SHA1_Final(hash, &c);
-
-       /* the hash is in network byte order at this point */
-       format_uuid_v3or5(uuid, hash, 5);
-}
-
-int uuid_object_to_string(_UUID_OBJECT uuid, char **device_uuid_string)
+int system_info_get_camera_count(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       *device_uuid_string = (char *) calloc(1, DEVICE_UUID_STRING_SIZE + 1);
+       bool camera;
+       int *count = 0;
 
-       if (*device_uuid_string == NULL)
-               return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
+       count = (int *)value;
+       *count = 0;
 
-       snprintf(*device_uuid_string, DEVICE_UUID_STRING_SIZE, "%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
-               (unsigned long)uuid.time_low,
-               (unsigned int)uuid.time_mid,
-               (unsigned int)uuid.time_hi_and_version,
-               (unsigned int)uuid.clock_seq_hi_and_reserved,
-               (unsigned int)uuid.clock_seq_low,
-               (unsigned int)uuid.node[0],
-               (unsigned int)uuid.node[1],
-               (unsigned int)uuid.node[2],
-               (unsigned int)uuid.node[3],
-               (unsigned int)uuid.node[4],
-               (unsigned int)uuid.node[5]);
+       if (system_info_get_platform_bool("tizen.org/feature/camera.back", &camera) == SYSTEM_INFO_ERROR_NONE
+               && camera == true)
+               (*count)++;
+       if (system_info_get_platform_bool("tizen.org/feature/camera.front", &camera) == SYSTEM_INFO_ERROR_NONE
+               && camera == true)
+               (*count)++;
 
        return SYSTEM_INFO_ERROR_NONE;
 }
 
-extern char *strcasestr(const char *s, const char *find);
-
-int xinput_extension_init(Display *disp)
-{
-       int opcode;
-       int event, error;
-       int major = XI_2_Major, minor = XI_2_Minor;
-
-       if (!XQueryExtension(disp, "XInputExtension", &opcode, &event, &error)) {
-               LOGE("XInput Extension isn't supported.");
-               return SYSTEM_INFO_ERROR_IO_ERROR;
-       }
-
-       if (XIQueryVersion(disp, &major, &minor) == BadRequest) {
-               LOGE("Failed to query XI version.");
-               return SYSTEM_INFO_ERROR_IO_ERROR;
-       }
-
-       if (!(major >= XI_2_Major && minor >= XI_2_Minor)) {
-               LOGE("XI2 is not supported ! (major:%d, minor:%d)", major, minor);
-               return SYSTEM_INFO_ERROR_IO_ERROR;
-       }
-       return opcode;
-}
-
-int get_device_property_value(Display *disp, int deviceid, Atom prop)
-{
-       Atom act_type;
-       unsigned long nitems, bytes_after;
-       unsigned char *data;
-       int act_format, ret = -1;
-
-       if (XIGetProperty(disp, deviceid, prop, 0, 1000, False,
-                                                       XA_INTEGER, &act_type, &act_format,
-                                                       &nitems, &bytes_after, &data) != Success) {
-               LOGE("Failed to get XI2 device property !(deviceid=%d)", deviceid);
-               return SYSTEM_INFO_ERROR_IO_ERROR;
-       }
-
-       if (!nitems)
-               goto out;
-
-       ret = (int)*data;
-
-out:
-       if (data)
-               XFree(data);
-
-       return ret;
-}
-
-int get_multitouch_max_count(Display *disp)
-{
-       int i;
-       int max_count;
-       int ndevices;
-       XIDeviceInfo *dev, *info = NULL;
-       Atom atomMultiTouch;
-       int xi_opcode = xinput_extension_init(disp);
-
-       if (0 >= xi_opcode) {
-               LOGE("Failed to initialize X Input Extension !");
-               return SYSTEM_INFO_ERROR_IO_ERROR;
-       }
-
-       atomMultiTouch = XInternAtom(disp, PROP_MULTITOUCH, True);
-
-       if (!atomMultiTouch) {
-               LOGE("Failed to make an atom for multitouch property !");
-               return SYSTEM_INFO_ERROR_IO_ERROR;
-       }
-
-       info = XIQueryDevice(disp, XIAllDevices, &ndevices);
-
-       if (!info) {
-               LOGE("Failed to query XI device.");
-               return SYSTEM_INFO_ERROR_IO_ERROR;
-       }
-
-       for (i = 0; i < ndevices ; i++) {
-               dev = &info[i];
-
-               switch (dev->use) {
-               case XISlavePointer:
-                       if (strcasestr(dev->name, "virtual") && !strcasestr(dev->name, "maru"))
-                               continue;
-                       if (strcasestr(dev->name, "extended"))
-                               continue;
-                       if (!strcasestr(dev->name, "touch"))
-                               continue;
-                       max_count = get_device_property_value(disp, dev->deviceid, atomMultiTouch);
-                       goto out;
-               }
-       }
-
-       XIFreeDeviceInfo(info);
-       return -1;
-
-out:
-       XIFreeDeviceInfo(info);
-       return max_count;
-}
-
-/**
- * @brief Setting face direction path
- *
- */
-
-void set_camera_direction_path(void)
-{
-       char str[MAXBUFSIZE];
-       char tmpStr[MAXBUFSIZE];
-       int direction = -1;
-       FILE *info = NULL;
-
-       info = fopen(CAM_VIDEO_PRI_FILE_PATH, "r");
-
-       if (NULL != info) {
-               while (fgets(str, MAXBUFSIZE, info)) {
-                       if (!strncmp(";", str, strlen(";")))
-                               continue;
-                       else if (!strncmp("FacingDirection", str, strlen("FacingDirection"))) {
-                               sscanf(str, "%s = %d", tmpStr, &direction);
-                               if (direction == 1) {
-                                       FRONT_CAM_PATH = strdup(CAM_VIDEO_PRI_FILE_PATH);
-                                       BACK_CAM_PATH = strdup(CAM_VIDEO_SEC_FILE_PATH);
-                                       fclose(info);
-                                       return;
-                               }
-                       } else
-                               continue;
-               }
-
-               fclose(info);
-       }
-
-       /* default setting */
-       FRONT_CAM_PATH = strdup(CAM_VIDEO_SEC_FILE_PATH);
-       BACK_CAM_PATH = strdup(CAM_VIDEO_PRI_FILE_PATH);
-
-       return;
-}
-
 int system_info_get_bluetooth_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       bool *supported;
-
-       supported = (bool *)value;
-
-       if (bluetooth_is_supported())
-                       *supported = true;
-               else
-                       *supported = false;
-
-       return SYSTEM_INFO_ERROR_NONE;
-}
-
-int system_info_get_camera_count(system_info_key_e key, system_info_data_type_e data_type, void **value)
-{
-       int *count;
-       char str[MAXBUFSIZE];
-       char tmpStr[MAXBUFSIZE];
-       FILE *info = NULL;
-
-       count = (int *)value;
-       /* default camera count is 2*/
-       *count = 2;
-
-       info = fopen(CAM_INI_FILE_PATH, "r");
-       if (NULL == info) {
-               LOGE("cannot file open %s file!!!", CAM_INI_FILE_PATH);
-               return SYSTEM_INFO_ERROR_IO_ERROR;
-       } else {
-               while (fgets(str, MAXBUFSIZE, info)) {
-                       if (!strncmp(";", str, strlen(";")))
-                               continue;
-                       else if (!strncmp("DeviceCount", str, strlen("DeviceCount"))) {
-                               sscanf(str, "%s = %d", tmpStr, count);
-                               break;
-                       } else
-                               continue;
-               }
-       }
-       fclose(info);
-       return SYSTEM_INFO_ERROR_NONE;
+       return system_info_get_platform_bool("tizen.org/feature/network.bluetooth", (bool *)value);
 }
 
 int system_info_get_fmradio_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       bool *supported;
-       MMHandleType hradio;
-
-       supported = (bool *)value;
-
-       memset(&hradio, 0x0, sizeof(MMHandleType));
-
-       if (mm_radio_create(&hradio) == MM_ERROR_NONE) {
-               if(mm_radio_realize(hradio) == MM_ERROR_NONE) {
-                       *supported = true;
-                       if (mm_radio_unrealize(hradio) == MM_ERROR_NONE) {
-                               if (mm_radio_destroy(hradio) == MM_ERROR_NONE)
-                                       return SYSTEM_INFO_ERROR_NONE;
-                               else {
-                                       LOGE("cannot destroy mm_radio handle!!!");
-                                       return SYSTEM_INFO_ERROR_IO_ERROR;
-                               }
-                       } else {
-                               LOGE("cannot unrealize mm_radio handle!!!");
-                               return SYSTEM_INFO_ERROR_IO_ERROR;
-                       }
-               } else {
-                       *supported = false;
-                       if (mm_radio_destroy(hradio) == MM_ERROR_NONE)
-                               return SYSTEM_INFO_ERROR_NONE;
-                       else {
-                               LOGE("cannot destroy mm_radio handle!!!");
-                               return SYSTEM_INFO_ERROR_IO_ERROR;
-                       }
-               }
-       } else {
-               *supported = false;
-               return SYSTEM_INFO_ERROR_NONE;
-       }
+       return system_info_get_platform_bool("tizen.org/feature/fmradio", (bool *)value);
 }
 
 int system_info_get_gps_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       bool *supported;
-
-       supported = (bool *)value;
-
-       if (location_is_supported_method(LOCATION_METHOD_GPS))
-               *supported = true;
-       else
-               *supported = false;
-
-       return SYSTEM_INFO_ERROR_NONE;
-}
-
-int system_info_get_cps_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
-{
-       bool *supported;
-
-       supported = (bool *)value;
-
-       if (location_is_supported_method(LOCATION_METHOD_CPS))
-               *supported = true;
-       else
-               *supported = false;
-
-       return SYSTEM_INFO_ERROR_NONE;
+       return system_info_get_platform_bool("tizen.org/feature/location.gps", (bool *)value);
 }
 
 int system_info_get_wps_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       bool *supported;
-
-       supported = (bool *)value;
-
-       if (location_is_supported_method(LOCATION_METHOD_WPS))
-               *supported = true;
-       else
-               *supported = false;
-
-       return SYSTEM_INFO_ERROR_NONE;
+       return system_info_get_platform_bool("tizen.org/feature/location.wps", (bool *)value);
 }
 
 int system_info_get_keyboard_type(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       char *string = NULL;
-       char *model = "default";
-
-       if (system_info_get_value_from_xml(XML_FILE_PATH, model, "Keyboad_type", &string)) {
-               LOGE("cannot get Keyboad_type info from %s!!!", XML_FILE_PATH);
-               return SYSTEM_INFO_ERROR_IO_ERROR;
-       }
-
-       if (!strcmp(string, "NULL")) {
-               *value = NULL;
-               free(string);
-               return SYSTEM_INFO_ERROR_NONE;
-       }
-
-       *value = string;
-
-       return SYSTEM_INFO_ERROR_NONE;
+       return system_info_get_platform_string("tizen.org/feature/input.keyboard.layout", (char**)value);
 }
 
 int system_info_get_multi_point_touch_count(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       int *count;
-       Display *disp;
-
-       count = (int *)value;
-
-       disp = XOpenDisplay(NULL);
-
-       if (!disp) {
-               LOGE("Failed to open display!");
-               return SYSTEM_INFO_ERROR_IO_ERROR;
-       }
-
-       *count = get_multitouch_max_count(disp);
-
-       return SYSTEM_INFO_ERROR_NONE;
+       return system_info_get_platform_int("tizen.org/feature/multi_point_touch.point_count", (int *)value);
 }
 
 int system_info_get_nfc_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       bool *supported;
-       int nfc_supported = 0;
-
-       supported = (bool *)value;
-
-       if (NET_NFC_OK == net_nfc_is_supported(&nfc_supported))
-               *supported = true;
-       else
-               *supported = false;
-
-       return SYSTEM_INFO_ERROR_NONE;
-}
-
-int system_info_get_tvout_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
-{
-       bool *supported;
-       char *string = NULL;
-       char *model = "default";
-
-       supported = (bool *)value;
-
-       if (system_info_get_value_from_xml(XML_FILE_PATH, model, "tv_out_support", &string)) {
-               LOGE("cannot get tv_out_support info from %s!!!", NFC_INFO_FILE_PATH);
-               return SYSTEM_INFO_ERROR_IO_ERROR;
-       }
-
-       if (!strcmp(string, "true") || !strcmp(string, "TRUE"))
-               *supported = true;
-       else
-               *supported = false;
-
-       free(string);
-
-       return SYSTEM_INFO_ERROR_NONE;
+       return system_info_get_platform_bool("tizen.org/feature/network.nfc", (bool *)value);
 }
 
 int system_info_get_wifi_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       bool *supported;
-       char *string = NULL;
-       char *model = "default";
-
-       supported = (bool *)value;
-
-       if (system_info_get_system_info_model_type() == SYSTEM_INFO_MODEL_TYPE_EMULATOR) {
-       *supported = false;
-       return SYSTEM_INFO_ERROR_NONE;
-       }
-
-       if (system_info_get_value_from_xml(XML_FILE_PATH, model, "wifi_support", &string)) {
-               LOGE("cannot get wifi_support info from %s!!!", NFC_INFO_FILE_PATH);
-               return SYSTEM_INFO_ERROR_IO_ERROR;
-       }
-
-       if (!strcmp(string, "true") || !strcmp(string, "TRUE"))
-               *supported = true;
-       else
-               *supported = false;
-
-       free(string);
-
-       return SYSTEM_INFO_ERROR_NONE;
+       return system_info_get_platform_bool("tizen.org/feature/network.wifi", (bool *)value);
 }
 
 int system_info_get_wifi_direct_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       bool *supported;
-       char *string = NULL;
-       char *model = "default";
-
-       supported = (bool *)value;
-
-       if (system_info_get_system_info_model_type() == SYSTEM_INFO_MODEL_TYPE_EMULATOR) {
-               *supported = false;
-               return SYSTEM_INFO_ERROR_NONE;
-       }
-
-       if (system_info_get_value_from_xml(XML_FILE_PATH, model, "wifi_direct_support", &string)) {
-               LOGE("cannot get wifi_direct_support info from %s!!!", NFC_INFO_FILE_PATH);
-               return SYSTEM_INFO_ERROR_IO_ERROR;
-       }
-
-       if (!strcmp(string, "true") || !strcmp(string, "TRUE"))
-               *supported = true;
-       else
-               *supported = false;
-
-       free(string);
-
-       return SYSTEM_INFO_ERROR_NONE;
-}
-
-int system_info_get_haptic_supproted(system_info_key_e key, system_info_data_type_e data_type, void **value)
-{
-       bool *supported;
-       int count;
-       int retVal;
-
-       supported = (bool *)value;
-
-       retVal = haptic_get_count(&count);
-       if (retVal < 0)
-               return SYSTEM_INFO_ERROR_IO_ERROR;
-
-       if (count <= 0)
-               *supported = false;
-       else
-               *supported = true;
-
-       return SYSTEM_INFO_ERROR_NONE;
-}
-
-int system_info_get_csc_sales_code(system_info_key_e key, system_info_data_type_e data_type, void **value)
-{
-       char *CSC_SALES_CODE;
-
-       CSC_SALES_CODE = (char *)value;
-
-       if (system_info_vconf_get_value_string(VCONFKEY_CSC_SALESCODE, &CSC_SALES_CODE))
-               return SYSTEM_INFO_ERROR_IO_ERROR;
-
-       return SYSTEM_INFO_ERROR_NONE;
-}
-
-int system_info_get_device_uuid(system_info_key_e key, system_info_data_type_e data_type, void **value)
-{
-       char *imei = NULL;
-       char *UUID;
-       _UUID_OBJECT device_uuid;
-       int retVal;
-
-       retVal = system_info_get_value_string(SYSTEM_INFO_KEY_MOBILE_DEVICE_ID, &imei);
-       if (SYSTEM_INFO_ERROR_NONE != retVal) {
-               LOGE("cannot get an IMEI value!!!");
-               return retVal;
-       }
-
-       if (imei) {
-               uuid_create_sha1_from_name(&device_uuid, VenderKey, imei, strlen(imei));
-
-               if (uuid_object_to_string(device_uuid, &UUID))
-                       return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
-
-               *value = UUID;
-
-               free(imei);
-               return SYSTEM_INFO_ERROR_NONE;
-       } else {
-               LOGE("imei is NULL!!!");
-               return SYSTEM_INFO_ERROR_IO_ERROR;
-       }
+       return system_info_get_platform_bool("tizen.org/feature/network.wifi.direct", (bool *)value);
 }
 
 int system_info_get_usb_host_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       bool *supported;
-       int usbhost_state = 0;
-
-       supported = (bool *)value;
-
-       if (vconf_get_int(VCONFKEY_SYSMAN_USB_HOST_STATUS, &usbhost_state))
-               *supported = false;
-       else
-               *supported = true;
-
-       return SYSTEM_INFO_ERROR_NONE;
+       return system_info_get_platform_bool("tizen.org/feature/usb.host", (bool *)value);
 }
 
 int system_info_get_usb_accessory_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       bool *supported;
-       int usbhost_state = 0;
-
-       supported = (bool *)value;
-
-       if (vconf_get_int(VCONFKEY_USB_ACCESSORY_STATUS, &usbhost_state))
-               *supported = false;
-       else
-               *supported = true;
-
-       return SYSTEM_INFO_ERROR_NONE;
+       return system_info_get_platform_bool("tizen.org/feature/usb.accessory", (bool *)value);
 }
 
 int system_info_get_front_camera_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       bool *supported;
-
-       supported = (bool *)value;
-
-       /* setting camera direction */
-       set_camera_direction_path();
-
-       /* There is no FacingDirection field in ini file */
-       if (!access(FRONT_CAM_PATH, R_OK))
-               *supported = true;
-       else
-               *supported = false;
-
-       /* free used memory for camera direction */
-       free(FRONT_CAM_PATH);
-       free(BACK_CAM_PATH);
-
-       return SYSTEM_INFO_ERROR_NONE;
-}
-
-int system_info_get_front_camera_af_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
-{
-       bool *supported;
-       char str[MAXBUFSIZE];
-       char tmpStr[MAXBUFSIZE];
-       int tmpInt[6];
-       FILE *info = NULL;
-
-       supported = (bool *)value;
-       /* default value is false */
-       *supported = false;
-
-       /* setting camera direction */
-       set_camera_direction_path();
-
-       /* Return false, if there is no "/usr/etc/mmfw_camcorder_dev_video_sec.ini" file */
-       if (access(FRONT_CAM_PATH, R_OK))
-               return SYSTEM_INFO_ERROR_NONE;
-
-       info = fopen(FRONT_CAM_PATH, "r");
-       if (NULL == info) {
-               LOGE("cannot file open %s file!!!", FRONT_CAM_PATH);
-               return SYSTEM_INFO_ERROR_IO_ERROR;
-       } else {
-               while (fgets(str, MAXBUFSIZE, info)) {
-                       if (!strncmp(";", str, strlen(";")))
-                               continue;
-                       else if (!strncmp("FocusMode", str, strlen("FocusMode"))) {
-                               sscanf(str, "%s = %d,%d,%d,%d,%d,%d", tmpStr, &tmpInt[0], &tmpInt[1], &tmpInt[2], &tmpInt[3], &tmpInt[4], &tmpInt[5]);
-                               if (tmpInt[2] != -255 || tmpInt[4] != -255)
-                                       *supported = true;
-                               break;
-                       } else
-                               continue;
-               }
-       }
-
-       /* free used memory for camera direction */
-       free(FRONT_CAM_PATH);
-       free(BACK_CAM_PATH);
-
-       fclose(info);
-       return SYSTEM_INFO_ERROR_NONE;
+       return system_info_get_platform_bool("tizen.org/feature/camera.front", (bool *)value);
 }
 
 int system_info_get_front_camera_flash_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       bool *supported;
-       char str[MAXBUFSIZE];
-       char tmpStr[MAXBUFSIZE];
-       int tmpInt[8];
-       int i = 0;
-       FILE *info = NULL;
-
-       supported = (bool *)value;
-       /* default value is false */
-       *supported = false;
-
-       /* setting camera direction */
-       set_camera_direction_path();
-
-       /* Return false, if there is no "/usr/etc/mmfw_camcorder_dev_video_sec.ini" file */
-       if (access(FRONT_CAM_PATH, R_OK))
-               return SYSTEM_INFO_ERROR_NONE;
-
-       info = fopen(FRONT_CAM_PATH, "r");
-       if (NULL == info) {
-               LOGE("cannot file open %s file!!!", FRONT_CAM_PATH);
-               return SYSTEM_INFO_ERROR_IO_ERROR;
-       } else {
-               while (fgets(str, MAXBUFSIZE, info)) {
-                       if (!strncmp(";", str, strlen(";")))
-                               continue;
-                       else if (!strncmp("StrobeMode", str, strlen("StrobeMode"))) {
-                               sscanf(str, "%s = %d,%d,%d,%d,%d,%d,%d,%d", tmpStr, &tmpInt[0], &tmpInt[1], &tmpInt[2], &tmpInt[3], &tmpInt[4], &tmpInt[5], &tmpInt[6], &tmpInt[7]);
-                               for (i = 1; i < 8; i++) {
-                                       if (tmpInt[i] != -255)
-                                               *supported = true;
-                               }
-                               break;
-                       } else
-                               continue;
-               }
-       }
-
-       /* free used memory for camera direction */
-       free(FRONT_CAM_PATH);
-       free(BACK_CAM_PATH);
-
-       fclose(info);
-       return SYSTEM_INFO_ERROR_NONE;
+       return system_info_get_platform_bool("tizen.org/feature/camera.front.flash", (bool *)value);
 }
 
 int system_info_get_back_camera_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       bool *supported;
-
-       supported = (bool *)value;
-
-       /* setting camera direction */
-       set_camera_direction_path();
-
-       if (!access(BACK_CAM_PATH, R_OK))
-               *supported = true;
-       else
-               *supported = false;
-
-       /* free used memory for camera direction */
-       free(FRONT_CAM_PATH);
-       free(BACK_CAM_PATH);
-
-       return SYSTEM_INFO_ERROR_NONE;
-}
-
-int system_info_get_back_camera_af_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
-{
-       bool *supported;
-       char str[MAXBUFSIZE];
-       char tmpStr[MAXBUFSIZE];
-       int tmpInt[6];
-       FILE *info = NULL;
-
-       supported = (bool *)value;
-       /* default value is false */
-       *supported = false;
-
-       /* setting camera direction */
-       set_camera_direction_path();
-
-       /* Return false, if there is no "/usr/etc/mmfw_camcorder_dev_video_pri.ini" file */
-       if (access(BACK_CAM_PATH, R_OK))
-               return SYSTEM_INFO_ERROR_NONE;
-
-       info = fopen(BACK_CAM_PATH, "r");
-       if (NULL == info) {
-               LOGE("cannot file open %s file!!!", BACK_CAM_PATH);
-               return SYSTEM_INFO_ERROR_IO_ERROR;
-       } else {
-               while (fgets(str, MAXBUFSIZE, info)) {
-                       if (!strncmp(";", str, strlen(";")))
-                               continue;
-                       else if (!strncmp("FocusMode", str, strlen("FocusMode"))) {
-                               sscanf(str, "%s = %d,%d,%d,%d,%d,%d", tmpStr, &tmpInt[0], &tmpInt[1], &tmpInt[2], &tmpInt[3], &tmpInt[4], &tmpInt[5]);
-                               if (tmpInt[2] != -255 || tmpInt[4] != -255)
-                                       *supported = true;
-                               break;
-                       } else
-                               continue;
-               }
-       }
-
-       /* free used memory for camera direction */
-       free(FRONT_CAM_PATH);
-       free(BACK_CAM_PATH);
-
-       fclose(info);
-       return SYSTEM_INFO_ERROR_NONE;
+       return system_info_get_platform_bool("tizen.org/feature/camera.back", (bool *)value);
 }
 
 int system_info_get_back_camera_flash_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       bool *supported;
-       char str[MAXBUFSIZE];
-       char tmpStr[MAXBUFSIZE];
-       int tmpInt[8];
-       int i = 0;
-       FILE *info = NULL;
-
-       supported = (bool *)value;
-       /* default value is false */
-       *supported = false;
-
-       /* setting camera direction */
-       set_camera_direction_path();
-
-       /* Return false, if there is no "/usr/etc/mmfw_camcorder_dev_video_pri.ini" file */
-       if (access(BACK_CAM_PATH, R_OK))
-               return SYSTEM_INFO_ERROR_NONE;
-
-       info = fopen(BACK_CAM_PATH, "r");
-       if (NULL == info) {
-               LOGE("cannot file open %s file!!!", BACK_CAM_PATH);
-               return SYSTEM_INFO_ERROR_IO_ERROR;
-       } else {
-               while (fgets(str, MAXBUFSIZE, info)) {
-                       if (!strncmp(";", str, strlen(";")))
-                               continue;
-                       else if (!strncmp("StrobeMode", str, strlen("StrobeMode"))) {
-                               sscanf(str, "%s = %d,%d,%d,%d,%d,%d,%d,%d", tmpStr, &tmpInt[0], &tmpInt[1], &tmpInt[2], &tmpInt[3], &tmpInt[4], &tmpInt[5], &tmpInt[6], &tmpInt[7]);
-                               for (i = 1; i < 8; i++) {
-                                       if (tmpInt[i] != -255)
-                                               *supported = true;
-                               }
-                               break;
-                       } else
-                               continue;
-               }
-       }
-
-       /* free used memory for camera direction */
-       free(FRONT_CAM_PATH);
-       free(BACK_CAM_PATH);
-
-       fclose(info);
-       return SYSTEM_INFO_ERROR_NONE;
+       return system_info_get_platform_bool("tizen.org/feature/camera.back.flash", (bool *)value);
 }
 
-
 int system_info_get_sip_voip_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       bool *supported;
-       char *string = NULL;
-       char *model = "default";
-
-       supported = (bool *)value;
-
-       if (system_info_get_value_from_xml(XML_FILE_PATH, model, "sip_voip_support", &string)) {
-               LOGE("cannot get sip_voip_support info from %s!!!", NFC_INFO_FILE_PATH);
-               return SYSTEM_INFO_ERROR_IO_ERROR;
-       }
-
-       if (!strcmp(string, "true") || !strcmp(string, "TRUE"))
-               *supported = true;
-       else
-               *supported = false;
-
-       free(string);
-
-       return SYSTEM_INFO_ERROR_NONE;
+       return system_info_get_platform_bool("tizen.org/feature/sip.voip", (bool *)value);
 }
 
 int system_info_get_microphone_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       bool *supported;
-       sound_device_in_e in;
-       sound_device_out_e out;
-
-       supported = (bool *)value;
-
-       if (SOUND_MANAGER_ERROR_NONE == sound_manager_get_active_device(&in, &out)) {
-               if (in == SOUND_DEVICE_IN_MIC)
-                       *supported = true;
-               else
-                       *supported = false;
-       } else
-               *supported = false;
-
-       return SYSTEM_INFO_ERROR_NONE;
+       return system_info_get_platform_bool("tizen.org/feature/microphone", (bool *)value);
 }
 
 int system_info_get_speech_recognition_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       bool *supported;
-       char *string = NULL;
-       char *model = "default";
-
-       supported = (bool *)value;
-
-       if (access(STT_INFO_FILE_PATH, R_OK)) {
-               *supported = false;
-               return SYSTEM_INFO_ERROR_NONE;
-       }
-
-       if (system_info_get_value_from_xml(STT_INFO_FILE_PATH, model, "stt-support", &string)) {
-               LOGE("cannot get stt-support info from %s!!!", STT_INFO_FILE_PATH);
-               return SYSTEM_INFO_ERROR_IO_ERROR;
-       }
-
-       if (!strcmp(string, "true") || !strcmp(string, "TRUE"))
-               *supported = true;
-       else
-               *supported = false;
-
-       free(string);
-
-       return SYSTEM_INFO_ERROR_NONE;
+       return system_info_get_platform_bool("tizen.org/feature/speech.recognition", (bool *)value);
 }
 
 int system_info_get_speech_synthesis_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       bool *supported;
-       char *string = NULL;
-       char *model = "default";
-
-       supported = (bool *)value;
-
-       if (access(TTS_INFO_FILE_PATH, R_OK)) {
-               *supported = false;
-               return SYSTEM_INFO_ERROR_NONE;
-       }
-
-       if (system_info_get_value_from_xml(TTS_INFO_FILE_PATH, model, "tts-support", &string)) {
-               LOGE("cannot get tts-support info from %s!!!", TTS_INFO_FILE_PATH);
-               return SYSTEM_INFO_ERROR_IO_ERROR;
-       }
-
-       if (!strcmp(string, "true") || !strcmp(string, "TRUE"))
-               *supported = true;
-       else
-               *supported = false;
-
-       free(string);
-
-       return SYSTEM_INFO_ERROR_NONE;
+       return system_info_get_platform_bool("tizen.org/feature/speech.synthesis", (bool *)value);
 }
 
 int system_info_get_barometer_sensor_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       bool *supported;
-
-       supported = (bool *)value;
-
-       if (sf_is_sensor_event_available(BAROMETER_SENSOR, 0))
-               *supported = false;
-       else
-               *supported = true;
-
-       return SYSTEM_INFO_ERROR_NONE;
+       return system_info_get_platform_bool("tizen.org/feature/sensor.barometer", (bool *)value);
 }
 
 int system_info_get_manufacturer(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       char *string = NULL;
-       char *model = "default";
+       char *manufacturer = NULL;
 
-       if (system_info_get_value_from_xml(XML_FILE_PATH, model, "MANUFACTURER", &string)) {
-               LOGE("cannot get MANUFACTURER info from %s!!!", XML_FILE_PATH);
-               return SYSTEM_INFO_ERROR_IO_ERROR;
-       }
-
-                               *value = string;
-
-       return SYSTEM_INFO_ERROR_NONE;
+       manufacturer = strdup("samsung");
+       if (manufacturer == NULL) {
+               LOGE("OUT_OF_MEMORY(0x%08x)", SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
+               return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
 }
 
-int system_info_get_cp_interface(system_info_key_e key, system_info_data_type_e data_type, void **value)
-{
-       char *string = NULL;
-       char *model = "default";
-
-       if (system_info_get_value_from_xml(XML_FILE_PATH, model, "CP_Interface", &string)) {
-               LOGE("cannot get CP_Interface info from %s!!!", XML_FILE_PATH);
-               return SYSTEM_INFO_ERROR_IO_ERROR;
-       }
-
-                               *value = string;
+       *value = manufacturer;
 
        return SYSTEM_INFO_ERROR_NONE;
 }
@@ -1067,28 +195,5 @@ int system_info_get_tethering_supported(system_info_key_e key, system_info_data_
 
 int system_info_get_nfc_reserved_push_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       bool *supported;
-       char *string = NULL;
-       char *model = "default";
-
-       supported = (bool *)value;
-
-       if (access(NFC_INFO_FILE_PATH, R_OK)) {
-               *supported = false;
-               return SYSTEM_INFO_ERROR_NONE;
-       }
-
-       if (system_info_get_value_from_xml(NFC_INFO_FILE_PATH, model, "reserved-push-support", &string)) {
-               LOGE("cannot get reserved-push-support info from %s!!!", NFC_INFO_FILE_PATH);
-               return SYSTEM_INFO_ERROR_IO_ERROR;
-       }
-
-       if (!strcmp(string, "true") || !strcmp(string, "TRUE"))
-               *supported = true;
-       else
-               *supported = false;
-
-       free(string);
-
-       return SYSTEM_INFO_ERROR_NONE;
+       return system_info_get_platform_bool("tizen.org/feature/network.nfc.reserved_push", (bool *)value);
 }
index c55eded..543a79a 100644 (file)
 #include <stdlib.h>
 #include <string.h>
 
-#include <vconf.h>
 #include <dlog.h>
 
-#include <tapi_common.h>
-#include <ITapiModem.h>
-
 #include <system_info.h>
 #include <system_info_private.h>
 
 
 int system_info_get_network_type(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       int service_type = 0;
-       char *NETWORK_TYPE = NULL;
-
-       if (system_info_vconf_get_value_int(VCONFKEY_TELEPHONY_SVCTYPE, &service_type))
-               return SYSTEM_INFO_ERROR_IO_ERROR;
-
-       switch (service_type) {
-       case VCONFKEY_TELEPHONY_SVCTYPE_NONE:
-               NETWORK_TYPE = strdup("NoService");
-               break;
-       case VCONFKEY_TELEPHONY_SVCTYPE_NOSVC:
-               NETWORK_TYPE = strdup("NoService");
-               break;
-       case VCONFKEY_TELEPHONY_SVCTYPE_EMERGENCY:
-               NETWORK_TYPE = strdup("Emergency");
-               break;
-       case VCONFKEY_TELEPHONY_SVCTYPE_2G:
-               NETWORK_TYPE = strdup("GSM");
-               break;
-       case VCONFKEY_TELEPHONY_SVCTYPE_2_5G:
-               NETWORK_TYPE = strdup("GPRS");
-               break;
-       case VCONFKEY_TELEPHONY_SVCTYPE_2_5G_EDGE:
-               NETWORK_TYPE = strdup("EDGE");
-               break;
-       case VCONFKEY_TELEPHONY_SVCTYPE_3G:
-               NETWORK_TYPE = strdup("UMTS");
-               break;
-       case VCONFKEY_TELEPHONY_SVCTYPE_HSDPA:
-               NETWORK_TYPE = strdup("HSDPA");
-               break;
-       case VCONFKEY_TELEPHONY_SVCTYPE_LTE:
-                NETWORK_TYPE = strdup("LTE");
-                break;
-       }
-
-       if (NETWORK_TYPE == NULL) {
+       bool service_type = 0;
+       char *NET_TYPE = NULL;
+       char NETWORK_TYPE[MAXBUFSIZE];
+
+       NETWORK_TYPE[0] = '\0';
+
+       strcat(NETWORK_TYPE, "Emergency ");
+
+       if (system_info_get_platform_bool("tizen.org/feature/network.telephony.service.cdma", &service_type) == SYSTEM_INFO_ERROR_NONE
+               && service_type == true)
+               strcat(NETWORK_TYPE, "| cdma ");
+       if (system_info_get_platform_bool("tizen.org/feature/network.telephony.service.edge", &service_type) == SYSTEM_INFO_ERROR_NONE
+               && service_type == true)
+               strcat(NETWORK_TYPE, "| edge ");
+       if (system_info_get_platform_bool("tizen.org/feature/network.telephony.service.gprs", &service_type) == SYSTEM_INFO_ERROR_NONE
+               && service_type == true)
+               strcat(NETWORK_TYPE, "| gprs ");
+       if (system_info_get_platform_bool("tizen.org/feature/network.telephony.service.gsm", &service_type) == SYSTEM_INFO_ERROR_NONE
+               && service_type == true)
+               strcat(NETWORK_TYPE, "| gsm ");
+       if (system_info_get_platform_bool("tizen.org/feature/network.telephony.service.hsdpa", &service_type) == SYSTEM_INFO_ERROR_NONE
+               && service_type == true)
+               strcat(NETWORK_TYPE, "| hsdpa ");
+       if (system_info_get_platform_bool("tizen.org/feature/network.telephony.service.hspa", &service_type) == SYSTEM_INFO_ERROR_NONE
+               && service_type == true)
+               strcat(NETWORK_TYPE, "| hspa ");
+       if (system_info_get_platform_bool("tizen.org/feature/network.telephony.service.hsupa", &service_type) == SYSTEM_INFO_ERROR_NONE
+               && service_type == true)
+               strcat(NETWORK_TYPE, "| hsupa ");
+       if (system_info_get_platform_bool("tizen.org/feature/network.telephony.service.umts", &service_type) == SYSTEM_INFO_ERROR_NONE
+               && service_type == true)
+               strcat(NETWORK_TYPE, "| umts ");
+       if (system_info_get_platform_bool("tizen.org/feature/network.telephony.service.lte", &service_type) == SYSTEM_INFO_ERROR_NONE
+               && service_type == true)
+               strcat(NETWORK_TYPE, "| lte ");
+
+       NET_TYPE = strdup(NETWORK_TYPE);
+
+       if (NET_TYPE == NULL) {
                LOGE("OUT_OF_MEMORY(0x%08x)", SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
                return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
        }
 
-       *value = NETWORK_TYPE;
-
-       return SYSTEM_INFO_ERROR_NONE;
-}
-
-int system_info_get_mobile_device_id(system_info_key_e key, system_info_data_type_e data_type, void **value)
-{
-       TapiHandle *handle = NULL;
-       char *imei = NULL;
-       char *MOBILE_DEVICE_ID = NULL;
-
-       handle = tel_init(0);
-
-       if (NULL == handle) {
-               LOGE("tel_init ERROR");
-               *value = NULL;
-               return SYSTEM_INFO_ERROR_IO_ERROR;
-       }
-
-       imei = tel_get_misc_me_imei_sync(handle);
-
-       if (imei == NULL) {
-               LOGE("IMEI value is NULL");
-               tel_deinit(handle);
-               *value = NULL;
-               return SYSTEM_INFO_ERROR_IO_ERROR;
-       }
-
-       MOBILE_DEVICE_ID = strdup((char *)imei);
-
-       if (MOBILE_DEVICE_ID == NULL) {
-               LOGE("OUT_OF_MEMORY(0x%08x)", SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
-               free(imei);
-               tel_deinit(handle);
-               *value = NULL;
-               return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
-       }
+       *value = NET_TYPE;
 
-       free(imei);
-       tel_deinit(handle);
-       *value = MOBILE_DEVICE_ID;
        return SYSTEM_INFO_ERROR_NONE;
 }
index e8e66c1..4cffc81 100644 (file)
@@ -242,6 +242,7 @@ int system_info_get_value_from_config_xml(char *feature_tag, const char *name_fi
                                                *value = strdup(string);
                                                free(name);
                                                free(type);
+                                               free(string);
                                                break;
                                        }
                                }
index 30e5fcc..40cf35c 100644 (file)
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
 
 #include <dlog.h>
-#include <vconf.h>
 
 #include <system_info.h>
 #include <system_info_private.h>
 
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-
 #ifdef LOG_TAG
 #undef LOG_TAG
 #endif
 
 #define LOG_TAG "CAPI_SYSTEM_INFO"
 
-#define LIB_GLES_V1 "/usr/lib/libGLESv1_CM.so"
-#define LIB_GLES_V2 "/usr/lib/libGLESv2.so"
-
-#define SIZE_OF_MODEL_NAME 8
-
-#define MESSAGE_INFO_FILE_PATH "/etc/config/sysinfo-message.xml"
-#define GRAPHICS_INFO_FILE_PATH "/etc/config/graphics/sysinfo-graphics.xml"
-#define SCREEN_INFO_FILE_PATH "/etc/config/screen/sysinfo-screen.xml"
-#define TOUCH_INFO_FILE_PATH   "/etc/config/touch/sysinfo-touch.xml"
-
 int system_info_get_model(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       char *MODEL = NULL;
-       char *name = NULL;
-       char str[MAXBUFSIZE];
-       char tmpStr[MAXBUFSIZE];
-       int tmpStrlen = 0;
-       FILE *info;
-       extern char *strcasestr(const char *s, const char *find);
-
-       info = fopen(INFO_FILE_PATH, "r");
-       if (NULL == info) {
-               LOGE("cannot file open %s file!!!", INFO_FILE_PATH);
-               return SYSTEM_INFO_ERROR_IO_ERROR;
-       } else {
-               while (fgets(str, MAXBUFSIZE, info)) {
-                       if (strcasestr(str, "Model")) {
-                               name = strchr(str, '=');
-                               name++;
-                               tmpStrlen = strlen(name);
-
-                               strncpy(tmpStr, name, tmpStrlen-2);
-                               tmpStr[tmpStrlen-2] = '\0';
-
-                               MODEL = strdup(tmpStr);
-                               if (MODEL == NULL) {
-                                       LOGE("OUT_OF_MEMORY(0x%08x)", SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
-                                       fclose(info);
-                                       return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
-                               }
-                               break;
-                       } else
-                               continue;
-               }
-       }
-       *value = MODEL;
-       fclose(info);
-       return SYSTEM_INFO_ERROR_NONE;
+       return system_info_ini_get_string(INFO_FILE_PATH, "version:model", (char **)value);
 }
 
-int system_info_get_tizen_version(system_info_key_e key, system_info_data_type_e data_type, void **value)
+int system_info_get_build_string(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       char *TIZEN_VERSION = NULL;
-       char *name = NULL;
-       char str[MAXBUFSIZE];
-       char tmpStr[MAXBUFSIZE];
-       int tmpStrlen = 0;
-       FILE *info;
-       extern char *strcasestr(const char *s, const char *find);
-
-       info = fopen(OS_RELEASE_FILE_PATH, "r");
-       if (NULL == info) {
-               LOGE("cannot file open %s file!!!", OS_RELEASE_FILE_PATH);
-               return SYSTEM_INFO_ERROR_IO_ERROR;
-       } else {
-               while (fgets(str, MAXBUFSIZE, info)) {
-                       if (strcasestr(str, "VERSION_ID")) {
-                               name = strchr(str, '=');
-                               name += 2;
-                               tmpStrlen = strlen(name);
-
-                               strncpy(tmpStr, name, tmpStrlen-2);
-                               tmpStr[tmpStrlen-2] = '\0';
-
-                               TIZEN_VERSION = strdup(tmpStr);
-                               if (TIZEN_VERSION == NULL) {
-                                       LOGE("OUT_OF_MEMORY(0x%08x)", SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
-                                       fclose(info);
-                                       return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
-                               }
-                               break;
-                       } else
-                               continue;
-               }
-       }
-       *value = TIZEN_VERSION;
-       fclose(info);
-       return SYSTEM_INFO_ERROR_NONE;
+       return system_info_ini_get_string(INFO_FILE_PATH, "version:build", (char **)value);
 }
 
-int system_info_get_platform_name(system_info_key_e key, system_info_data_type_e data_type, void **value)
+int system_info_get_build_date(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       char *PLATFORM_NAME = NULL;
-       char *name = NULL;
-       char str[MAXBUFSIZE];
-       char tmpStr[MAXBUFSIZE];
-       int tmpStrlen = 0;
-       int i = 0;
-       FILE *info;
-       extern char *strcasestr(const char *s, const char *find);
-
-       info = fopen(OS_RELEASE_FILE_PATH, "r");
-       if (NULL == info) {
-               LOGE("cannot file open %s file!!!", OS_RELEASE_FILE_PATH);
-               return SYSTEM_INFO_ERROR_IO_ERROR;
-       } else {
-               while (fgets(str, MAXBUFSIZE, info)) {
-                       if (strcasestr(str, "NAME")) {
-                               name = strchr(str, '=');
-                               name += 2;
-                               tmpStrlen = strlen(name);
-
-                               strncpy(tmpStr, name, tmpStrlen-2);
-                               tmpStr[tmpStrlen-2] = '\0';
-
-                               tmpStrlen = strlen(tmpStr);
-
-                               for (i = 0; i < tmpStrlen; i++)
-                                               tmpStr[i] = (char)toupper((int)tmpStr[i]);
-
-                               PLATFORM_NAME = strdup(tmpStr);
-                               if (PLATFORM_NAME == NULL) {
-                                       LOGE("OUT_OF_MEMORY(0x%08x)", SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
-                                       fclose(info);
-                                       return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
-                               }
-                               break;
-                       } else
-                               continue;
-               }
-       }
-       *value = PLATFORM_NAME;
-       fclose(info);
-       return SYSTEM_INFO_ERROR_NONE;
+       return system_info_ini_get_string(INFO_FILE_PATH, "build:date", (char **)value);
 }
 
-int system_info_get_tizen_version_name(system_info_key_e key, system_info_data_type_e data_type, void **value)
+int system_info_get_build_time(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       char *TIZEN_VERSION_NAME = NULL;
-       char *name = NULL;
-       char str[MAXBUFSIZE];
-       char tmpStr[MAXBUFSIZE];
-       int tmpStrlen = 0;
-       FILE *info;
-       extern char *strcasestr(const char *s, const char *find);
-
-       info = fopen(OS_RELEASE_FILE_PATH, "r");
-       if (NULL == info) {
-               LOGE("cannot file open %s file!!!", OS_RELEASE_FILE_PATH);
-               return SYSTEM_INFO_ERROR_IO_ERROR;
-       } else {
-               while (fgets(str, MAXBUFSIZE, info)) {
-                       if (strcasestr(str, "VERSION")) {
-                               name = strchr(str, ',');
-                               name += 2;
-                               tmpStrlen = strlen(name);
-
-                               strncpy(tmpStr, name, tmpStrlen-2);
-                               tmpStr[tmpStrlen-2] = '\0';
-
-                               TIZEN_VERSION_NAME = strdup(tmpStr);
-                               if (TIZEN_VERSION_NAME == NULL) {
-                                       LOGE("OUT_OF_MEMORY(0x%08x)", SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
-                                       fclose(info);
-                                       return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
-                               }
-                               break;
-                       } else
-                               continue;
-               }
-       }
-       *value = TIZEN_VERSION_NAME;
-       fclose(info);
-       return SYSTEM_INFO_ERROR_NONE;
+       return system_info_ini_get_string(INFO_FILE_PATH, "build:time", (char **)value);
 }
 
-int system_info_get_opengles_version(system_info_key_e key, system_info_data_type_e data_type, void **value)
+int system_info_get_tizen_version(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       char *version;
-       char *OPENGLES_VERSION = NULL;
-       int version_supported = 0;
-
-       if (!access(LIB_GLES_V1, R_OK))
-               version_supported += 1;
-
-       if (!access(LIB_GLES_V2, R_OK))
-               version_supported += 2;
-
-       switch (version_supported) {
-       case 1:
-               version = "1.1";
-               break;
-
-       case 2:
-               version = "2.0";
-               break;
-
-       case 3:
-               version = "1.1/2.0";
-               break;
-       default:
-               version = NULL;
-               break;
-       }
-
-       if (version != NULL) {
-               OPENGLES_VERSION = strdup(version);
-
-               if (OPENGLES_VERSION == NULL) {
-                       LOGE("OUT_OF_MEMORY(0x%08x)", SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
-                       return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
-               }
-       }
-
-       *value = OPENGLES_VERSION;
-
-       return SYSTEM_INFO_ERROR_NONE;
+       return system_info_get_platform_string("tizen.org/feature/platform.version", (char**)value);
 }
 
 int system_info_get_core_cpu_arch(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       FILE *cpuinfo = NULL;
+       bool cpu_arch;
        char *CORE_CPU_ARCH = NULL;
-       char *name = NULL;
-       char str[MAXBUFSIZE] = "";
-       char tmpStr[MAXBUFSIZE] = "";
 
-       cpuinfo = fopen(CPU_INFO_FILE_PATH, "r");
-       if (NULL == cpuinfo) {
-               LOGE("cannot file open %s file!!!", CPU_INFO_FILE_PATH);
-               return SYSTEM_INFO_ERROR_IO_ERROR;
-       } else {
-               while (fgets(str, MAXBUFSIZE, cpuinfo)) {
-                       if (!strncmp("Processor", str, strlen("Processor"))) {
-                               name = strchr(str, ':');
-                               if (!(strncmp("ARMv7", name+2, strlen("ARMv7")))) {
-                                       strncpy(tmpStr, name+2, strlen("ARMv7"));
-                                       tmpStr[strlen("ARMv7")] = '\0';
-                               } else if (!(strncmp("ARMv6", name+2, strlen("ARMv6")))) {
-                                       strncpy(tmpStr, name+2, strlen("ARMv6"));
-                                       tmpStr[strlen("ARMv6")] = '\0';
-                               } else if (!(strncmp("x86", name+2, strlen("x86")))) {
-                                       strncpy(tmpStr, name+2, strlen("x86"));
-                                       tmpStr[strlen("x86")] = '\0';
-                               }
-                       } else
-                               continue;
-               }
-
-               /* x86 emulator doesn't have "Processor" field in /proc/cpuinfo */
-               if (strlen(tmpStr) == 0 && system_info_get_system_info_model_type() == SYSTEM_INFO_MODEL_TYPE_EMULATOR) {
-                       strncpy(tmpStr, "x86", strlen("x86"));
-                       tmpStr[strlen("x86")] = '\0';
-               } else if (strlen(tmpStr) == 0) {
-                       strncpy(tmpStr, "Unkown", strlen("Unkown"));
-                       tmpStr[strlen("Unkown")] = '\0';
-               }
-
-               CORE_CPU_ARCH = strdup(tmpStr);
+       if (system_info_get_platform_bool("tizen.org/feature/platform.core.cpu.arch.armv6", &cpu_arch) == SYSTEM_INFO_ERROR_NONE
+               && cpu_arch == true)
+               CORE_CPU_ARCH = strdup("armv6");
+       else if (system_info_get_platform_bool("tizen.org/feature/platform.core.cpu.arch.armv7", &cpu_arch) == SYSTEM_INFO_ERROR_NONE
+               && cpu_arch == true)
+               CORE_CPU_ARCH = strdup("armv7");
+       else if (system_info_get_platform_bool("tizen.org/feature/platform.core.cpu.arch.x86", &cpu_arch) == SYSTEM_INFO_ERROR_NONE
+               && cpu_arch == true)
+               CORE_CPU_ARCH = strdup("x86");
 
                if (CORE_CPU_ARCH == NULL) {
-                       LOGE("OUT_OF_MEMORY(0x%08x)", SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
-                       fclose(cpuinfo);
-                       return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
-               }
+               LOGE("Unknown cpu");
+               return SYSTEM_INFO_ERROR_IO_ERROR;
        }
-       fclose(cpuinfo);
 
        *value = CORE_CPU_ARCH;
 
@@ -314,53 +83,29 @@ int system_info_get_core_cpu_arch(system_info_key_e key, system_info_data_type_e
 
 int system_info_get_core_fpu_arch(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       FILE *cpuinfo = NULL;
+       bool fpu_arch;
        char *CORE_FPU_ARCH = NULL;
-       char *name = NULL;
-       char str[MAXBUFSIZE] = "";
-       char tmpStr[MAXBUFSIZE] = "";
 
-       cpuinfo = fopen(CPU_INFO_FILE_PATH, "r");
-       if (NULL == cpuinfo) {
-               LOGE("cannot file open %s file!!!", CPU_INFO_FILE_PATH);
-               return SYSTEM_INFO_ERROR_IO_ERROR;
-       } else {
-               /* The target and the emulator uses the field "Features" and "flags" in /proc/cpuinfo */
-               if (system_info_get_system_info_model_type() != SYSTEM_INFO_MODEL_TYPE_EMULATOR)
-                       snprintf(tmpStr, strlen("Features"), "Features");
-               else
-                       snprintf(tmpStr, strlen("flags"), "flags");
-
-               while (fgets(str, MAXBUFSIZE, cpuinfo)) {
-                       if (!strncmp(tmpStr, str, strlen(tmpStr))) {
-                               name = strchr(str, ':');
-                               if (strstr(name+2, "vfpv3"))
-                                       CORE_FPU_ARCH = strdup("vfpv3");
-                               else if (strstr(name+2, "vfpv2"))
-                                       CORE_FPU_ARCH = strdup("vfpv2");
-                               else if (strstr(name+2, "ssse3"))
-                                       CORE_FPU_ARCH = strdup("ssse3");
-                               else if (strstr(name+2, "sse3"))
-                                       CORE_FPU_ARCH = strdup("sse3");
-                               else if (strstr(name+2, "sse2"))
+       if (system_info_get_platform_bool("tizen.org/feature/platform.core.fpu.arch.sse2", &fpu_arch) == SYSTEM_INFO_ERROR_NONE
+               && fpu_arch == true)
                                        CORE_FPU_ARCH = strdup("sse2");
-                               else if (strstr(name+2, "sse"))
-                                       CORE_FPU_ARCH = strdup("sse");
-                               else
-                                       CORE_FPU_ARCH = strdup("Unkown");
+       else if (system_info_get_platform_bool("tizen.org/feature/platform.core.fpu.arch.sse3", &fpu_arch) == SYSTEM_INFO_ERROR_NONE
+               && fpu_arch == true)
+               CORE_FPU_ARCH = strdup("sse3");
+       else if (system_info_get_platform_bool("tizen.org/feature/platform.core.fpu.arch.ssse3", &fpu_arch) == SYSTEM_INFO_ERROR_NONE
+               && fpu_arch == true)
+               CORE_FPU_ARCH = strdup("ssse3");
+       else if (system_info_get_platform_bool("tizen.org/feature/platform.core.fpu.arch.vfpv2", &fpu_arch) == SYSTEM_INFO_ERROR_NONE
+               && fpu_arch == true)
+               CORE_FPU_ARCH = strdup("vfpv2");
+       else if (system_info_get_platform_bool("tizen.org/feature/platform.core.fpu.arch.vfpv3", &fpu_arch) == SYSTEM_INFO_ERROR_NONE
+               && fpu_arch == true)
+               CORE_FPU_ARCH = strdup("vfpv3");
 
                                if (CORE_FPU_ARCH == NULL) {
-                                       LOGE("OUT_OF_MEMORY(0x%08x)", SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
-                                       fclose(cpuinfo);
-                                       return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
-                               }
-
-                               break;
-                       } else
-                               continue;
-               }
+               LOGE("Unknown fpu");
+               return SYSTEM_INFO_ERROR_IO_ERROR;
        }
-       fclose(cpuinfo);
 
        *value = CORE_FPU_ARCH;
 
@@ -413,317 +158,162 @@ int system_info_get_core_cpu_freq(system_info_key_e key, system_info_data_type_e
        return SYSTEM_INFO_ERROR_NONE;
 }
 
-
-int system_info_get_opengles_texture_format(system_info_key_e key, system_info_data_type_e data_type, void **value)
+int system_info_get_platform_name(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       char *OPENGLES_TEXTURE_FORMAT;
-       char textureformat[MAXBUFSIZE];
-
-       textureformat[0] = '\0';
-
-       if (!access(LIB_GLES_V2, R_OK)) {
-               strcat(textureformat, "utc ");
-       }
-       if (GL_OES_compressed_paletted_texture) {
-               strcat(textureformat, "| ptc ");
-       }
-       if (GL_OES_compressed_ETC1_RGB8_texture) {
-               strcat(textureformat, "| etc ");
+       return system_info_get_platform_string("tizen.org/system/platform.name", (char**)value);
        }
-       if (GL_AMD_compressed_3DC_texture) {
-               strcat(textureformat, "| 3dc ");
-       }
-       if (GL_AMD_compressed_ATC_texture) {
-               strcat(textureformat, "| atc ");
-       }
-       if (GL_IMG_texture_compression_pvrtc) {
-               strcat(textureformat, "| pvrtc");
-       }
-
-       OPENGLES_TEXTURE_FORMAT = strdup(textureformat);
-
-       if (OPENGLES_TEXTURE_FORMAT == NULL) {
-               LOGE("OUT_OF_MEMORY(0x%08x)", SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
-               return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
-       }
-
-       *value = OPENGLES_TEXTURE_FORMAT;
 
-       return SYSTEM_INFO_ERROR_NONE;
-}
-
-int system_info_get_build_string(system_info_key_e key, system_info_data_type_e data_type, void **value)
+int system_info_get_tizen_version_name(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       char *BUILD_STRING = NULL;
+       char *TIZEN_VERSION_NAME = NULL;
        char *name = NULL;
        char str[MAXBUFSIZE];
        char tmpStr[MAXBUFSIZE];
-       FILE *info = NULL;
+       int tmpStrlen = 0;
+       FILE *info;
+       extern char *strcasestr(const char *s, const char *find);
 
-       info = fopen(INFO_FILE_PATH, "r");
+       info = fopen(OS_RELEASE_FILE_PATH, "r");
        if (NULL == info) {
-               LOGE("cannot file open %s file!!!", INFO_FILE_PATH);
+               LOGE("cannot file open %s file!!!", OS_RELEASE_FILE_PATH);
                return SYSTEM_INFO_ERROR_IO_ERROR;
-       } else {
-               while (fgets(str, MAXBUFSIZE, info)) {
-                       if (!strncmp("Build", str, strlen("Build"))) {
-                               name = strchr(str, '=');
-                               name++;
-                               strncpy(tmpStr, name, strlen(name)-2);
-                               tmpStr[strlen(name)-2] = '\0';
-
-                               BUILD_STRING = strdup(tmpStr);
-                               if (BUILD_STRING == NULL) {
-                                       LOGE("OUT_OF_MEMORY(0x%08x)", SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
-                                       fclose(info);
-                                       return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
-                               }
-                               break;
-                       } else
-                               continue;
+       }
+
+       while (fgets(str, MAXBUFSIZE, info)) {
+               if (strcasestr(str, "VERSION")) {
+                       name = strchr(str, ',');
+                       name += 2;
+                       tmpStrlen = strlen(name);
+
+                       strncpy(tmpStr, name, tmpStrlen-2);
+                       tmpStr[tmpStrlen-2] = '\0';
+
+                       TIZEN_VERSION_NAME = strdup(tmpStr);
+                       if (TIZEN_VERSION_NAME == NULL) {
+                               LOGE("OUT_OF_MEMORY(0x%08x)", SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
+                               fclose(info);
+                               return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
+                       }
+                       break;
                }
        }
-       *value = BUILD_STRING;
+
+       *value = TIZEN_VERSION_NAME;
        fclose(info);
        return SYSTEM_INFO_ERROR_NONE;
 }
 
-int system_info_get_build_date(system_info_key_e key, system_info_data_type_e data_type, void **value)
+int system_info_get_opengles_version(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       char *BUILD_DATE = NULL;
-       char *name = NULL;
-       char str[MAXBUFSIZE];
-       char tmpStr[MAXBUFSIZE];
-       FILE *info = NULL;
+       bool glversion = 0;
+       char *version;
+       char *OPENGLES_VERSION = NULL;
+       int version_supported = 0;
 
-       info = fopen(INFO_FILE_PATH, "r");
-       if (NULL == info) {
-               LOGE("cannot file open %s file!!!", INFO_FILE_PATH);
-               return SYSTEM_INFO_ERROR_IO_ERROR;
-       } else {
-               while (fgets(str, MAXBUFSIZE, info)) {
-                       if (!strncmp("Date", str, strlen("Date"))) {
-                               name = strchr(str, '=');
-                               name++;
-                               strncpy(tmpStr, name, strlen(name)-2);
-                               tmpStr[strlen(name)-2] = '\0';
-
-                               BUILD_DATE = strdup(tmpStr);
-                               if (BUILD_DATE == NULL) {
-                                       LOGE("OUT_OF_MEMORY(0x%08x)", SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
-                                       fclose(info);
-                                       return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
-                               }
+       if (system_info_get_platform_bool("tizen.org/feature/opengles.version.1_1", &glversion) == SYSTEM_INFO_ERROR_NONE
+               && glversion == true)
+               version_supported += 1;
+
+       if (system_info_get_platform_bool("tizen.org/feature/opengles.version.2_0", &glversion) == SYSTEM_INFO_ERROR_NONE
+               && glversion == true)
+               version_supported += 2;
+
+       switch (version_supported) {
+       case 1:
+               version = "1.1";
+               break;
+
+       case 2:
+               version = "2.0";
+               break;
+
+       case 3:
+               version = "1.1/2.0";
+               break;
+       default:
+               version = NULL;
                                break;
-                       } else
-                               continue;
-               }
-       }
-       *value = BUILD_DATE;
-       fclose(info);
-       return SYSTEM_INFO_ERROR_NONE;
 }
 
-int system_info_get_build_time(system_info_key_e key, system_info_data_type_e data_type, void **value)
-{
-       char *BUILD_TIME = NULL;
-       char *name = NULL;
-       char str[MAXBUFSIZE];
-       char tmpStr[MAXBUFSIZE];
-       FILE *info = NULL;
+       if (version != NULL) {
+               OPENGLES_VERSION = strdup(version);
 
-       info = fopen(INFO_FILE_PATH, "r");
-       if (NULL == info) {
-               LOGE("cannot file open %s file!!!", INFO_FILE_PATH);
-               return SYSTEM_INFO_ERROR_IO_ERROR;
-       } else {
-               while (fgets(str, MAXBUFSIZE, info)) {
-                       if (!strncmp("Time", str, strlen("Time"))) {
-                               name = strchr(str, '=');
-                               name++;
-                               strncpy(tmpStr, name, strlen(name)-2);
-                               tmpStr[strlen(name)-2] = '\0';
-
-                               BUILD_TIME = strdup(tmpStr);
-                               if (BUILD_TIME == NULL) {
+               if (OPENGLES_VERSION == NULL) {
                                        LOGE("OUT_OF_MEMORY(0x%08x)", SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
-                                       fclose(info);
                                        return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
                                }
-                               break;
-                       } else
-                               continue;
-               }
        }
-       *value = BUILD_TIME;
-       fclose(info);
-       return SYSTEM_INFO_ERROR_NONE;
-}
 
-int system_info_get_mms_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
-{
-       bool *supported;
-       char *string = NULL;
-       char *model = "default";
-
-       supported = (bool *)value;
+       *value = OPENGLES_VERSION;
 
-       if (access(MESSAGE_INFO_FILE_PATH, R_OK)) {
-       *supported = false;
                return SYSTEM_INFO_ERROR_NONE;
        }
 
-       if (system_info_get_value_from_xml(MESSAGE_INFO_FILE_PATH, model, "mms-support", &string)) {
-               LOGE("cannot get mms-support info from %s!!!", MESSAGE_INFO_FILE_PATH);
-               return SYSTEM_INFO_ERROR_IO_ERROR;
-       }
-
-       if (!strcmp(string, "true") || !strcmp(string, "TRUE"))
-       *supported = true;
-       else
-               *supported = false;
-
-       free(string);
-
-       return SYSTEM_INFO_ERROR_NONE;
-}
-
-int system_info_get_sms_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
+int system_info_get_opengles_texture_format(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       bool *supported;
-       char *string = NULL;
-       char *model = "default";
+       bool texture;
+       char *OPENGLES_TEXTURE_FORMAT;
+       char textureformat[MAXBUFSIZE];
 
-       supported = (bool *)value;
+       textureformat[0] = '\0';
 
-       if (access(MESSAGE_INFO_FILE_PATH, R_OK)) {
-               *supported = false;
-               return SYSTEM_INFO_ERROR_NONE;
-       }
+       if (system_info_get_platform_bool("tizen.org/feature/opengles.texture_format.utc", &texture) == SYSTEM_INFO_ERROR_NONE
+               && texture == true)
+               strcat(textureformat, "utc ");
+       if (system_info_get_platform_bool("tizen.org/feature/opengles.texture_format.ptc", &texture) == SYSTEM_INFO_ERROR_NONE
+               && texture == true)
+               strcat(textureformat, "| ptc ");
+       if (system_info_get_platform_bool("tizen.org/feature/opengles.texture_format.etc", &texture) == SYSTEM_INFO_ERROR_NONE
+               && texture == true)
+               strcat(textureformat, "| etc ");
+       if (system_info_get_platform_bool("tizen.org/feature/opengles.texture_format.3dc", &texture) == SYSTEM_INFO_ERROR_NONE
+               && texture == true)
+               strcat(textureformat, "| 3dc ");
+       if (system_info_get_platform_bool("tizen.org/feature/opengles.texture_format.atc", &texture) == SYSTEM_INFO_ERROR_NONE
+               && texture == true)
+               strcat(textureformat, "| atc ");
+       if (system_info_get_platform_bool("tizen.org/feature/opengles.texture_format.pvrtc", &texture) == SYSTEM_INFO_ERROR_NONE
+               && texture == true)
+               strcat(textureformat, "| pvrtc");
 
-       if (system_info_get_value_from_xml(MESSAGE_INFO_FILE_PATH, model, "sms-support", &string)) {
-               LOGE("cannot get sms-support info from %s!!!", MESSAGE_INFO_FILE_PATH);
-               return SYSTEM_INFO_ERROR_IO_ERROR;
-       }
+       OPENGLES_TEXTURE_FORMAT = strdup(textureformat);
 
-       if (!strcmp(string, "true") || !strcmp(string, "TRUE"))
-               *supported = true;
-       else
-               *supported = false;
+       if (OPENGLES_TEXTURE_FORMAT == NULL) {
+               LOGE("OUT_OF_MEMORY(0x%08x)", SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
+               return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
+       }
 
-       free(string);
+       *value = OPENGLES_TEXTURE_FORMAT;
 
        return SYSTEM_INFO_ERROR_NONE;
 }
 
-int system_info_get_cbs_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
+int system_info_get_mms_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       bool *supported;
-       char *string = NULL;
-       char *model = "default";
-
-       supported = (bool *)value;
-
-       if (access(MESSAGE_INFO_FILE_PATH, R_OK)) {
-               *supported = false;
-               return SYSTEM_INFO_ERROR_NONE;
+       return system_info_get_platform_bool("tizen.org/feature/network.telephony.mms", (bool *)value);
        }
 
-       if (system_info_get_value_from_xml(MESSAGE_INFO_FILE_PATH, model, "cbs-support", &string)) {
-               LOGE("cannot get cbs-support info from %s!!!", MESSAGE_INFO_FILE_PATH);
-               return SYSTEM_INFO_ERROR_IO_ERROR;
+int system_info_get_sms_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       return system_info_get_platform_bool("tizen.org/feature/network.telephony.sms", (bool *)value);
        }
 
-       if (!strcmp(string, "true") || !strcmp(string, "TRUE"))
-               *supported = true;
-       else
-               *supported = false;
-
-       free(string);
-
-       return SYSTEM_INFO_ERROR_NONE;
+int system_info_get_cbs_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       return system_info_get_platform_bool("tizen.org/feature/network.telephony.cbs", (bool *)value);
 }
 
 int system_info_get_graphics_hwaccel_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       bool *supported;
-       char *string = NULL;
-       char *model = "default";
-
-       supported = (bool *)value;
-
-       if (access(GRAPHICS_INFO_FILE_PATH, R_OK)) {
-               *supported = false;
-               return SYSTEM_INFO_ERROR_NONE;
-       }
-
-       if (system_info_get_value_from_xml(GRAPHICS_INFO_FILE_PATH, model, "acceleration-support", &string)) {
-               LOGE("cannot get acceleration-support info from %s!!!", GRAPHICS_INFO_FILE_PATH);
-               return SYSTEM_INFO_ERROR_IO_ERROR;
-       }
-
-       if (!strcmp(string, "true") || !strcmp(string, "TRUE"))
-               *supported = true;
-       else
-               *supported = false;
-
-       free(string);
-
-       return SYSTEM_INFO_ERROR_NONE;
+       return system_info_get_platform_bool("tizen.org/feature/graphics.acceleration", (bool *)value);
 }
 
 int system_info_get_feature_pinch_zoom_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       bool *supported;
-       char *string = NULL;
-       char *model = "default";
-
-       supported = (bool *)value;
-
-       if (access(TOUCH_INFO_FILE_PATH, R_OK)) {
-               *supported = false;
-               return SYSTEM_INFO_ERROR_NONE;
-       }
-
-       if (system_info_get_value_from_xml(TOUCH_INFO_FILE_PATH, model, "pinch-zoom-support", &string)) {
-               LOGE("cannot get pinch-zoom-support info from %s!!!", TOUCH_INFO_FILE_PATH);
-               return SYSTEM_INFO_ERROR_IO_ERROR;
-       }
-
-       if (!strcmp(string, "true") || !strcmp(string, "TRUE"))
-               *supported = true;
-       else
-               *supported = false;
-
-       free(string);
-
-       return SYSTEM_INFO_ERROR_NONE;
+       return system_info_get_platform_bool("tizen.org/feature/multi_point_touch.pinch_zoom", (bool *)value);
 }
 
 int system_info_get_feature_auto_rotation_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       bool *supported;
-       char *string = NULL;
-       char *model = "default";
-
-       supported = (bool *)value;
-
-       if (access(SCREEN_INFO_FILE_PATH, R_OK)) {
-               *supported = false;
-               return SYSTEM_INFO_ERROR_NONE;
-       }
-
-       if (system_info_get_value_from_xml(SCREEN_INFO_FILE_PATH, model, "auto-rotation-support", &string)) {
-               LOGE("cannot get auto-rotation-support info from %s!!!", SCREEN_INFO_FILE_PATH);
-               return SYSTEM_INFO_ERROR_IO_ERROR;
-       }
-
-       if (!strcmp(string, "true") || !strcmp(string, "TRUE"))
-               *supported = true;
-       else
-               *supported = false;
-
-       free(string);
-
-       return SYSTEM_INFO_ERROR_NONE;
+       return system_info_get_platform_bool("tizen.org/feature/screen.auto_rotation", (bool *)value);
 }
index b5b6bb2..36b0a82 100644 (file)
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <math.h>
 
-#include <vconf.h>
 #include <dlog.h>
 
-#include <X11/X.h>
-#include <X11/Xlib.h>
-#include <X11/extensions/Xrandr.h>
-
 #include <system_info.h>
 #include <system_info_private.h>
 
 
 #define LOG_TAG "CAPI_SYSTEM_INFO"
 
-typedef struct _progInfo ProgInfo;
-
-/* globals */
-ProgInfo g_pinfo;
-
-struct _progInfo {
-       Display *dpy;
-       Window root;
-       int screen;
-       int event_base, error_base;
-       int major, minor;
-       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;
-
-       memset(&g_pinfo, 0x0, sizeof(ProgInfo));
-
-       g_pinfo.dpy = XOpenDisplay(NULL);
-       if (NULL == g_pinfo.dpy) {
-               LOGE("XOpenDisplay Failed");
-               return -1;
-       }
-
-       if (0 > g_pinfo.screen)
-               g_pinfo.screen = DefaultScreen(g_pinfo.dpy);
-       g_pinfo.root = RootWindow(g_pinfo.dpy, g_pinfo.screen);
-
-       if (!XRRQueryExtension(g_pinfo.dpy, &g_pinfo.event_base, &g_pinfo.error_base) ||
-               !XRRQueryVersion(g_pinfo.dpy, &g_pinfo.major, &g_pinfo.minor)) {
-               LOGE("XRRQuery Failed");
-               XCloseDisplay(g_pinfo.dpy);
-               return -1;
-       }
-
-       g_pinfo.res = XRRGetScreenResources(g_pinfo.dpy, g_pinfo.root);
-
-       if (!g_pinfo.res) {
-               LOGE("XRRGetScreenResources Failed");
-               XCloseDisplay(g_pinfo.dpy);
-               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) {
-                       LOGE("XRRGetOutputInfo Failed");
-                       XCloseDisplay(g_pinfo.dpy);
-                       return -1;
-               }
-
-               /* find target lcd */
-               if (!strcmp(output_info->name, "LVDS1")) {
-                       /* XRRCrtcInfo information */
-                       XRRCrtcInfo *crtc_info = XRRGetCrtcInfo(g_pinfo.dpy, g_pinfo.res, output_info->crtc);
-                       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);
-       }
-
-       XCloseDisplay(g_pinfo.dpy);
-
-       system_info_screen_initialized = 1;
-
-       return 0;
-}
-
 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;
+       bool check;
+       int *width = 0;
 
        width = (int *)value;
 
-       if (0 == system_info_screen_initialized) {
-               ret_val = system_info_screen_init();
-               if (ret_val)
-                       return ret_val;
-       }
-
-       *width = SCREEN_WIDTH;
+       if (system_info_get_platform_bool("tizen.org/feature/screen.size.normal.480.800", &check) == SYSTEM_INFO_ERROR_NONE
+               && check == true)
+               *width = 480;
+       if (system_info_get_platform_bool("tizen.org/feature/screen.size.normal.720.1280", &check) == SYSTEM_INFO_ERROR_NONE
+               && check == true)
+               *width = 720;
 
+       if (*width)
        return SYSTEM_INFO_ERROR_NONE;
+       else
+               return SYSTEM_INFO_ERROR_IO_ERROR;
 }
 
 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;
+       bool check;
+       int *height = 0;
 
        height = (int *)value;
 
-       if (0 == system_info_screen_initialized) {
-               ret_val = system_info_screen_init();
-               if (ret_val)
-                       return ret_val;
-       }
-
-       *height = SCREEN_HEIGHT;
+       if (system_info_get_platform_bool("tizen.org/feature/screen.size.normal.480.800", &check) == SYSTEM_INFO_ERROR_NONE
+               && check == true)
+               *height = 800;
+       if (system_info_get_platform_bool("tizen.org/feature/screen.size.normal.720.1280", &check) == SYSTEM_INFO_ERROR_NONE
+               && check == true)
+               *height = 1280;
 
+       if (*height)
        return SYSTEM_INFO_ERROR_NONE;
+       else
+               return SYSTEM_INFO_ERROR_IO_ERROR;
 }
 
 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 ret_val;
-
-       bpp = (int *)value;
-
-       if (0 == system_info_screen_initialized) {
-               ret_val = system_info_screen_init();
-               if (ret_val)
-                       return ret_val;
-       }
-
-       *bpp = PHYSICAL_SCREEN_HEIGHT;
-
-       return SYSTEM_INFO_ERROR_NONE;
+       return system_info_get_platform_int("tizen.org/feature/screen.height", (int *)value);
 }
 
 int system_info_get_physical_screen_width(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 = PHYSICAL_SCREEN_WIDTH;
-
-       return SYSTEM_INFO_ERROR_NONE;
+       return system_info_get_platform_int("tizen.org/feature/screen.width", (int *)value);
 }