refactoring for model-config
[framework/api/system-info.git] / src / system_info_screen.c
1 /*
2  * Copyright (c) 2011 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 #include <stdio.h>
19 #include <stdlib.h>
20 #include <string.h>
21
22 #include <dlog.h>
23
24 #include <system_info.h>
25 #include <system_info_private.h>
26
27 #ifdef LOG_TAG
28 #undef LOG_TAG
29 #endif
30
31 #define LOG_TAG "CAPI_SYSTEM_INFO"
32
33 int system_info_get_screen_bits_per_pixel(system_info_key_e key, system_info_data_type_e data_type, void **value)
34 {
35         return system_info_get_platform_int("tizen.org/feature/screen.bpp", (int *)value);
36 }
37
38 int system_info_get_screen_width(system_info_key_e key, system_info_data_type_e data_type, void **value)
39 {
40         bool check;
41         int *width = 0;
42
43         width = (int *)value;
44
45         if (system_info_get_platform_bool("tizen.org/feature/screen.size.normal.480.800", &check) == SYSTEM_INFO_ERROR_NONE
46                 && check == true)
47                 *width = 480;
48         if (system_info_get_platform_bool("tizen.org/feature/screen.size.normal.720.1280", &check) == SYSTEM_INFO_ERROR_NONE
49                 && check == true)
50                 *width = 720;
51
52         if (*width)
53         return SYSTEM_INFO_ERROR_NONE;
54         else
55                 return SYSTEM_INFO_ERROR_IO_ERROR;
56 }
57
58 int system_info_get_screen_height(system_info_key_e key, system_info_data_type_e data_type, void **value)
59 {
60         bool check;
61         int *height = 0;
62
63         height = (int *)value;
64
65         if (system_info_get_platform_bool("tizen.org/feature/screen.size.normal.480.800", &check) == SYSTEM_INFO_ERROR_NONE
66                 && check == true)
67                 *height = 800;
68         if (system_info_get_platform_bool("tizen.org/feature/screen.size.normal.720.1280", &check) == SYSTEM_INFO_ERROR_NONE
69                 && check == true)
70                 *height = 1280;
71
72         if (*height)
73         return SYSTEM_INFO_ERROR_NONE;
74         else
75                 return SYSTEM_INFO_ERROR_IO_ERROR;
76 }
77
78 int system_info_get_screen_DPI(system_info_key_e key, system_info_data_type_e data_type, void **value)
79 {
80         return system_info_get_platform_int("tizen.org/feature/screen.dpi", (int *)value);
81 }
82
83 int system_info_get_hdmi_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
84 {
85         return system_info_get_platform_bool("tizen.org/feature/screen.output.hdmi", (bool *)value);
86 }
87
88 int system_info_get_rca_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
89 {
90         return system_info_get_platform_bool("tizen.org/feature/screen.output.rca", (bool *)value);
91 }
92
93 int system_info_get_physical_screen_height(system_info_key_e key, system_info_data_type_e data_type, void **value)
94 {
95         return system_info_get_platform_int("tizen.org/feature/screen.height", (int *)value);
96 }
97
98 int system_info_get_physical_screen_width(system_info_key_e key, system_info_data_type_e data_type, void **value)
99 {
100         return system_info_get_platform_int("tizen.org/feature/screen.width", (int *)value);
101 }