4 * Copyright (c) 2010-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.
19 #ifndef __LOCATION_COMMON_UTIL_H__
20 #define __LOCATION_COMMON_UTIL_H__
23 #include <location-ielement.h>
24 #include <location-boundary.h>
27 * @file location-common-util.h
28 * @brief This file contains the common utils for LocationObject.
40 LOCATION_APP_NOT_FOUND
49 typedef struct _LocationBoundaryPrivate {
50 LocationBoundary *boundary;
51 ZoneStatus zone_status;
52 } LocationBoundaryPrivate;
54 int location_application_get_authority(void);
55 int location_application_set_authority(int auth);
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);
61 int location_get_app_type(char *app_id);
63 const char* err_msg(int err);
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; \
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; \