Tizen 2.1 base
authorJinkun Jang <jinkun.jang@samsung.com>
Tue, 12 Mar 2013 16:46:14 +0000 (01:46 +0900)
committerJinkun Jang <jinkun.jang@samsung.com>
Tue, 12 Mar 2013 16:46:14 +0000 (01:46 +0900)
27 files changed:
AUTHORS [new file with mode: 0755]
CMakeLists.txt [new file with mode: 0755]
LICENSE.APLv2 [new file with mode: 0644]
LICENSE.RFC4122 [new file with mode: 0644]
NOTICE [new file with mode: 0644]
capi-system-info.pc.in [new file with mode: 0755]
configuration/sys-info_.xml [new file with mode: 0644]
debian/README [new file with mode: 0644]
debian/capi-system-info-dev.install [new file with mode: 0644]
debian/capi-system-info-dev.postinst [new file with mode: 0644]
debian/capi-system-info.install [new file with mode: 0644]
debian/capi-system-info.postinst [new file with mode: 0644]
debian/changelog [new file with mode: 0644]
debian/compat [new file with mode: 0644]
debian/control [new file with mode: 0755]
debian/rules [new file with mode: 0755]
include/system_info.h [new file with mode: 0755]
include/system_info_private.h [new file with mode: 0644]
packaging/capi-system-info.spec [new file with mode: 0644]
script/make_info_file.sh [new file with mode: 0644]
src/system_info.c [new file with mode: 0644]
src/system_info_device.c [new file with mode: 0644]
src/system_info_network.c [new file with mode: 0644]
src/system_info_platform.c [new file with mode: 0644]
src/system_info_screen.c [new file with mode: 0644]
src/system_info_vconf.c [new file with mode: 0644]
system-info.manifest [new file with mode: 0644]

