diff options
author | Stefan Schmidt <s.schmidt@samsung.com> | 2014-10-28 11:22:55 +0100 |
---|---|---|
committer | Stefan Schmidt <s.schmidt@samsung.com> | 2014-11-11 11:02:08 +0100 |
commit | a2d2cdaf9f258ec4c6c7c33d912bbe41625e8532 (patch) | |
tree | 62f61f67cd6a74790e1b11f35a55f3a22e82b5ea /src/lib/elocation/elocation_private.h | |
parent | c2f130a2f77f7f319e819ff7883c8695aa45319e (diff) |
elocation: Add elocation libraray to EFL.
Elocation is meant as a convenience library to ease application developers
the usage of geo information in their apps. Adding a geo tag to a picture or
translating an address to a GPS position and show it on a map widget are just
some of the use cases.
In the beginning elocation will rely on the GeoClue1 DBus service. Supporting
the new GeoClue2 DBus service is planned and worked on. GeoClue offers
providers for various techniques to get hold off the current position. Ranging
from GeoIP over wifi and GSM cell location to GPS.
This has been developed a while ago and was living in my private dev space.
It is about time to move this into EFL and bring it forward.
The detection of the GeoClue service is being handled on runtime and no new
dependency is added due to this library.
@feature
Diffstat (limited to '')
-rw-r--r-- | src/lib/elocation/elocation_private.h | 181 |
1 files changed, 181 insertions, 0 deletions
diff --git a/src/lib/elocation/elocation_private.h b/src/lib/elocation/elocation_private.h new file mode 100644 index 0000000000..1203cc35b1 --- /dev/null +++ b/src/lib/elocation/elocation_private.h | |||
@@ -0,0 +1,181 @@ | |||
1 | #ifndef _ELOCATION_PRIVATE_H | ||
2 | #define _ELOCATION_PRIVATE_H | ||
3 | |||
4 | #ifdef HAVE_CONFIG_H | ||
5 | #include "config.h" | ||
6 | #endif | ||
7 | |||
8 | #include <stdio.h> | ||
9 | |||
10 | #include <Eina.h> | ||
11 | #include <Ecore.h> | ||
12 | #include <Eldbus.h> | ||
13 | |||
14 | #ifndef ELOCATION_COLOR_DEFAULT | ||
15 | #define ELOCATION_COLOR_DEFAULT EINA_COLOR_BLUE | ||
16 | #endif | ||
17 | extern int _elocation_log_dom; | ||
18 | #ifdef CRI | ||
19 | #undef CRI | ||
20 | #endif | ||
21 | |||
22 | #ifdef ERR | ||
23 | #undef ERR | ||
24 | #endif | ||
25 | #ifdef INF | ||
26 | #undef INF | ||
27 | #endif | ||
28 | #ifdef WARN | ||
29 | #undef WARN | ||
30 | #endif | ||
31 | #ifdef DBG | ||
32 | #undef DBG | ||
33 | #endif | ||
34 | |||
35 | #define CRI(...) EINA_LOG_DOM_CRIT(_elocation_log_dom, __VA_ARGS__) | ||
36 | #define DBG(...) EINA_LOG_DOM_DBG(_elocation_log_dom, __VA_ARGS__) | ||
37 | #define INF(...) EINA_LOG_DOM_INFO(_elocation_log_dom, __VA_ARGS__) | ||
38 | #define WARN(...) EINA_LOG_DOM_WARN(_elocation_log_dom, __VA_ARGS__) | ||
39 | #define ERR(...) EINA_LOG_DOM_ERR(_elocation_log_dom, __VA_ARGS__) | ||
40 | |||
41 | /* Provider bus names and object paths. Master is the generic one which should | ||
42 | * pick up the best one internally based on given requirements. It is also still | ||
43 | * possible to use providers directly */ | ||
44 | #define GEOCLUE_DBUS_NAME "org.freedesktop.Geoclue.Master" | ||
45 | #define GEOCLUE_OBJECT_PATH "/org/freedesktop/Geoclue/Master" | ||
46 | #define GSMLOC_DBUS_NAME "org.freedesktop.Geoclue.Providers.Gsmloc" | ||
47 | #define GSMLOC_OBJECT_PATH "/org/freedesktop/Geoclue/Providers/Gsmloc" | ||
48 | #define HOSTIP_DBUS_NAME "org.freedesktop.Geoclue.Providers.Hostip" | ||
49 | #define HOSTIP_OBJECT_PATH "/org/freedesktop/Geoclue/Providers/Hostip" | ||
50 | #define SKYHOOK_DBUS_NAME "org.freedesktop.Geoclue.Providers.Skyhook" | ||
51 | #define SKYHOOK_OBJECT_PATH "/org/freedesktop/Geoclue/Providers/Skyhook" | ||
52 | #define UBUNTU_DBUS_NAME "org.freedesktop.Geoclue.Providers.UbuntuGeoIP" | ||
53 | #define UBUNTU_OBJECT_PATH "/org/freedesktop/Geoclue/Providers/UbuntuGeoIP" | ||
54 | #define GEONAMES_DBUS_NAME "org.freedesktop.Geoclue.Providers.Geonames" | ||
55 | #define GEONAMES_OBJECT_PATH "/org/freedesktop/Geoclue/Providers/Geonames" | ||
56 | #define PLAZES_DBUS_NAME "org.freedesktop.Geoclue.Providers.Plazes" | ||
57 | #define PLAZES_OBJECT_PATH "/org/freedesktop/Geoclue/Providers/Plazes" | ||
58 | #define YAHOO_DBUS_NAME "org.freedesktop.Geoclue.Providers.Yahoo" | ||
59 | #define YAHOO_OBJECT_PATH "/org/freedesktop/Geoclue/Providers/Yahoo" | ||
60 | |||
61 | /* Master interfaces to control geoclue */ | ||
62 | #define GEOCLUE_MASTER_IFACE "org.freedesktop.Geoclue.Master" | ||
63 | #define GEOCLUE_MASTERCLIENT_IFACE "org.freedesktop.Geoclue.MasterClient" | ||
64 | |||
65 | /* Provider interfaces to access location data */ | ||
66 | #define GEOCLUE_GEOCLUE_IFACE "org.freedesktop.Geoclue" | ||
67 | #define GEOCLUE_POSITION_IFACE "org.freedesktop.Geoclue.Position" | ||
68 | #define GEOCLUE_ADDRESS_IFACE "org.freedesktop.Geoclue.Address" | ||
69 | #define GEOCLUE_VELOCITY_IFACE "org.freedesktop.Geoclue.Velocity" | ||
70 | #define GEOCLUE_GEOCODE_IFACE "org.freedesktop.Geoclue.Geocode" | ||
71 | #define GEOCLUE_REVERSEGEOCODE_IFACE "org.freedesktop.Geoclue.ReverseGeocode" | ||
72 | |||
73 | /* More provider interfaces. These three are not in upstream geoclue but only | ||
74 | * in the Tizen version. Lets hope they get upstream at some point. Right now | ||
75 | * we will test at runtime if they are offered and ignore them if not */ | ||
76 | #define GEOCLUE_NMEA_IFACE "org.freedesktop.Geoclue.Nmea" | ||
77 | #define GEOCLUE_SATELLITE_IFACE "org.freedesktop.Geoclue.Satellite" | ||
78 | #define GEOCLUE_POI_IFACE "org.freedesktop.Geoclue.Poi" | ||
79 | |||
80 | #define GEOCLUE_ADDRESS_KEY_AREA "area" | ||
81 | #define GEOCLUE_ADDRESS_KEY_COUNTRY "country" | ||
82 | #define GEOCLUE_ADDRESS_KEY_COUNTRYCODE "countrycode" | ||
83 | #define GEOCLUE_ADDRESS_KEY_LOCALITY "locality" | ||
84 | #define GEOCLUE_ADDRESS_KEY_POSTALCODE "postalcode" | ||
85 | #define GEOCLUE_ADDRESS_KEY_REGION "region" | ||
86 | #define GEOCLUE_ADDRESS_KEY_STREET "street" | ||
87 | |||
88 | extern int ELOCATION_EVENT_IN; | ||
89 | extern int ELOCATION_EVENT_OUT; | ||
90 | |||
91 | /* Some ENUMs that we mimic from GeoClue code as we only access it over the DBus | ||
92 | * interface and share no header file for such defines. | ||
93 | */ | ||
94 | |||
95 | /** | ||
96 | * @ingroup Location | ||
97 | * @typedef GeocluePositionFields | ||
98 | * @since 1.8 | ||
99 | * | ||
100 | * Bitmask to indicate which of the supplied positions fields are valid. | ||
101 | * | ||
102 | * @{ | ||
103 | */ | ||
104 | typedef enum { | ||
105 | GEOCLUE_POSITION_FIELDS_NONE = 0, | ||
106 | GEOCLUE_POSITION_FIELDS_LATITUDE = 1 << 0, | ||
107 | GEOCLUE_POSITION_FIELDS_LONGITUDE = 1 << 1, | ||
108 | GEOCLUE_POSITION_FIELDS_ALTITUDE = 1 << 2 | ||
109 | } GeocluePositionFields; | ||
110 | /**@}*/ | ||
111 | |||
112 | /** | ||
113 | * @ingroup Location | ||
114 | * @typedef GeoclueNetworkStatus | ||
115 | * @since 1.8 | ||
116 | * | ||
117 | * Status of the network connectivity for GeoClue. Needed for all providers that | ||
118 | * access external data to determine the location. For example GeoIP or GeoCode | ||
119 | * providers. | ||
120 | * | ||
121 | * @{ | ||
122 | */ | ||
123 | typedef enum { | ||
124 | GEOCLUE_CONNECTIVITY_UNKNOWN, | ||
125 | GEOCLUE_CONNECTIVITY_OFFLINE, | ||
126 | GEOCLUE_CONNECTIVITY_ACQUIRING, | ||
127 | GEOCLUE_CONNECTIVITY_ONLINE, | ||
128 | } GeoclueNetworkStatus; | ||
129 | /**@}*/ | ||
130 | |||
131 | /** | ||
132 | * @ingroup Location | ||
133 | * @typedef GeoclueStatus | ||
134 | * @since 1.8 | ||
135 | * | ||
136 | * Status of a GeoClue provider. | ||
137 | * | ||
138 | * @{ | ||
139 | */ | ||
140 | typedef enum { | ||
141 | GEOCLUE_STATUS_ERROR, | ||
142 | GEOCLUE_STATUS_UNAVAILABLE, | ||
143 | GEOCLUE_STATUS_ACQUIRING, | ||
144 | GEOCLUE_STATUS_AVAILABLE | ||
145 | } GeoclueStatus; | ||
146 | /**@}*/ | ||
147 | |||
148 | /** | ||
149 | * @ingroup Location | ||
150 | * @typedef GeoclueVelocityFields | ||
151 | * @since 1.8 | ||
152 | * | ||
153 | * Bitmask to indicate which of the supplied velocity fields are valid. | ||
154 | * | ||
155 | * @{ | ||
156 | */ | ||
157 | typedef enum { | ||
158 | GEOCLUE_VELOCITY_FIELDS_NONE = 0, | ||
159 | GEOCLUE_VELOCITY_FIELDS_SPEED = 1 << 0, | ||
160 | GEOCLUE_VELOCITY_FIELDS_DIRECTION = 1 << 1, | ||
161 | GEOCLUE_VELOCITY_FIELDS_CLIMB = 1 << 2 | ||
162 | } GeoclueVelocityFields; | ||
163 | /**@}*/ | ||
164 | |||
165 | /** | ||
166 | * @ingroup Location | ||
167 | * @typedef Elocation_Provider | ||
168 | * @since 1.8 | ||
169 | * | ||
170 | * Data structure to hold information about a GeoClue provider. | ||
171 | * | ||
172 | */ | ||
173 | typedef struct _Elocation_Provider | ||
174 | { | ||
175 | char *name; | ||
176 | char *description; | ||
177 | char *service; | ||
178 | char *path; | ||
179 | GeoclueStatus status; | ||
180 | } Elocation_Provider; | ||
181 | #endif | ||