4 * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
19 #include <resourced.h>
23 #include "data_usage.h"
24 #include "datausage-vconf-common.h"
26 #ifndef VCONFKEY_SETAPPL_SET_DATA_USAGE_LIMIT_BOOL
27 #define VCONFKEY_SETAPPL_SET_DATA_USAGE_LIMIT_BOOL "db/setting/set_data_usage_limit"
30 #ifndef VCONFKEY_SETAPPL_DATA_LIMIT_INT
31 #define VCONFKEY_SETAPPL_DATA_LIMIT_INT "db/setting/data_limit"
34 #ifndef VCONFKEY_SETAPPL_DATA_RESTRICTION_INT
35 #define VCONFKEY_SETAPPL_DATA_RESTRICTION_INT "db/setting/data_restriction"
38 resourced_ret_c restriction_check_limit_status(int *retval)
40 if (vconf_get_bool(VCONFKEY_SETAPPL_SET_DATA_USAGE_LIMIT_BOOL, retval)) {
41 _E("vconf_get_bool FAIL\n");
42 return RESOURCED_ERROR_FAIL;
45 return RESOURCED_ERROR_NONE;
48 resourced_ret_c restriction_read_quota(int *quota)
50 if (vconf_get_int(VCONFKEY_SETAPPL_DATA_LIMIT_INT, quota)) {
51 _E("vconf_get_int FAIL\n");
52 return RESOURCED_ERROR_FAIL;
55 return RESOURCED_ERROR_NONE;
58 void restriction_set_status(int value)
60 int limit = RESTRICTION_STATE_INIT;
62 if (vconf_get_int(VCONFKEY_SETAPPL_DATA_RESTRICTION_INT, &limit)) {
63 _E("vconf_get_int FAIL\n");
68 _E("No need to change a restriction status: %d", limit);
72 vconf_set_int(VCONFKEY_SETAPPL_DATA_RESTRICTION_INT, value);