Initialize Tizen 2.3
[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_width(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.width", (int *)value);
36 }
37
38 int system_info_get_screen_height(system_info_key_e key, system_info_data_type_e data_type, void **value)
39 {
40         return system_info_get_platform_int("tizen.org/feature/screen.height", (int *)value);
41 }
42
43 int system_info_get_physical_screen_height(system_info_key_e key, system_info_data_type_e data_type, void **value)
44 {
45         int *height;
46         char *str;
47
48         height = (int *)value;
49
50         if (system_info_get_bsp_info("board.display.height_mm", &str))
51                 return SYSTEM_INFO_ERROR_IO_ERROR;
52
53         *height = atoi(str);
54
55         free(str);
56
57         return SYSTEM_INFO_ERROR_NONE;
58 }
59
60 int system_info_get_physical_screen_width(system_info_key_e key, system_info_data_type_e data_type, void **value)
61 {
62         int *width;
63         char *str;
64
65         width = (int *)value;
66
67         if (system_info_get_bsp_info("board.display.width_mm", &str))
68                 return SYSTEM_INFO_ERROR_IO_ERROR;
69
70         *width = atoi(str);
71
72         free(str);
73
74         return SYSTEM_INFO_ERROR_NONE;
75 }