system-info: Merge Tizen 2.3 source code into tizen branch
[platform/core/api/system-info.git] / include / system_info_private.h
1 /*
2  * Copyright (c) 2011 - 2015 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17
18 #ifndef __TIZEN_SYSTEM_SYSTEM_INFO_PRIVATE_H__
19 #define __TIZEN_SYSTEM_SYSTEM_INFO_PRIVATE_H__
20
21 #ifdef __cplusplus
22 extern "C"
23 {
24 #endif
25
26 #ifndef API
27 #define API __attribute__ ((visibility("default")))
28 #endif
29
30 #define INFO_FILE_PATH "/etc/info.ini"
31 #define OS_RELEASE_FILE_PATH "/etc/os-release"
32 #define CPU_INFO_FILE_PATH "/proc/cpuinfo"
33 #define CPU_INFO_MAX_FREQ_PATH "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq"
34 #define CONFIG_FILE_PATH "/etc/config/model-config.xml"
35 #define SERIAL_PATH "/csa/imei/serialno.dat"
36 #define MAXBUFSIZE 512
37
38 #define PLATFORM_TAG    "platform"
39 #define CUSTOM_TAG              "custom"
40 #define INTERNAL_TAG    "internal"
41
42 #define BOOL_TYPE       "bool"
43 #define INT_TYPE        "int"
44 #define DBL_TYPE        "double"
45 #define STR_TYPE        "string"
46
47 #define BOARD_CONFIG    "board"
48
49 /**
50  * @brief Enumeration of key for system information
51  */
52 typedef enum {
53         SYSTEM_INFO_KEY_MODEL,                  /**< The model of the device */
54         SYSTEM_INFO_KEY_TIZEN_VERSION,          /**< The version of the Tizen API */
55         SYSTEM_INFO_KEY_PLATFORM_NAME,          /**< The name of platform */
56         SYSTEM_INFO_KEY_TIZEN_VERSION_NAME,     /**< The name of tizen version  */
57         SYSTEM_INFO_KEY_MANUFACTURER,           /**< The manufacturer of the device */
58         SYSTEM_INFO_KEY_CORE_CPU_ARCH,          /**< The CORE CPU architecture of model */
59         SYSTEM_INFO_KEY_CORE_CPU_FREQ,          /**< The CORE CPU frequency of model */
60         SYSTEM_INFO_KEY_BUILD_STRING,           /**< The build string of platform binary */
61         SYSTEM_INFO_KEY_BUILD_DATE,             /**< The build date of platform binary */
62         SYSTEM_INFO_KEY_BUILD_TIME,             /**< The build time of platform binary */
63         SYSTEM_INFO_KEY_SCREEN_HEIGHT,          /**< The height of the screen in pixels */
64         SYSTEM_INFO_KEY_SCREEN_WIDTH,           /**< The width of the screen in pixels */
65         SYSTEM_INFO_KEY_PHYSICAL_SCREEN_HEIGHT, /**< The physical screen height in millimeters */
66         SYSTEM_INFO_KEY_PHYSICAL_SCREEN_WIDTH,  /**< The physical screen width in millimeters */
67         SYSTEM_INFO_KEY_TETHERING_SUPPORTED,    /**< Indicates whether the device supports tethering */
68 } system_info_key_e;
69
70 typedef enum {
71         SYSTEM_INFO_DATA_TYPE_STRING,
72         SYSTEM_INFO_DATA_TYPE_INT,
73         SYSTEM_INFO_DATA_TYPE_DOUBLE,
74         SYSTEM_INFO_DATA_TYPE_BOOL
75 } system_info_data_type_e;
76
77 /**
78  * @brief Enumeration of Mode type
79  */
80 typedef enum {
81         SYSTEM_INFO_MODEL_TYPE_EMULATOR,
82         SYSTEM_INFO_MODEL_TYPE_TARGET
83 } system_info_mode_type_e;
84
85 typedef int (*system_info_get_value_cb) (system_info_key_e key, system_info_data_type_e data_type, void **value);
86
87 system_info_mode_type_e system_info_get_system_info_model_type(void);
88
89 int system_info_ini_get_string(char *ini_file, char *key, char **output);
90 int system_info_get_value_from_xml(char *xml_file_path, char *model, char *id_field, char **value);
91 int system_info_get_value_from_config_xml(char *feature_tag, const char *name_field, char *type_field, char **value);
92
93 int system_info_vconf_get_value_int(const char *vconf_key, int *value);
94 int system_info_vconf_get_value_bool(const char *vconf_key, bool *value);
95 int system_info_vconf_get_value_double(const char *vconf_key, double *value);
96 int system_info_vconf_get_value_string(const char *vconf_key, char **value);
97
98 int system_info_get_model(system_info_key_e key, system_info_data_type_e data_type, void **value);
99 int system_info_get_tizen_version(system_info_key_e key, system_info_data_type_e data_type, void **value);
100 int system_info_get_platform_name(system_info_key_e key, system_info_data_type_e data_type, void **value);
101 int system_info_get_tizen_version_name(system_info_key_e key, system_info_data_type_e data_type, void **value);
102 int system_info_get_core_cpu_arch(system_info_key_e key, system_info_data_type_e data_type, void **value);
103 int system_info_get_core_cpu_freq(system_info_key_e key, system_info_data_type_e data_type, void **value);
104 int system_info_get_screen_height(system_info_key_e key, system_info_data_type_e data_type, void **value);
105 int system_info_get_screen_width(system_info_key_e key, system_info_data_type_e data_type, void **value);
106 int system_info_get_physical_screen_height(system_info_key_e key, system_info_data_type_e data_type, void **value);
107 int system_info_get_physical_screen_width(system_info_key_e key, system_info_data_type_e data_type, void **value);
108 int system_info_get_manufacturer(system_info_key_e key, system_info_data_type_e data_type, void **value);
109 int system_info_get_build_string(system_info_key_e key, system_info_data_type_e data_type, void **value);
110 int system_info_get_build_date(system_info_key_e key, system_info_data_type_e data_type, void **value);
111 int system_info_get_build_time(system_info_key_e key, system_info_data_type_e data_type, void **value);
112 int system_info_get_tethering_supported(system_info_key_e key, system_info_data_type_e data_type, void **value);
113
114 int system_info_get_no_file(const char *key, void **value);
115
116 #ifdef __cplusplus
117 }
118 #endif
119
120 #endif /* __TIZEN_SYSTEM_SYSTEM_INFO_PRIVATE_H__ */