2.0_alpha release commit accepted/2.0alpha/20121025.191715 submit/2.0alpha/20121025.193703
authorYeongil Jang <yg0577.jang@samsung.com>
Thu, 20 Sep 2012 15:14:18 +0000 (00:14 +0900)
committerYeongil Jang <yg0577.jang@samsung.com>
Thu, 20 Sep 2012 15:14:18 +0000 (00:14 +0900)
12 files changed:
CMakeLists.txt
debian/changelog
include/system_info.h
include/system_info_private.h
packaging/capi-system-info.manifest [deleted file]
packaging/capi-system-info.spec [changed mode: 0644->0755]
src/system_info.c
src/system_info_device.c
src/system_info_network.c
src/system_info_platform.c
src/system_info_screen.c
src/system_info_vconf.c [new file with mode: 0755]

index 007e9b8..50c061c 100755 (executable)
@@ -10,7 +10,7 @@ SET(PREFIX ${CMAKE_INSTALL_PREFIX})
 SET(INC_DIR include)
 INCLUDE_DIRECTORIES(${INC_DIR})
 
-SET(requires "dlog capi-base-common vconf iniparser x11 tapi")
+SET(requires "dlog capi-base-common capi-network-wifi capi-media-sound-manager capi-uix-stt wifi-direct vconf iniparser x11 xi xrandr tapi devman xproto openssl nfc location bluetooth-api mm-radio sensor")
 SET(pc_requires "capi-base-common")
 
 INCLUDE(FindPkgConfig)
index 289593f..14fd6f6 100755 (executable)
@@ -1,7 +1,41 @@
+capi-system-info (0.1.5-1) unstable; urgency=low
+
+  * Change how to get the camera informations
+  * Git: /framework/api/system-info
+  * Tag: capi-system-info_0.1.5-1
+
+ -- Yang Yonghyun <alex.yang@samsung.com>  Tue, 04 Sep 2012 16:10:00 +0900
+
+
+capi-system-info (0.1.5-0) unstable; urgency=low
+
+  * Addded Platform Build Information APIs
+  * Git: /framework/api/system-info
+  * Tag: capi-system-info_0.1.5-0
+
+ -- Yang Yonghyun <alex.yang@samsung.com>  Mon, 03 Sep 2012 15:06:00 +0900
+
+
+capi-system-info (0.1.0-14) unstable; urgency=low
+
+  * Updated supported network-type
+  * Git: slp/api/system-info
+  * Tag: capi-system-info_0.1.0-14
+
+ -- Junghyuk Park <junghyuk.park@samsung.com>  Fri, 18 May 2012 19:20:13 +0900
+
+capi-system-info (0.1.0-13) unstable; urgency=low
+
+  * Added CSC sales code
+  * Git: slp/api/system-info
+  * Tag: capi-system-info_0.1.0-13
+
+ -- Junghyuk Park <junghyuk.park@samsung.com>  Thu, 17 May 2012 21:10:23 +0900
+
 capi-system-info (0.1.0-12) unstable; urgency=low
 
   * Updated Tizen version
-  * Git: api/system-info
+  * Git: slp/api/system-info
   * Tag: capi-system-info_0.1.0-12
 
  -- Junghyuk Park <junghyuk.park@samsung.com>  Mon, 19 Mar 2012 19:25:53 +0900
@@ -9,16 +43,23 @@ capi-system-info (0.1.0-12) unstable; urgency=low
 capi-system-info (0.1.0-11) unstable; urgency=low
 
   * Updated build configuration
-  * Added SYSTEM_INFO_KEY_MOBILE_DEVICE_ID
-  * Git: api/system-info
+  * Git: slp/api/system-info
   * Tag: capi-system-info_0.1.0-11
 
  -- Junghyuk Park <junghyuk.park@samsung.com>  Thu, 15 Mar 2012 11:41:29 +0900
 
+capi-system-info (0.1.0-10) unstable; urgency=low
+
+  * Added SYSTEM_INFO_KEY_MOBILE_DEVICE_ID
+  * Git: slp/api/system-info
+  * Tag: capi-system-info_0.1.0-10
+
+ -- Junghyuk Park <junghyuk.park@samsung.com>  Wed, 07 Mar 2012 16:36:27 +0900
+
 capi-system-info (0.1.0-9) unstable; urgency=low
 
   * Updated tizen version
-  * Git: api/system-info
+  * Git: slp/api/system-info
   * Tag: capi-system-info_0.1.0-9
 
  -- Junghyuk Park <junghyuk.park@samsung.com>  Wed, 22 Feb 2012 15:23:27 +0900
@@ -26,7 +67,7 @@ capi-system-info (0.1.0-9) unstable; urgency=low
 capi-system-info (0.1.0-8) unstable; urgency=low
 
   * Added version numbering
-  * Git: api/system-info
+  * Git: slp/api/system-info
   * Tag: capi-system-info_0.1.0-8
 
  -- Junghyuk Park <junghyuk.park@samsung.com>  Wed, 15 Feb 2012 10:56:43 +0900
@@ -34,22 +75,101 @@ capi-system-info (0.1.0-8) unstable; urgency=low
 capi-system-info (0.1.0-7) unstable; urgency=low
 
   * Updated tizen version
-  * Git: api/system-info
+  * Git: slp/api/system-info
   * Tag: capi-system-info_0.1.0-7
 
- -- Junghyuk Park <junghyuk.park@samsung.com>  Mon, 09 Jan 2012 15:08:54 +0900
+ -- Junghyuk Park <junghyuk.park@samsung.com>  Mon, 09 Jan 2012 15:04:37 +0900
 
 capi-system-info (0.1.0-6) unstable; urgency=low
 
   * Fixed spelling
   * Fixed invalid key
-  * Git: api/system-info
+  * Git: slp/api/system-info
   * Tag: capi-system-info_0.1.0-6
 
  -- Junghyuk Park <junghyuk.park@samsung.com>  Tue, 20 Dec 2011 16:23:42 +0900
 
 capi-system-info (0.1.0-5) unstable; urgency=low
 
-  * Initial release.
+  * Change type of keys
+  * Git: slp/api/system-info
+  * Tag: capi-system-info_0.1.0-5
+
+ -- Junghyuk Park <junghyuk.park@samsung.com>  Thu, 15 Dec 2011 07:43:25 +0300
+
+capi-system-info (0.1.0-4) unstable; urgency=low
+
+  * The available keys are changed
+  * The system information changed event is deprecated
+  * Git: slp-source.sec.samsung.net:slp/api/system-info
+  * Tag: capi-system-info_0.1.0-4
+
+ -- Junghyuk Park <junghyuk.park@samsung.com>  Tue, 06 Dec 2011 21:29:38 +0900
+
+capi-system-info (0.1.0-3) unstable; urgency=low
+
+  * Using Tizen namespace
+  * Git: slp-source.sec.samsung.net:slp/api/system-info
+  * Tag: capi-system-info_0.1.0-3
+
+ -- Kyuhun Jung <kyuhun.jung@samsung.com>  Wed, 23 Nov 2011 07:19:43 +0300
+
+capi-system-info (0.1.0-2) unstable; urgency=low
+
+  * Change system information key and value
+  * Git: slp-source.sec.samsung.net:slp/api/system-info
+  * Tag: capi-system-info_0.1.0-2
+ -- Kyuhun Jung <kyuhun.jung@samsung.com>  Mon, 21 Nov 2011 09:56:39 +0300
+
+
+capi-system-info (0.1.0-1) unstable; urgency=low
+
+  * Update API descriptions
+  * Git: slp-source.sec.samsung.net:slp/api/system-info
+  * Tag: capi-system-info_0.1.0-1
+
+ -- Kyuhun Jung <kyuhun.jung@samsung.com>  Tue, 27 Sep 2011 21:00:50 +0900
+
+capi-system-info (0.0.1-5) unstable; urgency=low
+  
+  * Update API descriptions
+  * Git: slp-source.sec.samsung.net:slp/api/system-info
+  * Tag: capi-system-info_0.0.1-5
+
+ -- Kyuhun Jung <kyuhun.jung@samsung.com>  Mon, 26 Sep 2011 16:38:58 +0900
+
+capi-system-info (0.0.1-4) unstable; urgency=low
+
+  * Some System Information keys are changed
+  * Git: slp-source.sec.samsung.net:slp/api/system-info
+  * Tag: capi-system-info_0.0.1-4
+
+ -- Kyuhun Jung <kyuhun.jung@samsung.com>  Mon, 26 Sep 2011 13:43:35 +0900
+
+capi-system-info (0.0.1-3) unstable; urgency=low
+
+  * SYSTEM_INFO_ERROR_INTERNAL error code is removed
+  * Git: slp-source.sec.samsung.net:slp/api/system-info
+  * Tag: capi-system-info_0.0.1-3
+
+ -- Kyuhun Jung <kyuhun.jung@samsung.com>  Thu, 25 Aug 2011 18:41:35 +0900
+
+capi-system-info (0.0.1-2) unstable; urgency=low
+
+  * system_info_get_value_type API is deprecated
+  * Git: slp-source.sec.samsung.net:slp/api/system-info
+  * Tag: capi-system-info_0.0.1-2
+
+
+ -- Kyuhun Jung <kyuhun.jung@samsung.com>  Mon, 22 Aug 2011 19:58:48 +0900
+
+capi-system-info (0.0.1-1) unstable; urgency=low
+
+  * Initial upload
+  * Git: slp-source.sec.samsung.net:slp/api/system-info
+  * Tag: capi-system-info_0.0.1-1
+
+
+ -- Woongsuk Cho <ws77.cho@samsung.com>  Thu, 04 Aug 2011 17:40:37 +0900
 
