4 * Copyright (c) 2000 - 2013 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.
23 * @desc Implementation of API for option tweaking:
24 * wifi - collect information for wifi
25 * datacall - collect information for packet data
26 * datausage_time - kernel update period
29 * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
34 #include <sys/socket.h>
37 #include <vconf/vconf.h>
42 #include "resourced.h"
45 static int save_options(const resourced_options *options)
48 _E("Please provid valid argument!");
52 if (vconf_set_bool(RESOURCED_WIFI_STATISTICS_PATH,
53 options->wifi == RESOURCED_OPTION_ENABLE ? 1 : 0) != 0) {
54 _D("Can not get WiFi statistics settings");
58 if (vconf_set_bool(RESOURCED_DATACALL_PATH,
59 options->datacall == RESOURCED_OPTION_ENABLE ? 1 : 0) != 0) {
60 _D("Can not get DataCall settings");
64 if (vconf_set_int(RESOURCED_DATAUSAGE_TIMER_PATH,
65 options->datausage_timer) != 0) {
66 _D("Can not get DataUsage timer settings");
70 if (vconf_set_bool(RESOURCED_DATACALL_LOGGING_PATH,
71 options->datacall_logging == RESOURCED_OPTION_ENABLE ? 1 : 0) != 0) {
72 _D("Can not get DataCall logging settings");
78 API resourced_ret_c set_resourced_options(const resourced_options *options)
80 return save_options(options) ? RESOURCED_ERROR_FAIL : RESOURCED_ERROR_NONE;
83 API resourced_ret_c get_resourced_options(resourced_options *options)
85 return load_options(options) ? RESOURCED_ERROR_FAIL : RESOURCED_ERROR_NONE;