Tizen 2.1 base
[platform/core/api/location-manager.git] / include / locations_private.h
1 /*
2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #ifndef __TIZEN_LOCATION_LOCATIONS_PRIVATE_H__
18 #define __TIZEN_LOCATION_LOCATIONS_PRIVATE_H__
19
20 #include <location/location.h>
21 #include <locations.h>
22 #include <dlog.h>
23
24 #ifdef LOG_TAG
25 #undef LOG_TAG
26 #endif
27 #define LOG_TAG "CAPI_LOCATION_MANAGER"
28
29 /*
30 * Internal Macros
31 */
32 #define LOCATIONS_LOGD(fmt,args...)  LOGD(fmt, ##args)
33 #define LOCATIONS_LOGW(fmt,args...)  LOGW(fmt, ##args)
34 #define LOCATIONS_LOGI(fmt,args...)  LOGI(fmt, ##args)
35 #define LOCATIONS_LOGE(fmt,args...)  LOGE(fmt, ##args)
36
37 #define LOCATIONS_CHECK_CONDITION(condition, error, msg)        \
38                 do { \
39                         if (condition) { \
40                         } else { \
41                                 LOCATIONS_LOGE("%s(0x%08x)", msg, error); \
42                                 return error; \
43                         } \
44                 } while (0)
45
46
47 #define LOCATIONS_PRINT_ERROR_CODE(error, msg)  \
48                 do { \
49                         LOCATIONS_LOGE("%s(0x%08x)", msg, error); \
50                         return error; \
51                 } while (0)
52
53
54 #ifdef __cplusplus
55 extern "C" {
56 #endif
57
58 typedef enum {
59         _LOCATIONS_EVENT_TYPE_SERVICE_STATE,
60         _LOCATIONS_EVENT_TYPE_POSITION,
61         _LOCATIONS_EVENT_TYPE_VELOCITY,
62         _LOCATIONS_EVENT_TYPE_BOUNDARY,
63         _LOCATIONS_EVENT_TYPE_SATELLITE,
64         _LOCATIONS_EVENT_TYPE_FOREACH_BOUNDS,
65         _LOCATIONS_EVENT_TYPE_NUM
66 }_location_event_e;
67
68 typedef struct _location_manager_s {
69         LocationObject* object;
70         const void* user_cb[_LOCATIONS_EVENT_TYPE_NUM];
71         void* user_data[_LOCATIONS_EVENT_TYPE_NUM];
72         location_method_e method;
73         bool is_continue_foreach_bounds;
74         GList *bounds_list;
75 } location_manager_s;
76
77 typedef struct _location_bounds_s {
78         LocationBoundary* boundary;
79         const void* user_cb;
80         void* user_data;
81         bool is_added;
82 } location_bounds_s;
83 #ifdef __cplusplus
84 }
85 #endif
86
87 #endif //__TIZEN_LOCATION_LOCATIONS_PRIVATE_H__