update for beta universally
[framework/location/libslp-location.git] / location / location-setting.h
1 /*
2  * libslp-location
3  *
4  * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Youngae Kang <youngae.kang@samsung.com>, Yunhan Kim <yhan.kim@samsung.com>,
7  *          Genie Kim <daejins.kim@samsung.com>, Minjune Kim <sena06.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
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-keys.h>
28
29 /**
30  * @file location-setting.h
31  * @brief This file contains the definitions and functions for setting.
32  * @addtogroup LocationInternal
33  * @{
34  * @}
35  */
36
37 #define VCONF_LOCATION_PATH             "db/location"
38
39 #define LOCATION_LAST_POSITION_PATH             VCONF_LOCATION_PATH"/lastposition"
40 #define GPS_LAST_POSITION_PATH                  LOCATION_LAST_POSITION_PATH"/gps"
41 #define WPS_LAST_POSITION_PATH                  LOCATION_LAST_POSITION_PATH"/wps"
42 #define SPS_LAST_POSITION_PATH                  LOCATION_LAST_POSITION_PATH"/sps"
43
44 #define GPS_LAST_TIMESTAMP      GPS_LAST_POSITION_PATH"/Timestamp"
45 #define GPS_LAST_LATITUDE       GPS_LAST_POSITION_PATH"/Latitude"
46 #define GPS_LAST_LONGITUDE      GPS_LAST_POSITION_PATH"/Longitude"
47 #define GPS_LAST_ALTITUDE       GPS_LAST_POSITION_PATH"/Altitude"
48 #define GPS_LAST_HORACCURACY    GPS_LAST_POSITION_PATH"/HorAccuracy"
49 #define GPS_LAST_VERACCURACY    GPS_LAST_POSITION_PATH"/VerAccuracy"
50
51 #define WPS_LAST_TIMESTAMP      WPS_LAST_POSITION_PATH"/Timestamp"
52 #define WPS_LAST_LATITUDE       WPS_LAST_POSITION_PATH"/Latitude"
53 #define WPS_LAST_LONGITUDE      WPS_LAST_POSITION_PATH"/Longitude"
54 #define WPS_LAST_ALTITUDE       WPS_LAST_POSITION_PATH"/Altitude"
55 #define WPS_LAST_HORACCURACY    WPS_LAST_POSITION_PATH"/HorAccuracy"
56 #define WPS_LAST_VERACCURACY    WPS_LAST_POSITION_PATH"/VerAccuracy"
57
58 #define SPS_LAST_TIMESTAMP      SPS_LAST_POSITION_PATH"/Timestamp"
59 #define SPS_LAST_LATITUDE       SPS_LAST_POSITION_PATH"/Latitude"
60 #define SPS_LAST_LONGITUDE      SPS_LAST_POSITION_PATH"/Longitude"
61 #define SPS_LAST_ALTITUDE       SPS_LAST_POSITION_PATH"/Altitude"
62 #define SPS_LAST_HORACCURACY    SPS_LAST_POSITION_PATH"/HorAccuracy"
63 #define SPS_LAST_VERACCURACY    SPS_LAST_POSITION_PATH"/VerAccuracy"
64
65 #define GPS_ENABLED                     VCONFKEY_LOCATION_ENABLED
66 #define LOCATION_SETTING_PATH           VCONF_LOCATION_PATH"/setting"
67 #define AGPS_ENABLED                    LOCATION_SETTING_PATH"/AgpsEnabled"
68 #define NETWORK_ENABLED                 LOCATION_SETTING_PATH"/NetworkEnabled"
69 #define SENSOR_ENABLED                  LOCATION_SETTING_PATH"/SensorEnabled"
70
71 #define LOCATION_UPDATE_INTERVAL_MIN            1
72 #define LOCATION_UPDATE_INTERVAL_MAX            120
73 #define LOCATION_UPDATE_INTERVAL_DEFAULT        LOCATION_UPDATE_INTERVAL_MIN
74
75 typedef void (*SettingCB)(keynode_t *key, gpointer data);
76
77 gint location_setting_get_key_val(keynode_t *key);
78 gint location_setting_get_int(const gchar* path);
79 gchar *location_setting_get_string(const gchar* path);
80 gint location_setting_add_notify(const gchar* path, SettingCB setting_cb, gpointer self);
81 gint location_setting_ignore_notify(const gchar* path, SettingCB setting_cb);
82
83 #define setting_retval_if_fail(path) {\
84         if(!location_setting_get_int(path)){\
85                 return LOCATION_ERROR_NOT_ALLOWED;\
86         }\
87 }
88
89 #define setting_ret_if_fail(path) {\
90         if(!location_setting_get_int(path)){\
91                 return;\
92         }\
93 }
94
95
96 #endif