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.
20 #ifndef __LOCATION_H__
21 #define __LOCATION_H__
25 #include <location-types.h>
26 #include <location-position.h>
27 #include <location-batch.h>
28 #include <location-velocity.h>
29 #include <location-accuracy.h>
30 #include <location-boundary.h>
31 #include <location-satellite.h>
37 * @brief This file contains the Location API and related structure and enumeration.
40 * @defgroup LocationFW LocationFW
41 * @brief This is a Location Framework for providing location based services.
42 * @addtogroup LocationFW
44 * @defgroup LocationAPI Location API
45 * @brief This sub module provides the Location API.
46 * @addtogroup LocationAPI
51 * @brief Initialize location sub module.
52 * @remarks None. This API should be called before any other Location APIs.
57 * Please refer #LocationError for more information.
60 int location_init(void);
63 * @brief Create a new #LocationObject by using given #LocationMethod.
64 * @remarks Returned object is necessary for other APIs.
65 * @pre #location_init should be called before.
67 * @param [in] method - Location method to be used.
68 * @return a new #LocationObject
69 * @retval NULL if error occured
72 LocationObject *location_new(LocationMethod method, gboolean multi_handle);
75 * @brief Free memory of given #LocationObject.
77 * @pre #location_init should be called before.
79 * @param [in] obj - a #LocationObject created by #location_new.
82 * Please refer #LocationError for more information.
84 int location_free(LocationObject *obj, gboolean multi_handle);
87 * @brief Start the location service by using given #LocationObject.
88 * @remarks If you want to recieve signals, you should use this API.
89 * @pre #location_init should be called before.
91 * @param [in] obj - a #LocationObject created by #location_new
94 * Please refer #LocationError for more information.
96 int location_start(LocationObject *obj);
99 * @brief Stop the location service by using given #LocationObject.
100 * @remarks After call this API, you can not recieve signals.
101 * @pre #location_init should be called before.\n
102 * #location_start should be called before.
104 * @param [in] obj - a #LocationObject created by #location_new
107 * Please refer #LocationError for more information.
109 int location_stop(LocationObject *obj);
111 int location_request_single_location(LocationObject *obj, int timeout);
113 int location_cancel_single_location(LocationObject *obj);
116 * @brief Check wheither a method is available.
118 * @pre #location_init should be called before.\n
120 * @param [in] method - a #LocationMethod
122 * @retval True Supported
123 * False Not supported
125 gboolean location_is_supported_method(LocationMethod method);
127 int location_is_enabled_method(LocationMethod method, int *is_enabled);
129 int location_enable_method(const LocationMethod method, const int enable);
133 * @brief Get current position information with estimate of the accuracy.
134 * @remarks Out parameters are should be freed.
135 * @pre #location_init should be called before.\n #location_start should be called before.
137 * @param [in] obj - a #LocationObject created by #location_new
138 * @param [out] position - a new #LocationPosition
139 * @param [out] accuracy - a new #LocationAccuracy
142 * Please refer #LocationError for more information.
144 int location_get_position(LocationObject *obj, LocationPosition **position, LocationAccuracy **accuracy);
147 * @brief Get current position & velocity information with estimate of the accuracy.
148 * @remarks Out parameters are should be freed.
149 * @pre #location_init should be called before.\n #location_start should be called before.
151 * @param [in] obj - a #LocationObject created by #location_new
152 * @param [out] position - a new #LocationPosition
153 * @param [out] velocity - a new #LocationVelocity
154 * @param [out] accuracy - a new #LocationAccuracy
157 * Please refer #LocationError for more information.
159 int location_get_position_ext(LocationObject *obj, LocationPosition **position, LocationVelocity **velocity, LocationAccuracy **accuracy);
162 * @brief Get last position information with estimate of the accuracy.
163 * @remarks Out parameters are should be freed.
164 * @pre #location_init should be called before.
166 * @param [in] obj - a #LocationObject created by #location_new
167 * @param [out] position - a new #LocationPosition
168 * @param [out] accuracy - a new #LocationAccuracy
171 * Please refer #LocationError for more information.
173 int location_get_last_position(LocationObject *obj, LocationPosition **position, LocationAccuracy **accuracy);
176 * @brief Get last position & velocity information with estimate of the accuracy.
177 * @remarks Out parameters are should be freed.
178 * @pre #location_init should be called before.
180 * @param [in] obj - a #LocationObject created by #location_new
181 * @param [out] position - a new #LocationPosition
182 * @param [out] velocity - a new #LocationVelocity
183 * @param [out] accuracy - a new #LocationAccuracy
186 * Please refer #LocationError for more information.
188 int location_get_last_position_ext(LocationObject *obj, LocationPosition **position, LocationVelocity **velocity, LocationAccuracy **accuracy);
190 * @brief Get last satellite information.
191 * @remarks This API is not implemented now. \n Out parameters are should be freed.
192 * @pre #location_init should be called before.
194 * @param [in] obj - a #LocationObject created by #location_new
195 * @param [out] satellite - a new #LocationSatellite
198 * Please refer #LocationError for more information.
200 int location_get_satellite(LocationObject *obj, LocationSatellite **satellite);
203 int location_start_batch(LocationObject *obj);
205 int location_stop_batch(LocationObject *obj);
207 int location_get_batch(LocationObject *obj, LocationBatch **batch);
211 * @brief Get last satellite information.
212 * @remarks This API is not implemented now. \n Out parameters are should be freed.
213 * @pre #location_init should be called before.
215 * @param [in] obj - a #LocationObject created by #location_new
216 * @param [out] satellite - a new #LocationSatellite
219 * Please refer #LocationError for more information.
221 int location_get_last_satellite(LocationObject *obj, LocationSatellite **satellite);
224 * @brief Get current velocity information with estimate of the accuracy.
225 * @remarks Out parameters are should be freed.
226 * @pre #location_init should be called before.\n #location_start should be called before.
228 * @param [in] obj - a #LocationObject created by #location_new
229 * @param [out] velocity - a new #LocationVelocity
230 * @param [out] accuracy - a new #LocationAccuracy
233 * Please refer #LocationError for more information.
235 int location_get_velocity(LocationObject *obj, LocationVelocity **velocity, LocationAccuracy **accuracy);
238 * @brief Get last velocity information with estimate of the accuracy.
239 * @remarks Out parameters are should be freed.
240 * @pre #location_init should be called before.
242 * @param [in] obj - a #LocationObject created by #location_new
243 * @param [out] velocity - a new #LocationVelocity
244 * @param [out] accuracy - a new #LocationAccuracy
247 * Please refer #LocationError for more information.
249 int location_get_last_velocity(LocationObject *obj, LocationVelocity **velocity, LocationAccuracy **accuracy);
252 * @brief Get the accessibility state of an application
254 * @pre #location_init should be called before.\n
256 * @param [out] state - a #LocationAccessState
259 * Please refer #LocationError for more information.
261 int location_get_accessibility_state(LocationAccessState *state);
264 * @brief Send command to the server.
265 * @pre #location_init should be called before.\n
266 * Calling application must have glib or ecore main loop.\n
267 * Calling application must have an active data connection.
269 * @param [in] cmd - a #char
272 * Please refer #LocationError for more information.
274 int location_send_command(const char *cmd);
277 * @brief Set option of server.
278 * @pre #location_init should be called before.\n
279 * Calling application must have glib or ecore main loop.\n
280 * Calling application must have an active data connection.
282 * @param [in] obj - a #LocationObject created by #location_new
283 * @param [in] option - a #char
286 * Please refer #LocationError for more information.
288 int location_set_option(LocationObject *obj, const char *option);
290 int location_add_setting_notify(LocationMethod method, LocationSettingCb callback, void *user_data);
292 int location_ignore_setting_notify(LocationMethod method, LocationSettingCb callback);
294 int location_get_nmea(LocationObject *obj, char **nmea_data);
299 int location_enable_mock(const int enable);
301 int location_set_mock_location(LocationObject *obj, const LocationPosition *position, const LocationVelocity *velocity, const LocationAccuracy *accuracy);
303 int location_clear_mock_location(LocationObject *obj);
305 int location_enable_restriction(const int enable);
313 #endif /* __LOCATION_H__ */