Initialize Tizen 2.3 2.3a_release submit/tizen_2.3/20140531.063205
authorSehong Na <sehong.na@samsung.com>
Sat, 31 May 2014 03:34:04 +0000 (12:34 +0900)
committerSehong Na <sehong.na@samsung.com>
Sat, 31 May 2014 03:34:04 +0000 (12:34 +0900)
39 files changed:
AUTHORS [new file with mode: 0755]
CMakeLists.txt [new file with mode: 0644]
LICENSE.APLv2 [new file with mode: 0644]
NOTICE [new file with mode: 0644]
TC/_export_env.sh [new file with mode: 0755]
TC/_export_target_env.sh [new file with mode: 0755]
TC/build.sh [new file with mode: 0755]
TC/clean.sh [new file with mode: 0755]
TC/config [new file with mode: 0755]
TC/execute.sh [new file with mode: 0755]
TC/testcase/Makefile [new file with mode: 0755]
TC/testcase/tslist [new file with mode: 0755]
TC/testcase/utc_system_info.c [new file with mode: 0644]
TC/tet_scen [new file with mode: 0755]
TC/tetbuild.cfg [new file with mode: 0755]
TC/tetclean.cfg [new file with mode: 0755]
TC/tetexec.cfg [new file with mode: 0755]
capi-system-info.pc.in [new file with mode: 0755]
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: 0644]
include/system_info_doc.h [new file with mode: 0644]
include/system_info_private.h [new file with mode: 0644]
packaging/capi-system-info.manifest [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_hardware.c [new file with mode: 0644]
src/system_info_parse.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]

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 100644 (file)
index 0000000..e91bee4
--- /dev/null
@@ -0,0 +1,96 @@
+
+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 iniparser 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 -fvisibility=hidden")
+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 "-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 "*_doc.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/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/TC/_export_env.sh b/TC/_export_env.sh
new file mode 100755 (executable)
index 0000000..72a11ec
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+. ./config
+export TET_INSTALL_PATH=$TET_INSTALL_HOST_PATH # tetware root path
+export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target # tetware target path
+export PATH=$TET_TARGET_PATH/bin:$PATH
+export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
+export TET_ROOT=$TET_TARGET_PATH
diff --git a/TC/_export_target_env.sh b/TC/_export_target_env.sh
new file mode 100755 (executable)
index 0000000..5ddaa53
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh
+. ./config
+export TET_INSTALL_PATH=$TET_INSTALL_TARGET_PATH # path to path
+export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target
+export PATH=$TET_TARGET_PATH/bin:$PATH
+export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
+export TET_ROOT=$TET_TARGET_PATH
diff --git a/TC/build.sh b/TC/build.sh
new file mode 100755 (executable)
index 0000000..72aad6c
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+. ./_export_env.sh                              # setting environment variables
+
+export TET_SUITE_ROOT=`pwd`
+FILE_NAME_EXTENSION=`date +%s`
+
+RESULT_DIR=results
+HTML_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.html
+JOURNAL_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.journal
+
+mkdir -p $RESULT_DIR
+
+tcc -c -p ./
+tcc -b -j $JOURNAL_RESULT -p ./
+grw -c 7 -f chtml -o $HTML_RESULT $JOURNAL_RESULT
diff --git a/TC/clean.sh b/TC/clean.sh
new file mode 100755 (executable)
index 0000000..29743e0
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+. ./_export_env.sh                              # setting environment variables
+
+export TET_SUITE_ROOT=`pwd`
+RESULT_DIR=results
+
+tcc -c -p ./                                # executing tcc, with clean option (-c)
+rm -r $RESULT_DIR
+rm -r tet_tmp_dir
+rm testcase/tet_captured
diff --git a/TC/config b/TC/config
new file mode 100755 (executable)
index 0000000..bc02baf
--- /dev/null
+++ b/TC/config
@@ -0,0 +1,3 @@
+TET_INSTALL_HOST_PATH=/home/junghyuk/workspace/TETware
+TET_INSTALL_TARGET_PATH=/mnt/nfs/workspace/TETware
+
diff --git a/TC/execute.sh b/TC/execute.sh
new file mode 100755 (executable)
index 0000000..a4f6095
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+. ./_export_target_env.sh                    # setting environment variables
+
+export TET_SUITE_ROOT=`pwd`
+FILE_NAME_EXTENSION=`date +%s`
+
+RESULT_DIR=results
+HTML_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.html
+JOURNAL_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.journal
+
+mkdir -p $RESULT_DIR
+
+tcc -e -j $JOURNAL_RESULT -p ./
+grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT
diff --git a/TC/testcase/Makefile b/TC/testcase/Makefile
new file mode 100755 (executable)
index 0000000..ab8fa69
--- /dev/null
@@ -0,0 +1,26 @@
+CC = gcc
+
+C_FILES = $(shell ls *.c)
+
+PKGS = capi-system-info dlog glib-2.0
+
+LDFLAGS += $(TET_ROOT)/lib/tet3/tcm_s.o
+LDFLAGS += -L$(TET_ROOT)/lib/tet3 -ltcm_s
+LDFLAGS += -L$(TET_ROOT)/lib/tet3 -lapi_s
+LDFLAGS += `pkg-config --libs $(PKGS)`
+
+CFLAGS += `pkg-config --cflags $(PKGS)`
+CFLAGS += -I.
+CFLAGS += -I$(TET_ROOT)/inc/tet3
+CFLAGS += -Wall
+
+#TARGETS = $(C_FILES:%.c=tc-%)
+TCS := $(shell ls -1 *.c | cut -d. -f1)
+
+all: $(TCS)
+
+%: %.c
+       $(CC) -o $@ $< $(CFLAGS) $(LDFLAGS)
+
+clean:
+       rm -f $(TCS)
diff --git a/TC/testcase/tslist b/TC/testcase/tslist
new file mode 100755 (executable)
index 0000000..3083489
--- /dev/null
@@ -0,0 +1 @@
+/testcase/utc_system_info
diff --git a/TC/testcase/utc_system_info.c b/TC/testcase/utc_system_info.c
new file mode 100644 (file)
index 0000000..b69d51e
--- /dev/null
@@ -0,0 +1,588 @@
+/*
+ * 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 <tet_api.h>
+#include <system_info.h>
+
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+
+#define API_NAME_SYSINFO_ACCESSIBLE "system_info_type_accessible"
+#define API_NAME_SYSINFO_GOOD_VALUE "system_info_good_value"
+#define API_NAME_SYSINFO_SUPPORT_CHECK(key) "system_info_support_check_"#key
+
+/* this is the sting with 2^15 elements, really huge */
+#define HUGE_STRING_LEN 65536
+
+/****************************************************************/
+/* check if all defined types for results are accessible */
+static void utc_system_info_get_int_p(void);
+static void utc_system_info_get_int_n(void);
+static void utc_system_info_get_bool_p(void);
+static void utc_system_info_get_bool_n(void);
+static void utc_system_info_get_string_p(void);
+static void utc_system_info_get_string_n(void);
+static void utc_system_info_get_double_p(void);
+static void utc_system_info_get_double_n(void);
+static void utc_system_info_get_platform_bool(void);
+static void utc_system_info_get_platform_int(void);
+static void utc_system_info_get_platform_double(void);
+static void utc_system_info_get_platform_string(void);
+static void utc_system_info_get_custom_bool(void);
+static void utc_system_info_get_custom_int(void);
+static void utc_system_info_get_custom_double(void);
+static void utc_system_info_get_custom_string(void);
+static void utc_system_info_get_internal_value(void);
+
+/****************************************************************/
+/* check if all particular informations have reasonable values */
+static void utc_system_info_model_p(void);
+static void utc_system_info_tizen_ver_p(void);
+static void utc_system_info_h_res_p(void);
+static void utc_system_info_w_res_p(void);
+static void utc_system_info_platform_name_p(void);
+static void utc_system_info_platform_ver_p(void);
+static void utc_system_info_screen_DPI_p(void);
+static void utc_system_info_core_cpu_arch_p(void);
+static void utc_system_info_core_freq_p(void);
+static void utc_system_info_physical_screen_height_p(void);
+static void utc_system_info_physical_screen_width_p(void);
+static void utc_system_info_build_string_p(void);
+static void utc_system_info_build_date_p(void);
+static void utc_system_info_build_time_p(void);
+static void utc_system_info_manufacturer_p(void);
+static void utc_system_info_tethering_support_key_p(void);
+
+struct tet_testlist tet_testlist[] = {
+       {utc_system_info_get_int_p, 1},
+       {utc_system_info_get_int_n, 1},
+       {utc_system_info_get_bool_p, 1},
+       {utc_system_info_get_bool_n, 1},
+       {utc_system_info_get_string_p, 1},
+       {utc_system_info_get_string_n, 1},
+       {utc_system_info_get_double_p, 1},
+       {utc_system_info_get_double_n, 1},
+       {utc_system_info_model_p, 1},
+       {utc_system_info_tizen_ver_p, 1},
+       {utc_system_info_h_res_p, 1},
+       {utc_system_info_w_res_p, 1},
+       {utc_system_info_platform_name_p, 1},
+       {utc_system_info_platform_ver_p, 1},
+       {utc_system_info_screen_DPI_p, 1},
+       {utc_system_info_core_cpu_arch_p, 1},
+       {utc_system_info_core_freq_p, 1},
+       {utc_system_info_physical_screen_height_p, 1},
+       {utc_system_info_physical_screen_width_p, 1},
+       {utc_system_info_build_string_p, 1},
+       {utc_system_info_build_date_p, 1},
+       {utc_system_info_build_time_p, 1},
+       {utc_system_info_manufacturer_p, 1},
+       {utc_system_info_tethering_support_key_p, 1},
+       {utc_system_info_get_platform_bool, 1},
+       {utc_system_info_get_platform_int, 1},
+       {utc_system_info_get_platform_double, 1},
+       {utc_system_info_get_platform_string, 1},
+       {utc_system_info_get_custom_bool, 1},
+       {utc_system_info_get_custom_int, 1},
+       {utc_system_info_get_custom_double, 1},
+       {utc_system_info_get_custom_string, 1},
+       {utc_system_info_get_internal_value, 1},
+       {NULL, 0},
+};
+
+static void startup(void)
+{
+
+}
+
+static void cleanup(void)
+{
+       /* end of TC */
+}
+
+/****************************************************************/
+/* check if all defined types for results are accessible */
+static void utc_system_info_get_int_p(void)
+{
+       int value;
+
+       int retcode = system_info_get_value_int(SYSTEM_INFO_KEY_CAMERA_COUNT, &value);
+
+       if (retcode == SYSTEM_INFO_ERROR_NONE)
+               dts_pass(API_NAME_SYSINFO_ACCESSIBLE, "passed");
+       else
+               dts_fail(API_NAME_SYSINFO_ACCESSIBLE, "failed");
+}
+
+static void utc_system_info_get_int_n(void)
+{
+       int retcode = system_info_get_value_int(SYSTEM_INFO_KEY_CAMERA_COUNT, NULL);
+
+       if (retcode != SYSTEM_INFO_ERROR_NONE)
+               dts_pass(API_NAME_SYSINFO_ACCESSIBLE, "passed");
+       else
+               dts_fail(API_NAME_SYSINFO_ACCESSIBLE, "failed");
+}
+
+static void utc_system_info_get_bool_p(void)
+{
+       bool value;
+
+       int retcode = system_info_get_value_bool(SYSTEM_INFO_KEY_BLUETOOTH_SUPPORTED, &value);
+
+       if (retcode == SYSTEM_INFO_ERROR_NONE)
+               dts_pass(API_NAME_SYSINFO_ACCESSIBLE, "passed");
+       else
+               dts_fail(API_NAME_SYSINFO_ACCESSIBLE, "failed");
+}
+
+static void utc_system_info_get_bool_n(void)
+{
+       int retcode = system_info_get_value_bool(SYSTEM_INFO_KEY_BLUETOOTH_SUPPORTED, NULL);
+
+       if (retcode != SYSTEM_INFO_ERROR_NONE)
+               dts_pass(API_NAME_SYSINFO_ACCESSIBLE, "passed");
+       else
+               dts_fail(API_NAME_SYSINFO_ACCESSIBLE, "failed");
+}
+
+static void utc_system_info_get_string_p(void)
+{
+       char *value = NULL;
+
+       int retcode = system_info_get_value_string(SYSTEM_INFO_KEY_MODEL, &value);
+
+       if (value) {
+               free(value);
+       }
+
+       if (retcode == SYSTEM_INFO_ERROR_NONE)
+               dts_pass(API_NAME_SYSINFO_ACCESSIBLE, "passed");
+       else
+               dts_fail(API_NAME_SYSINFO_ACCESSIBLE, "failed");
+}
+
+static void utc_system_info_get_string_n(void)
+{
+       int retcode = system_info_get_value_string(SYSTEM_INFO_KEY_MODEL, NULL);
+
+       if (retcode != SYSTEM_INFO_ERROR_NONE)
+               dts_pass(API_NAME_SYSINFO_ACCESSIBLE, "passed");
+       else
+               dts_fail(API_NAME_SYSINFO_ACCESSIBLE, "failed");
+}
+
+
+static void utc_system_info_get_double_p(void)
+{
+       double value;
+
+       int retcode = system_info_get_value_double(SYSTEM_INFO_KEY_CORE_CPU_FREQ, &value);
+
+       if (retcode == SYSTEM_INFO_ERROR_NONE)
+               dts_pass(API_NAME_SYSINFO_ACCESSIBLE, "passed");
+       else
+               dts_fail(API_NAME_SYSINFO_ACCESSIBLE, "failed");
+}
+
+static void utc_system_info_get_double_n(void)
+{
+       int retcode = system_info_get_value_double(SYSTEM_INFO_KEY_CORE_CPU_FREQ, NULL);
+
+       if (retcode != SYSTEM_INFO_ERROR_NONE)
+               dts_pass(API_NAME_SYSINFO_ACCESSIBLE, "passed");
+       else
+               dts_fail(API_NAME_SYSINFO_ACCESSIBLE, "failed");
+}
+
+/****************************************************************/
+/* check if all particular informations have reasonable values */
+
+static void utc_system_info_model_p(void)
+{
+       char *string = NULL;
+       int string_len = 0;
+       int result = 0;
+
+       system_info_get_value_string(SYSTEM_INFO_KEY_MODEL, &string);
+
+       if (string) {
+               string_len = strlen(string);
+               free(string);
+       }
+
+       result = (string_len < HUGE_STRING_LEN)  &&  (string_len > 0);
+
+       dts_check_eq(API_NAME_SYSINFO_GOOD_VALUE, result, 1);
+}
+
+static void utc_system_info_tizen_ver_p(void)
+{
+       char *string = NULL;
+       int string_len = 0;
+       int result = 0;
+
+       system_info_get_value_string(SYSTEM_INFO_KEY_TIZEN_VERSION, &string);
+
+       if (string) {
+               string_len = strlen(string);
+               free(string);
+       }
+
+       result = (string_len < HUGE_STRING_LEN)  &&  (string_len > 0);
+
+       dts_check_eq(API_NAME_SYSINFO_GOOD_VALUE, result, 1);
+}
+
+static void utc_system_info_h_res_p(void)
+{
+       int h = -1;
+       int result = 0;
+
+       system_info_get_value_int(SYSTEM_INFO_KEY_SCREEN_HEIGHT, &h);
+
+       result = (h > 0)  &&  (h < 10000);
+
+       dts_check_eq(API_NAME_SYSINFO_GOOD_VALUE, result, 1);
+}
+
+static void utc_system_info_w_res_p(void)
+{
+       int w = -1;
+       int result = 0;
+
+       system_info_get_value_int(SYSTEM_INFO_KEY_SCREEN_WIDTH, &w);
+
+       result = (w > 0)  &&  (w < 10000);
+
+       dts_check_eq(API_NAME_SYSINFO_GOOD_VALUE, result, 1);
+}
+
+static void utc_system_info_platform_name_p(void)
+{
+       char *string = NULL;
+       int string_len = 0;
+       int result = 0;
+
+       system_info_get_value_string(SYSTEM_INFO_KEY_PLATFORM_NAME, &string);
+
+       if (string) {
+               string_len = strlen(string);
+               free(string);
+       }
+
+       result = (string_len < HUGE_STRING_LEN)  &&  (string_len > 0);
+
+       dts_check_eq(API_NAME_SYSINFO_GOOD_VALUE, result, 1);
+}
+
+static void utc_system_info_platform_ver_p(void)
+{
+       char *string = NULL;
+       int string_len = 0;
+       int result = 0;
+
+       system_info_get_value_string(SYSTEM_INFO_KEY_TIZEN_VERSION_NAME, &string);
+
+       if (string) {
+               string_len = strlen(string);
+               free(string);
+       }
+
+       result = (string_len < HUGE_STRING_LEN)  &&  (string_len > 0);
+
+       dts_check_eq(API_NAME_SYSINFO_GOOD_VALUE, result, 1);
+}
+
+static void utc_system_info_screen_DPI_p(void)
+{
+       int w = -1;
+       int result = 0;
+
+       system_info_get_value_int(SYSTEM_INFO_KEY_SCREEN_DPI, &w);
+
+       result = (w > 0)  &&  (w < 10000);
+
+       dts_check_eq(API_NAME_SYSINFO_GOOD_VALUE, result, 1);
+}
+
+static void utc_system_info_core_cpu_arch_p(void)
+{
+       char *string = NULL;
+
+       int result = system_info_get_value_string(SYSTEM_INFO_KEY_CORE_CPU_ARCH, &string);
+
+       if (string) {
+               free(string);
+       }
+
+       dts_check_eq(API_NAME_SYSINFO_GOOD_VALUE, result, 0);
+}
+
+static void utc_system_info_core_freq_p(void)
+{
+       double w = 0;
+       int result = 0;
+
+       system_info_get_value_double(SYSTEM_INFO_KEY_CORE_CPU_FREQ, &w);
+
+       result = (w > 0)  &&  (w < 10000);
+
+       dts_check_eq(API_NAME_SYSINFO_GOOD_VALUE, result, 1);
+}
+
+static void utc_system_info_physical_screen_height_p(void)
+{
+       int w = -1;
+       int result = 0;
+
+       system_info_get_value_int(SYSTEM_INFO_KEY_PHYSICAL_SCREEN_HEIGHT, &w);
+
+       result = (w > 0)  &&  (w < 10000);
+
+       dts_check_eq(API_NAME_SYSINFO_GOOD_VALUE, result, 1);
+}
+
+static void utc_system_info_physical_screen_width_p(void)
+{
+       int w = -1;
+       int result = 0;
+
+       system_info_get_value_int(SYSTEM_INFO_KEY_PHYSICAL_SCREEN_WIDTH, &w);
+
+       result = (w > 0)  &&  (w < 10000);
+
+       dts_check_eq(API_NAME_SYSINFO_GOOD_VALUE, result, 1);
+}
+
+static void utc_system_info_build_string_p(void)
+{
+       char *string = NULL;
+       int string_len = 0;
+       int result = 0;
+
+       system_info_get_value_string(SYSTEM_INFO_KEY_BUILD_STRING, &string);
+
+       if (string) {
+               string_len = strlen(string);
+               free(string);
+       }
+
+       result = (string_len < HUGE_STRING_LEN)  &&  (string_len > 0);
+
+       dts_check_eq(API_NAME_SYSINFO_GOOD_VALUE, result, 1);
+}
+
+static void utc_system_info_build_date_p(void)
+{
+       char *string = NULL;
+       int string_len = 0;
+       int result = 0;
+
+       system_info_get_value_string(SYSTEM_INFO_KEY_BUILD_DATE, &string);
+
+       if (string) {
+               string_len = strlen(string);
+               free(string);
+       }
+
+       result = (string_len < HUGE_STRING_LEN)  &&  (string_len > 0);
+
+       dts_check_eq(API_NAME_SYSINFO_GOOD_VALUE, result, 1);
+}
+
+static void utc_system_info_build_time_p(void)
+{
+       char *string = NULL;
+       int string_len = 0;
+       int result = 0;
+
+       system_info_get_value_string(SYSTEM_INFO_KEY_BUILD_TIME, &string);
+
+       if (string) {
+               string_len = strlen(string);
+               free(string);
+       }
+
+       result = (string_len < HUGE_STRING_LEN)  &&  (string_len > 0);
+
+       dts_check_eq(API_NAME_SYSINFO_GOOD_VALUE, result, 1);
+}
+
+static void utc_system_info_manufacturer_p(void)
+{
+       char *string = NULL;
+       int string_len = 0;
+       int result = 0;
+
+       system_info_get_value_string(SYSTEM_INFO_KEY_MANUFACTURER, &string);
+
+       if (string) {
+               string_len = strlen(string);
+               free(string);
+       }
+
+       result = (string_len < HUGE_STRING_LEN)  &&  (string_len > 0);
+
+       dts_check_eq(API_NAME_SYSINFO_GOOD_VALUE, result, 1);
+}
+
+static void utc_system_info_tethering_support_key_p(void)
+{
+       bool supported;
+       int retcode = -1;
+       int i;
+
+       retcode = system_info_get_value_bool(SYSTEM_INFO_KEY_TETHERING_SUPPORTED, &supported);
+
+       if (retcode == SYSTEM_INFO_ERROR_NONE)
+               dts_pass(API_NAME_SYSINFO_SUPPORT_CHECK(i), "passed");
+       else
+               dts_fail(API_NAME_SYSINFO_SUPPORT_CHECK(i), "failed");
+}
+
+static void utc_system_info_get_platform_bool(void)
+{
+       bool supported;
+       int retcode = -1;
+
+       retcode = system_info_get_platform_bool("tizen.org/feature/fmradio", &supported);
+
+       if (retcode == SYSTEM_INFO_ERROR_NONE)
+               dts_pass(API_NAME_SYSINFO_SUPPORT_CHECK(i), "passed");
+       else
+               dts_fail(API_NAME_SYSINFO_SUPPORT_CHECK(i), "failed");
+}
+
+static void utc_system_info_get_platform_int(void)
+{
+       int value = -1;
+       int result = 0;
+
+       system_info_get_value_int("tizen.org/feature/screen.bpp", &value);
+
+       result = (value > 0)  &&  (value < 10000);
+
+       dts_check_eq(API_NAME_SYSINFO_GOOD_VALUE, result, 1);
+}
+
+static void utc_system_info_get_platform_double(void)
+{
+       double value;
+       int retcode = -1;
+
+       retcode = system_info_get_platform_double("tizen.org/feature/double", &value);
+
+       if (retcode == SYSTEM_INFO_ERROR_IO_ERROR)
+               dts_pass(API_NAME_SYSINFO_SUPPORT_CHECK(i), "passed");
+       else
+               dts_fail(API_NAME_SYSINFO_SUPPORT_CHECK(i), "failed");
+}
+
+static void utc_system_info_get_platform_string(void)
+{
+       char *string = NULL;
+       int string_len = 0;
+       int result = 0;
+
+       system_info_get_platform_string("tizen.org/system/platform.name", &string);
+
+       if (string) {
+               string_len = strlen(string);
+               free(string);
+       }
+
+       result = (string_len < HUGE_STRING_LEN)  &&  (string_len > 0);
+
+       dts_check_eq(API_NAME_SYSINFO_GOOD_VALUE, result, 1);
+}
+
+static void utc_system_info_get_custom_bool(void)
+{
+       bool value;
+       int retcode = -1;
+
+       retcode = system_info_get_custom_bool("tizen.org/feature/double", &value);
+
+       if (retcode == SYSTEM_INFO_ERROR_IO_ERROR)
+               dts_pass(API_NAME_SYSINFO_SUPPORT_CHECK(i), "passed");
+       else
+               dts_fail(API_NAME_SYSINFO_SUPPORT_CHECK(i), "failed");
+}
+
+static void utc_system_info_get_custom_int(void)
+{
+       int value;
+       int retcode = -1;
+
+       retcode = system_info_get_custom_int("tizen.org/feature/double", &value);
+
+       if (retcode == SYSTEM_INFO_ERROR_IO_ERROR)
+               dts_pass(API_NAME_SYSINFO_SUPPORT_CHECK(i), "passed");
+       else
+               dts_fail(API_NAME_SYSINFO_SUPPORT_CHECK(i), "failed");
+}
+
+static void utc_system_info_get_custom_double(void)
+{
+       int value;
+       int retcode = -1;
+
+       retcode = system_info_get_custom_double("tizen.org/feature/double", &value);
+
+       if (retcode == SYSTEM_INFO_ERROR_IO_ERROR)
+               dts_pass(API_NAME_SYSINFO_SUPPORT_CHECK(i), "passed");
+       else
+               dts_fail(API_NAME_SYSINFO_SUPPORT_CHECK(i), "failed");
+}
+
+static void utc_system_info_get_custom_string(void)
+{
+       char *value = NULL;
+       int retcode = -1;
+
+       retcode = system_info_get_custom_string("tizen.org/feature/double", &value);
+
+       if (value)
+               free(value);
+
+       if (retcode == SYSTEM_INFO_ERROR_IO_ERROR)
+               dts_pass(API_NAME_SYSINFO_SUPPORT_CHECK(i), "passed");
+       else
+               dts_fail(API_NAME_SYSINFO_SUPPORT_CHECK(i), "failed");
+}
+
+static void utc_system_info_get_internal_value(void)
+{
+       char *value = NULL;
+       int retcode = -1;
+
+       retcode = system_info_get_internal_value("board.display.height_mm", &value);
+
+       if (value)
+               free(value);
+
+       if (retcode == SYSTEM_INFO_ERROR_NONE)
+               dts_pass(API_NAME_SYSINFO_SUPPORT_CHECK(i), "passed");
+       else
+               dts_fail(API_NAME_SYSINFO_SUPPORT_CHECK(i), "failed");
+}
\ No newline at end of file
diff --git a/TC/tet_scen b/TC/tet_scen
new file mode 100755 (executable)
index 0000000..03f029a
--- /dev/null
@@ -0,0 +1,7 @@
+all
+       ^TEST
+##### Scenarios for TEST #####
+
+# Test scenario
+TEST
+       :include:/testcase/tslist
diff --git a/TC/tetbuild.cfg b/TC/tetbuild.cfg
new file mode 100755 (executable)
index 0000000..f7eda55
--- /dev/null
@@ -0,0 +1,5 @@
+TET_OUTPUT_CAPTURE=True # capture option for build operation checking
+TET_BUILD_TOOL=make # build with using make command
+TET_BUILD_FILE=-f Makefile # execution file (Makefile) for build
+TET_API_COMPLIANT=True # use TET API in Test Case ?
+TET_PASS_TC_NAME=True # report passed TC name in Journal file?
diff --git a/TC/tetclean.cfg b/TC/tetclean.cfg
new file mode 100755 (executable)
index 0000000..02d7030
--- /dev/null
@@ -0,0 +1,5 @@
+TET_OUTPUT_CAPTURE=True # capture option
+TET_CLEAN_TOOL= make clean # clean tool
+TET_CLEAN_FILE= Makefile # file for clean
+TET_API_COMPLIANT=True # TET API useage 
+TET_PASS_TC_NAME=True # showing name , passed TC
diff --git a/TC/tetexec.cfg b/TC/tetexec.cfg
new file mode 100755 (executable)
index 0000000..ef3e452
--- /dev/null
@@ -0,0 +1,5 @@
+TET_OUTPUT_CAPTURE=True # capturing execution or not
+TET_EXEC_TOOL=  # ex) exec : execution tool set up/ Optional
+TET_EXEC_FILE=   # ex) exectool : execution file/ Optional
+TET_API_COMPLIANT=True # Test case or Tool usesTET API?
+TET_PASS_TC_NAME=True # showing Passed TC name ?
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/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 100644 (file)
index 0000000..c216e8a
--- /dev/null
@@ -0,0 +1,225 @@
+/*
+ * 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_PLATFORM_NAME, /**< The name of platform */
+       SYSTEM_INFO_KEY_TIZEN_VERSION_NAME, /**< The name of tizen version  */
+       SYSTEM_INFO_KEY_MANUFACTURER, /**< The manufacturer of the device */
+       SYSTEM_INFO_KEY_CORE_CPU_ARCH, /**< The CORE CPU architecture of model */
+       SYSTEM_INFO_KEY_CORE_CPU_FREQ, /**< The CORE CPU frequency of model */
+       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_SCREEN_HEIGHT, /**< The height of the screen in pixels */
+       SYSTEM_INFO_KEY_SCREEN_WIDTH, /**< The width of the screen in pixels */
+       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_TETHERING_SUPPORTED, /**< Indicates whether the device supports tethering */
+} 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 @c 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);
+
+/**
+ * @brief   Gets the boolean value of the platform feature
+ * @param[in] key The name of the platform feature to get
+ * @param[out] value The value of the given platform feature
+ * @return  0 on success, otherwise a negative error value.
+ * @retval  #SYSTEM_INFO_ERROR_NONE Successful
+ * @retval  #SYSTEM_INFO_ERROR_INVALID_PARAMETER cannot find key in model config file
+ * @retval  #SYSTEM_INFO_ERROR_IO_ERROR An input/output error occurred when read value from model config file
+ */
+int system_info_get_platform_bool(const char *key, bool *value);
+
+/**
+ * @brief   Gets the integer value of the platform feature
+ * @param[in] key The name of the platform feature to get
+ * @param[out] value The value of the given platform feature
+ * @return  0 on success, otherwise a negative error value.
+ * @retval  #SYSTEM_INFO_ERROR_NONE Successful
+ * @retval  #SYSTEM_INFO_ERROR_INVALID_PARAMETER cannot find key in model config file
+ * @retval  #SYSTEM_INFO_ERROR_IO_ERROR An input/output error occurred when read value from model config file
+ */
+int system_info_get_platform_int(const char *key, int *value);
+
+/**
+ * @brief   Gets the string value of the platform feature
+ * @param[in] key The name of the platform feature to get
+ * @param[out] value The value of the given platform feature
+ * @return  0 on success, otherwise a negative error value.
+ * @retval  #SYSTEM_INFO_ERROR_NONE Successful
+ * @retval  #SYSTEM_INFO_ERROR_INVALID_PARAMETER cannot find key in model config file
+ * @retval  #SYSTEM_INFO_ERROR_IO_ERROR An input/output error occurred when read value from model config file
+ */
+int system_info_get_platform_double(const char *key, double *value);
+
+/**
+ * @brief   Gets the string value of the platform feature
+ * @remarks The @a value must be released with @c free() by you.
+ * @param[in] key The name of the platform feature to get
+ * @param[out] value The value of the given platform feature
+ * @return  0 on success, otherwise a negative error value.
+ * @retval  #SYSTEM_INFO_ERROR_NONE Successful
+ * @retval  #SYSTEM_INFO_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval  #SYSTEM_INFO_ERROR_INVALID_PARAMETER cannot find key in model config file
+ * @retval  #SYSTEM_INFO_ERROR_IO_ERROR An input/output error occurred when read value from model config file
+ */
+int system_info_get_platform_string(const char *key, char **value);
+
+
+/**
+ * @brief   Gets the boolean value of the custom feature
+ * @param[in] key The name of the custom feature to get
+ * @param[out] value The value of the given custom feature
+ * @return  0 on success, otherwise a negative error value.
+ * @retval  #SYSTEM_INFO_ERROR_NONE Successful
+ * @retval  #SYSTEM_INFO_ERROR_INVALID_PARAMETER cannot find key in model config file
+ * @retval  #SYSTEM_INFO_ERROR_IO_ERROR An input/output error occurred when read value from model config file
+ */
+int system_info_get_custom_bool(const char *key, bool *value);
+
+/**
+ * @brief   Gets the string value of the custom feature
+ * @param[in] key The name of the custom feature to get
+ * @param[out] value The value of the given custom feature
+ * @return  0 on success, otherwise a negative error value.
+ * @retval  #SYSTEM_INFO_ERROR_NONE Successful
+ * @retval  #SYSTEM_INFO_ERROR_INVALID_PARAMETER cannot find key in model config file
+ * @retval  #SYSTEM_INFO_ERROR_IO_ERROR An input/output error occurred when read value from model config file
+ */
+int system_info_get_custom_int(const char *key, int *value);
+
+/**
+ * @brief   Gets the string value of the custom feature
+ * @param[in] key The name of the custom feature to get
+ * @param[out] value The value of the given custom feature
+ * @return  0 on success, otherwise a negative error value.
+ * @retval  #SYSTEM_INFO_ERROR_NONE Successful
+ * @retval  #SYSTEM_INFO_ERROR_INVALID_PARAMETER cannot find key in model config file
+ * @retval  #SYSTEM_INFO_ERROR_IO_ERROR An input/output error occurred when read value from model config file
+ */
+int system_info_get_custom_double(const char *key, double *value);
+
+/**
+ * @brief   Gets the string value of the custom feature
+ * @remarks The @a value must be released with @c free() by you.
+ * @param[in] key The name of the custom feature to get
+ * @param[out] value The value of the given custom feature
+ * @return  0 on success, otherwise a negative error value.
+ * @retval  #SYSTEM_INFO_ERROR_NONE Successful
+ * @retval  #SYSTEM_INFO_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval  #SYSTEM_INFO_ERROR_INVALID_PARAMETER cannot find key in model config file
+ * @retval  #SYSTEM_INFO_ERROR_IO_ERROR An input/output error occurred when read value from model config file
+ */
+int system_info_get_custom_string(const char *key, char **value);
+
+/**
+ * @brief   Gets the string value of the internal feature
+ * @remarks The @a value must be released with @c free() by you.
+ * @param[in] key The name of the internal feature to get
+ * @param[out] value The value of the given internal feature
+ * @return  0 on success, otherwise a negative error value.
+ * @retval  #SYSTEM_INFO_ERROR_NONE Successful
+ * @retval  #SYSTEM_INFO_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval  #SYSTEM_INFO_ERROR_INVALID_PARAMETER cannot find key in config files
+ * @retval  #SYSTEM_INFO_ERROR_IO_ERROR An input/output error occurred when read value from config files
+ */
+int system_info_get_internal_value(const char *key, char **value);
+
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIZEN_SYSTEM_SYSTEM_INFO_H__ */
diff --git a/include/system_info_doc.h b/include/system_info_doc.h
new file mode 100644 (file)
index 0000000..7bbb2e4
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * 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_DOC_H__
+#define __TIZEN_SYSTEM_SYSTEM_INFO_DOC_H__
+
+/**
+ * @defgroup CAPI_SYSTEM_SYSTEM_INFO_MODULE SYSTEM_INFO
+ * @brief  The System Information API provides functions to obtain information about devices.
+ * @ingroup CAPI_SYSTEM_SYSTEM_INFO
+ *
+ * @section CAPI_SYSTEM_SYSTEM_INFO_MODULE_HEADER Required Header
+ *   \#include <system_info.h>
+ *
+ * @section CAPI_SYSTEM_SYSTEM_INFO_MODULE_OVERVIEW Overview
+ * The System Information API provides functions to obtain information about the device such as the API and platform versions, device model, supported device features, and screen dimensions.
+ * The system information available is stored in key/value pairs, where there may be different data types for the value.
+ *
+ * To read a value, use the appropriate function, one of system_info_get_value_int(), system_info_get_value_bool(), system_info_get_value_double() or system_info_get_value_string().
+*
+*/
+
+#endif /* __TIZEN_SYSTEM_SYSTEM_INFO_DOC_H__ */
diff --git a/include/system_info_private.h b/include/system_info_private.h
new file mode 100644 (file)
index 0000000..901444d
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+ * 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
+
+#ifndef API
+#define API __attribute__ ((visibility("default")))
+#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 CONFIG_FILE_PATH "/etc/config/model-config.xml"
+#define MAXBUFSIZE 512
+
+#define PLATFORM_TAG   "platform"
+#define CUSTOM_TAG             "custom"
+#define INTERNAL_TAG   "internal"
+
+#define BOOL_TYPE      "bool"
+#define INT_TYPE       "int"
+#define DBL_TYPE       "double"
+#define STR_TYPE       "string"
+
+#define BOARD_CONFIG   "board"
+
+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);
+
+system_info_mode_type_e system_info_get_system_info_model_type(void);
+
+int system_info_ini_get_string(char *ini_file, char *key, char **output);
+int system_info_get_value_from_xml(char *xml_file_path, char *model, char *id_field, char **value);
+int system_info_get_value_from_config_xml(char *feature_tag, const char *name_field, char *type_field, char **value);
+
+int system_info_get_bsp_info(const char *key, char **value);
+
+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_cpu_freq(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_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_manufacturer(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);
+int system_info_get_tethering_supported(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.manifest b/packaging/capi-system-info.manifest
new file mode 100644 (file)
index 0000000..97e8c31
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+       <request>
+               <domain name="_"/>
+       </request>
+</manifest>
diff --git a/packaging/capi-system-info.spec b/packaging/capi-system-info.spec
new file mode 100644 (file)
index 0000000..24d70a4
--- /dev/null
@@ -0,0 +1,64 @@
+Name:          capi-system-info
+Summary:       A System Information library in Core API
+Version:       0.2.0
+Release:       0
+Group:         System/Libraries
+License:       Apache License, Version 2.0
+Source0:       %{name}-%{version}.tar.gz
+Source1001:    %{name}.manifest
+BuildRequires: cmake
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(capi-base-common)
+BuildRequires: pkgconfig(iniparser)
+BuildRequires:         pkgconfig(libxml-2.0)
+
+Requires(post):        /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
+
+%description
+
+
+%package devel
+Summary:  A System Information library in Core API (Development)
+Group:    Development/System
+Requires: %{name} = %{version}-%{release}
+
+%description devel
+
+
+%prep
+%setup -q
+cp %{SOURCE1001} .
+
+%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}
+
+%make_install
+mkdir -p %{buildroot}/usr/share/license
+cp -f LICENSE.APLv2 %{buildroot}/usr/share/license/%{name}
+
+mkdir -p %{buildroot}/etc
+cp -f script/make_info_file.sh %{buildroot}/etc/make_info_file.sh
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+
+%files
+%manifest %{name}.manifest
+/usr/share/license/%{name}
+%{_libdir}/libcapi-system-info.so.*
+%attr(0744,root,-) /etc/make_info_file.sh
+
+%files devel
+%manifest %{name}.manifest
+%{_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..9e739a9
--- /dev/null
@@ -0,0 +1,484 @@
+/*
+ * 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 <unistd.h>
+
+#include <dlog.h>
+
+#include <system_info.h>
+#include <system_info_private.h>
+#include <sys/utsname.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
+},
+
+{
+       /**< 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
+},
+
+{
+       /**< 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
+},
+
+{
+       /**< 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 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
+},
+
+{
+       /**< Indicates whether the device supports tethering */
+       SYSTEM_INFO_KEY_TETHERING_SUPPORTED,
+       SYSTEM_INFO_DATA_TYPE_BOOL,
+       system_info_get_tethering_supported
+},
+
+{
+       SYSTEM_INFO_MAX, -1, NULL
+}
+
+};
+
+static system_info_mode_type_e system_info_system_info_model_type;
+
+system_info_mode_type_e system_info_get_system_info_model_type(void)
+{
+       return system_info_system_info_model_type;
+}
+
+void __attribute__((constructor)) system_info_init(void)
+{
+       int ret;
+       char *str;
+
+       ret = system_info_get_platform_string("tizen.org/system/model_name", &str);
+
+       if (ret != SYSTEM_INFO_ERROR_NONE) {
+               LOGE("initialize error");
+               return;
+       }
+
+       if (!strcmp(str, "Emulator"))
+               system_info_system_info_model_type = SYSTEM_INFO_MODEL_TYPE_EMULATOR;
+       else
+               system_info_system_info_model_type = SYSTEM_INFO_MODEL_TYPE_TARGET;
+
+       free(str);
+}
+
+static int system_info_get(system_info_key_e key, system_info_h *system_info)
+{
+       int index = 0;
+
+       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);
+}
+
+API 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);
+}
+
+API 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);
+}
+
+API 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);
+}
+
+API int system_info_get_value_string(system_info_key_e key, char **value)
+{
+       return system_info_get_value(key, SYSTEM_INFO_DATA_TYPE_STRING, (void **)value);
+}
+
+API int system_info_get_platform_bool(const char *key, bool *value)
+{
+       int ret;
+       bool *supported;
+       char *string = NULL;
+
+       supported = (bool *)value;
+
+       if (access(CONFIG_FILE_PATH, R_OK)) {
+               LOGE("cannot find file %s!!!", CONFIG_FILE_PATH);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       ret = system_info_get_value_from_config_xml(PLATFORM_TAG, key, BOOL_TYPE, &string);
+       if (ret) {
+               LOGE("cannot get %s", key);
+               return ret;
+       }
+
+       if (!strcmp(string, "true") || !strcmp(string, "TRUE"))
+               *supported = true;
+       else
+               *supported = false;
+
+       free(string);
+
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+API int system_info_get_platform_int(const char *key, int *value)
+{
+       int ret;
+       int *ret_val;
+       char *string = NULL;
+
+       ret_val = (int *)value;
+
+       if (access(CONFIG_FILE_PATH, R_OK)) {
+               LOGE("cannot find file %s!!!", CONFIG_FILE_PATH);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       ret = system_info_get_value_from_config_xml(PLATFORM_TAG, key, INT_TYPE, &string);
+       if (ret) {
+               LOGE("cannot get %s", key);
+               return ret;
+       }
+
+       *ret_val = atoi(string);
+
+       free(string);
+
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+API int system_info_get_platform_double(const char *key, double *value)
+{
+       int ret;
+       double *ret_val;
+       char *string = NULL;
+
+       ret_val = (double *)value;
+
+       if (access(CONFIG_FILE_PATH, R_OK)) {
+               LOGE("cannot find file %s!!!", CONFIG_FILE_PATH);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       ret = system_info_get_value_from_config_xml(PLATFORM_TAG, key, DBL_TYPE, &string);
+       if (ret) {
+               LOGE("cannot get %s", key);
+               return ret;
+       }
+
+       *ret_val = atof(string);
+
+       free(string);
+
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+API int system_info_get_platform_string(const char *key, char **value)
+{
+       int ret;
+       char *string = NULL;
+
+       if (access(CONFIG_FILE_PATH, R_OK)) {
+               LOGE("cannot find file %s!!!", CONFIG_FILE_PATH);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       ret = system_info_get_value_from_config_xml(PLATFORM_TAG, key, STR_TYPE, &string);
+       if (ret) {
+               LOGE("cannot get %s", key);
+               return ret;
+       }
+
+       *value = string;
+
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+API int system_info_get_custom_bool(const char *key, bool *value)
+{
+       int ret;
+       bool *supported;
+       char *string = NULL;
+
+       supported = (bool *)value;
+
+       if (access(CONFIG_FILE_PATH, R_OK)) {
+               LOGE("cannot find file %s!!!", CONFIG_FILE_PATH);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       ret = system_info_get_value_from_config_xml(CUSTOM_TAG, key, BOOL_TYPE, &string);
+       if (ret) {
+               LOGI("cannot get %s", key);
+               *supported = false;
+               return SYSTEM_INFO_ERROR_NONE;
+       }
+
+       if (!strcmp(string, "true") || !strcmp(string, "TRUE"))
+               *supported = true;
+       else
+               *supported = false;
+
+       free(string);
+
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+API int system_info_get_custom_int(const char *key, int *value)
+{
+       int ret;
+       int *ret_val;
+       char *string = NULL;
+
+       ret_val = (int *)value;
+
+       if (access(CONFIG_FILE_PATH, R_OK)) {
+               LOGE("cannot find file %s!!!", CONFIG_FILE_PATH);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       ret = system_info_get_value_from_config_xml(CUSTOM_TAG, key, INT_TYPE, &string);
+       if (ret) {
+               LOGI("cannot get %s", key);
+               *ret_val = 0;
+               return SYSTEM_INFO_ERROR_NONE;
+       }
+
+       *ret_val = atoi(string);
+
+       free(string);
+
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+API int system_info_get_custom_double(const char *key, double *value)
+{
+       int ret;
+       double *ret_val;
+       char *string = NULL;
+
+       ret_val = (double *)value;
+
+       if (access(CONFIG_FILE_PATH, R_OK)) {
+               LOGE("cannot find file %s!!!", CONFIG_FILE_PATH);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       ret = system_info_get_value_from_config_xml(CUSTOM_TAG, key, DBL_TYPE, &string);
+       if (ret) {
+               LOGI("cannot get %s", key);
+               *ret_val = 0;
+               return SYSTEM_INFO_ERROR_NONE;
+       }
+
+       *ret_val = atof(string);
+
+       free(string);
+
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+API int system_info_get_custom_string(const char *key, char **value)
+{
+       int ret;
+       char *string = NULL;
+
+       if (access(CONFIG_FILE_PATH, R_OK)) {
+               LOGE("cannot find file %s!!!", CONFIG_FILE_PATH);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       ret = system_info_get_value_from_config_xml(CUSTOM_TAG, key, STR_TYPE, &string);
+       if (ret) {
+               LOGE("cannot get %s info from %s!!!", key, CONFIG_FILE_PATH);
+               return ret;
+       }
+
+       *value = string;
+
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+API int system_info_get_internal_value(const char *key, char **value)
+{
+       int ret, len;
+       char *string = NULL;
+
+       len = strlen(BOARD_CONFIG);
+
+       if (!strncmp(key, BOARD_CONFIG, len)) {
+               if (system_info_get_bsp_info(key, value) == SYSTEM_INFO_ERROR_NONE)
+                       return SYSTEM_INFO_ERROR_NONE;
+       }
+
+       if (access(CONFIG_FILE_PATH, R_OK)) {
+               LOGE("cannot find file %s!!!", CONFIG_FILE_PATH);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       ret = system_info_get_value_from_config_xml(INTERNAL_TAG, key, STR_TYPE, &string);
+       if (ret) {
+               LOGE("cannot get %s info from %s!!!", key, CONFIG_FILE_PATH);
+               return ret;
+       }
+
+       *value = string;
+
+       return SYSTEM_INFO_ERROR_NONE;
+}
diff --git a/src/system_info_device.c b/src/system_info_device.c
new file mode 100644 (file)
index 0000000..64655df
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * 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 <unistd.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 TETHERING_INFO_FILE_PATH "/etc/config/connectivity/sysinfo-tethering.xml"
+
+int system_info_get_manufacturer(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       char *manufacturer = NULL;
+
+       manufacturer = strdup("samsung");
+       if (manufacturer == NULL) {
+               LOGE("OUT_OF_MEMORY(0x%08x)", SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
+               return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
+       }
+
+       *value = manufacturer;
+
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+int system_info_get_tethering_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       bool *supported;
+       char *string = NULL;
+       char *model = "default";
+
+       supported = (bool *)value;
+
+       if (access(TETHERING_INFO_FILE_PATH, R_OK)) {
+                       *supported = false;
+                       return SYSTEM_INFO_ERROR_NONE;
+       }
+
+       if (system_info_get_value_from_xml(TETHERING_INFO_FILE_PATH, model, "tethering-support", &string)) {
+                       LOGE("cannot get tethering-support info from %s!!!", TETHERING_INFO_FILE_PATH);
+                       return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       if (!strcmp(string, "true") || !strcmp(string, "TRUE"))
+                       *supported = true;
+       else
+                       *supported = false;
+
+       free(string);
+
+       return SYSTEM_INFO_ERROR_NONE;
+}
diff --git a/src/system_info_hardware.c b/src/system_info_hardware.c
new file mode 100644 (file)
index 0000000..515217e
--- /dev/null
@@ -0,0 +1,131 @@
+/*
+ * 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 <stdint.h>
+#include <unistd.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_get_value_from_cpuinfo(char *field, char **value)
+{
+       int tmpStrlen = 0;
+       FILE *cpuinfo = 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;
+       }
+
+       while (fgets(str, MAXBUFSIZE, cpuinfo)) {
+               if (!strncmp(field, str, strlen(field))) {
+                       name = strchr(str, ':');
+                       tmpStrlen = strlen(name+2);
+                       strncpy(tmpStr, name+2, tmpStrlen);
+                       tmpStr[tmpStrlen-1] = '\0';
+                       *value = strdup(tmpStr);
+                       if (*value == NULL) {
+                               LOGE("OUT_OF_MEMORY(0x%08x)", SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
+                               fclose(cpuinfo);
+                               return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
+                       }
+               }
+       }
+
+       if (system_info_get_system_info_model_type() == SYSTEM_INFO_MODEL_TYPE_EMULATOR)
+               *value = strdup("default");
+
+       if (*value == NULL) {
+               LOGE("cannot get %s in cpuinfo", field);
+               fclose(cpuinfo);
+               return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
+       }
+
+       fclose(cpuinfo);
+
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+int system_info_get_bsp_info(const char *key, char **value)
+{
+       char *id_field;
+       char *string = NULL;
+       char *model = NULL;
+       char *revision = NULL;
+       char Rrevision[MAXBUFSIZE] = "";
+       char file_path[MAXBUFSIZE] = "";
+
+       if (system_info_get_system_info_model_type() == SYSTEM_INFO_MODEL_TYPE_EMULATOR) {
+               LOGE("cannot get Hardware info in emulator!!!");
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       if (system_info_get_value_from_cpuinfo("Hardware", &model)) {
+               LOGE("cannot get Hardware info from cpuinfo file!!!");
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       if (system_info_get_value_from_cpuinfo("Revision", &revision)) {
+               LOGE("cannot get Hardware info from cpuinfo file!!!");
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       if (!revision || !strcmp(revision, "default")) {
+               LOGE("cannot get revision info from cpuinfo file!!!");
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       snprintf(Rrevision, MAXBUFSIZE, "R%s", revision);
+       snprintf(file_path, MAXBUFSIZE, "/etc/config/board-config-%s.xml", model);
+
+       if (access(file_path, R_OK)) {
+               LOGE("cannot find file %s!!!", file_path);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       id_field = strdup(key);
+
+       if (system_info_get_value_from_xml(file_path, Rrevision, id_field, &string)) {
+               free(id_field);
+               free(model);
+               free(revision);
+               LOGE("cannot get aud_amrwb info from %s!!!", file_path);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       free(id_field);
+       free(model);
+       free(revision);
+
+       *value = string;
+
+       return SYSTEM_INFO_ERROR_NONE;
+}
diff --git a/src/system_info_parse.c b/src/system_info_parse.c
new file mode 100644 (file)
index 0000000..da38edb
--- /dev/null
@@ -0,0 +1,286 @@
+/*
+ * 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 <dlog.h>
+
+#include <system_info.h>
+#include <system_info_private.h>
+
+#include <iniparser.h>
+
+#include <libxml/xmlmemory.h>
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "CAPI_SYSTEM_INFO"
+
+#define MODEL_CONFIG_TAG "model-config"
+
+int system_info_ini_get_string(char *ini_file, char *key, char **output)
+{
+       dictionary      *ini;
+       char *str;
+       char *tmp;
+
+       ini = iniparser_load(ini_file);
+
+       if (ini == NULL) {
+               LOGE("cannot file open %s file!!!", ini_file);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       str = iniparser_getstr(ini, key);
+
+       if (str == NULL) {
+               LOGE("NOT found %s(0x%08x)", key, SYSTEM_INFO_ERROR_IO_ERROR);
+               iniparser_freedict(ini);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       tmp = strdup(str);
+
+       if (tmp == NULL) {
+               LOGE("OUT_OF_MEMORY(0x%08x)", SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
+               iniparser_freedict(ini);
+               return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
+       }
+
+       *output = tmp;
+       iniparser_freedict(ini);
+
+       return SYSTEM_INFO_ERROR_NONE;
+}
+
+int system_info_get_value_from_xml(char *xml_file_path, char *model, char *id_field, char **value)
+{
+       xmlDocPtr doc = NULL;
+       xmlNodePtr cur = NULL;
+       xmlNodePtr default_node = NULL;
+       xmlNodePtr model_node = NULL;
+       xmlNode *cur_node = NULL;
+       char *id = NULL;
+       char *string = NULL;
+
+       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;
+       }
+
+       for (cur_node = cur; cur_node; cur_node = cur_node->next) {
+               if (!xmlStrcmp(cur->name, (const xmlChar*)"sys-info"))
+                       break;
+       }
+
+       if (cur == NULL) {
+               LOGE("cannot find %s root element file!!!", "sys-info");
+               xmlFreeDoc(doc);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       cur = cur->xmlChildrenNode;
+
+       for (cur_node = cur; cur_node; cur_node = cur_node->next) {
+               if (!xmlStrcmp(cur_node->name, (const xmlChar*)"default"))
+                       default_node = cur_node;
+               if (strcmp(model, "default") && !xmlStrcmp(cur_node->name, (const xmlChar*)model))
+                       model_node = cur_node;
+       }
+
+       if (model_node) {
+               cur = model_node->xmlChildrenNode;
+
+               for (cur_node = cur; cur_node; cur_node = cur_node->next) {
+                       if (cur_node->type == XML_ELEMENT_NODE) {
+                               id = (char *)xmlGetProp(cur_node, (const xmlChar*)"id");
+                               string = (char *) xmlGetProp(cur_node, (const xmlChar*)"string");
+
+                               if (!strncmp(id, id_field, strlen(id))) {
+                                       if (!strncmp(id, id_field, strlen(id_field))) {
+                                               if (!string) {
+                                                       free(id);
+                                                       continue;
+                                               }
+
+                                               *value = strdup(string);
+                                               free(id);
+                                               free(string);
+                                               xmlFreeDoc(doc);
+                                               if (*value == NULL) {
+                                                               LOGE("OUT_OF_MEMORY(0x%08x)", SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
+                                                               xmlFreeDoc(doc);
+                                                               return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
+                                               }
+                                               return SYSTEM_INFO_ERROR_NONE;
+                                       }
+                               }
+                               free(id);
+                               free(string);
+                       }
+               }
+       }
+
+       if (*value == NULL && default_node) {
+               cur = default_node->xmlChildrenNode;
+
+               for (cur_node = cur; cur_node; cur_node = cur_node->next) {
+                       if (cur_node->type == XML_ELEMENT_NODE) {
+                               id = (char *)xmlGetProp(cur_node, (const xmlChar*)"id");
+                               string = (char *) xmlGetProp(cur_node, (const xmlChar*)"string");
+
+                               if (!strncmp(id, id_field, strlen(id))) {
+                                       if (!strncmp(id, id_field, strlen(id_field))) {
+                                               if (!string) {
+                                                       free(id);
+                                                       continue;
+                                               }
+
+                                               *value = strdup(string);
+                                               free(id);
+                                               free(string);
+                                               xmlFreeDoc(doc);
+                                               if (*value == NULL) {
+                                                               LOGE("OUT_OF_MEMORY(0x%08x)", SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
+                                                               xmlFreeDoc(doc);
+                                                               return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
+                                               }
+                                               return SYSTEM_INFO_ERROR_NONE;
+                                       }
+                               }
+                               free(id);
+                               free(string);
+                       }
+               }
+       }
+
+       LOGE("cannot find %s field from %s file!!!", id_field, xml_file_path);
+       xmlFreeDoc(doc);
+       return SYSTEM_INFO_ERROR_IO_ERROR;
+}
+
+int system_info_get_value_from_config_xml(char *feature_tag, const char *name_field, char *type_field, char **value)
+{
+       xmlDocPtr doc = NULL;
+       xmlNodePtr cur = NULL;
+       xmlNodePtr model_node = NULL;
+       xmlNode *cur_node = NULL;
+       char *name = NULL;
+       char *type = NULL;
+       char *string = NULL;
+
+       doc = xmlParseFile(CONFIG_FILE_PATH);
+
+       if (doc == NULL) {
+               LOGE("cannot file open %s file!!!", CONFIG_FILE_PATH);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       cur = xmlDocGetRootElement(doc);
+       if (cur == NULL) {
+               LOGE("empty document %s file!!!", CONFIG_FILE_PATH);
+               xmlFreeDoc(doc);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       for (cur_node = cur; cur_node; cur_node = cur_node->next) {
+               if (!xmlStrcmp(cur->name, (const xmlChar*)MODEL_CONFIG_TAG))
+                       break;
+       }
+
+       if (cur == NULL) {
+               LOGE("cannot find %s root element file!!!", MODEL_CONFIG_TAG);
+               xmlFreeDoc(doc);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       cur = cur->xmlChildrenNode;
+
+       for (cur_node = cur; cur_node; cur_node = cur_node->next) {
+               if (!xmlStrcmp(cur_node->name, (const xmlChar*)feature_tag))
+                       model_node = cur_node;
+       }
+
+       if (model_node == NULL) {
+               LOGE("cannot find %s field from %s file!!!", name_field, CONFIG_FILE_PATH);
+               xmlFreeDoc(doc);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       if (model_node) {
+               cur = model_node->xmlChildrenNode;
+
+               for (cur_node = cur; cur_node; cur_node = cur_node->next) {
+                       if (cur_node->type == XML_ELEMENT_NODE) {
+                               name = (char *)xmlGetProp(cur_node, (const xmlChar*)"name");
+                               type = (char *)xmlGetProp(cur_node, (const xmlChar*)"type");
+
+                               if (!strncmp(name, name_field, strlen(name))) {
+                                       if (!strncmp(name, name_field, strlen(name_field))) {
+                                               if (strncmp(type, type_field, strlen(type_field))) {
+                                                       LOGE("INVALID_PARAMETER(0x%08x) : invalid output param", SYSTEM_INFO_ERROR_INVALID_PARAMETER);
+                                                       free(name);
+                                                       free(type);
+                                                       xmlFreeDoc(doc);
+                                                       return SYSTEM_INFO_ERROR_INVALID_PARAMETER;
+                                               }
+                                               string = (char *)xmlNodeListGetString(doc, cur_node->xmlChildrenNode, 1);
+                                               if (string) {
+                                                       *value = strdup(string);
+                                                       free(name);
+                                                       free(type);
+                                                       free(string);
+                                                       break;
+                                               }
+                                       }
+                               }
+                               free(name);
+                               free(type);
+                       }
+               }
+       }
+
+       if (!cur_node) {
+               LOGE("cannot find %s field from %s file!!!", name_field, CONFIG_FILE_PATH);
+               xmlFreeDoc(doc);
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       if (*value == NULL) {
+               LOGE("OUT_OF_MEMORY(0x%08x)", SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
+               xmlFreeDoc(doc);
+               return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
+       }
+
+       xmlFreeDoc(doc);
+       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..537c8f1
--- /dev/null
@@ -0,0 +1,173 @@
+/*
+ * 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 <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_get_model(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       return system_info_ini_get_string(INFO_FILE_PATH, "version:model", (char **)value);
+}
+
+int system_info_get_build_string(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       return system_info_ini_get_string(INFO_FILE_PATH, "version:build", (char **)value);
+}
+
+int system_info_get_build_date(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       return system_info_ini_get_string(INFO_FILE_PATH, "build:date", (char **)value);
+}
+
+int system_info_get_build_time(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       return system_info_ini_get_string(INFO_FILE_PATH, "build:time", (char **)value);
+}
+
+int system_info_get_tizen_version(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       return system_info_get_platform_string("tizen.org/feature/platform.version", (char**)value);
+}
+
+int system_info_get_core_cpu_arch(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       bool cpu_arch;
+       char *CORE_CPU_ARCH = NULL;
+
+       if (system_info_get_platform_bool("tizen.org/feature/platform.core.cpu.arch.armv6", &cpu_arch) == SYSTEM_INFO_ERROR_NONE
+               && cpu_arch == true)
+               CORE_CPU_ARCH = strdup("armv6");
+       else if (system_info_get_platform_bool("tizen.org/feature/platform.core.cpu.arch.armv7", &cpu_arch) == SYSTEM_INFO_ERROR_NONE
+               && cpu_arch == true)
+               CORE_CPU_ARCH = strdup("armv7");
+       else if (system_info_get_platform_bool("tizen.org/feature/platform.core.cpu.arch.x86", &cpu_arch) == SYSTEM_INFO_ERROR_NONE
+               && cpu_arch == true)
+               CORE_CPU_ARCH = strdup("x86");
+
+       if (CORE_CPU_ARCH == NULL) {
+               LOGE("Unknown cpu");
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+       }
+
+       *value = CORE_CPU_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_platform_name(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       return system_info_get_platform_string("tizen.org/system/platform.name", (char**)value);
+}
+
+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;
+       }
+
+       while (fgets(str, MAXBUFSIZE, info)) {
+               if (strcasestr(str, "VERSION")) {
+                       name = strchr(str, ',');
+                       name += 2;
+                       tmpStrlen = strlen(name);
+
+                       strncpy(tmpStr, name, tmpStrlen-2);
+                       tmpStr[tmpStrlen-2] = '\0';
+
+                       TIZEN_VERSION_NAME = strdup(tmpStr);
+                       if (TIZEN_VERSION_NAME == NULL) {
+                               LOGE("OUT_OF_MEMORY(0x%08x)", SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
+                               fclose(info);
+                               return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
+                       }
+                       break;
+               }
+       }
+
+       *value = TIZEN_VERSION_NAME;
+       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..946e993
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * 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 <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_get_screen_width(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       return system_info_get_platform_int("tizen.org/feature/screen.width", (int *)value);
+}
+
+int system_info_get_screen_height(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       return system_info_get_platform_int("tizen.org/feature/screen.height", (int *)value);
+}
+
+int system_info_get_physical_screen_height(system_info_key_e key, system_info_data_type_e data_type, void **value)
+{
+       int *height;
+       char *str;
+
+       height = (int *)value;
+
+       if (system_info_get_bsp_info("board.display.height_mm", &str))
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+
+       *height = atoi(str);
+
+       free(str);
+
+       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 *width;
+       char *str;
+
+       width = (int *)value;
+
+       if (system_info_get_bsp_info("board.display.width_mm", &str))
+               return SYSTEM_INFO_ERROR_IO_ERROR;
+
+       *width = atoi(str);
+
+       free(str);
+
+       return SYSTEM_INFO_ERROR_NONE;
+}