- -- Junghyuk Park <junghyuk.park@samsung.com>  Wed, 07 Dec 2011 11:44:07 +0900
index ebf584b..f462af7 100755 (executable)
@@ -11,7 +11,7 @@
  * distributed under the License is distributed on an AS IS BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
- * limitations under the License. 
+ * limitations under the License.
  */
 
 
@@ -25,7 +25,7 @@ extern "C"
 {
 #endif
 
- /**
+/**
  * @addtogroup CAPI_SYSTEM_SYSTEM_INFO_MODULE
  * @{
  */
@@ -33,8 +33,7 @@ extern "C"
 /**
  * @brief Enumeration of error code for system information
  */
-typedef enum
-{
+typedef enum {
        SYSTEM_INFO_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
        SYSTEM_INFO_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
        SYSTEM_INFO_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
@@ -61,7 +60,39 @@ typedef enum {
        SYSTEM_INFO_KEY_SCREEN_WIDTH, /**< The width of the screen in pixels */
        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_MOBILE_DEVICE_ID, /**< The unique ID to identify GSM, UMTS and CDMA mobile devices */ 
+       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_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_SCREEN_DPI, /**< The width of the screen DPI */
+       SYSTEM_INFO_KEY_DEVICE_UUID, /**< The Device unique ID to identify */
+       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_CORE_CPU_ARCH, /**< The CORE CPU architecture of model */
+       SYSTEM_INFO_KEY_CORE_FPU_ARCH, /**< The CORE FPU architecture of model */
+       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 */
+       SYSTEM_INFO_KEY_SIP_VOIP_SUPPORTED, /**< Indicates whether the device supports SIP VOIP */
+       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_OPENGLES_TEXTURE_FORMAT, /**< The supported texture format of the OpenGL ES */
+       SYSTEM_INFO_KEY_CORE_CPU_FREQ, /**< The CORE CPU frequency of model */
+       SYSTEM_INFO_KEY_PHYSICAL_SCREEN_HEIGHT, /**< The physical screen height in millimeters */
+       SYSTEM_INFO_KEY_PHYSICAL_SCREEN_WIDTH, /**< The physical screen width in millimeters */
+       SYSTEM_INFO_KEY_BUILD_STRING, /**< The build string of platform binary */
+       SYSTEM_INFO_KEY_BUILD_DATE, /**< The build date of platform binary */
+       SYSTEM_INFO_KEY_BUILD_TIME /**< The build time of platform binary */
 } system_info_key_e;
 
 /**
index f2ae1a3..dd94b3f 100755 (executable)
@@ -11,7 +11,7 @@
  * distributed under the License is distributed on an AS IS BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
- * limitations under the License. 
+ * limitations under the License.
  */
 
 
@@ -23,6 +23,12 @@ extern "C"
 {
 #endif
 
+#define INFO_FILE_PATH "/etc/info.ini"
+#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 MAXBUFSIZE 512
+
 typedef enum {
        SYSTEM_INFO_DATA_TYPE_STRING,
        SYSTEM_INFO_DATA_TYPE_INT,
@@ -30,25 +36,76 @@ typedef enum {
        SYSTEM_INFO_DATA_TYPE_BOOL
 } system_info_data_type_e;
 
+/**
+ * @brief Enumeration of Mode type
+ */
+typedef enum {
+       SYSTEM_INFO_MODEL_TYPE_EMULATOR,
+       SYSTEM_INFO_MODEL_TYPE_TARGET
+} system_info_mode_type_e;
+
 typedef int (*system_info_get_value_cb) (system_info_key_e key, system_info_data_type_e data_type, void **value);
 
+int system_info_init(void);
+int system_info_get_system_info_initialized(void);
+void system_info_set_system_info_initialized(int value);
+system_info_mode_type_e system_info_get_system_info_model_type();
+
+int system_info_vconf_get_value_int(const char *vconf_key, int *value);
+int system_info_vconf_get_value_bool(const char *vconf_key, bool *value);
+int system_info_vconf_get_value_double(const char *vconf_key, double *value);
+int system_info_vconf_get_value_string(const char *vconf_key, char **value);
+
 int system_info_get_model(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);
+int system_info_get_platform_name(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);
+int system_info_get_core_cpu_arch(system_info_key_e key, system_info_data_type_e data_type, void **value);
+int system_info_get_core_fpu_arch(system_info_key_e key, system_info_data_type_e data_type, void **value);
+int system_info_get_core_cpu_freq(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);
 int system_info_get_bluetooth_supported(system_info_key_e key, system_info_data_type_e data_type, void **value);
 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);
+int system_info_get_usb_accessory_supported(system_info_key_e key, system_info_data_type_e data_type, void **value);
 int system_info_get_multi_point_touch_count(system_info_key_e key, system_info_data_type_e data_type, void **value);
 int system_info_get_network_type(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_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);
 int system_info_get_screen_height(system_info_key_e key, system_info_data_type_e data_type, void **value);
 int system_info_get_screen_width(system_info_key_e key, system_info_data_type_e data_type, void **value);
+int system_info_get_screen_DPI(system_info_key_e key, system_info_data_type_e data_type, void **value);
+int system_info_get_hdmi_supported(system_info_key_e key, system_info_data_type_e data_type, void **value);
+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_barometer_sensor_supported(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);
 
 #ifdef __cplusplus
 }
diff --git a/packaging/capi-system-info.manifest b/packaging/capi-system-info.manifest
deleted file mode 100644 (file)
index 017d22d..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<manifest>
- <request>
-    <domain name="_"/>
- </request>
-</manifest>
old mode 100644 (file)
new mode 100755 (executable)
index 1547789..65e1471
@@ -1,27 +1,46 @@
+#sbs-git:slp/api/system-info capi-system-info 0.1.0 63d15bafa590ee9de869c8a8ade712e06828e5c3
 Name:       capi-system-info
-Summary:    A System Information library in Tizen Native API
-Version:    0.1.0
-Release:    12
+Summary:    A System Information library in SLP C API
+Version: 0.1.5
+Release:    0
 Group:      TO_BE/FILLED_IN
-License:    Apache-2.0
+License:    TO BE FILLED IN
 Source0:    %{name}-%{version}.tar.gz
-Source1001: packaging/capi-system-info.manifest 
 BuildRequires:  cmake
 BuildRequires:  pkgconfig(dlog)
 BuildRequires:  pkgconfig(vconf)
 BuildRequires:  pkgconfig(capi-base-common)
+BuildRequires: pkgconfig(capi-network-wifi)
+BuildRequires: pkgconfig(capi-media-sound-manager)
+BuildRequires: pkgconfig(capi-uix-stt)
+BuildRequires: pkgconfig(wifi-direct)
 BuildRequires:  pkgconfig(iniparser)
 BuildRequires:  pkgconfig(x11)
+BuildRequires:  pkgconfig(xi)
+BuildRequires: pkgconfig(xrandr)
 BuildRequires:  pkgconfig(tapi)
-
-Requires(post): /sbin/ldconfig  
+BuildRequires: pkgconfig(devman)
+BuildRequires: pkgconfig(xproto)
+BuildRequires: pkgconfig(openssl)
+BuildRequires: pkgconfig(nfc)
+BuildRequires: pkgconfig(location)
+BuildRequires: pkgconfig(bluetooth-api)
+BuildRequires: pkgconfig(mm-radio)
+BuildRequires: pkgconfig(sensor)
+%ifarch %{ix86}
+BuildRequires: simulator-opengl-devel
+%else
+BuildRequires: pkgconfig(gles11)
+%endif
+
+Requires(post): /sbin/ldconfig
 Requires(postun): /sbin/ldconfig
 
 %description
 
 
 %package devel
-Summary:  A System Information library in Tizen Native API (Development)
+Summary:  A System Information library in SLP C API (Development)
 Group:    TO_BE/FILLED_IN
 Requires: %{name} = %{version}-%{release}
 
@@ -34,7 +53,6 @@ Requires: %{name} = %{version}-%{release}
 
 
 %build
-cp %{SOURCE1001} .
 MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
 cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
 
@@ -51,13 +69,9 @@ rm -rf %{buildroot}
 
 
 %files
-%manifest capi-system-info.manifest
 %{_libdir}/libcapi-system-info.so.*
 
 %files devel
-%manifest capi-system-info.manifest
 %{_includedir}/system/system_info.h
 %{_libdir}/pkgconfig/*.pc
 %{_libdir}/libcapi-system-info.so
-
-
index 1ce72fb..a9a74aa 100755 (executable)
@@ -11,7 +11,7 @@
  * distributed under the License is distributed on an AS IS BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
- * limitations under the License. 
+ * limitations under the License.
  */
 
 
@@ -39,7 +39,7 @@ typedef struct {
        system_info_get_value_cb get_value_cb;
 } system_info_s;
 
-typedef system_info_s *system_info_h;
+typedef system_info_s * system_info_h;
 
 system_info_s system_info_table[] = {
 
@@ -93,7 +93,8 @@ system_info_s system_info_table[] = {
 },
 
 {
-       /**< The maximum number of concurrent touch points supported in the device */
+       /**< The maximum number of concurrent touch points supported
+       in the device */
        SYSTEM_INFO_KEY_MULTI_POINT_TOUCH_COUNT,
        SYSTEM_INFO_DATA_TYPE_INT,
        system_info_get_multi_point_touch_count
@@ -163,19 +164,296 @@ system_info_s system_info_table[] = {
 },
 
 {
+       /**< 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,
+       system_info_get_platform_name
+},
+
+{
+       /**< The Name of the Tizen version */
+       SYSTEM_INFO_KEY_TIZEN_VERSION_NAME,
+       SYSTEM_INFO_DATA_TYPE_STRING,
+       system_info_get_tizen_version_name
+},
+
+{
+       /**< 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 */
+       SYSTEM_INFO_KEY_WIFI_DIRECT_SUPPORTED,
+       SYSTEM_INFO_DATA_TYPE_BOOL,
+       system_info_get_wifi_direct_supported
+},
+
+{
+       /**< The height of the screen DPI */
+       SYSTEM_INFO_KEY_SCREEN_DPI,
+       SYSTEM_INFO_DATA_TYPE_INT,
+       system_info_get_screen_DPI
+},
+
+{
+       /**< 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,
+       system_info_get_wps_supported
+},
+
+{
+       /**< Indicates whether the device supports USB host */
+       SYSTEM_INFO_KEY_USB_HOST_SUPPORTED,
+       SYSTEM_INFO_DATA_TYPE_BOOL,
+       system_info_get_usb_host_supported
+},
+
+{
+       /**< Indicates whether the device supports USB accessory */
+       SYSTEM_INFO_KEY_USB_ACCESSORY_SUPPORTED,
+       SYSTEM_INFO_DATA_TYPE_BOOL,
+       system_info_get_usb_accessory_supported
+},
+
+{
+       /**< The CORE CPU architecture of model */
+       SYSTEM_INFO_KEY_CORE_CPU_ARCH,
+       SYSTEM_INFO_DATA_TYPE_STRING,
+       system_info_get_core_cpu_arch
+},
+
+{
+       /**< The CORE FPU architecture of model */
+       SYSTEM_INFO_KEY_CORE_FPU_ARCH,
+       SYSTEM_INFO_DATA_TYPE_STRING,
+       system_info_get_core_fpu_arch
+},
+
+{
+       /**< Indicates whether the device supports front camera */
+       SYSTEM_INFO_KEY_FRONT_CAMERA_SUPPORTED,
+       SYSTEM_INFO_DATA_TYPE_BOOL,
+       system_info_get_front_camera_supported
+},
+
+{
+       /**< 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,
+       system_info_get_front_camera_flash_supported
+},
+
+{
+       /**< Indicates whether the device supports back camera */
+       SYSTEM_INFO_KEY_BACK_CAMERA_SUPPORTED,
+       SYSTEM_INFO_DATA_TYPE_BOOL,
+       system_info_get_back_camera_supported
+},
+
+{
+       /**< 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,
+       system_info_get_back_camera_flash_supported
+},
+
+{
+       /**< Indicates whether the device supports HDMI */
+       SYSTEM_INFO_KEY_HDMI_SUPPORTED,
+       SYSTEM_INFO_DATA_TYPE_BOOL,
+       system_info_get_hdmi_supported
+},
+
+{
+       /**< Indicates whether the device supports RCA */
+       SYSTEM_INFO_KEY_RCA_SUPPORTED,
+       SYSTEM_INFO_DATA_TYPE_BOOL,
+       system_info_get_rca_supported
+},
+
+{
+       /**< Indicates whether the device supports SIP VOIP */
+       SYSTEM_INFO_KEY_SIP_VOIP_SUPPORTED,
+       SYSTEM_INFO_DATA_TYPE_BOOL,
+       system_info_get_sip_voip_supported
+},
+
+{
+       /**< Indicates whether the device supports Microphone */
+       SYSTEM_INFO_KEY_MICROPHONE_SUPPORTED,
+       SYSTEM_INFO_DATA_TYPE_BOOL,
+       system_info_get_microphone_supported
+},
+
+{
+       /**< Indicates whether the device supports stt */
+       SYSTEM_INFO_KEY_SPEECH_RECOGNITION_SUPPORTED,
+       SYSTEM_INFO_DATA_TYPE_BOOL,
+       system_info_get_speech_recognition_supported
+},
+
+{
+       /**< Indicates whether the device supports barometer sensor */
+       SYSTEM_INFO_KEY_BAROMETER_SENSOR_SUPPORTED,
+       SYSTEM_INFO_DATA_TYPE_BOOL,
+       system_info_get_barometer_sensor_supported
+},
+
+{
+       /**< The supported texture format of the OpenGL ES */
+       SYSTEM_INFO_KEY_OPENGLES_TEXTURE_FORMAT,
+       SYSTEM_INFO_DATA_TYPE_STRING,
+       system_info_get_opengles_texture_format
+},
+
+{
+       /**< The CORE CPU frequency of model */
+       SYSTEM_INFO_KEY_CORE_CPU_FREQ,
+       SYSTEM_INFO_DATA_TYPE_DOUBLE,
+       system_info_get_core_cpu_freq
+},
+
+{
+       /**< The height of the physical screen size in millimeters */
+       SYSTEM_INFO_KEY_PHYSICAL_SCREEN_HEIGHT,
+       SYSTEM_INFO_DATA_TYPE_INT,
+       system_info_get_physical_screen_height
+},
+
+{
+       /**< The width of the physical screen size in millimeters */
+       SYSTEM_INFO_KEY_PHYSICAL_SCREEN_WIDTH,
+       SYSTEM_INFO_DATA_TYPE_INT,
+       system_info_get_physical_screen_width
+},
+
+{
+       /**< The build string of the platform binary */
+       SYSTEM_INFO_KEY_BUILD_STRING,
+       SYSTEM_INFO_DATA_TYPE_STRING,
+       system_info_get_build_string
+},
+
+{
+       /**< The build date of the platform binary */
+       SYSTEM_INFO_KEY_BUILD_DATE,
+       SYSTEM_INFO_DATA_TYPE_STRING,
+       system_info_get_build_date
+},
+
+{
+       /**< The build time of the platform binary */
+       SYSTEM_INFO_KEY_BUILD_TIME,
+       SYSTEM_INFO_DATA_TYPE_STRING,
+       system_info_get_build_time
+},
+
+{
        SYSTEM_INFO_MAX, -1, NULL
 }
 
 };
 
+static system_info_mode_type_e system_info_system_info_model_type;
+static int system_info_initialized;
+
+int system_info_get_system_info_initialized()
+{
+       return system_info_initialized;
+}
+
+void system_info_set_system_info_initialized(int value)
+{
+       system_info_initialized = value;
+}
+
+system_info_mode_type_e system_info_get_system_info_model_type()
+{
+       return system_info_system_info_model_type;
+}
+
+int system_info_init(void)
+{
+       FILE *fp;
+       char str[MAXBUFSIZE];
+       extern char *strcasestr(const char *s, const char *find);
+
+       fp = popen("uname -m", "r");
+       if (NULL == fp) {
+               LOGE("[%s] cannot execute uname command!!!", __func__);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       } else {
+               while (fgets(str, MAXBUFSIZE, fp)) {
+                       if (strcasestr(str, "emulated")) {
+                               system_info_system_info_model_type = SYSTEM_INFO_MODEL_TYPE_EMULATOR;
+                               system_info_set_system_info_initialized(1);
+                               pclose(fp);
+                               return SYSTEM_INFO_ERROR_NONE;
+
+                       }
+               }
+
+               system_info_system_info_model_type = SYSTEM_INFO_MODEL_TYPE_TARGET;
+               system_info_set_system_info_initialized(1);
+               pclose(fp);
+               return SYSTEM_INFO_ERROR_NONE;
+       }
+}
+
 static int system_info_get(system_info_key_e key, system_info_h *system_info)
 {
        int index = 0;
+       int ret_val;
 
-       while (system_info_table[index].key != SYSTEM_INFO_MAX)
-       {
-               if (system_info_table[index].key == key)
-               {
+       if (0 == system_info_get_system_info_initialized()) {
+               ret_val = system_info_init();
+               if (ret_val) {
+                       LOGE("[%s] system information initialize fail!!!", __func__);
+                       return ret_val;
+               }
+       }
+
+       while (system_info_table[index].key != SYSTEM_INFO_MAX) {
+               if (system_info_table[index].key == key) {
                        *system_info = &system_info_table[index];
                        return 0;
                }
@@ -183,7 +461,7 @@ static int system_info_get(system_info_key_e key, system_info_h *system_info)
                index++;
        }
 
-       return -1;
+       return -1;
 }
 
 int system_info_get_value(system_info_key_e key, system_info_data_type_e data_type, void **value)
@@ -191,29 +469,25 @@ int system_info_get_value(system_info_key_e key, system_info_data_type_e data_ty
        system_info_h system_info;
        system_info_get_value_cb system_info_getter;
 
-       if (value == NULL)
-       {
-               LOGE("[%s] INVALID_PARAMETER(0x%08x) : invalid output param", __FUNCTION__, SYSTEM_INFO_ERROR_INVALID_PARAMETER);
+       if (value == NULL) {
+               LOGE("[%s] INVALID_PARAMETER(0x%08x) : invalid output param", __func__, SYSTEM_INFO_ERROR_INVALID_PARAMETER);
                return SYSTEM_INFO_ERROR_INVALID_PARAMETER;
        }
 
-       if (system_info_get(key, &system_info))
-       {
-               LOGE("[%s] INVALID_PARAMETER(0x%08x) : invalid key", __FUNCTION__, SYSTEM_INFO_ERROR_INVALID_PARAMETER);
+       if (system_info_get(key, &system_info)) {
+               LOGE("[%s] INVALID_PARAMETER(0x%08x) : invalid key", __func__, SYSTEM_INFO_ERROR_INVALID_PARAMETER);
                return SYSTEM_INFO_ERROR_INVALID_PARAMETER;
        }
 
-       if (system_info->data_type != data_type)
-       {
-               LOGE("[%s] INVALID_PARAMETER(0x%08x) : invalid data type", __FUNCTION__, SYSTEM_INFO_ERROR_INVALID_PARAMETER);
+       if (system_info->data_type != data_type) {
+               LOGE("[%s] INVALID_PARAMETER(0x%08x) : invalid data type", __func__, SYSTEM_INFO_ERROR_INVALID_PARAMETER);
                return SYSTEM_INFO_ERROR_INVALID_PARAMETER;
        }
 
        system_info_getter = system_info->get_value_cb;
 
-       if (system_info_getter == NULL)
-       {
-               LOGE("[%s] IO_ERROR(0x%08x) : failed to call getter for the system information", __FUNCTION__, SYSTEM_INFO_ERROR_IO_ERROR);
+       if (system_info_getter == NULL) {
+               LOGE("[%s] IO_ERROR(0x%08x) : failed to call getter for the system information", __func__, SYSTEM_INFO_ERROR_IO_ERROR);
                return SYSTEM_INFO_ERROR_IO_ERROR;
        }
 
@@ -222,21 +496,20 @@ int system_info_get_value(system_info_key_e key, system_info_data_type_e data_ty
 
 int system_info_get_value_int(system_info_key_e key, int *value)
 {
-       return system_info_get_value(key, SYSTEM_INFO_DATA_TYPE_INT, (void**)value);
+       return system_info_get_value(key, SYSTEM_INFO_DATA_TYPE_INT, (void **)value);
 }
 
 int system_info_get_value_bool(system_info_key_e key, bool *value)
 {
-       return system_info_get_value(key, SYSTEM_INFO_DATA_TYPE_BOOL, (void**)value);
+       return system_info_get_value(key, SYSTEM_INFO_DATA_TYPE_BOOL, (void **)value);
 }
 
 int system_info_get_value_double(system_info_key_e key, double *value)
 {
-       return system_info_get_value(key, SYSTEM_INFO_DATA_TYPE_DOUBLE, (void**)value);
+       return system_info_get_value(key, SYSTEM_INFO_DATA_TYPE_DOUBLE, (void **)value);
 }
 
 int system_info_get_value_string(system_info_key_e key, char **value)
 {
-       return system_info_get_value(key, SYSTEM_INFO_DATA_TYPE_STRING, (void**)value);
+       return system_info_get_value(key, SYSTEM_INFO_DATA_TYPE_STRING, (void **)value);
 }
-
index 50c2722..9677f22 100755 (executable)
  * distributed under the License is distributed on an AS IS BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
- * limitations under the License. 
+ * 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 <vconf.h>
+#include <vconf-internal-csc-keys.h>
 #include <dlog.h>
 
 #include <system_info.h>
 #include <system_info_private.h>
 
+#include <devman_haptic.h>
+#include <wifi.h>
+#include <wifi-direct.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 "TIZEN_N_SYSTEM_INFO"
 
-static const bool BLUETOOTH_SUPPORT = true;
-static const int CAMERA_COUNT = 2;
-static const bool FM_RADIO_SUPPORT = true;
-static const bool GPS_SUPPORT = true;
-static const char *KEYBOARD_TYPE = NULL;
-static const int MULTI_POINT_TOUCH_COUNT = 3;
-static const bool NFC_SUPPORT = true;
+#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"
+
+static char *KEYBOARD_TYPE;
+static char *FRONT_CAM_PATH;
+static char *BACK_CAM_PATH;
 static const bool TVOUT_SUPPORT = true;
-static const bool WIFI_SUPPORT = true;
+static const bool SIP_VOIP_SUPPROT = true;
+static const bool SPEECH_RECOGNITION_SUPPROT = true;
+
+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)
+{
+       *device_uuid_string = (char *) calloc(1, DEVICE_UUID_STRING_SIZE + 1);
+
+       if (*device_uuid_string == NULL)
+               return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
+
+       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]);
+
+       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("[%s] XInput Extension isn't supported.", __func__);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       if (XIQueryVersion(disp, &major, &minor) == BadRequest) {
+               LOGE("[%s] Failed to query XI version.", __func__);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       if (!(major >= XI_2_Major && minor >= XI_2_Minor)) {
+               LOGE("[%s] XI2 is not supported ! (major:%d, minor:%d)", __func__, 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("[%s] Failed to get XI2 device property !(deviceid=%d)", __func__, 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("[%s] Failed to initialize X Input Extension !", __func__);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       atomMultiTouch = XInternAtom(disp, PROP_MULTITOUCH, True);
+
+       if (!atomMultiTouch) {
+               LOGE("[%s] Failed to make an atom for multitouch property !", __func__);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       info = XIQueryDevice(disp, XIAllDevices, &ndevices);
+
+       if (!info) {
+               LOGE("[%s] Failed to query XI device.", __func__);
+               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;
+               }
+       }
+
+       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;
+       supported = (bool *)value;
 
-       *supported = BLUETOOTH_SUPPORT;
+       if (bluetooth_is_supported())
+                       *supported = true;
+               else
+                       *supported = false;
 
        return SYSTEM_INFO_ERROR_NONE;
 }
@@ -55,32 +333,90 @@ 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 *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("[%s] cannot file open %s file!!!", __func__, 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;
+}
+
+int system_info_get_fmradio_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       bool *supported;
+       MMHandleType hradio;
 
-       count = (int*)value;
+       supported = (bool *)value;
 
-       *count = CAMERA_COUNT;
+       memset(&hradio, 0x0, sizeof(MMHandleType));
+
+       if (MM_ERROR_NONE == mm_radio_create(&hradio))
+               *supported = true;
+       else
+               *supported = false;
+
+       mm_radio_destroy(hradio);
 
        return SYSTEM_INFO_ERROR_NONE;
 }
 
-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)
 {
        bool *supported;
 
-       supported = (bool*)value;
+       supported = (bool *)value;
 
-       *supported = FM_RADIO_SUPPORT;
+       if (location_is_supported_method(LOCATION_METHOD_GPS))
+               *supported = true;
+       else
+               *supported = false;
 
        return SYSTEM_INFO_ERROR_NONE;
 }
 
-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)
 {
        bool *supported;
 
-       supported = (bool*)value;
+       supported = (bool *)value;
 
-       *supported = GPS_SUPPORT;
+       if (location_is_supported_method(LOCATION_METHOD_CPS))
+               *supported = true;
+       else
+               *supported = false;
+
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+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;
 }
@@ -89,20 +425,16 @@ int system_info_get_keyboard_type(system_info_key_e key, system_info_data_type_e
 {
        char *keyboard_type;
 
-       if (KEYBOARD_TYPE != NULL)
-       {
+       if (KEYBOARD_TYPE != NULL) {
                keyboard_type = strdup(KEYBOARD_TYPE);
 
-               if (keyboard_type == NULL)
-               {
-                       LOGE("[%s] OUT_OF_MEMORY(0x%08x)", __FUNCTION__, SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
+               if (keyboard_type == NULL) {
+                       LOGE("[%s] OUT_OF_MEMORY(0x%08x)", __func__, SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
                        return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
                }
 
                *value = keyboard_type;
-       }
-       else
-       {
+       } else {
                *value = NULL;
        }
 
@@ -112,10 +444,18 @@ int system_info_get_keyboard_type(system_info_key_e key, system_info_data_type_e
 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;
 
-       count = (int*)value;
+       disp = XOpenDisplay(NULL);
 
-       *count = MULTI_POINT_TOUCH_COUNT;
+       if (!disp) {
+               LOGE("[%s] Failed to open display!", __func__);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       *count = get_multitouch_max_count(disp);
 
        return SYSTEM_INFO_ERROR_NONE;
 }
@@ -123,10 +463,14 @@ int system_info_get_multi_point_touch_count(system_info_key_e key, system_info_d
 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;
+       supported = (bool *)value;
 
-       *supported = NFC_SUPPORT;
+       if (NET_NFC_OK == net_nfc_is_supported(&nfc_supported))
+               *supported = true;
+       else
+               *supported = false;
 
        return SYSTEM_INFO_ERROR_NONE;
 }
@@ -135,7 +479,7 @@ int system_info_get_tvout_supported(system_info_key_e key, system_info_data_type
 {
        bool *supported;
 
-       supported = (bool*)value;
+       supported = (bool *)value;
 
        *supported = TVOUT_SUPPORT;
 
@@ -146,10 +490,394 @@ int system_info_get_wifi_supported(system_info_key_e key, system_info_data_type_
 {
        bool *supported;
 
-       supported = (bool*)value;
+       supported = (bool *)value;
+
+       if (WIFI_ERROR_NONE == wifi_initialize())
+               *supported = true;
+       else
+               *supported = false;
+
+       wifi_deinitialize();
+
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+int system_info_get_wifi_direct_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       bool *supported;
+
+       supported = (bool *)value;
+
+       /* this is a temporary code by wifi-direct team request */
+       *supported = true;
+
+       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;
+
+       supported = (bool *)value;
+
+       count = device_haptic_get_device_count();
+
+       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;
+
+       system_info_get_value_string(SYSTEM_INFO_KEY_MOBILE_DEVICE_ID, &imei);
+
+       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("[%s] imei is NULL!!!", __func__);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+}
+
+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;
+}
+
+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;
 
-       *supported = WIFI_SUPPORT;
+       if (vconf_get_int(VCONFKEY_USB_ACCESSORY_STATUS, &usbhost_state))
+               *supported = false;
+       else
+               *supported = true;
+
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+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("[%s] cannot file open %s file!!!", __func__, 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;
+}
+
+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("[%s] cannot file open %s file!!!", __func__, 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;
+}
+
+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("[%s] cannot file open %s file!!!", __func__, 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;
+}
+
+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("[%s] cannot file open %s file!!!", __func__, 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;
+}
+
+
+int system_info_get_sip_voip_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       bool *supported;
+
+       supported = (bool *)value;
+
+       *supported = SIP_VOIP_SUPPROT;
+
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+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;
+}
+
+int system_info_get_speech_recognition_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       bool *supported;
+
+       supported = (bool *)value;
+
+       *supported = SPEECH_RECOGNITION_SUPPROT;
+
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+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;
+}
index 7a563f5..b33e59f 100755 (executable)
@@ -11,7 +11,7 @@
  * distributed under the License is distributed on an AS IS BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
- * limitations under the License. 
+ * limitations under the License.
  */
 
 #include <stdio.h>
@@ -21,8 +21,8 @@
 #include <vconf.h>
 #include <dlog.h>
 
-#include <TapiCommon.h>
-#include <ITapiMisc.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)
 {
-       char * network_type;
+       int service_type = 0;
+       char *NETWORK_TYPE = NULL;
 
-       network_type = strdup("GSM/UMTS");
+       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;
+       }
 
-       if (network_type == NULL)
-       {
-               LOGE("[%s] OUT_OF_MEMORY(0x%08x)", __FUNCTION__, SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
+       if (NETWORK_TYPE == NULL) {
+               LOGE("[%s] OUT_OF_MEMORY(0x%08x)", __func__, SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
                return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
        }
 
-       *value = network_type;
-       
+       *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)
 {
-       TelMiscSNInformation imei = {0,};
+       TapiHandle *handle = NULL;
+       char *imei = NULL;
+       char *MOBILE_DEVICE_ID = NULL;
+
+       handle = tel_init(0);
 
-       if (tel_init() != TAPI_API_SUCCESS)
-       {
-               LOGE("[%s] IO_ERROR(0x%08x)", __FUNCTION__, SYSTEM_INFO_ERROR_IO_ERROR);
+       if (NULL == handle) {
+               LOGE("[%s] tel_init ERROR", __func__);
+               *value = NULL;
                return SYSTEM_INFO_ERROR_IO_ERROR;
        }
 
-       if (tel_get_misc_me_sn(TAPI_MISC_ME_IMEI, &imei) != TAPI_API_SUCCESS)
-       {
-               tel_deinit();
-               LOGE("[%s] IO_ERROR(0x%08x)", __FUNCTION__, SYSTEM_INFO_ERROR_IO_ERROR);
+       imei = tel_get_misc_me_imei_sync(handle);
+
+       if (imei == NULL) {
+               LOGE("[%s] IMEI value is NULL", __func__);
+               tel_deinit(handle);
+               *value = NULL;
                return SYSTEM_INFO_ERROR_IO_ERROR;
        }
 
-       *value = strdup((char*)imei.szNumber);
+       MOBILE_DEVICE_ID = strdup((char *)imei);
 
-       tel_deinit();
+       if (MOBILE_DEVICE_ID == NULL) {
+               LOGE("[%s] OUT_OF_MEMORY(0x%08x)", __func__, SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
+               free(imei);
+               tel_deinit(handle);
+               *value = NULL;
+               return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
+       }
 
+       free(imei);
+       tel_deinit(handle);
+       *value = MOBILE_DEVICE_ID;
        return SYSTEM_INFO_ERROR_NONE;
 }
-
index 7862d32..e8de58f 100755 (executable)
@@ -11,7 +11,7 @@
  * distributed under the License is distributed on an AS IS BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
- * limitations under the License. 
+ * limitations under the License.
  */
 
 
 #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 "TIZEN_N_SYSTEM_INFO"
 
-#define TIZEN_VERSION "1.0"
-#define DEVICE_MODEL "SDK"
 #define LIB_GLES_V1 "/usr/lib/libGLESv1_CM.so"
 #define LIB_GLES_V2 "/usr/lib/libGLESv2.so"
 
+#define SIZE_OF_MODEL_NAME 8
+
 int system_info_get_model(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       char *model_dup;
+       FILE *info = NULL;
+       char *name = NULL;
+       char *MODEL = NULL;
+       char *token = NULL;
+       char tmpStr[MAXBUFSIZE];
+       char str[MAXBUFSIZE];
+       extern char *strcasestr(const char *s, const char *find);
 
-       model_dup = strdup(DEVICE_MODEL);
-
-       if (model_dup == NULL)
-       {
-               LOGE("[%s] OUT_OF_MEMORY(0x%08x)", __FUNCTION__, SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
-               return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
+       if (system_info_get_system_info_model_type() != SYSTEM_INFO_MODEL_TYPE_EMULATOR) {
+               info = fopen(INFO_FILE_PATH, "r");
+               if (NULL == info) {
+                       LOGE("[%s] cannot file open %s file!!!", __func__, INFO_FILE_PATH);
+                       return SYSTEM_INFO_ERROR_IO_ERROR;
+               } else {
+                       while (fgets(str, MAXBUFSIZE, info)) {
+                               if (strncmp("Build", str, strlen("Build")))
+                                       continue;
+                               else {
+                                       /* Open SDK Target*/
+                                       if (strcasestr(str, "Tizen")) {
+                                               strcpy(tmpStr, str);
+                                               token = strtok(tmpStr, "_");
+                                               token = strtok(NULL, "_");
+                                               MODEL = strdup(token);
+                                               if (MODEL == NULL) {
+                                                       LOGE("[%s] OUT_OF_MEMORY(0x%08x)", __func__, SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
+                                                       fclose(info);
+                                                       return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
+                                               }
+                                       } else {
+                                               /* DEV, SEL, REL Target */
+                                               name = strchr(str, '=');
+                                               strncpy(tmpStr, name+1, SIZE_OF_MODEL_NAME);
+                                               tmpStr[SIZE_OF_MODEL_NAME] = '\0';
+                                               MODEL = strdup(tmpStr);
+                                               if (MODEL == NULL) {
+                                                       LOGE("[%s] OUT_OF_MEMORY(0x%08x)", __func__, SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
+                                                       fclose(info);
+                                                       return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
+                                               }
+                                       }
+                                       break;
+                               }
+                       }
+                       fclose(info);
+               }
+       } else {
+               /* Emulator */
+               MODEL = strdup("Emulator");
+               if (MODEL == NULL) {
+                       LOGE("[%s] OUT_OF_MEMORY(0x%08x)", __func__, SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
+                       return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
+               }
        }
 
-       *value = model_dup;
+       *value = MODEL;
 
        return SYSTEM_INFO_ERROR_NONE;
 }
 
 int system_info_get_tizen_version(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       char *version_dup;
+       char *TIZEN_VERSION = NULL;
+       char *name = NULL;
+       char *major = NULL;
+       char *minor = NULL;
+       char *order = NULL;
+       char str[MAXBUFSIZE];
+       char tmpStr[MAXBUFSIZE];
+       FILE *info;
 
-       version_dup = strdup(TIZEN_VERSION);
 
-       if (version_dup == NULL)
-       {
-               LOGE("[%s] OUT_OF_MEMORY(0x%08x)", __FUNCTION__, SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
+       info = fopen(INFO_FILE_PATH, "r");
+       if (NULL == info) {
+               LOGE("[%s] cannot file open %s file!!!", __func__, INFO_FILE_PATH);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       } else {
+               while (fgets(str, MAXBUFSIZE, info)) {
+                       if (!strncmp("Major", str, strlen("Major"))) {
+                               name = strchr(str, '=');
+                               name++;
+                               strncpy(tmpStr, name, strlen(name)-2);
+                               tmpStr[strlen(name)-2] = '\0';
+                               major = strdup(tmpStr);
+                               continue;
+                       } else if (!strncmp("Minor", str, strlen("Minor"))) {
+                               name = strchr(str, '=');
+                               name++;
+                               strncpy(tmpStr, name, strlen(name)-2);
+                               tmpStr[strlen(name)-2] = '\0';
+                               minor = strdup(tmpStr);
+                               continue;
+                       } else if (!strncmp("Order", str, strlen("Order"))) {
+                               name = strchr(str, '=');
+                               name++;
+                               strncpy(tmpStr, name, strlen(name)-2);
+                               tmpStr[strlen(name)-2] = '\0';
+                               if (!strcmp(tmpStr, ""))
+                                       order = strdup("0");
+                               else
+                                       order = strdup(tmpStr);
+                               continue;
+                       } else
+                               continue;
+               }
+       }
+       fclose(info);
+
+       TIZEN_VERSION = (char *)malloc(strlen(major)+strlen(minor)+strlen(order)+3);
+
+       if (TIZEN_VERSION == NULL) {
+               LOGE("[%s] OUT_OF_MEMORY(0x%08x)", __func__, SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
+               free(major);
+               free(minor);
+               free(order);
                return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
        }
 
-       *value = version_dup;
+       memset(TIZEN_VERSION, 0, strlen(major)+strlen(minor)+strlen(order)+3);
 
+       sprintf(TIZEN_VERSION, "%s.%s.%s", major, minor, order);
+       TIZEN_VERSION[strlen(TIZEN_VERSION)] = '\0';
+
+       *value = TIZEN_VERSION;
+
+       free(major);
+       free(minor);
+       free(order);
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+int system_info_get_platform_name(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       char *PLATFORM_NAME = NULL;
+
+       PLATFORM_NAME = strdup("TIZEN");
+       if (PLATFORM_NAME == NULL) {
+               LOGE("[%s] OUT_OF_MEMORY(0x%08x)", __func__, SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
+               return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
+       }
+
+       *value = PLATFORM_NAME;
+
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+int system_info_get_tizen_version_name(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];
+       FILE *info = NULL;
+
+       info = fopen(INFO_FILE_PATH, "r");
+       if (NULL == info) {
+               LOGE("[%s] cannot file open %s file!!!", __func__, INFO_FILE_PATH);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       } else {
+               while (fgets(str, MAXBUFSIZE, info)) {
+                       if (!strncmp("Major", str, strlen("Major"))) {
+                               name = strchr(str, '=');
+                               name++;
+                               if (!strncmp("1", name, 1))
+                                       TIZEN_VERSION_NAME = strdup("Larkspur");
+                               else if (!strncmp("2", name, 1))
+                                       TIZEN_VERSION_NAME = strdup("Magnolia");
+                               else
+                                       TIZEN_VERSION_NAME = strdup("Unknown Version Name");
+
+                               if (TIZEN_VERSION_NAME == NULL) {
+                                       LOGE("[%s] OUT_OF_MEMORY(0x%08x)", __func__, 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;
 }
 
 int system_info_get_opengles_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;
-       char *version_dup = NULL;
-       
+
        if (!access(LIB_GLES_V1, R_OK))
-       {
                version_supported += 1;
-       }
 
        if (!access(LIB_GLES_V2, R_OK))
-       {
                version_supported += 2;
-       }
 
-       switch (version_supported)
-       {
+       switch (version_supported) {
        case 1:
                version = "1.1";
                break;
@@ -109,19 +260,292 @@ int system_info_get_opengles_version(system_info_key_e key, system_info_data_typ
                break;
        }
 
-       if (version != NULL)
-       {
-               version_dup = strdup(version);
+       if (version != NULL) {
+               OPENGLES_VERSION = strdup(version);
 
-               if (version_dup == NULL)
-               {
-                       LOGE("[%s] OUT_OF_MEMORY(0x%08x)", __FUNCTION__, SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
+               if (OPENGLES_VERSION == NULL) {
+                       LOGE("[%s] OUT_OF_MEMORY(0x%08x)", __func__, SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
                        return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
                }
        }
 
-       *value = version_dup;
+       *value = OPENGLES_VERSION;
+
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+int system_info_get_core_cpu_arch(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       FILE *cpuinfo;
+       char *CORE_CPU_ARCH = NULL;
+       char *name;
+       char str[MAXBUFSIZE];
+
+       if (system_info_get_system_info_model_type() != SYSTEM_INFO_MODEL_TYPE_EMULATOR) {
+               cpuinfo = fopen(CPU_INFO_FILE_PATH, "r");
+               if (NULL == cpuinfo) {
+                       LOGE("[%s] cannot file open %s file!!!", __func__, 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"))))
+                                               CORE_CPU_ARCH = strdup("ARMv7");
+                                       else if (!(strncmp("ARMv6", name+2, strlen("ARMv6"))))
+                                               CORE_CPU_ARCH = strdup("ARMv6");
+                                       else if (!(strncmp("x86", name+2, strlen("x86"))))
+                                               CORE_CPU_ARCH = strdup("x86");
+                               } else
+                                       continue;
+                       }
+                       fclose(cpuinfo);
+               }
+       } else {
+               /* Emulator */
+               CORE_CPU_ARCH = NULL;
+       }
+
+       *value = CORE_CPU_ARCH;
 
        return SYSTEM_INFO_ERROR_NONE;
 }
 
+int system_info_get_core_fpu_arch(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       FILE *cpuinfo;
+       char *CORE_FPU_ARCH = NULL;
+       char *name;
+       char str[MAXBUFSIZE];
+
+       if (system_info_get_system_info_model_type() != SYSTEM_INFO_MODEL_TYPE_EMULATOR) {
+               cpuinfo = fopen(CPU_INFO_FILE_PATH, "r");
+               if (NULL == cpuinfo) {
+                       LOGE("[%s] cannot file open %s file!!!", __func__, CPU_INFO_FILE_PATH);
+                       return SYSTEM_INFO_ERROR_IO_ERROR;
+               } else {
+                       while (fgets(str, MAXBUFSIZE, cpuinfo)) {
+                               if (!strncmp("Features", str, strlen("Features"))) {
+                                       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, "sse2"))
+                                               CORE_FPU_ARCH = strdup("sse2");
+                                       else if (strstr(name+2, "sse3"))
+                                               CORE_FPU_ARCH = strdup("sse3");
+                                       else if (strstr(name+2, "ssse3"))
+                                               CORE_FPU_ARCH = strdup("ssse3");
+                               } else
+                                       continue;
+                       }
+                       fclose(cpuinfo);
+               }
+       } else {
+               /* Emulator */
+               CORE_FPU_ARCH = NULL;
+       }
+
+       *value = CORE_FPU_ARCH;
+
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+int system_info_get_core_cpu_freq(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       double *count;
+       FILE *cpuinfo, *cpuinfo_max_freq;
+       double max_freq;
+       char *name;
+       char str[MAXBUFSIZE];
+
+       if (system_info_get_system_info_model_type() != SYSTEM_INFO_MODEL_TYPE_EMULATOR) {
+               cpuinfo_max_freq = fopen(CPU_INFO_MAX_FREQ_PATH, "r");
+               if (NULL == cpuinfo_max_freq) {
+                       LOGE("[%s] cannot file open %s file!!!", __func__, CPU_INFO_MAX_FREQ_PATH);
+                       return SYSTEM_INFO_ERROR_IO_ERROR;
+               } else {
+                       if (fscanf(cpuinfo_max_freq, "%lf", &max_freq) < 1) {
+                               fclose(cpuinfo_max_freq);
+                               return SYSTEM_INFO_ERROR_IO_ERROR;
+                       }
+                       max_freq = max_freq / 1024;
+               }
+       } else {
+               /* Emulator */
+               cpuinfo = fopen(CPU_INFO_FILE_PATH, "r");
+               if (NULL == cpuinfo) {
+                       LOGE("[%s] cannot file open %s file!!!", __func__, CPU_INFO_FILE_PATH);
+                       return SYSTEM_INFO_ERROR_IO_ERROR;
+               } else {
+                       while (fgets(str, MAXBUFSIZE, cpuinfo)) {
+                               if (!strncmp("cpu MHz", str, strlen("cpu MHz"))) {
+                                       name = strchr(str, ':');
+                                       max_freq = atof(name+2);
+                                       break;
+                               }
+                       }
+               }
+       }
+
+       count = (double *)value;
+
+       *count = max_freq;
+
+       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 cnt = 0;
+       char *OPENGLES_TEXTURE_FORMAT;
+       char textureformat[MAXBUFSIZE];
+
+       memset(textureformat, 0, MAXBUFSIZE);
+
+       if (!access(LIB_GLES_V1, R_OK)) {
+               strncpy(textureformat+cnt, "utc ", strlen("utc "));
+               cnt += strlen("utc ");
+       }
+       if (GL_OES_compressed_paletted_texture) {
+               strncpy(textureformat+cnt, "| ptc ", strlen("| ptc "));
+               cnt += strlen("| ptc ");
+       }
+       if (GL_OES_compressed_ETC1_RGB8_texture) {
+               strncpy(textureformat+cnt, "| etc ", strlen("| etc "));
+               cnt += strlen("| etc ");
+       }
+       if (GL_AMD_compressed_3DC_texture) {
+               strncpy(textureformat+cnt, "| 3dc ", strlen("| 3dc "));
+               cnt += strlen("| 3dc ");
+       }
+       if (GL_AMD_compressed_ATC_texture) {
+               strncpy(textureformat+cnt, "| atc ", strlen("| atc "));
+               cnt += strlen("| atc ");
+       }
+       if (GL_IMG_texture_compression_pvrtc) {
+               strncpy(textureformat+cnt, "| pvrtc", strlen("| pvrtc"));
+               cnt += strlen("| pvrtc");
+       }
+
+       OPENGLES_TEXTURE_FORMAT = strdup(textureformat);
+
+       if (OPENGLES_TEXTURE_FORMAT == NULL) {
+               LOGE("[%s] OUT_OF_MEMORY(0x%08x)", __func__, 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)
+{
+       char *BUILD_STRING = NULL;
+       char *name = NULL;
+       char str[MAXBUFSIZE];
+       char tmpStr[MAXBUFSIZE];
+       FILE *info = NULL;
+
+       info = fopen(INFO_FILE_PATH, "r");
+       if (NULL == info) {
+               LOGE("[%s] cannot file open %s file!!!", __func__, INFO_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("[%s] OUT_OF_MEMORY(0x%08x)", __func__, SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
+                                       fclose(info);
+                                       return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
+                               }
+                               break;
+                       } else
+                               continue;
+               }
+       }
+       *value = BUILD_STRING;
+       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)
+{
+       char *BUILD_DATE = NULL;
+       char *name = NULL;
+       char str[MAXBUFSIZE];
+       char tmpStr[MAXBUFSIZE];
+       FILE *info = NULL;
+
+       info = fopen(INFO_FILE_PATH, "r");
+       if (NULL == info) {
+               LOGE("[%s] cannot file open %s file!!!", __func__, 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("[%s] OUT_OF_MEMORY(0x%08x)", __func__, SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
+                                       fclose(info);
+                                       return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
+                               }
+                               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;
+
+       info = fopen(INFO_FILE_PATH, "r");
+       if (NULL == info) {
+               LOGE("[%s] cannot file open %s file!!!", __func__, 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) {
+                                       LOGE("[%s] OUT_OF_MEMORY(0x%08x)", __func__, 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;
+}
index 6da7dea..cb8b8dc 100755 (executable)
  * distributed under the License is distributed on an AS IS BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
- * limitations under the License. 
+ * limitations under the License.
  */
 
 
 #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 "TIZEN_N_SYSTEM_INFO"
 
-typedef enum {
-       SCREEN_METRICS_BPP,
-       SCREEN_METRICS_WIDTH,
-       SCREEN_METRICS_HEIGHT
-} screen_metrics_e;
+typedef struct _progInfo ProgInfo;
 
-static const int SCREEN_BPP = 32;
+/* globals */
+ProgInfo g_pinfo;
 
-static int system_info_get_default_screen_metrics(screen_metrics_e key, int *value)
+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()
 {
-       static Display *display = NULL;
-       
-       if (display == NULL)
-       {
-               display = XOpenDisplay(":0");
-
-               if (display == NULL)
-               {
-                       return -1;
-               }
+       int i, n;
+       XPixmapFormatValues *pmf;
+
+       memset(&g_pinfo, 0x0, sizeof(ProgInfo));
+
+       g_pinfo.dpy = XOpenDisplay(NULL);
+       if (NULL == g_pinfo.dpy)
+               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)) {
+               return -1;
        }
 
-       switch (key)
-       {
-       case SCREEN_METRICS_BPP:
-       {
-               *value = SCREEN_BPP;
-               break;
+       g_pinfo.res = XRRGetScreenResources(g_pinfo.dpy, g_pinfo.root);
+
+       if (!g_pinfo.res)
+               return -1;
+
+       pmf = XListPixmapFormats(g_pinfo.dpy, &n);
+
+       for (i = 0; i < n; i++) {
+               if (BITS_PER_PIXEL < pmf->bits_per_pixel)
+                       BITS_PER_PIXEL = pmf->bits_per_pixel;
+               pmf++;
+       }
+
+       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)
+                       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);
        }
 
-       case SCREEN_METRICS_WIDTH:
-               *value = DisplayWidth(display, DefaultScreen(display));
-               break;
+       if (BITS_PER_PIXEL == 0)
+               return -1;
 
-       case SCREEN_METRICS_HEIGHT:
-               *value = DisplayHeight(display, DefaultScreen(display));
-               break;
+       if (!SCREEN_WIDTH)
+               SCREEN_WIDTH = DisplayWidth(g_pinfo.dpy, DefaultScreen(g_pinfo.dpy));
 
-       default:
+       if (!SCREEN_WIDTH)
                return -1;
+
+       if (!SCREEN_HEIGHT)
+               SCREEN_HEIGHT = DisplayHeight(g_pinfo.dpy, DefaultScreen(g_pinfo.dpy));
+
+       if (!SCREEN_HEIGHT)
+               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("[%s] cannot file open %s file!!!", __func__, CPU_INFO_FILE_PATH);
+                       return SYSTEM_INFO_ERROR_IO_ERROR;
+               } else {
+                       while (fgets(str, MAXBUFSIZE, cmdline)) {
+                               dpi = strstr(str, "dpi=");
+                               SCREEN_DPI = atoi(dpi+4) / 10;
+                               fclose(cmdline);
+                               break;
+                       }
+               }
+       } else {
+               int max_resolution;
+               double ratio, width_inch;
+
+               width_inch = PHYSICAL_SCREEN_WIDTH / 10 / 2.54;
+               max_resolution = SCREEN_WIDTH + SCREEN_HEIGHT;
+               ratio = SCREEN_WIDTH / SCREEN_HEIGHT;
+
+               SCREEN_DPI = max_resolution / (width_inch + (ratio * width_inch)) + 0.5;
        }
 
+       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;
+       bpp = (int *)value;
 
-       if (system_info_get_default_screen_metrics(SCREEN_METRICS_BPP, bpp))
-       {
-               LOGE("[%s] IO_ERROR(0x%08x) : failed to get the screen metrics", __FUNCTION__, SYSTEM_INFO_ERROR_IO_ERROR);
-               return SYSTEM_INFO_ERROR_IO_ERROR;
+       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;
 }
 
 int system_info_get_screen_width(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
        int *width;
+       int ret_val;
 
-       width = (int*)value;
+       width = (int *)value;
 
-       if (system_info_get_default_screen_metrics(SCREEN_METRICS_WIDTH, width))
-       {
-               LOGE("[%s] IO_ERROR(0x%08x) : failed to get the screen metrics", __FUNCTION__, SYSTEM_INFO_ERROR_IO_ERROR);
-               return SYSTEM_INFO_ERROR_IO_ERROR;
+       if (0 == system_info_screen_initialized) {
+               ret_val = system_info_screen_init();
+               if (ret_val)
+                       return ret_val;
        }
 
+       *width = SCREEN_WIDTH;
+
        return SYSTEM_INFO_ERROR_NONE;
 }
 
 int system_info_get_screen_height(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
        int *height;
+       int ret_val;
+
+       height = (int *)value;
+
+       if (0 == system_info_screen_initialized) {
+               ret_val = system_info_screen_init();
+               if (ret_val)
+                       return ret_val;
+       }
+
+       *height = SCREEN_HEIGHT;
+
+       return SYSTEM_INFO_ERROR_NONE;
+}
 
-       height = (int*)value;
+int system_info_get_screen_DPI(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       int *bpp;
+       int ret_val;
+
+       bpp = (int *)value;
+
+       if (0 == system_info_screen_initialized) {
+               ret_val = system_info_screen_init();
+               if (ret_val)
+                       return ret_val;
+       }
+
+       *bpp = SCREEN_DPI;
+
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+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;
+}
+
+int system_info_get_rca_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       bool *supported;
 
-       if (system_info_get_default_screen_metrics(SCREEN_METRICS_HEIGHT, height))
-       {
-               LOGE("[%s] IO_ERROR(0x%08x) : failed to get the screen metrics", __FUNCTION__, SYSTEM_INFO_ERROR_IO_ERROR);
-               return SYSTEM_INFO_ERROR_IO_ERROR;
+       supported = (bool *)value;
+
+       *supported = RCA_SUPPORTED;
+
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+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;
+}
+
+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;
 }
 
diff --git a/src/system_info_vconf.c b/src/system_info_vconf.c
new file mode 100755 (executable)
index 0000000..c0f2620
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <vconf.h>
+#include <dlog.h>
+
+#include <system_info.h>
+#include <system_info_private.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "TIZEN_N_SYSTEM_INFO"
+
+int system_info_vconf_get_value_int(const char *vconf_key, int *value)
+{
+       return vconf_get_int(vconf_key, value);
+}
+
+int system_info_vconf_get_value_bool(const char *vconf_key, bool *value)
+{
+       return vconf_get_bool(vconf_key, (int *)value);
+}
+
+int system_info_vconf_get_value_double(const char *vconf_key, double *value)
+{
+       return vconf_get_dbl(vconf_key, value);
+}
+
+int system_info_vconf_get_value_string(const char *vconf_key, char **value)
+{
+       char *str_value = NULL;
+
+       str_value = vconf_get_str(vconf_key);
+
+       if (str_value != NULL) {
+               *value = str_value;
+               return 0;
+       } else {
+               return -1;
+       }
+}