Plugin updated
[platform/adaptation/artik/lbs-plugin-gps-artik7.git] / gps-plugin / src / setting.c
1 /*
2  * gps-manager replay plugin
3  *
4  * Copyright (c) 2011-2013 Samsung Electronics Co., Ltd. All rights reserved.
5  *
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
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
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.
17  */
18
19 #include <string.h>
20 #include <glib.h>
21 #include "setting.h"
22 #include "gps_plugin_debug.h"
23
24 int setting_get_int(const char *path, int *val)
25 {
26         int ret = vconf_get_int(path, val);
27         if (ret == 0) {
28                 ret = TRUE;
29         } else {
30                 LOG_PLUGIN(DBG_ERR, "vconf_get_int failed, [%s]", path);
31                 ret = FALSE;
32         }
33         return ret;
34 }
35
36 int setting_get_double(const char *path, double *val)
37 {
38         int ret = vconf_get_dbl(path, val);
39         if (ret == 0) {
40                 ret = TRUE;
41         } else {
42                 LOG_PLUGIN(DBG_ERR, "vconf_get_int failed, [%s]", path);
43                 ret = FALSE;
44         }
45         return ret;
46 }
47
48 char *setting_get_string(const char *path)
49 {
50         return vconf_get_str(path);
51 }
52
53 int setting_notify_key_changed(const char *path, void *key_changed_cb)
54 {
55         int ret = TRUE;
56         if (vconf_notify_key_changed(path, key_changed_cb, NULL) != 0) {
57                 LOG_PLUGIN(DBG_ERR, "Fail to vconf_notify_key_changed [%s]", path);
58                 ret = FALSE;
59         }
60         return ret;
61 }
62
63 int setting_ignore_key_changed(const char *path, void *key_changed_cb)
64 {
65         int ret = TRUE;
66         if (vconf_ignore_key_changed(path, key_changed_cb) != 0) {
67                 LOG_PLUGIN(DBG_ERR, "Fail to vconf_ignore_key_changed [%s]", path);
68                 ret = FALSE;
69         }
70         return ret;
71 }