diff --git a/AUTHORS b/AUTHORS
new file mode 100755 (executable)
index 0000000..5b0ed9c
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1 @@
+Kyuhun Jung <kyuhun.jung@samsung.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..0f58f45
--- /dev/null
@@ -0,0 +1,95 @@
+
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+SET(fw_name "capi-system-info")
+
+PROJECT(${fw_name})
+
+SET(CMAKE_INSTALL_PREFIX /usr)
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+
+SET(INC_DIR include)
+INCLUDE_DIRECTORIES(${INC_DIR})
+
+SET(requires "dlog capi-base-common capi-media-sound-manager vconf x11 xi xrandr tapi haptic xproto openssl nfc location bluetooth-api mm-radio sensor libxml-2.0")
+SET(pc_requires "capi-base-common")
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(${fw_name} REQUIRED ${requires})
+FOREACH(flag ${${fw_name}_CFLAGS})
+    SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror")
+SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
+
+IF("${ARCH}" STREQUAL "arm")
+    ADD_DEFINITIONS("-DTARGET")
+ENDIF("${ARCH}" STREQUAL "arm")
+
+ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+ADD_DEFINITIONS("-DSLP_DEBUG")
+
+SET(CMAKE_EXE_LINKER_FLAGS "-fvisibility=hidden -Wl,--as-needed -Wl,--rpath=/usr/lib")
+
+aux_source_directory(src SOURCES)
+ADD_LIBRARY(${fw_name} SHARED ${SOURCES})
+
+TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS})
+
+SET_TARGET_PROPERTIES(${fw_name}
+     PROPERTIES
+     VERSION ${FULLVER}
+     SOVERSION ${MAJORVER}
+     CLEAN_DIRECT_OUTPUT 1
+)
+
+INSTALL(TARGETS ${fw_name} DESTINATION lib)
+INSTALL(
+        DIRECTORY ${INC_DIR}/ DESTINATION include/system
+        FILES_MATCHING
+        PATTERN "*_private.h" EXCLUDE
+        PATTERN "${INC_DIR}/*.h"
+        )
+
+SET(PC_NAME ${fw_name})
+SET(PC_REQUIRED ${pc_requires})
+SET(PC_LDFLAGS -l${fw_name})
+SET(PC_CFLAGS -I\${includedir}/system)
+
+CONFIGURE_FILE(
+    ${fw_name}.pc.in
+    ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc
+    @ONLY
+)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION lib/pkgconfig)
+
+IF(UNIX)
+
+ADD_CUSTOM_TARGET (distclean @echo cleaning for source distribution)
+ADD_CUSTOM_COMMAND(
+        DEPENDS clean
+        COMMENT "distribution clean"
+        COMMAND find
+        ARGS    .
+        -not -name config.cmake -and \(
+        -name tester.c -or
+        -name Testing -or
+        -name CMakeFiles -or
+        -name cmake.depends -or
+        -name cmake.check_depends -or
+        -name CMakeCache.txt -or
+        -name cmake.check_cache -or
+        -name *.cmake -or
+        -name Makefile -or
+        -name core -or
+        -name core.* -or
+        -name gmon.out -or
+        -name install_manifest.txt -or
+        -name *.pc -or
+        -name *~ \)
+        | grep -v TC | xargs rm -rf
+        TARGET  distclean
+        VERBATIM
+)
+
+ENDIF(UNIX)
diff --git a/LICENSE.APLv2 b/LICENSE.APLv2
new file mode 100644 (file)
index 0000000..261eeb9
--- /dev/null
@@ -0,0 +1,201 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   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.
diff --git a/LICENSE.RFC4122 b/LICENSE.RFC4122
new file mode 100644 (file)
index 0000000..e0e32fa
--- /dev/null
@@ -0,0 +1,17 @@
+ Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc.
+ Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. &
+ Digital Equipment Corporation, Maynard, Mass.
+ Copyright (c) 1998 Microsoft.
+ To anyone who acknowledges that this file is provided "AS IS"
+ without any express or implied warranty: permission to use, copy,
+ modify, and distribute this file for any purpose is hereby
+ granted without fee, provided that the above copyright notices and
+ this notice appears in all source code copies, and that none of
+ the names of Open Software Foundation, Inc., Hewlett-Packard
+ Company, Microsoft, or Digital Equipment Corporation be used in
+ advertising or publicity pertaining to distribution of the software
+ without specific, written prior permission. Neither Open Software
+ Foundation, Inc., Hewlett-Packard Company, Microsoft, nor Digital
+ Equipment Corporation makes any representations about the
+ suitability of this software for any purpose.
+
diff --git a/NOTICE b/NOTICE
new file mode 100644 (file)
index 0000000..8d651da
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,14 @@
+Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+Except as noted, this software is licensed under Apache License, Version 2.
+Please, see the LICENSE.APLv2 file for Apache License terms and conditions.
+
+format_uuid_v3orv5() and uuid_create_sha1_from_name() functions are copyrighted
+by other copyright holder.
+
+Copyright   1990- 1993, 1996 Open Software Foundation, Inc.
+Copyright   1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass.
+Copyright   1998 Microsoft.
+
+format_uuid_v3orv5() and uuid_create_sha1_from_name() functions are licensed under 
+a separate license. Please, see the LICENSE.RFCXXXX file for terms and conditions 
+of the license.
diff --git a/capi-system-info.pc.in b/capi-system-info.pc.in
new file mode 100755 (executable)
index 0000000..d0610b9
--- /dev/null
@@ -0,0 +1,15 @@
+
+# Package Information for pkg-config
+
+prefix=@PREFIX@
+exec_prefix=/usr
+libdir=/usr/lib
+includedir=/usr/include/system
+
+Name: @PC_NAME@
+Description: @PACKAGE_DESCRIPTION@
+Version: @VERSION@
+Requires: @PC_REQUIRED@ 
+Libs: -L${libdir} @PC_LDFLAGS@
+Cflags: -I${includedir}
+
diff --git a/configuration/sys-info_.xml b/configuration/sys-info_.xml
new file mode 100644 (file)
index 0000000..b796dc6
--- /dev/null
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<sysinfo>
+  <key id="MANUFACTURER" string="samsung"/>
+  <key id="CP_Interface" string="svnet2"/>
+  <key id="Keyboad_type" string="NULL"/>
+  <key id="speech_recognition_support" string="TRUE"/>
+  <key id="sip_voip_support" string="TRUE"/>
+  <key id="tv_out_support" string="TRUE"/>
+  <key id="wifi_support" string="TRUE"/>
+  <key id="wifi_direct_support" string="TRUE"/>
+</sysinfo>
diff --git a/debian/README b/debian/README
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/debian/capi-system-info-dev.install b/debian/capi-system-info-dev.install
new file mode 100644 (file)
index 0000000..761a28b
--- /dev/null
@@ -0,0 +1,4 @@
+/usr/include/*
+/usr/include/*/*
+/usr/lib/pkgconfig/*.pc
+
diff --git a/debian/capi-system-info-dev.postinst b/debian/capi-system-info-dev.postinst
new file mode 100644 (file)
index 0000000..1a24852
--- /dev/null
@@ -0,0 +1 @@
+#!/bin/sh
diff --git a/debian/capi-system-info.install b/debian/capi-system-info.install
new file mode 100644 (file)
index 0000000..4a755a4
--- /dev/null
@@ -0,0 +1 @@
+/usr/lib/lib*.so*
diff --git a/debian/capi-system-info.postinst b/debian/capi-system-info.postinst
new file mode 100644 (file)
index 0000000..1a24852
--- /dev/null
@@ -0,0 +1 @@
+#!/bin/sh
diff --git a/debian/changelog b/debian/changelog
new file mode 100644 (file)
index 0000000..40c9522
--- /dev/null
@@ -0,0 +1,252 @@
+capi-system-info (0.1.6-1) unstable; urgency=low
+
+  * Support SYSTEM_INFO_KEY_MANUFACTURER, SYSTEM_INFO_KEY_CP_INTERFACE
+  * Git: /framework/api/system-info
+  * Tag: capi-system-info_0.1.6-1
+
+ -- Kwanwoo Nam <kw46.nam@samsung.com>  Thu, 15 Nov 2012 17:00:00 +0900
+
+capi-system-info (0.1.5-10) unstable; urgency=low
+
+  * Add make_info_file.sh
+  * Git: /framework/api/system-info
+  * Tag: capi-system-info_0.1.5-10
+
+ -- Kwanwoo Nam <kw46.nam@samsung.com>  Thu, 15 Nov 2012 17:00:00 +0900
+
+capi-system-info (0.1.5-9) unstable; urgency=low
+
+  * Fixed some prevent defect cases
+  * Git: /framework/api/system-info
+  * Tag: capi-system-info_0.1.5-9
+
+ -- Yang Yonghyun <alex.yang@samsung.com>  Fri, 26 Oct 2012 17:00:00 +0900
+
+capi-system-info (0.1.5-8) unstable; urgency=low
+
+  * Remove the dependent with capi-network-wifi & wifi-direct packages
+  * Git: /framework/api/system-info
+  * Tag: capi-system-info_0.1.5-8
+
+ -- Yang Yonghyun <alex.yang@samsung.com>  Wed, 24 Oct 2012 14:00:00 +0900
+
+capi-system-info (0.1.5-7) unstable; urgency=low
+
+  * Support SYSTEM_INFO_KEY_CORE_CPU_ARCH, SYSTEM_INFO_KEY_CORE_FPU_ARCH in Emulator Environment
+  * Git: /framework/api/system-info
+  * Tag: capi-system-info_0.1.5-7
+
+ -- Yang Yonghyun <alex.yang@samsung.com>  Wed, 17 Oct 2012 17:00:00 +0900
+
+capi-system-info (0.1.5-6) unstable; urgency=low
+
+  * Fixed prevent defect cases : CID 17696, 14717, 12322, 12323, 14713, 14716, 16983, 14714, 14715, 10432
+  * Git: /framework/api/system-info
+  * Tag: capi-system-info_0.1.5-6
+
+ -- Yang Yonghyun <alex.yang@samsung.com>  Mon, 15 Oct 2012 15:30:00 +0900
+
+capi-system-info (0.1.5-5) unstable; urgency=low
+
+  * Applying SMACK manifest
+  * Git: /framework/api/system-info
+  * Tag: capi-system-info_0.1.5-5
+
+ -- Yang Yonghyun <alex.yang@samsung.com>  Fri, 21 Sep 2012 09:30:00 +0900
+
+capi-system-info (0.1.5-4) unstable; urgency=low
+
+  * Bug Fix : Add XFree code after using Xmalloc pointer & fixed DPI calculation code
+  * Git: /framework/api/system-info
+  * Tag: capi-system-info_0.1.5-4
+
+ -- Yang Yonghyun <alex.yang@samsung.com>  Tue, 11 Sep 2012 15:00:00 +0900
+
+capi-system-info (0.1.5-3) unstable; urgency=low
+
+  * Bug Fix : Add null checking code when IMEI value is null
+  * Git: /framework/api/system-info
+  * Tag: capi-system-info_0.1.5-3
+
+ -- Yang Yonghyun <alex.yang@samsung.com>  Sat, 08 Sep 2012 19:30:00 +0900
+
+capi-system-info (0.1.5-2) unstable; urgency=low
+
+  * Remove usage of wifi_direct_deinitialize() function
+  * Git: /framework/api/system-info
+  * Tag: capi-system-info_0.1.5-2
+
+ -- Yang Yonghyun <alex.yang@samsung.com>  Wed, 05 Sep 2012 15:53:00 +0900
+
+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: 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
+
+capi-system-info (0.1.0-11) unstable; urgency=low
+
+  * Updated build configuration
+  * 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: 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
+
+capi-system-info (0.1.0-8) unstable; urgency=low
+
+  * Added version numbering
+  * 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
+
+capi-system-info (0.1.0-7) unstable; urgency=low
+
+  * Updated tizen version
+  * Git: slp/api/system-info
+  * Tag: capi-system-info_0.1.0-7
+
+ -- 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: 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
+
+  * 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
diff --git a/debian/compat b/debian/compat
new file mode 100644 (file)
index 0000000..7ed6ff8
--- /dev/null
@@ -0,0 +1 @@
+5
diff --git a/debian/control b/debian/control
new file mode 100755 (executable)
index 0000000..ee18cd0
--- /dev/null
@@ -0,0 +1,22 @@
+
+Source: capi-system-info
+Section: libs
+Priority: extra
+Maintainer: Woongsuk Cho <ws77.cho@samsung.com>, Kyuhun Jung <kyuhun.jung@samsung.com>
+Build-Depends: debhelper (>= 5), dlog-dev, capi-base-common-dev, libvconf-dev, iniparser-dev, libx11-dev, libslp-tapi-dev
+
+Package: capi-system-info
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: A System Information library in Tizen Native API
+
+Package: capi-system-info-dev
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, capi-system-info (= ${Source-Version}), capi-base-common-dev
+Description: A System Information library in Tizen Native API (DEV)
+
+Package: capi-system-info-dbg
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, capi-system-info (= ${Source-Version})
+Description: A System Information library in Tizen Native API (DBG)
+
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..7360e1d
--- /dev/null
@@ -0,0 +1,68 @@
+#!/usr/bin/make -f
+
+CFLAGS = -Wall -g
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+       CFLAGS += -O0
+else
+       CFLAGS += -O2
+endif
+CMAKE_ROOT_DIR ?= $(CURDIR)
+CMAKE_BUILD_DIR ?= $(CURDIR)/cmake_build_tmp
+
+FULLVER ?= $(shell dpkg-parsechangelog | grep Version: | cut -d ' ' -f 2 | cut -d '-' -f 1)
+MAJORVER ?= $(shell echo $(FULLVER) | cut -d '.' -f 1)
+
+configure: configure-stamp
+configure-stamp:
+       dh_testdir
+       mkdir -p $(CMAKE_BUILD_DIR) && cd $(CMAKE_BUILD_DIR) && cmake .. -DFULLVER=${FULLVER} -DMAJORVER=${MAJORVER}
+       touch configure-stamp
+
+
+build: build-stamp
+build-stamp: configure-stamp 
+       dh_testdir
+       cd $(CMAKE_BUILD_DIR) && $(MAKE)
+       touch $@
+
+clean:
+       cd $(CMAKE_ROOT_DIR)
+       dh_testdir
+       dh_testroot
+       rm -f build-stamp configure-stamp
+       rm -f `find . -name *.pc`
+       rm -rf $(CMAKE_BUILD_DIR)
+       dh_clean
+       
+install: build
+       dh_testdir
+       dh_testroot
+       dh_clean -k 
+       dh_installdirs
+
+       cd $(CMAKE_BUILD_DIR) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
+
+binary-indep: build install
+
+binary-arch: build install
+       dh_testdir
+       dh_testroot
+       dh_installchangelogs 
+       dh_installdocs
+       dh_installexamples
+       dh_install --sourcedir=debian/tmp
+       dh_installman
+       dh_link
+       dh_strip --dbg-package=capi-system-info-dbg
+       dh_fixperms
+       dh_makeshlibs
+       dh_installdeb
+       dh_shlibdeps
+       dh_gencontrol
+       dh_md5sums
+       dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
+
diff --git a/include/system_info.h b/include/system_info.h
new file mode 100755 (executable)
index 0000000..d335f17
--- /dev/null
@@ -0,0 +1,154 @@
+/*
+ * 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.
+ */
+
+
+#ifndef __TIZEN_SYSTEM_SYSTEM_INFO_H__
+#define __TIZEN_SYSTEM_SYSTEM_INFO_H__
+
+#include <tizen.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ * @addtogroup CAPI_SYSTEM_SYSTEM_INFO_MODULE
+ * @{
+ */
+
+/**
+ * @brief Enumeration of error code for system information
+ */
+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 */
+       SYSTEM_INFO_ERROR_IO_ERROR =  TIZEN_ERROR_IO_ERROR,     /**< An input/output error occurred when read value from system */
+} system_info_error_e;
+
+/**
+ * @brief Enumeration of key for system information
+ */
+typedef enum {
+       SYSTEM_INFO_KEY_MODEL, /**< The model of the device */
+       SYSTEM_INFO_KEY_TIZEN_VERSION, /**< The version of the Tizen API */
+       SYSTEM_INFO_KEY_CAMERA_COUNT, /**< The number of cameras in the device */
+       SYSTEM_INFO_KEY_KEYBOARD_TYPE, /**< The type of the keyboard */
+       SYSTEM_INFO_KEY_MULTI_POINT_TOUCH_COUNT, /**< The maximum number of concurrent touch points supported in the device */
+       SYSTEM_INFO_KEY_NETWORK_TYPE, /**< The supported network type */
+       SYSTEM_INFO_KEY_OPENGLES_VERSION, /**< The supported version of the OpenGL ES */
+       SYSTEM_INFO_KEY_SCREEN_BITS_PER_PIXEL, /**< The number of bits per pixel */
+       SYSTEM_INFO_KEY_SCREEN_HEIGHT, /**< The height of the screen in pixels */
+       SYSTEM_INFO_KEY_SCREEN_WIDTH, /**< The width of the screen in pixels */
+       SYSTEM_INFO_KEY_MOBILE_DEVICE_ID, /**< The unique ID to identify GSM, UMTS and CDMA mobile devices */
+       SYSTEM_INFO_KEY_CSC_SALES_CODE, /**< The sales code of CSC */
+       SYSTEM_INFO_KEY_PLATFORM_NAME, /**< The name of platform */
+       SYSTEM_INFO_KEY_TIZEN_VERSION_NAME, /**< The name of tizen version  */
+       SYSTEM_INFO_KEY_SCREEN_DPI, /**< The width of the screen DPI */
+       SYSTEM_INFO_KEY_DEVICE_UUID, /**< The Device unique ID to identify */
+       SYSTEM_INFO_KEY_CORE_CPU_ARCH, /**< The CORE CPU architecture of model */
+       SYSTEM_INFO_KEY_CORE_FPU_ARCH, /**< The CORE FPU architecture of model */
+       SYSTEM_INFO_KEY_OPENGLES_TEXTURE_FORMAT, /**< The supported texture format of the OpenGL ES */
+       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_BLUETOOTH_SUPPORTED, /**< Indicates whether the device supports Bluetooth */
+       SYSTEM_INFO_KEY_FMRADIO_SUPPORTED, /**< Indicates whether the device supports FM radio */
+       SYSTEM_INFO_KEY_GPS_SUPPORTED, /**< Indicates whether the device supports GPS */
+       SYSTEM_INFO_KEY_NFC_SUPPORTED, /**< Indicates whether the device supports NFC */
+       SYSTEM_INFO_KEY_TVOUT_SUPPORTED, /**< Indicates whether the device supports TV-out */
+       SYSTEM_INFO_KEY_WIFI_SUPPORTED, /**< Indicates whether the device supports Wi-Fi */
+       SYSTEM_INFO_KEY_HAPTIC_SUPPORTED, /**< Indicates whether the device supports Haptic */
+       SYSTEM_INFO_KEY_WIFI_DIRECT_SUPPORTED, /**< Indicates whether the device supports Wi-Fi Direct */
+       SYSTEM_INFO_KEY_CPS_SUPPORTED, /**< Indicates whether the device supports CPS */
+       SYSTEM_INFO_KEY_WPS_SUPPORTED, /**< Indicates whether the device supports WPS */
+       SYSTEM_INFO_KEY_USB_HOST_SUPPORTED, /**< Indicates whether the device supports USB host */
+       SYSTEM_INFO_KEY_USB_ACCESSORY_SUPPORTED, /**< Indicates whether the device supports USB accessory */
+       SYSTEM_INFO_KEY_FRONT_CAMERA_SUPPORTED, /**< Indicates whether the device supports front camera */
+       SYSTEM_INFO_KEY_FRONT_CAMERA_AF_SUPPORTED, /**< Indicates whether the device supports front camera auto focus */
+       SYSTEM_INFO_KEY_FRONT_CAMERA_FLASH_SUPPORTED, /**< Indicates whether the device supports front camera flash */
+       SYSTEM_INFO_KEY_BACK_CAMERA_SUPPORTED, /**< Indicates whether the device supports back camera */
+       SYSTEM_INFO_KEY_BACK_CAMERA_AF_SUPPORTED, /**< Indicates whether the device supports back camera auto focus */
+       SYSTEM_INFO_KEY_BACK_CAMERA_FLASH_SUPPORTED, /**< Indicates whether the device supports back camera flash */
+       SYSTEM_INFO_KEY_HDMI_SUPPORTED, /**< Indicates whether the device supports HDMI */
+       SYSTEM_INFO_KEY_RCA_SUPPORTED, /**< Indicates whether the device supports RCA */
+       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_MANUFACTURER, /**< The manufacturer of the device */
+       SYSTEM_INFO_KEY_CP_INTERFACE /**< The method of interface with CP */
+} system_info_key_e;
+
+/**
+ * @brief   Gets the integer value of the system information
+ * @param[in] key The name of the system information to get
+ * @param[out] value The value of the given system information
+ * @return  0 on success, otherwise a negative error value.
+ * @retval  #SYSTEM_INFO_ERROR_NONE Successful
+ * @retval  #SYSTEM_INFO_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval  #SYSTEM_INFO_ERROR_IO_ERROR An input/output error occurred when read value from system
+ */
+int system_info_get_value_int(system_info_key_e key, int *value);
+
+/**
+ * @brief   Gets the boolean value of the system information
+ * @param[in] key The name of the system information to get
+ * @param[out] value The value of the given system information
+ * @return  0 on success, otherwise a negative error value.
+ * @retval  #SYSTEM_INFO_ERROR_NONE Successful
+ * @retval  #SYSTEM_INFO_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval  #SYSTEM_INFO_ERROR_IO_ERROR An input/output error occurred when read value from system
+ */
+int system_info_get_value_bool(system_info_key_e key, bool *value);
+
+/**
+ * @brief   Gets the double value of the system information
+ * @param[in] key The name of the system information to get
+ * @param[out] value The value of the given system information
+ * @return  0 on success, otherwise a negative error value.
+ * @retval  #SYSTEM_INFO_ERROR_NONE Successful
+ * @retval  #SYSTEM_INFO_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval  #SYSTEM_INFO_ERROR_IO_ERROR An input/output error occurred when read value from system
+ */
+int system_info_get_value_double(system_info_key_e key, double *value);
+
+/**
+ * @brief   Gets the string value of the system information
+ * @remarks The @a value must be released with free() by you.
+ * @param[in] key The name of the system information to get
+ * @param[out] value The value of the given system information
+ * @return  0 on success, otherwise a negative error value.
+ * @retval  #SYSTEM_INFO_ERROR_NONE Successful
+ * @retval  #SYSTEM_INFO_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval  #SYSTEM_INFO_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval  #SYSTEM_INFO_ERROR_IO_ERROR An input/output error occurred when read value from system
+ */
+int system_info_get_value_string(system_info_key_e key, char **value);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIZEN_SYSTEM_SYSTEM_INFO_H__ */
diff --git a/include/system_info_private.h b/include/system_info_private.h
new file mode 100644 (file)
index 0000000..e10448d
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+ * 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.
+ */
+
+
+#ifndef __TIZEN_SYSTEM_SYSTEM_INFO_PRIVATE_H__
+#define __TIZEN_SYSTEM_SYSTEM_INFO_PRIVATE_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#define INFO_FILE_PATH "/etc/info.ini"
+#define OS_RELEASE_FILE_PATH "/etc/os-release"
+#define CPU_INFO_FILE_PATH "/proc/cpuinfo"
+#define CPU_INFO_MAX_FREQ_PATH "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq"
+#define CMDLINE_PATH "/proc/cmdline"
+#define XML_FILE_PATH "/usr/etc/sys-info.xml"
+#define MAXBUFSIZE 512
+
+typedef enum {
+       SYSTEM_INFO_DATA_TYPE_STRING,
+       SYSTEM_INFO_DATA_TYPE_INT,
+       SYSTEM_INFO_DATA_TYPE_DOUBLE,
+       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_manufacturer(system_info_key_e key, system_info_data_type_e data_type, void **value);
+int system_info_get_cp_interface(system_info_key_e key, system_info_data_type_e data_type, void **value);
+int system_info_get_build_string(system_info_key_e key, system_info_data_type_e data_type, void **value);
+int system_info_get_build_date(system_info_key_e key, system_info_data_type_e data_type, void **value);
+int system_info_get_build_time(system_info_key_e key, system_info_data_type_e data_type, void **value);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIZEN_SYSTEM_SYSTEM_INFO_PRIVATE_H__ */
diff --git a/packaging/capi-system-info.spec b/packaging/capi-system-info.spec
new file mode 100644 (file)
index 0000000..9682d1f
--- /dev/null
@@ -0,0 +1,85 @@
+#sbs-git:slp/api/system-info capi-system-info 0.1.0 63d15bafa590ee9de869c8a8ade712e06828e5c3
+Name:       capi-system-info
+Summary:    A System Information library in SLP C API
+Version: 0.1.7
+Release:    0
+Group:      System/Libraries
+License:    Apache License, Version 2.0 and IEFT RFC Collection
+Source0:    %{name}-%{version}.tar.gz
+BuildRequires:  cmake
+BuildRequires:  pkgconfig(dlog)
+BuildRequires:  pkgconfig(vconf)
+BuildRequires:  pkgconfig(capi-base-common)
+BuildRequires: pkgconfig(capi-media-sound-manager)
+BuildRequires:  pkgconfig(x11)
+BuildRequires:  pkgconfig(xi)
+BuildRequires: pkgconfig(xrandr)
+BuildRequires:  pkgconfig(tapi)
+BuildRequires: pkgconfig(haptic)
+BuildRequires: pkgconfig(xproto)
+BuildRequires: pkgconfig(openssl)
+BuildRequires: pkgconfig(nfc)
+BuildRequires: pkgconfig(location)
+BuildRequires: pkgconfig(bluetooth-api)
+BuildRequires: pkgconfig(mm-radio)
+BuildRequires: pkgconfig(sensor)
+BuildRequires: pkgconfig(gles11)
+BuildRequires:  pkgconfig(libxml-2.0)
+
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
+
+%description
+
+
+%package devel
+Summary:  A System Information library in SLP C API (Development)
+Group:    TO_BE/FILLED_IN
+Requires: %{name} = %{version}-%{release}
+
+%description devel
+
+
+
+%prep
+%setup -q
+
+
+%build
+MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
+cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
+
+
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+
+mkdir -p %{buildroot}/usr/share/license
+cp -f LICENSE.APLv2 %{buildroot}/usr/share/license/%{name}
+cat LICENSE.RFC4122 >> %{buildroot}/usr/share/license/%{name}
+
+mkdir -p %{buildroot}/etc
+cp -f script/make_info_file.sh %{buildroot}/etc/make_info_file.sh
+
+mkdir -p %{buildroot}/usr/etc
+cp -f configuration/sys-info_.xml %{buildroot}/usr/etc/sys-info.xml
+
+%make_install
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+
+%files
+%{_libdir}/libcapi-system-info.so.*
+/usr/share/license/%{name}
+%attr(0744,root,-) /etc/make_info_file.sh
+/usr/etc/sys-info.xml
+%manifest system-info.manifest
+
+%files devel
+%{_includedir}/system/system_info.h
+%{_libdir}/pkgconfig/*.pc
+%{_libdir}/libcapi-system-info.so
diff --git a/script/make_info_file.sh b/script/make_info_file.sh
new file mode 100644 (file)
index 0000000..11d1382
--- /dev/null
@@ -0,0 +1,20 @@
+#! /bin/bash
+# make_info_file.sh : make /etc/info.ini
+#
+
+if [ $# != 2 ]; then
+        echo "Usage : make_info_file.sh [model] [build] "
+        exit
+fi
+
+MODEL=$1
+BUILD=$2
+
+cat >/etc/info.ini <<EOF
+[Version]
+Model=$MODEL;
+Build=$BUILD;
+[Build]
+Date=`date +%Y.%m.%d`;
+Time=`date +%H:%M:%S`;
+EOF
diff --git a/src/system_info.c b/src/system_info.c
new file mode 100644 (file)
index 0000000..36c7f86
--- /dev/null
@@ -0,0 +1,529 @@
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <vconf.h>
+#include <dlog.h>
+
+#include <system_info.h>
+#include <system_info_private.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "CAPI_SYSTEM_INFO"
+
+#define SYSTEM_INFO_MAX -1
+
+typedef struct {
+       system_info_key_e key;
+       system_info_data_type_e data_type;
+       system_info_get_value_cb get_value_cb;
+} system_info_s;
+
+typedef system_info_s * system_info_h;
+
+system_info_s system_info_table[] = {
+
+{
+        /**< The model of the device */
+       SYSTEM_INFO_KEY_MODEL,
+       SYSTEM_INFO_DATA_TYPE_STRING,
+       system_info_get_model
+},
+
+{
+        /**< The version of the Tizen supported by the platform */
+       SYSTEM_INFO_KEY_TIZEN_VERSION,
+       SYSTEM_INFO_DATA_TYPE_STRING,
+       system_info_get_tizen_version
+},
+
+{
+       /**< Indicates whether the device supports Bluetooth */
+       SYSTEM_INFO_KEY_BLUETOOTH_SUPPORTED,
+       SYSTEM_INFO_DATA_TYPE_BOOL,
+       system_info_get_bluetooth_supported
+},
+
+{
+       /**< The number of cameras in the device */
+       SYSTEM_INFO_KEY_CAMERA_COUNT,
+       SYSTEM_INFO_DATA_TYPE_INT,
+       system_info_get_camera_count
+},
+
+{
+       /**< Indicates whether the device supports FM radio */
+       SYSTEM_INFO_KEY_FMRADIO_SUPPORTED,
+       SYSTEM_INFO_DATA_TYPE_BOOL,
+       system_info_get_fmradio_supported
+},
+
+{
+       /**< Indicates whether the device supports GPS */
+       SYSTEM_INFO_KEY_GPS_SUPPORTED,
+       SYSTEM_INFO_DATA_TYPE_BOOL,
+       system_info_get_gps_supported
+},
+
+{
+       /**< The type of the keyboard */
+       SYSTEM_INFO_KEY_KEYBOARD_TYPE,
+       SYSTEM_INFO_DATA_TYPE_STRING,
+       system_info_get_keyboard_type
+},
+
+{
+       /**< 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
+},
+
+{
+       /**< The supported network type */
+       SYSTEM_INFO_KEY_NETWORK_TYPE,
+       SYSTEM_INFO_DATA_TYPE_STRING,
+       system_info_get_network_type
+},
+
+{
+       /**< Indicates whether the device supports NFC */
+       SYSTEM_INFO_KEY_NFC_SUPPORTED,
+       SYSTEM_INFO_DATA_TYPE_BOOL,
+       system_info_get_nfc_supported
+},
+
+{
+       /**< The supported version of the OpenGL ES */
+       SYSTEM_INFO_KEY_OPENGLES_VERSION,
+       SYSTEM_INFO_DATA_TYPE_STRING,
+       system_info_get_opengles_version
+},
+
+{
+       /**< The number of bits per pixel */
+       SYSTEM_INFO_KEY_SCREEN_BITS_PER_PIXEL,
+       SYSTEM_INFO_DATA_TYPE_INT,
+       system_info_get_screen_bits_per_pixel
+},
+
+{
+       /**< The height of the screen in pixels */
+       SYSTEM_INFO_KEY_SCREEN_HEIGHT,
+       SYSTEM_INFO_DATA_TYPE_INT,
+       system_info_get_screen_height
+},
+
+{
+       /**< The width of the screen in pixels */
+       SYSTEM_INFO_KEY_SCREEN_WIDTH,
+       SYSTEM_INFO_DATA_TYPE_INT,
+       system_info_get_screen_width
+},
+
+{
+       /**< Indicates whether the device supports TV-out */
+       SYSTEM_INFO_KEY_TVOUT_SUPPORTED,
+       SYSTEM_INFO_DATA_TYPE_BOOL,
+       system_info_get_tvout_supported
+},
+
+{
+        /**< Indicates whether the device supports Wi-Fi */
+       SYSTEM_INFO_KEY_WIFI_SUPPORTED,
+       SYSTEM_INFO_DATA_TYPE_BOOL,
+       system_info_get_wifi_supported
+},
+
+{
+        /**< The unique ID to identify GSM, and UMTS mobile devices */
+       SYSTEM_INFO_KEY_MOBILE_DEVICE_ID,
+       SYSTEM_INFO_DATA_TYPE_STRING,
+       system_info_get_mobile_device_id
+},
+
+{
+       /**< The sales code of the CSC */
+       SYSTEM_INFO_KEY_CSC_SALES_CODE,
+       SYSTEM_INFO_DATA_TYPE_STRING,
+       system_info_get_csc_sales_code
+},
+
+{
+       /**< The Name of the Platform */
+       SYSTEM_INFO_KEY_PLATFORM_NAME,
+       SYSTEM_INFO_DATA_TYPE_STRING,
+       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
+},
+
+{
+       /**< The manufacturer of the device */
+       SYSTEM_INFO_KEY_MANUFACTURER,
+       SYSTEM_INFO_DATA_TYPE_STRING,
+       system_info_get_manufacturer
+},
+
+{
+       /**< The method of interface with CP */
+       SYSTEM_INFO_KEY_CP_INTERFACE,
+       SYSTEM_INFO_DATA_TYPE_STRING,
+       system_info_get_cp_interface
+},
+
+{
+       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("cannot execute uname command!!!");
+               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;
+
+       if (0 == system_info_get_system_info_initialized()) {
+               ret_val = system_info_init();
+               if (ret_val) {
+                       LOGE("system information initialize fail!!!");
+                       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;
+               }
+
+               index++;
+       }
+
+       return -1;
+}
+
+int system_info_get_value(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       system_info_h system_info;
+       system_info_get_value_cb system_info_getter;
+
+       if (value == NULL) {
+               LOGE("INVALID_PARAMETER(0x%08x) : invalid output param", SYSTEM_INFO_ERROR_INVALID_PARAMETER);
+               return SYSTEM_INFO_ERROR_INVALID_PARAMETER;
+       }
+
+       if (system_info_get(key, &system_info)) {
+               LOGE("INVALID_PARAMETER(0x%08x) : invalid key", SYSTEM_INFO_ERROR_INVALID_PARAMETER);
+               return SYSTEM_INFO_ERROR_INVALID_PARAMETER;
+       }
+
+       if (system_info->data_type != data_type) {
+               LOGE("INVALID_PARAMETER(0x%08x) : invalid data type", 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("IO_ERROR(0x%08x) : failed to call getter for the system information", SYSTEM_INFO_ERROR_IO_ERROR);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       return system_info_getter(key, system_info->data_type, value);
+}
+
+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);
+}
+
+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);
+}
+
+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);
+}
+
+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);
+}
diff --git a/src/system_info_device.c b/src/system_info_device.c
new file mode 100644 (file)
index 0000000..9b686e8
--- /dev/null
@@ -0,0 +1,1239 @@
+/*
+ * 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.
+ */
+
+/*
+** 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 <haptic.h>
+
+#include <X11/extensions/XI2.h>
+#include <X11/extensions/XI2proto.h>
+#include <X11/Xlib.h>
+#include <X11/Xatom.h>
+#include <X11/extensions/XInput2.h>
+
+#include <openssl/sha.h>
+#include <arpa/inet.h>
+
+#include <net_nfc.h>
+#include <net_nfc_typedef.h>
+
+#include <location.h>
+#include <location-types.h>
+
+#include <bluetooth-api.h>
+
+#include <mm_radio.h>
+#include <mm_types.h>
+
+#include <sound_manager.h>
+#include <sensor.h>
+
+#include <libxml/xmlmemory.h>
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+
+#define PROP_MULTITOUCH        "EvdevMultitouch MultiTouch"
+#define DEVICE_UUID_STRING_SIZE 37
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "CAPI_SYSTEM_INFO"
+
+#define CAM_INI_FILE_PATH "/usr/etc/mmfw_camcorder.ini"
+#define CAM_VIDEO_PRI_FILE_PATH "/usr/etc/mmfw_camcorder_dev_video_pri.ini"
+#define CAM_VIDEO_SEC_FILE_PATH "/usr/etc/mmfw_camcorder_dev_video_sec.ini"
+
+static char *FRONT_CAM_PATH;
+static char *BACK_CAM_PATH;
+
+typedef struct {
+       uint32_t  time_low;
+       uint16_t  time_mid;
+       uint16_t  time_hi_and_version;
+       uint8_t  clock_seq_hi_and_reserved;
+       uint8_t  clock_seq_low;
+       uint8_t node[6];
+} _UUID_OBJECT;
+
+/*
+    Tizen Default vender key = f7884739-3c9f-5f7c-af-e1-fc9f5da56003
+     This value should be modified by each venders.
+*/
+_UUID_OBJECT VenderKey = {0xf7884739, 0x3c9f, 0x5f7c, 0xaf, 0xe1, {0xfc, 0x9f, 0x5d, 0xa5, 0x60, 0x3} };
+/*
+    format_uuid_v3or5 -- make a UUID from a (pseudo)random 128-bit
+    number
+*/
+void format_uuid_v3or5(_UUID_OBJECT *uuid, unsigned char hash[16], int v)
+{
+       /* convert UUID to local byte order */
+       memcpy(uuid, hash, sizeof(*uuid));
+       uuid->time_low = ntohl(uuid->time_low);
+       uuid->time_mid = ntohs(uuid->time_mid);
+       uuid->time_hi_and_version = ntohs(uuid->time_hi_and_version);
+
+       /* put in the variant and version bits */
+       uuid->time_hi_and_version &= 0x0FFF;
+       uuid->time_hi_and_version |= (v << 12);
+       uuid->clock_seq_hi_and_reserved &= 0x3F;
+       uuid->clock_seq_hi_and_reserved |= 0x80;
+}
+
+void uuid_create_sha1_from_name(_UUID_OBJECT *uuid, _UUID_OBJECT nsid, void *name, int namelen)
+{
+       SHA_CTX c;
+       unsigned char hash[20];
+       _UUID_OBJECT net_nsid;
+
+       /* put name space ID in network byte order so it hashes the same
+          no matter what endian machine we're on */
+       net_nsid = nsid;
+       net_nsid.time_low = htonl(net_nsid.time_low);
+       net_nsid.time_mid = htons(net_nsid.time_mid);
+       net_nsid.time_hi_and_version = htons(net_nsid.time_hi_and_version);
+
+       SHA1_Init(&c);
+       SHA1_Update(&c, &net_nsid, sizeof(net_nsid));
+       SHA1_Update(&c, name, namelen);
+       SHA1_Final(hash, &c);
+
+       /* the hash is in network byte order at this point */
+       format_uuid_v3or5(uuid, hash, 5);
+}
+
+int uuid_object_to_string(_UUID_OBJECT uuid, char **device_uuid_string)
+{
+       *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("XInput Extension isn't supported.");
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       if (XIQueryVersion(disp, &major, &minor) == BadRequest) {
+               LOGE("Failed to query XI version.");
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       if (!(major >= XI_2_Major && minor >= XI_2_Minor)) {
+               LOGE("XI2 is not supported ! (major:%d, minor:%d)", major, minor);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+       return opcode;
+}
+
+int get_device_property_value(Display *disp, int deviceid, Atom prop)
+{
+       Atom act_type;
+       unsigned long nitems, bytes_after;
+       unsigned char *data;
+       int act_format, ret = -1;
+
+       if (XIGetProperty(disp, deviceid, prop, 0, 1000, False,
+                                                       XA_INTEGER, &act_type, &act_format,
+                                                       &nitems, &bytes_after, &data) != Success) {
+               LOGE("Failed to get XI2 device property !(deviceid=%d)", deviceid);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       if (!nitems)
+               goto out;
+
+       ret = (int)*data;
+
+out:
+       if (data)
+               XFree(data);
+
+       return ret;
+}
+
+int get_multitouch_max_count(Display *disp)
+{
+       int i;
+       int max_count;
+       int ndevices;
+       XIDeviceInfo *dev, *info = NULL;
+       Atom atomMultiTouch;
+       int xi_opcode = xinput_extension_init(disp);
+
+       if (0 >= xi_opcode) {
+               LOGE("Failed to initialize X Input Extension !");
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       atomMultiTouch = XInternAtom(disp, PROP_MULTITOUCH, True);
+
+       if (!atomMultiTouch) {
+               LOGE("Failed to make an atom for multitouch property !");
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       info = XIQueryDevice(disp, XIAllDevices, &ndevices);
+
+       if (!info) {
+               LOGE("Failed to query XI device.");
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       for (i = 0; i < ndevices ; i++) {
+               dev = &info[i];
+
+               switch (dev->use) {
+               case XISlavePointer:
+                       if (strcasestr(dev->name, "virtual") && !strcasestr(dev->name, "maru"))
+                               continue;
+                       if (strcasestr(dev->name, "extended"))
+                               continue;
+                       if (!strcasestr(dev->name, "touch"))
+                               continue;
+                       max_count = get_device_property_value(disp, dev->deviceid, atomMultiTouch);
+                       goto out;
+               }
+       }
+
+       XIFreeDeviceInfo(info);
+       return -1;
+
+out:
+       XIFreeDeviceInfo(info);
+       return max_count;
+}
+
+/**
+ * @brief Setting face direction path
+ *
+ */
+
+void set_camera_direction_path(void)
+{
+       char str[MAXBUFSIZE];
+       char tmpStr[MAXBUFSIZE];
+       int direction = -1;
+       FILE *info = NULL;
+
+       info = fopen(CAM_VIDEO_PRI_FILE_PATH, "r");
+
+       if (NULL != info) {
+               while (fgets(str, MAXBUFSIZE, info)) {
+                       if (!strncmp(";", str, strlen(";")))
+                               continue;
+                       else if (!strncmp("FacingDirection", str, strlen("FacingDirection"))) {
+                               sscanf(str, "%s = %d", tmpStr, &direction);
+                               if (direction == 1) {
+                                       FRONT_CAM_PATH = strdup(CAM_VIDEO_PRI_FILE_PATH);
+                                       BACK_CAM_PATH = strdup(CAM_VIDEO_SEC_FILE_PATH);
+                                       fclose(info);
+                                       return;
+                               }
+                       } else
+                               continue;
+               }
+
+               fclose(info);
+       }
+
+       /* default setting */
+       FRONT_CAM_PATH = strdup(CAM_VIDEO_SEC_FILE_PATH);
+       BACK_CAM_PATH = strdup(CAM_VIDEO_PRI_FILE_PATH);
+
+       return;
+}
+
+int system_info_get_bluetooth_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       bool *supported;
+
+       supported = (bool *)value;
+
+       if (bluetooth_is_supported())
+                       *supported = true;
+               else
+                       *supported = false;
+
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+int system_info_get_camera_count(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       int *count;
+       char str[MAXBUFSIZE];
+       char tmpStr[MAXBUFSIZE];
+       FILE *info = NULL;
+
+       count = (int *)value;
+       /* default camera count is 2*/
+       *count = 2;
+
+       info = fopen(CAM_INI_FILE_PATH, "r");
+       if (NULL == info) {
+               LOGE("cannot file open %s file!!!", CAM_INI_FILE_PATH);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       } else {
+               while (fgets(str, MAXBUFSIZE, info)) {
+                       if (!strncmp(";", str, strlen(";")))
+                               continue;
+                       else if (!strncmp("DeviceCount", str, strlen("DeviceCount"))) {
+                               sscanf(str, "%s = %d", tmpStr, count);
+                               break;
+                       } else
+                               continue;
+               }
+       }
+       fclose(info);
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+int system_info_get_fmradio_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       bool *supported;
+       MMHandleType hradio;
+
+       supported = (bool *)value;
+
+       memset(&hradio, 0x0, sizeof(MMHandleType));
+
+       if (mm_radio_create(&hradio) == MM_ERROR_NONE) {
+               if(mm_radio_realize(hradio) == MM_ERROR_NONE) {
+                       *supported = true;
+                       if (mm_radio_unrealize(hradio) == MM_ERROR_NONE) {
+                               if (mm_radio_destroy(hradio) == MM_ERROR_NONE)
+                                       return SYSTEM_INFO_ERROR_NONE;
+                               else {
+                                       LOGE("cannot destroy mm_radio handle!!!");
+                                       return SYSTEM_INFO_ERROR_IO_ERROR;
+                               }
+                       } else {
+                               LOGE("cannot unrealize mm_radio handle!!!");
+                               return SYSTEM_INFO_ERROR_IO_ERROR;
+                       }
+               } else {
+                       *supported = false;
+                       if (mm_radio_destroy(hradio) == MM_ERROR_NONE)
+                               return SYSTEM_INFO_ERROR_NONE;
+                       else {
+                               LOGE("cannot destroy mm_radio handle!!!");
+                               return SYSTEM_INFO_ERROR_IO_ERROR;
+                       }
+               }
+       } else {
+               *supported = false;
+               return SYSTEM_INFO_ERROR_NONE;
+       }
+}
+
+int system_info_get_gps_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       bool *supported;
+
+       supported = (bool *)value;
+
+       if (location_is_supported_method(LOCATION_METHOD_GPS))
+               *supported = true;
+       else
+               *supported = false;
+
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+int system_info_get_cps_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       bool *supported;
+
+       supported = (bool *)value;
+
+       if (location_is_supported_method(LOCATION_METHOD_CPS))
+               *supported = true;
+       else
+               *supported = false;
+
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+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;
+}
+
+int system_info_get_keyboard_type(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       xmlDocPtr doc = NULL;
+       xmlNodePtr cur = NULL;
+       xmlNode *cur_node = NULL;
+       char *id;
+       char *string;
+
+       doc = xmlParseFile(XML_FILE_PATH);
+
+       if (doc == NULL) {
+               LOGE("cannot file open %s file!!!", XML_FILE_PATH);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       cur = xmlDocGetRootElement(doc);
+       if (cur == NULL) {
+               LOGE("empty document %s file!!!", XML_FILE_PATH);
+               xmlFreeDoc(doc);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       if (xmlStrcmp(cur->name, (const xmlChar*)"sysinfo")) {
+               LOGE("document of the wrong type, root node != sysinfo");
+               xmlFreeDoc(doc);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       cur = cur->xmlChildrenNode;
+
+       for (cur_node = cur; cur_node; cur_node = cur_node->next) {
+               if (cur_node->type == XML_ELEMENT_NODE) {
+                       id = (char *)g_strdup((char*)xmlGetProp(cur_node, (const xmlChar*)"id"));
+                       string = (char *)g_strdup((char *) xmlGetProp(cur_node, (const xmlChar*)"string"));
+
+                       if (!strncmp(id, "Keyboad_type", strlen("Keyboad_type"))) {
+                               if (!strncmp(string, "NULL", strlen("NULL")))
+                                       *value = NULL;
+                               else
+                                       *value = string;
+                               break;
+                       }
+               }
+       }
+
+       xmlFreeDoc(doc);
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+int system_info_get_multi_point_touch_count(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       int *count;
+       Display *disp;
+
+       count = (int *)value;
+
+       disp = XOpenDisplay(NULL);
+
+       if (!disp) {
+               LOGE("Failed to open display!");
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       *count = get_multitouch_max_count(disp);
+
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+int system_info_get_nfc_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       bool *supported;
+       int nfc_supported = 0;
+
+       supported = (bool *)value;
+
+       if (NET_NFC_OK == net_nfc_is_supported(&nfc_supported))
+               *supported = true;
+       else
+               *supported = false;
+
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+int system_info_get_tvout_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       xmlDocPtr doc = NULL;
+       xmlNodePtr cur = NULL;
+       xmlNode *cur_node = NULL;
+       char *id;
+       char *string;
+       bool *supported;
+
+       supported = (bool *)value;
+
+       doc = xmlParseFile(XML_FILE_PATH);
+
+       if (doc == NULL) {
+               LOGE("cannot file open %s file!!!", XML_FILE_PATH);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       cur = xmlDocGetRootElement(doc);
+       if (cur == NULL) {
+               LOGE("empty document %s file!!!", XML_FILE_PATH);
+               xmlFreeDoc(doc);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       if (xmlStrcmp(cur->name, (const xmlChar*)"sysinfo")) {
+               LOGE("document of the wrong type, root node != sysinfo");
+               xmlFreeDoc(doc);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       cur = cur->xmlChildrenNode;
+
+       for (cur_node = cur; cur_node; cur_node = cur_node->next) {
+               if (cur_node->type == XML_ELEMENT_NODE) {
+                       id = (char *)g_strdup((char*)xmlGetProp(cur_node, (const xmlChar*)"id"));
+                       string = (char *)g_strdup((char *) xmlGetProp(cur_node, (const xmlChar*)"string"));
+
+                       if (!strncmp(id, "tv_out_support", strlen("tv_out_support"))) {
+                               if (!strncmp(string, "TRUE", strlen("TRUE")))
+                                       *supported = true;
+                               else
+                                       *supported = false;
+                               break;
+                       }
+               }
+       }
+
+       xmlFreeDoc(doc);
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+int system_info_get_wifi_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       xmlDocPtr doc = NULL;
+       xmlNodePtr cur = NULL;
+       xmlNode *cur_node = NULL;
+       char *id;
+       char *string;
+       bool *supported;
+
+       supported = (bool *)value;
+
+       if (system_info_get_system_info_model_type() == SYSTEM_INFO_MODEL_TYPE_EMULATOR) {
+       *supported = false;
+       return SYSTEM_INFO_ERROR_NONE;
+       }
+
+       doc = xmlParseFile(XML_FILE_PATH);
+
+       if (doc == NULL) {
+               LOGE("cannot file open %s file!!!", XML_FILE_PATH);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       cur = xmlDocGetRootElement(doc);
+       if (cur == NULL) {
+               LOGE("empty document %s file!!!", XML_FILE_PATH);
+               xmlFreeDoc(doc);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       if (xmlStrcmp(cur->name, (const xmlChar*)"sysinfo")) {
+               LOGE("document of the wrong type, root node != sysinfo");
+               xmlFreeDoc(doc);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       cur = cur->xmlChildrenNode;
+
+       for (cur_node = cur; cur_node; cur_node = cur_node->next) {
+               if (cur_node->type == XML_ELEMENT_NODE) {
+                       id = (char *)g_strdup((char*)xmlGetProp(cur_node, (const xmlChar*)"id"));
+                       string = (char *)g_strdup((char *) xmlGetProp(cur_node, (const xmlChar*)"string"));
+
+                       if (!strncmp(id, "wifi_support", strlen("wifi_support"))) {
+                               if (!strncmp(string, "TRUE", strlen("TRUE")))
+                                       *supported = true;
+                               else
+                                       *supported = false;
+                               break;
+                       }
+               }
+       }
+
+       xmlFreeDoc(doc);
+       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)
+{
+       xmlDocPtr doc = NULL;
+       xmlNodePtr cur = NULL;
+       xmlNode *cur_node = NULL;
+       char *id;
+       char *string;
+       bool *supported;
+
+       supported = (bool *)value;
+
+       if (system_info_get_system_info_model_type() == SYSTEM_INFO_MODEL_TYPE_EMULATOR) {
+               *supported = false;
+               return SYSTEM_INFO_ERROR_NONE;
+       }
+
+       doc = xmlParseFile(XML_FILE_PATH);
+
+       if (doc == NULL) {
+               LOGE("cannot file open %s file!!!", XML_FILE_PATH);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       cur = xmlDocGetRootElement(doc);
+       if (cur == NULL) {
+               LOGE("empty document %s file!!!", XML_FILE_PATH);
+               xmlFreeDoc(doc);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       if (xmlStrcmp(cur->name, (const xmlChar*)"sysinfo")) {
+               LOGE("document of the wrong type, root node != sysinfo");
+               xmlFreeDoc(doc);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       cur = cur->xmlChildrenNode;
+
+       for (cur_node = cur; cur_node; cur_node = cur_node->next) {
+               if (cur_node->type == XML_ELEMENT_NODE) {
+                       id = (char *)g_strdup((char*)xmlGetProp(cur_node, (const xmlChar*)"id"));
+                       string = (char *)g_strdup((char *) xmlGetProp(cur_node, (const xmlChar*)"string"));
+
+                       if (!strncmp(id, "wifi_direct_support", strlen("wifi_direct_support"))) {
+                               if (!strncmp(string, "TRUE", strlen("TRUE")))
+                                       *supported = true;
+                               else
+                                       *supported = false;
+                               break;
+                       }
+               }
+       }
+
+       xmlFreeDoc(doc);
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+int system_info_get_haptic_supproted(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       bool *supported;
+       int count;
+       int retVal;
+
+       supported = (bool *)value;
+
+       retVal = haptic_get_count(&count);
+       if (retVal < 0)
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+
+       if (count <= 0)
+               *supported = false;
+       else
+               *supported = true;
+
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+int system_info_get_csc_sales_code(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       char *CSC_SALES_CODE;
+
+       CSC_SALES_CODE = (char *)value;
+
+       if (system_info_vconf_get_value_string(VCONFKEY_CSC_SALESCODE, &CSC_SALES_CODE))
+                       return SYSTEM_INFO_ERROR_IO_ERROR;
+
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+int system_info_get_device_uuid(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       char *imei = NULL;
+       char *UUID;
+       _UUID_OBJECT device_uuid;
+       int retVal;
+
+       retVal = system_info_get_value_string(SYSTEM_INFO_KEY_MOBILE_DEVICE_ID, &imei);
+       if (SYSTEM_INFO_ERROR_NONE != retVal) {
+               LOGE("cannot get an IMEI value!!!");
+               return retVal;
+       }
+
+       if (imei) {
+               uuid_create_sha1_from_name(&device_uuid, VenderKey, imei, strlen(imei));
+
+               if (uuid_object_to_string(device_uuid, &UUID))
+                       return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
+
+               *value = UUID;
+
+               free(imei);
+               return SYSTEM_INFO_ERROR_NONE;
+       } else {
+               LOGE("imei is NULL!!!");
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+}
+
+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;
+
+       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("cannot file open %s file!!!", FRONT_CAM_PATH);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       } else {
+               while (fgets(str, MAXBUFSIZE, info)) {
+                       if (!strncmp(";", str, strlen(";")))
+                               continue;
+                       else if (!strncmp("FocusMode", str, strlen("FocusMode"))) {
+                               sscanf(str, "%s = %d,%d,%d,%d,%d,%d", tmpStr, &tmpInt[0], &tmpInt[1], &tmpInt[2], &tmpInt[3], &tmpInt[4], &tmpInt[5]);
+                               if (tmpInt[2] != -255 || tmpInt[4] != -255)
+                                       *supported = true;
+                               break;
+                       } else
+                               continue;
+               }
+       }
+
+       /* free used memory for camera direction */
+       free(FRONT_CAM_PATH);
+       free(BACK_CAM_PATH);
+
+       fclose(info);
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+int system_info_get_front_camera_flash_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       bool *supported;
+       char str[MAXBUFSIZE];
+       char tmpStr[MAXBUFSIZE];
+       int tmpInt[8];
+       int i = 0;
+       FILE *info = NULL;
+
+       supported = (bool *)value;
+       /* default value is false */
+       *supported = false;
+
+       /* setting camera direction */
+       set_camera_direction_path();
+
+       /* Return false, if there is no "/usr/etc/mmfw_camcorder_dev_video_sec.ini" file */
+       if (access(FRONT_CAM_PATH, R_OK))
+               return SYSTEM_INFO_ERROR_NONE;
+
+       info = fopen(FRONT_CAM_PATH, "r");
+       if (NULL == info) {
+               LOGE("cannot file open %s file!!!", FRONT_CAM_PATH);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       } else {
+               while (fgets(str, MAXBUFSIZE, info)) {
+                       if (!strncmp(";", str, strlen(";")))
+                               continue;
+                       else if (!strncmp("StrobeMode", str, strlen("StrobeMode"))) {
+                               sscanf(str, "%s = %d,%d,%d,%d,%d,%d,%d,%d", tmpStr, &tmpInt[0], &tmpInt[1], &tmpInt[2], &tmpInt[3], &tmpInt[4], &tmpInt[5], &tmpInt[6], &tmpInt[7]);
+                               for (i = 1; i < 8; i++) {
+                                       if (tmpInt[i] != -255)
+                                               *supported = true;
+                               }
+                               break;
+                       } else
+                               continue;
+               }
+       }
+
+       /* free used memory for camera direction */
+       free(FRONT_CAM_PATH);
+       free(BACK_CAM_PATH);
+
+       fclose(info);
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+int system_info_get_back_camera_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       bool *supported;
+
+       supported = (bool *)value;
+
+       /* setting camera direction */
+       set_camera_direction_path();
+
+       if (!access(BACK_CAM_PATH, R_OK))
+               *supported = true;
+       else
+               *supported = false;
+
+       /* free used memory for camera direction */
+       free(FRONT_CAM_PATH);
+       free(BACK_CAM_PATH);
+
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+int system_info_get_back_camera_af_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       bool *supported;
+       char str[MAXBUFSIZE];
+       char tmpStr[MAXBUFSIZE];
+       int tmpInt[6];
+       FILE *info = NULL;
+
+       supported = (bool *)value;
+       /* default value is false */
+       *supported = false;
+
+       /* setting camera direction */
+       set_camera_direction_path();
+
+       /* Return false, if there is no "/usr/etc/mmfw_camcorder_dev_video_pri.ini" file */
+       if (access(BACK_CAM_PATH, R_OK))
+               return SYSTEM_INFO_ERROR_NONE;
+
+       info = fopen(BACK_CAM_PATH, "r");
+       if (NULL == info) {
+               LOGE("cannot file open %s file!!!", BACK_CAM_PATH);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       } else {
+               while (fgets(str, MAXBUFSIZE, info)) {
+                       if (!strncmp(";", str, strlen(";")))
+                               continue;
+                       else if (!strncmp("FocusMode", str, strlen("FocusMode"))) {
+                               sscanf(str, "%s = %d,%d,%d,%d,%d,%d", tmpStr, &tmpInt[0], &tmpInt[1], &tmpInt[2], &tmpInt[3], &tmpInt[4], &tmpInt[5]);
+                               if (tmpInt[2] != -255 || tmpInt[4] != -255)
+                                       *supported = true;
+                               break;
+                       } else
+                               continue;
+               }
+       }
+
+       /* free used memory for camera direction */
+       free(FRONT_CAM_PATH);
+       free(BACK_CAM_PATH);
+
+       fclose(info);
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+int system_info_get_back_camera_flash_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       bool *supported;
+       char str[MAXBUFSIZE];
+       char tmpStr[MAXBUFSIZE];
+       int tmpInt[8];
+       int i = 0;
+       FILE *info = NULL;
+
+       supported = (bool *)value;
+       /* default value is false */
+       *supported = false;
+
+       /* setting camera direction */
+       set_camera_direction_path();
+
+       /* Return false, if there is no "/usr/etc/mmfw_camcorder_dev_video_pri.ini" file */
+       if (access(BACK_CAM_PATH, R_OK))
+               return SYSTEM_INFO_ERROR_NONE;
+
+       info = fopen(BACK_CAM_PATH, "r");
+       if (NULL == info) {
+               LOGE("cannot file open %s file!!!", BACK_CAM_PATH);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       } else {
+               while (fgets(str, MAXBUFSIZE, info)) {
+                       if (!strncmp(";", str, strlen(";")))
+                               continue;
+                       else if (!strncmp("StrobeMode", str, strlen("StrobeMode"))) {
+                               sscanf(str, "%s = %d,%d,%d,%d,%d,%d,%d,%d", tmpStr, &tmpInt[0], &tmpInt[1], &tmpInt[2], &tmpInt[3], &tmpInt[4], &tmpInt[5], &tmpInt[6], &tmpInt[7]);
+                               for (i = 1; i < 8; i++) {
+                                       if (tmpInt[i] != -255)
+                                               *supported = true;
+                               }
+                               break;
+                       } else
+                               continue;
+               }
+       }
+
+       /* free used memory for camera direction */
+       free(FRONT_CAM_PATH);
+       free(BACK_CAM_PATH);
+
+       fclose(info);
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+
+int system_info_get_sip_voip_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       xmlDocPtr doc = NULL;
+       xmlNodePtr cur = NULL;
+       xmlNode *cur_node = NULL;
+       char *id;
+       char *string;
+       bool *supported;
+
+       supported = (bool *)value;
+
+       doc = xmlParseFile(XML_FILE_PATH);
+
+       if (doc == NULL) {
+               LOGE("cannot file open %s file!!!", XML_FILE_PATH);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       cur = xmlDocGetRootElement(doc);
+       if (cur == NULL) {
+               LOGE("empty document %s file!!!", XML_FILE_PATH);
+               xmlFreeDoc(doc);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       if (xmlStrcmp(cur->name, (const xmlChar*)"sysinfo")) {
+               LOGE("document of the wrong type, root node != sysinfo");
+               xmlFreeDoc(doc);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       cur = cur->xmlChildrenNode;
+
+       for (cur_node = cur; cur_node; cur_node = cur_node->next) {
+               if (cur_node->type == XML_ELEMENT_NODE) {
+                       id = (char *)g_strdup((char*)xmlGetProp(cur_node, (const xmlChar*)"id"));
+                       string = (char *)g_strdup((char *) xmlGetProp(cur_node, (const xmlChar*)"string"));
+
+                       if (!strncmp(id, "sip_voip_support", strlen("sip_voip_support"))) {
+                               if (!strncmp(string, "TRUE", strlen("TRUE")))
+                                       *supported = true;
+                               else
+                                       *supported = false;
+                               break;
+                       }
+               }
+       }
+
+       xmlFreeDoc(doc);
+       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)
+{
+       xmlDocPtr doc = NULL;
+       xmlNodePtr cur = NULL;
+       xmlNode *cur_node = NULL;
+       char *id;
+       char *string;
+       bool *supported;
+
+       supported = (bool *)value;
+
+       doc = xmlParseFile(XML_FILE_PATH);
+
+       if (doc == NULL) {
+               LOGE("cannot file open %s file!!!", XML_FILE_PATH);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       cur = xmlDocGetRootElement(doc);
+       if (cur == NULL) {
+               LOGE("empty document %s file!!!", XML_FILE_PATH);
+               xmlFreeDoc(doc);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       if (xmlStrcmp(cur->name, (const xmlChar*)"sysinfo")) {
+               LOGE("document of the wrong type, root node != sysinfo");
+               xmlFreeDoc(doc);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       cur = cur->xmlChildrenNode;
+
+       for (cur_node = cur; cur_node; cur_node = cur_node->next) {
+               if (cur_node->type == XML_ELEMENT_NODE) {
+                       id = (char *)g_strdup((char*)xmlGetProp(cur_node, (const xmlChar*)"id"));
+                       string = (char *)g_strdup((char *) xmlGetProp(cur_node, (const xmlChar*)"string"));
+
+                       if (!strncmp(id, "speech_recognition_support", strlen("speech_recognition_support"))) {
+                               if (!strncmp(string, "TRUE", strlen("TRUE")))
+                                       *supported = true;
+                               else
+                                       *supported = false;
+                               break;
+                       }
+               }
+       }
+
+       xmlFreeDoc(doc);
+       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;
+}
+
+int system_info_get_manufacturer(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       xmlDocPtr doc = NULL;
+       xmlNodePtr cur = NULL;
+       xmlNode *cur_node = NULL;
+       char *id;
+       char *string;
+
+       doc = xmlParseFile(XML_FILE_PATH);
+
+       if (doc == NULL) {
+               LOGE("cannot file open %s file!!!", XML_FILE_PATH);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       cur = xmlDocGetRootElement(doc);
+       if (cur == NULL) {
+               LOGE("empty document %s file!!!", XML_FILE_PATH);
+               xmlFreeDoc(doc);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       if (xmlStrcmp(cur->name, (const xmlChar*)"sysinfo")) {
+               LOGE("document of the wrong type, root node != sysinfo");
+               xmlFreeDoc(doc);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       cur = cur->xmlChildrenNode;
+
+       for (cur_node = cur; cur_node; cur_node = cur_node->next) {
+               if (cur_node->type == XML_ELEMENT_NODE) {
+                       id = (char *)g_strdup((char*)xmlGetProp(cur_node, (const xmlChar*)"id"));
+                       string = (char *)g_strdup((char *) xmlGetProp(cur_node, (const xmlChar*)"string"));
+
+                       if (!strncmp(id, "MANUFACTURER", strlen("MANUFACTURER"))) {
+                               *value = string;
+                               break;
+                       }
+               }
+       }
+
+       xmlFreeDoc(doc);
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+int system_info_get_cp_interface(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       xmlDocPtr doc = NULL;
+       xmlNodePtr cur = NULL;
+       xmlNode *cur_node = NULL;
+       char *id;
+       char *string;
+
+       doc = xmlParseFile(XML_FILE_PATH);
+
+       if (doc == NULL) {
+               LOGE("cannot file open %s file!!!", XML_FILE_PATH);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       cur = xmlDocGetRootElement(doc);
+       if (cur == NULL) {
+               LOGE("empty document %s file!!!", XML_FILE_PATH);
+               xmlFreeDoc(doc);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       if (xmlStrcmp(cur->name, (const xmlChar*)"sysinfo")) {
+               LOGE("document of the wrong type, root node != sysinfo");
+               xmlFreeDoc(doc);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       cur = cur->xmlChildrenNode;
+
+       for (cur_node = cur; cur_node; cur_node = cur_node->next) {
+               if (cur_node->type == XML_ELEMENT_NODE) {
+                       id = (char *)g_strdup((char*)xmlGetProp(cur_node, (const xmlChar*)"id"));
+                       string = (char *)g_strdup((char *) xmlGetProp(cur_node, (const xmlChar*)"string"));
+
+                       if (!strncmp(id, "CP_Interface", strlen("CP_Interface"))) {
+                               *value = string;
+                               break;
+                       }
+               }
+       }
+
+       xmlFreeDoc(doc);
+       return SYSTEM_INFO_ERROR_NONE;
+}
diff --git a/src/system_info_network.c b/src/system_info_network.c
new file mode 100644 (file)
index 0000000..b548e27
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+ * 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 <tapi_common.h>
+#include <ITapiModem.h>
+
+#include <system_info.h>
+#include <system_info_private.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "CAPI_SYSTEM_INFO"
+
+int system_info_get_network_type(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       int service_type = 0;
+       char *NETWORK_TYPE = NULL;
+
+       if (system_info_vconf_get_value_int(VCONFKEY_TELEPHONY_SVCTYPE, &service_type))
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+
+       switch (service_type) {
+       case VCONFKEY_TELEPHONY_SVCTYPE_NONE:
+               NETWORK_TYPE = strdup("NoService");
+               break;
+       case VCONFKEY_TELEPHONY_SVCTYPE_NOSVC:
+               NETWORK_TYPE = strdup("NoService");
+               break;
+       case VCONFKEY_TELEPHONY_SVCTYPE_EMERGENCY:
+               NETWORK_TYPE = strdup("Emergency");
+               break;
+       case VCONFKEY_TELEPHONY_SVCTYPE_2G:
+               NETWORK_TYPE = strdup("GSM");
+               break;
+       case VCONFKEY_TELEPHONY_SVCTYPE_2_5G:
+               NETWORK_TYPE = strdup("GPRS");
+               break;
+       case VCONFKEY_TELEPHONY_SVCTYPE_2_5G_EDGE:
+               NETWORK_TYPE = strdup("EDGE");
+               break;
+       case VCONFKEY_TELEPHONY_SVCTYPE_3G:
+               NETWORK_TYPE = strdup("UMTS");
+               break;
+       case VCONFKEY_TELEPHONY_SVCTYPE_HSDPA:
+               NETWORK_TYPE = strdup("HSDPA");
+               break;
+       }
+
+       if (NETWORK_TYPE == NULL) {
+               LOGE("OUT_OF_MEMORY(0x%08x)", SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
+               return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
+       }
+
+       *value = NETWORK_TYPE;
+
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+int system_info_get_mobile_device_id(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       TapiHandle *handle = NULL;
+       char *imei = NULL;
+       char *MOBILE_DEVICE_ID = NULL;
+
+       handle = tel_init(0);
+
+       if (NULL == handle) {
+               LOGE("tel_init ERROR");
+               *value = NULL;
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       imei = tel_get_misc_me_imei_sync(handle);
+
+       if (imei == NULL) {
+               LOGE("IMEI value is NULL");
+               tel_deinit(handle);
+               *value = NULL;
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       MOBILE_DEVICE_ID = strdup((char *)imei);
+
+       if (MOBILE_DEVICE_ID == NULL) {
+               LOGE("OUT_OF_MEMORY(0x%08x)", SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
+               free(imei);
+               tel_deinit(handle);
+               *value = NULL;
+               return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
+       }
+
+       free(imei);
+       tel_deinit(handle);
+       *value = MOBILE_DEVICE_ID;
+       return SYSTEM_INFO_ERROR_NONE;
+}
diff --git a/src/system_info_platform.c b/src/system_info_platform.c
new file mode 100644 (file)
index 0000000..479ea07
--- /dev/null
@@ -0,0 +1,556 @@
+/*
+ * 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 <unistd.h>
+#include <string.h>
+#include <ctype.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include <dlog.h>
+#include <vconf.h>
+
+#include <system_info.h>
+#include <system_info_private.h>
+
+#include <GLES/gl.h>
+#include <GLES/glext.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "CAPI_SYSTEM_INFO"
+
+#define LIB_GLES_V1 "/usr/lib/libGLESv1_CM.so"
+#define LIB_GLES_V2 "/usr/lib/libGLESv2.so"
+
+#define SIZE_OF_MODEL_NAME 8
+
+int system_info_get_model(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       char *MODEL = NULL;
+       char *name = NULL;
+       char str[MAXBUFSIZE];
+       char tmpStr[MAXBUFSIZE];
+       int tmpStrlen = 0;
+       FILE *info;
+       extern char *strcasestr(const char *s, const char *find);
+
+       info = fopen(INFO_FILE_PATH, "r");
+       if (NULL == info) {
+               LOGE("cannot file open %s file!!!", INFO_FILE_PATH);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       } else {
+               while (fgets(str, MAXBUFSIZE, info)) {
+                       if (strcasestr(str, "Model")) {
+                               name = strchr(str, '=');
+                               name++;
+                               tmpStrlen = strlen(name);
+
+                               strncpy(tmpStr, name, tmpStrlen-2);
+                               tmpStr[tmpStrlen-2] = '\0';
+
+                               MODEL = strdup(tmpStr);
+                               if (MODEL == NULL) {
+                                       LOGE("OUT_OF_MEMORY(0x%08x)", SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
+                                       fclose(info);
+                                       return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
+                               }
+                               break;
+                       } else
+                               continue;
+               }
+       }
+       *value = MODEL;
+       fclose(info);
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+int system_info_get_tizen_version(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       char *TIZEN_VERSION = NULL;
+       char *name = NULL;
+       char str[MAXBUFSIZE];
+       char tmpStr[MAXBUFSIZE];
+       int tmpStrlen = 0;
+       FILE *info;
+       extern char *strcasestr(const char *s, const char *find);
+
+       info = fopen(OS_RELEASE_FILE_PATH, "r");
+       if (NULL == info) {
+               LOGE("cannot file open %s file!!!", OS_RELEASE_FILE_PATH);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       } else {
+               while (fgets(str, MAXBUFSIZE, info)) {
+                       if (strcasestr(str, "VERSION_ID")) {
+                               name = strchr(str, '=');
+                               name += 2;
+                               tmpStrlen = strlen(name);
+
+                               strncpy(tmpStr, name, tmpStrlen-2);
+                               tmpStr[tmpStrlen-2] = '\0';
+
+                               TIZEN_VERSION = strdup(tmpStr);
+                               if (TIZEN_VERSION == NULL) {
+                                       LOGE("OUT_OF_MEMORY(0x%08x)", SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
+                                       fclose(info);
+                                       return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
+                               }
+                               break;
+                       } else
+                               continue;
+               }
+       }
+       *value = TIZEN_VERSION;
+       fclose(info);
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+int system_info_get_platform_name(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       char *PLATFORM_NAME = NULL;
+       char *name = NULL;
+       char str[MAXBUFSIZE];
+       char tmpStr[MAXBUFSIZE];
+       int tmpStrlen = 0;
+       int i = 0;
+       FILE *info;
+       extern char *strcasestr(const char *s, const char *find);
+
+       info = fopen(OS_RELEASE_FILE_PATH, "r");
+       if (NULL == info) {
+               LOGE("cannot file open %s file!!!", OS_RELEASE_FILE_PATH);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       } else {
+               while (fgets(str, MAXBUFSIZE, info)) {
+                       if (strcasestr(str, "NAME")) {
+                               name = strchr(str, '=');
+                               name += 2;
+                               tmpStrlen = strlen(name);
+
+                               strncpy(tmpStr, name, tmpStrlen-2);
+                               tmpStr[tmpStrlen-2] = '\0';
+
+                               tmpStrlen = strlen(tmpStr);
+
+                               for (i = 0; i < tmpStrlen; i++)
+                                               tmpStr[i] = (char)toupper((int)tmpStr[i]);
+
+                               PLATFORM_NAME = strdup(tmpStr);
+                               if (PLATFORM_NAME == NULL) {
+                                       LOGE("OUT_OF_MEMORY(0x%08x)", SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
+                                       fclose(info);
+                                       return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
+                               }
+                               break;
+                       } else
+                               continue;
+               }
+       }
+       *value = PLATFORM_NAME;
+       fclose(info);
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+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];
+       char tmpStr[MAXBUFSIZE];
+       int tmpStrlen = 0;
+       FILE *info;
+       extern char *strcasestr(const char *s, const char *find);
+
+       info = fopen(OS_RELEASE_FILE_PATH, "r");
+       if (NULL == info) {
+               LOGE("cannot file open %s file!!!", OS_RELEASE_FILE_PATH);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       } else {
+               while (fgets(str, MAXBUFSIZE, info)) {
+                       if (strcasestr(str, "VERSION")) {
+                               name = strchr(str, ',');
+                               name += 2;
+                               tmpStrlen = strlen(name);
+
+                               strncpy(tmpStr, name, tmpStrlen-2);
+                               tmpStr[tmpStrlen-2] = '\0';
+
+                               TIZEN_VERSION_NAME = strdup(tmpStr);
+                               if (TIZEN_VERSION_NAME == NULL) {
+                                       LOGE("OUT_OF_MEMORY(0x%08x)", SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
+                                       fclose(info);
+                                       return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
+                               }
+                               break;
+                       } else
+                               continue;
+               }
+       }
+       *value = TIZEN_VERSION_NAME;
+       fclose(info);
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+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;
+
+       if (!access(LIB_GLES_V1, R_OK))
+               version_supported += 1;
+
+       if (!access(LIB_GLES_V2, R_OK))
+               version_supported += 2;
+
+       switch (version_supported) {
+       case 1:
+               version = "1.1";
+               break;
+
+       case 2:
+               version = "2.0";
+               break;
+
+       case 3:
+               version = "1.1/2.0";
+               break;
+       default:
+               version = NULL;
+               break;
+       }
+
+       if (version != NULL) {
+               OPENGLES_VERSION = strdup(version);
+
+               if (OPENGLES_VERSION == NULL) {
+                       LOGE("OUT_OF_MEMORY(0x%08x)", SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
+                       return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
+               }
+       }
+
+       *value = OPENGLES_VERSION;
+
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+int system_info_get_core_cpu_arch(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       FILE *cpuinfo = NULL;
+       char *CORE_CPU_ARCH = NULL;
+       char *name = NULL;
+       char str[MAXBUFSIZE] = "";
+       char tmpStr[MAXBUFSIZE] = "";
+
+       cpuinfo = fopen(CPU_INFO_FILE_PATH, "r");
+       if (NULL == cpuinfo) {
+               LOGE("cannot file open %s file!!!", CPU_INFO_FILE_PATH);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       } else {
+               while (fgets(str, MAXBUFSIZE, cpuinfo)) {
+                       if (!strncmp("Processor", str, strlen("Processor"))) {
+                               name = strchr(str, ':');
+                               if (!(strncmp("ARMv7", name+2, strlen("ARMv7")))) {
+                                       strncpy(tmpStr, name+2, strlen("ARMv7"));
+                                       tmpStr[strlen("ARMv7")] = '\0';
+                               } else if (!(strncmp("ARMv6", name+2, strlen("ARMv6")))) {
+                                       strncpy(tmpStr, name+2, strlen("ARMv6"));
+                                       tmpStr[strlen("ARMv6")] = '\0';
+                               } else if (!(strncmp("x86", name+2, strlen("x86")))) {
+                                       strncpy(tmpStr, name+2, strlen("x86"));
+                                       tmpStr[strlen("x86")] = '\0';
+                               }
+                       } else
+                               continue;
+               }
+
+               /* x86 emulator doesn't have "Processor" field in /proc/cpuinfo */
+               if (strlen(tmpStr) == 0 && system_info_get_system_info_model_type() == SYSTEM_INFO_MODEL_TYPE_EMULATOR) {
+                       strncpy(tmpStr, "x86", strlen("x86"));
+                       tmpStr[strlen("x86")] = '\0';
+               } else if (strlen(tmpStr) == 0) {
+                       strncpy(tmpStr, "Unkown", strlen("Unkown"));
+                       tmpStr[strlen("Unkown")] = '\0';
+               }
+
+               CORE_CPU_ARCH = strdup(tmpStr);
+
+               if (CORE_CPU_ARCH == NULL) {
+                       LOGE("OUT_OF_MEMORY(0x%08x)", SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
+                       fclose(cpuinfo);
+                       return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
+               }
+       }
+       fclose(cpuinfo);
+
+       *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 = NULL;
+       char *CORE_FPU_ARCH = NULL;
+       char *name = NULL;
+       char str[MAXBUFSIZE] = "";
+       char tmpStr[MAXBUFSIZE] = "";
+
+       cpuinfo = fopen(CPU_INFO_FILE_PATH, "r");
+       if (NULL == cpuinfo) {
+               LOGE("cannot file open %s file!!!", CPU_INFO_FILE_PATH);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       } else {
+               /* The target and the emulator uses the field "Features" and "flags" in /proc/cpuinfo */
+               if (system_info_get_system_info_model_type() != SYSTEM_INFO_MODEL_TYPE_EMULATOR)
+                       snprintf(tmpStr, strlen("Features"), "Features");
+               else
+                       snprintf(tmpStr, strlen("flags"), "flags");
+
+               while (fgets(str, MAXBUFSIZE, cpuinfo)) {
+                       if (!strncmp(tmpStr, str, strlen(tmpStr))) {
+                               name = strchr(str, ':');
+                               if (strstr(name+2, "vfpv3"))
+                                       CORE_FPU_ARCH = strdup("vfpv3");
+                               else if (strstr(name+2, "vfpv2"))
+                                       CORE_FPU_ARCH = strdup("vfpv2");
+                               else if (strstr(name+2, "ssse3"))
+                                       CORE_FPU_ARCH = strdup("ssse3");
+                               else if (strstr(name+2, "sse3"))
+                                       CORE_FPU_ARCH = strdup("sse3");
+                               else if (strstr(name+2, "sse2"))
+                                       CORE_FPU_ARCH = strdup("sse2");
+                               else if (strstr(name+2, "sse"))
+                                       CORE_FPU_ARCH = strdup("sse");
+                               else
+                                       CORE_FPU_ARCH = strdup("Unkown");
+
+                               if (CORE_FPU_ARCH == NULL) {
+                                       LOGE("OUT_OF_MEMORY(0x%08x)", SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
+                                       fclose(cpuinfo);
+                                       return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
+                               }
+
+                               break;
+                       } else
+                               continue;
+               }
+       }
+       fclose(cpuinfo);
+
+       *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 = 0.0;
+       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("cannot file open %s file!!!", 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;
+               }
+               fclose(cpuinfo_max_freq);
+       } else {
+               /* Emulator */
+               cpuinfo = fopen(CPU_INFO_FILE_PATH, "r");
+               if (NULL == cpuinfo) {
+                       LOGE("cannot file open %s file!!!", CPU_INFO_FILE_PATH);
+                       return SYSTEM_INFO_ERROR_IO_ERROR;
+               } else {
+                       while (fgets(str, MAXBUFSIZE, cpuinfo)) {
+                               if (!strncmp("cpu MHz", str, strlen("cpu MHz"))) {
+                                       name = strchr(str, ':');
+                                       max_freq = atof(name+2);
+                                       break;
+                               }
+                       }
+               }
+               fclose(cpuinfo);
+       }
+
+       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)
+{
+       char *OPENGLES_TEXTURE_FORMAT;
+       char textureformat[MAXBUFSIZE];
+
+       textureformat[0] = '\0';
+
+       if (!access(LIB_GLES_V2, R_OK)) {
+               strcat(textureformat, "utc ");
+       }
+       if (GL_OES_compressed_paletted_texture) {
+               strcat(textureformat, "| ptc ");
+       }
+       if (GL_OES_compressed_ETC1_RGB8_texture) {
+               strcat(textureformat, "| etc ");
+       }
+       if (GL_AMD_compressed_3DC_texture) {
+               strcat(textureformat, "| 3dc ");
+       }
+       if (GL_AMD_compressed_ATC_texture) {
+               strcat(textureformat, "| atc ");
+       }
+       if (GL_IMG_texture_compression_pvrtc) {
+               strcat(textureformat, "| pvrtc");
+       }
+
+       OPENGLES_TEXTURE_FORMAT = strdup(textureformat);
+
+       if (OPENGLES_TEXTURE_FORMAT == NULL) {
+               LOGE("OUT_OF_MEMORY(0x%08x)", SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
+               return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
+       }
+
+       *value = OPENGLES_TEXTURE_FORMAT;
+
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+int system_info_get_build_string(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       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("cannot file open %s file!!!", 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("OUT_OF_MEMORY(0x%08x)", SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
+                                       fclose(info);
+                                       return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
+                               }
+                               break;
+                       } else
+                               continue;
+               }
+       }
+       *value = BUILD_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("cannot file open %s file!!!", INFO_FILE_PATH);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       } else {
+               while (fgets(str, MAXBUFSIZE, info)) {
+                       if (!strncmp("Date", str, strlen("Date"))) {
+                               name = strchr(str, '=');
+                               name++;
+                               strncpy(tmpStr, name, strlen(name)-2);
+                               tmpStr[strlen(name)-2] = '\0';
+
+                               BUILD_DATE = strdup(tmpStr);
+                               if (BUILD_DATE == NULL) {
+                                       LOGE("OUT_OF_MEMORY(0x%08x)", SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
+                                       fclose(info);
+                                       return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
+                               }
+                               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("cannot file open %s file!!!", INFO_FILE_PATH);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       } else {
+               while (fgets(str, MAXBUFSIZE, info)) {
+                       if (!strncmp("Time", str, strlen("Time"))) {
+                               name = strchr(str, '=');
+                               name++;
+                               strncpy(tmpStr, name, strlen(name)-2);
+                               tmpStr[strlen(name)-2] = '\0';
+
+                               BUILD_TIME = strdup(tmpStr);
+                               if (BUILD_TIME == NULL) {
+                                       LOGE("OUT_OF_MEMORY(0x%08x)", SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
+                                       fclose(info);
+                                       return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
+                               }
+                               break;
+                       } else
+                               continue;
+               }
+       }
+       *value = BUILD_TIME;
+       fclose(info);
+       return SYSTEM_INFO_ERROR_NONE;
+}
diff --git a/src/system_info_screen.c b/src/system_info_screen.c
new file mode 100644 (file)
index 0000000..b5b6bb2
--- /dev/null
@@ -0,0 +1,332 @@
+/*
+ * 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 <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>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "CAPI_SYSTEM_INFO"
+
+typedef struct _progInfo ProgInfo;
+
+/* globals */
+ProgInfo g_pinfo;
+
+struct _progInfo {
+       Display *dpy;
+       Window root;
+       int screen;
+       int event_base, error_base;
+       int major, minor;
+       XRRScreenResources *res;
+};
+
+static int RCA_SUPPORTED;
+static int HDMI_SUPPORTED;
+static int SCREEN_DPI;
+static int BITS_PER_PIXEL;
+static int SCREEN_WIDTH;
+static int SCREEN_HEIGHT;
+static int PHYSICAL_SCREEN_WIDTH;
+static int PHYSICAL_SCREEN_HEIGHT;
+int system_info_screen_initialized;
+
+int system_info_screen_init()
+{
+       int i, n;
+       XPixmapFormatValues *pmf = NULL;
+
+       memset(&g_pinfo, 0x0, sizeof(ProgInfo));
+
+       g_pinfo.dpy = XOpenDisplay(NULL);
+       if (NULL == g_pinfo.dpy) {
+               LOGE("XOpenDisplay Failed");
+               return -1;
+       }
+
+       if (0 > g_pinfo.screen)
+               g_pinfo.screen = DefaultScreen(g_pinfo.dpy);
+       g_pinfo.root = RootWindow(g_pinfo.dpy, g_pinfo.screen);
+
+       if (!XRRQueryExtension(g_pinfo.dpy, &g_pinfo.event_base, &g_pinfo.error_base) ||
+               !XRRQueryVersion(g_pinfo.dpy, &g_pinfo.major, &g_pinfo.minor)) {
+               LOGE("XRRQuery Failed");
+               XCloseDisplay(g_pinfo.dpy);
+               return -1;
+       }
+
+       g_pinfo.res = XRRGetScreenResources(g_pinfo.dpy, g_pinfo.root);
+
+       if (!g_pinfo.res) {
+               LOGE("XRRGetScreenResources Failed");
+               XCloseDisplay(g_pinfo.dpy);
+               return -1;
+       }
+
+       pmf = XListPixmapFormats(g_pinfo.dpy, &n);
+
+       if (!pmf) {
+               LOGE("XListPixmapFormats Failed");
+               XCloseDisplay(g_pinfo.dpy);
+               return -1;
+       }
+
+       for (i = 0; i < n; i++) {
+               if (BITS_PER_PIXEL < pmf[i].bits_per_pixel)
+                       BITS_PER_PIXEL = pmf[i].bits_per_pixel;
+       }
+       XFree(pmf);
+       pmf = NULL;
+
+       for (i = 0; i < g_pinfo.res->noutput; i++) {
+               XRROutputInfo *output_info = XRRGetOutputInfo(g_pinfo.dpy, g_pinfo.res, g_pinfo.res->outputs[i]);
+               if (!output_info) {
+                       LOGE("XRRGetOutputInfo Failed");
+                       XCloseDisplay(g_pinfo.dpy);
+                       return -1;
+               }
+
+               /* find target lcd */
+               if (!strcmp(output_info->name, "LVDS1")) {
+                       /* XRRCrtcInfo information */
+                       XRRCrtcInfo *crtc_info = XRRGetCrtcInfo(g_pinfo.dpy, g_pinfo.res, output_info->crtc);
+                       if (!crtc_info)
+                               break;
+
+                       SCREEN_WIDTH = crtc_info->width;
+                       SCREEN_HEIGHT = crtc_info->height;
+                       PHYSICAL_SCREEN_WIDTH = output_info->mm_width;
+                       PHYSICAL_SCREEN_HEIGHT = output_info->mm_height;
+
+                       XRRFreeCrtcInfo(crtc_info);
+               } else if (!strcmp(output_info->name, "HDMI1"))
+                       HDMI_SUPPORTED = true;
+               XRRFreeOutputInfo(output_info);
+       }
+
+       if (BITS_PER_PIXEL == 0) {
+               LOGE("BIT PER PIXEL is Zero");
+               XCloseDisplay(g_pinfo.dpy);
+               return -1;
+       }
+
+       if (!SCREEN_WIDTH)
+               SCREEN_WIDTH = DisplayWidth(g_pinfo.dpy, DefaultScreen(g_pinfo.dpy));
+
+       if (!SCREEN_WIDTH) {
+               LOGE("SCREEN WIDTH is Zero");
+               XCloseDisplay(g_pinfo.dpy);
+               return -1;
+       }
+
+       if (!SCREEN_HEIGHT)
+               SCREEN_HEIGHT = DisplayHeight(g_pinfo.dpy, DefaultScreen(g_pinfo.dpy));
+
+       if (!SCREEN_HEIGHT) {
+               LOGE("SCREEN HEIGHT is Zero");
+               XCloseDisplay(g_pinfo.dpy);
+               return -1;
+       }
+
+       if (system_info_get_system_info_model_type() == SYSTEM_INFO_MODEL_TYPE_EMULATOR) {
+               FILE *cmdline;
+               char *dpi;
+               char str[MAXBUFSIZE];
+
+               cmdline = fopen(CMDLINE_PATH, "r");
+               if (NULL == cmdline) {
+                       LOGE("cannot file open %s file!!!", CPU_INFO_FILE_PATH);
+                       XCloseDisplay(g_pinfo.dpy);
+                       return SYSTEM_INFO_ERROR_IO_ERROR;
+               } else {
+                       while (fgets(str, MAXBUFSIZE, cmdline)) {
+                               dpi = strstr(str, "dpi=");
+                               SCREEN_DPI = atoi(dpi+4) / 10;
+                               break;
+                       }
+               }
+               fclose(cmdline);
+
+       } else {
+               double dp, di;
+
+               /* diagonal size(logical) by pixel */
+               dp = sqrt(SCREEN_WIDTH*SCREEN_WIDTH+SCREEN_HEIGHT*SCREEN_HEIGHT);
+               /* diagonal size(physical) by inch */
+               di = sqrt(PHYSICAL_SCREEN_WIDTH*PHYSICAL_SCREEN_WIDTH + PHYSICAL_SCREEN_HEIGHT*PHYSICAL_SCREEN_HEIGHT) / 10 / 2.54;
+               /* DPI = PPI */
+               SCREEN_DPI = round(dp/di);
+       }
+
+       XCloseDisplay(g_pinfo.dpy);
+
+       system_info_screen_initialized = 1;
+
+       return 0;
+}
+
+int system_info_get_screen_bits_per_pixel(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       int *bpp;
+       int ret_val;
+
+       bpp = (int *)value;
+
+       if (0 == system_info_screen_initialized) {
+               ret_val = system_info_screen_init();
+               if (ret_val)
+                       return ret_val;
+       }
+
+       *bpp = BITS_PER_PIXEL;
+
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+int system_info_get_screen_width(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       int *width;
+       int ret_val;
+
+       width = (int *)value;
+
+       if (0 == system_info_screen_initialized) {
+               ret_val = system_info_screen_init();
+               if (ret_val)
+                       return ret_val;
+       }
+
+       *width = SCREEN_WIDTH;
+
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+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;
+}
+
+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;
+
+       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 100644 (file)
index 0000000..264dabf
--- /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 "CAPI_SYSTEM_INFO"
+
+int system_info_vconf_get_value_int(const char *vconf_key, int *value)
+{
+       return vconf_get_int(vconf_key, value);
+}
+
+int system_info_vconf_get_value_bool(const char *vconf_key, bool *value)
+{
+       return vconf_get_bool(vconf_key, (int *)value);
+}
+
+int system_info_vconf_get_value_double(const char *vconf_key, double *value)
+{
+       return vconf_get_dbl(vconf_key, value);
+}
+
+int system_info_vconf_get_value_string(const char *vconf_key, char **value)
+{
+       char *str_value = NULL;
+
+       str_value = vconf_get_str(vconf_key);
+
+       if (str_value != NULL) {
+               *value = str_value;
+               return 0;
+       } else {
+               return -1;
+       }
+}
diff --git a/system-info.manifest b/system-info.manifest
new file mode 100644 (file)
index 0000000..97e8c31
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+       <request>
+               <domain name="_"/>
+       </request>
+</manifest>