2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
24 #include <runtime_info.h>
25 #include <runtime_info_private.h>
31 #define LOG_TAG "CAPI_SYSTEM_RUNTIME_INFO"
33 static const char *VCONF_24HOUR_FORMAT = VCONFKEY_REGIONFORMAT_TIME1224;
34 static const char *VCONF_FIRST_DAY_OF_WEEK = VCONFKEY_SETAPPL_WEEKOFDAY_FORMAT_INT;
35 static const char *VCONF_LANGUAGE = VCONFKEY_LANGSET;
36 static const char *VCONF_REGION = VCONFKEY_REGIONFORMAT;
38 int runtime_info_24hour_format_get_value(runtime_info_value_h value)
42 if (runtime_info_vconf_get_value_int(VCONF_24HOUR_FORMAT, &vconf_value))
43 return RUNTIME_INFO_ERROR_IO_ERROR;
45 switch (vconf_value) {
46 case VCONFKEY_TIME_FORMAT_12:
50 case VCONFKEY_TIME_FORMAT_24:
55 return RUNTIME_INFO_ERROR_IO_ERROR;
58 return RUNTIME_INFO_ERROR_NONE;
61 int runtime_info_24hour_format_set_event_cb()
63 return runtime_info_vconf_set_event_cb(VCONF_24HOUR_FORMAT, RUNTIME_INFO_KEY_24HOUR_CLOCK_FORMAT_ENABLED, 0);
66 void runtime_info_24hour_format_unset_event_cb()
68 runtime_info_vconf_unset_event_cb(VCONF_24HOUR_FORMAT, 0);
71 int runtime_info_first_day_of_week_get_value(runtime_info_value_h value)
75 if (runtime_info_vconf_get_value_int(VCONF_FIRST_DAY_OF_WEEK, &vconf_value))
76 return RUNTIME_INFO_ERROR_IO_ERROR;
78 switch (vconf_value) {
79 case SETTING_WEEKOFDAY_FORMAT_SUNDAY:
80 value->i = RUNTIME_INFO_FIRST_DAY_OF_WEEK_SUNDAY;
83 case SETTING_WEEKOFDAY_FORMAT_MONDAY:
84 value->i = RUNTIME_INFO_FIRST_DAY_OF_WEEK_MONDAY;
87 case SETTING_WEEKOFDAY_FORMAT_TUESDAY:
88 value->i = RUNTIME_INFO_FIRST_DAY_OF_WEEK_TUESDAY;
91 case SETTING_WEEKOFDAY_FORMAT_WEDNESDAY:
92 value->i = RUNTIME_INFO_FIRST_DAY_OF_WEEK_WEDNESDAY;
95 case SETTING_WEEKOFDAY_FORMAT_THURSDAY:
96 value->i = RUNTIME_INFO_FIRST_DAY_OF_WEEK_THURSDAY;
99 case SETTING_WEEKOFDAY_FORMAT_FRIDAY:
100 value->i = RUNTIME_INFO_FIRST_DAY_OF_WEEK_FRIDAY;
103 case SETTING_WEEKOFDAY_FORMAT_SATURDAY:
104 value->i = RUNTIME_INFO_FIRST_DAY_OF_WEEK_SATURDAY;
108 return RUNTIME_INFO_ERROR_IO_ERROR;
111 return RUNTIME_INFO_ERROR_NONE;
114 int runtime_info_first_day_of_week_set_event_cb()
116 return runtime_info_vconf_set_event_cb(VCONF_FIRST_DAY_OF_WEEK, RUNTIME_INFO_KEY_FIRST_DAY_OF_WEEK, 0);
119 void runtime_info_first_day_of_week_unset_event_cb()
121 runtime_info_vconf_unset_event_cb(VCONF_FIRST_DAY_OF_WEEK, 0);
124 int runtime_info_language_get_value(runtime_info_value_h value)
129 if (runtime_info_vconf_get_value_string(VCONF_LANGUAGE, &vconf_value))
130 return RUNTIME_INFO_ERROR_IO_ERROR;
132 token = strchr(vconf_value, '.');
137 value->s = vconf_value;
139 return RUNTIME_INFO_ERROR_NONE;
142 int runtime_info_language_set_event_cb()
144 return runtime_info_vconf_set_event_cb(VCONF_LANGUAGE, RUNTIME_INFO_KEY_LANGUAGE, 0);
147 void runtime_info_language_unset_event_cb()
149 runtime_info_vconf_unset_event_cb(VCONF_LANGUAGE, 0);
152 int runtime_info_region_get_value(runtime_info_value_h value)
156 if (runtime_info_vconf_get_value_string(VCONF_REGION, &vconf_value))
157 return RUNTIME_INFO_ERROR_IO_ERROR;
159 value->s = vconf_value;
161 return RUNTIME_INFO_ERROR_NONE;
164 int runtime_info_region_set_event_cb()
166 return runtime_info_vconf_set_event_cb(VCONF_REGION, RUNTIME_INFO_KEY_REGION, 0);
169 void runtime_info_region_unset_event_cb()
171 runtime_info_vconf_unset_event_cb(VCONF_REGION, 0);