tizen 2.4 release
[framework/location/libslp-location.git] / location / manager / location-setting.h
1 /*
2  * libslp-location
3  *
4  * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
7  *          Genie Kim <daejins.kim@samsung.com>
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and "1
19  * limitations under the License.
20  */
21
22 #ifndef __LOCATION_SETTING_H__
23 #define __LOCATION_SETTING_H__
24
25 #include <glib.h>
26 #include <vconf.h>
27 #include <vconf-internal-location-keys.h>
28
29 /**
30  * @file location-setting.h
31  * @brief This file contains the definitions and functions for setting.
32  */
33
34 #define LOCATION_UPDATE_INTERVAL_NONE           0
35 #define LOCATION_UPDATE_INTERVAL_MIN            1
36 #define LOCATION_UPDATE_INTERVAL_MAX            120
37 #define LOCATION_UPDATE_INTERVAL_DEFAULT        LOCATION_UPDATE_INTERVAL_MIN
38 #define LOCATION_BATCH_PERIOD_MIN                       120
39 #define LOCATION_BATCH_PERIOD_MAX                       600
40 #define LOCATION_BATCH_PERIOD_DEFAULT           LOCATION_BATCH_PERIOD_MIN
41 #define LOCATION_MIN_INTERVAL_MIN                       1
42 #define LOCATION_MIN_INTERVAL_MAX                       120
43 #define LOCATION_MIN_INTERVAL_DEFAULT           LOCATION_MIN_INTERVAL_MIN
44 #define LOCATION_MIN_DISTANCE_MIN                       1.0
45 #define LOCATION_MIN_DISTANCE_MAX                       120.0
46 #define LOCATION_MIN_DISTANCE_DEFAULT           LOCATION_MIN_DISTANCE_MIN
47
48 typedef void (*SettingCB)(keynode_t *key, gpointer data);
49
50
51 gint location_setting_send_system_event(const char *path, const int val);
52 gint location_setting_get_key_val(keynode_t *key);
53 gint location_setting_get_int(const gchar *path);
54 gboolean location_setting_get_bool(const gchar *path);
55 gchar *location_setting_get_string(const gchar *path);
56 gint location_setting_add_notify(const gchar *path, SettingCB setting_cb, gpointer self);
57 gint location_setting_ignore_notify(const gchar *path, SettingCB setting_cb);
58 gint location_state_add_notify(const gchar *path, SettingCB setting_cb, gpointer self);
59 gint location_state_ignore_notify(const gchar *path, SettingCB setting_cb);
60
61
62 #define setting_retval_if_fail(path) {\
63                 int val = location_setting_get_int(path);\
64                 if (val == -1){\
65                         return LOCATION_ERROR_UNKNOWN;\
66                 } else if (val == 0) {\
67                         return LOCATION_ERROR_SETTING_OFF;\
68                 }\
69         }
70
71 #endif