Remove tv profile dependency for cynara
[platform/core/location/lbs-location.git] / location / manager / location-common-util.h
1 /*
2  * libslp-location
3  *
4  * Copyright (c) 2010-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 #ifndef __LOCATION_COMMON_UTIL_H__
20 #define __LOCATION_COMMON_UTIL_H__
21
22 #include <location.h>
23 #include <location-ielement.h>
24 #include <location-boundary.h>
25
26 /**
27  * @file location-common-util.h
28  * @brief This file contains the common utils for LocationObject.
29  */
30
31 G_BEGIN_DECLS
32
33 #define CAPP    1
34 #define WEBAPP  2
35 #define CPPAPP  3
36
37 typedef enum {
38         LOCATION_APP_OFF = 0,
39         LOCATION_APP_ON,
40         LOCATION_APP_NOT_FOUND
41 } LOCATION_APP_STATE;
42
43 typedef enum {
44         ZONE_STATUS_NONE = 0,
45         ZONE_STATUS_IN,
46         ZONE_STATUS_OUT,
47 } ZoneStatus;
48
49 typedef struct _LocationBoundaryPrivate {
50         LocationBoundary *boundary;
51         ZoneStatus zone_status;
52 } LocationBoundaryPrivate;
53
54 int location_application_get_authority(void);
55 int location_application_set_authority(int auth);
56
57 int set_prop_boundary(GList **prev_boundary_list, GList *new_boundary_list);
58 int set_prop_removal_boundary(GList **prev_boundary_list, LocationBoundary *boundary);
59 void free_boundary_list(gpointer data);
60
61 int location_get_app_type(char *app_id);
62
63 const char* err_msg(int err);
64
65 #define LOCATION_IF_POS_FAIL(path) { \
66                 int state = 0, mock; \
67                 vconf_get_int(VCONFKEY_LOCATION_MOCK_ENABLED, &mock); \
68                 vconf_get_int(path, &state); \
69                 if (state != 2 && mock != 1) { \
70                         return LOCATION_ERROR_NOT_AVAILABLE; \
71                 } \
72         }
73
74 #define LOCATION_IF_HYBRID_FAIL(gpath, wpath) { \
75                 int gps = 0; vconf_get_int(gpath, &gps); \
76                 int wps = 0; vconf_get_int(wpath, &wps); \
77                 int mock = 0; vconf_get_int(VCONFKEY_LOCATION_MOCK_ENABLED, &mock); \
78                 if (gps != 2 && wps != 2 && mock != 1) { \
79                         return LOCATION_ERROR_NOT_AVAILABLE; \
80                 } \
81         }
82
83 G_END_DECLS
84
85 #endif