2 * Copyright (c) 2011-2013 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef __TIZEN_LOCATION_LOCATIONS_H__
18 #define __TIZEN_LOCATION_LOCATIONS_H__
20 #include <tizen_type.h>
21 #include <tizen_error.h>
23 #include <location_bounds.h>
30 * @addtogroup CAPI_LOCATION_MANAGER_MODULE
35 * @brief Enumerations of error code for Location manager.
39 LOCATIONS_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
40 LOCATIONS_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
41 LOCATIONS_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
42 LOCATIONS_ERROR_INCORRECT_METHOD = TIZEN_ERROR_LOCATION_CLASS | 0x01, /**< Location manager contains incorrect method for a given call */
43 LOCATIONS_ERROR_NETWORK_FAILED = TIZEN_ERROR_LOCATION_CLASS | 0x02, /**< Network unavailable */
44 LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE = TIZEN_ERROR_LOCATION_CLASS | 0x03, /**< Location service is not available */
45 LOCATIONS_ERROR_GPS_SETTING_OFF = TIZEN_ERROR_LOCATION_CLASS | 0x04, /**< GPS/WPS setting is not enabled */
46 LOCATIONS_ERROR_SECURITY_RESTRICTED = TIZEN_ERROR_LOCATION_CLASS | 0x05, /**< Restricted by security system policy */
47 LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED = TIZEN_ERROR_LOCATION_CLASS | 0x06, /**< Location service accessibility is not allowed */
51 * @brief Location method type.
55 LOCATIONS_METHOD_NONE=-1, /**< Undefined method. */
56 LOCATIONS_METHOD_HYBRID, /**< This method selects the best method available at the moment. */
57 LOCATIONS_METHOD_GPS, /**< This method uses Global Positioning System. */
58 LOCATIONS_METHOD_WPS, /**< This method uses Wifi Positioning System. */
59 LOCATIONS_METHOD_CPS /**< This method uses Cellular Positioning System. */
63 * @brief Approximate accuracy level of given information.
67 LOCATIONS_ACCURACY_NONE=0, /**< Invalid data. */
68 LOCATIONS_ACCURACY_COUNTRY, /**< Country accuracy level. */
69 LOCATIONS_ACCURACY_REGION, /**< Regional accuracy level. */
70 LOCATIONS_ACCURACY_LOCALITY, /**< Local accuracy level. */
71 LOCATIONS_ACCURACY_POSTALCODE, /**< Postal accuracy level. */
72 LOCATIONS_ACCURACY_STREET, /**< Street accuracy level. */
73 LOCATIONS_ACCURACY_DETAILED, /**< Detailed accuracy level. */
74 } location_accuracy_level_e;
77 * @brief Enumerations of the state of the location service.
81 LOCATIONS_SERVICE_DISABLED, /**< Service is disabled */
82 LOCATIONS_SERVICE_ENABLED /**< Service is enabled */
83 } location_service_state_e;
86 * @brief Enumerations of the location service accessibility state.
90 LOCATIONS_ACCESS_STATE_NONE, /**< Not determined yet */
91 LOCATIONS_ACCESS_STATE_DENIED, /**< Access denied */
92 LOCATIONS_ACCESS_STATE_ALLOWED, /**< Access authorized */
93 } location_accessibility_state_e;
96 * @brief The location manager handle.
98 typedef struct location_manager_s *location_manager_h;
107 * @addtogroup CAPI_LOCATION_MANAGER_MODULE
111 * @brief Called at defined interval with updated position information.
112 * @param[in] latitude The updated latitude [-90.0 ~ 90.0] (degrees)
113 * @param[in] longitude The updated longitude [-180.0 ~ 180.0] (degrees)
114 * @param[in] altitude The updated altitude (meters)
115 * @param[in] timestamp The timestamp (time when measurement took place or 0 if invalid)
116 * @param[in] user_data The user data passed from the call registration function
117 * @pre location_manager_start() will invoke this callback if you register this callback using location_manager_set_position_updated_cb()
118 * @see location_manager_start()
119 * @see location_manager_set_position_updated_cb()
121 typedef void(*location_position_updated_cb)(double latitude, double longitude, double altitude, time_t timestamp, void *user_data);
124 * @brief Called at defined interval with updated velocity information.
125 * @param[in] speed The updated speed (km/h)
126 * @param[in] direction The updated direction (in degrees from the north)
127 * @param[in] climb The updated climb (km/h)
128 * @param[in] timestamp The timestamp (time when measurement took place or 0 if invalid)
129 * @param[in] user_data The user data passed from the callback registration function
130 * @pre location_manager_start() will invoke this callback if you register this callback using location_manager_set_velocity_updated_cb()
131 * @see location_manager_start()
132 * @see location_manager_set_velocity_updated_cb()
134 typedef void(*location_velocity_updated_cb)(double speed, double direction, double climb, time_t timestamp, void *user_data);
137 * @brief Called when the state of location service is changed from enabled to disabled or vice versa.
138 * @param[in] state The service state
139 * @param[in] user_data The user data passed from the callback registration function
140 * @pre Either location_manager_start() or location_manager_stop() will invoke this callback if you register this callback using location_manager_set_service_state_changed_cb()
141 * @see location_manager_start()
142 * @see location_manager_stop()
143 * @see location_manager_set_service_state_changed_cb()
144 * @see #location_service_state_e
146 typedef void(*location_service_state_changed_cb)(location_service_state_e state, void *user_data);
149 * @brief Called when the user defined zones are entered or exited.
150 * @param[in] state The boundary state
151 * @param[in] latitude The updated latitude [-90.0 ~ 90.0] (degrees)
152 * @param[in] longitude The updated longitude [-180.0 ~ 180.0] (degrees)
153 * @param[in] altitude The updated altitude (meters)
154 * @param[in] timestamp The timestamp (time when measurement took place or 0 if invalid)
155 * @param[in] user_data The user data passed from the callback registration function
156 * @pre location_manager_start() will invoke this callback if you register this callback using location_manager_set_zone_changed_cb()
157 * @see #location_boundary_state_e
158 * @see location_manager_start()
159 * @see location_manager_set_zone_changed_cb()
161 typedef void(*location_zone_changed_cb)(location_boundary_state_e state, double latitude, double longitude, double altitude, time_t timestamp, void *user_data);
164 * @brief Gets called iteratively to notify you of location bounds.
165 * @param[in] bounds The location bounds handle
166 * @param[in] user_data The user data passed from the callback registration function
167 * @pre location_manager_foreach_boundary() will invoke this callback.
168 * @see location_manager_foreach_boundary()
170 typedef bool(*location_bounds_cb)(location_bounds_h bounds, void *user_data);
173 * @brief Checks whether the given location method is avaliable or not.
174 * @param[in] method The location method to be checked
175 * @return @c true if the specified location method is supported, \n else @c false
176 * @see location_manager_create()
177 * @see location_manager_get_method()
179 bool location_manager_is_supported_method(location_method_e method);
183 * @brief Creates a new location manager.
184 * @remarks @a manager must be released location_manager_destroy() by you.
185 * @param[in] method The location method
186 * @param[out] manager A location manager handle to be newly created on success
187 * @return 0 on success, otherwise a negative error value.
188 * @retval #LOCATIONS_ERROR_NONE Successful
189 * @retval #LOCATIONS_ERROR_OUT_OF_MEMORY Out of memory
190 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
191 * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
192 * @see location_manager_destroy()
194 int location_manager_create(location_method_e method, location_manager_h* manager);
197 * @brief Releases the location manager.
198 * @param[in] manager The location manager handle
199 * @return 0 on success, otherwise a negative error value.
200 * @retval #LOCATIONS_ERROR_NONE Successful
201 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
202 * @see location_manager_create()
204 int location_manager_destroy(location_manager_h manager);
207 * @brief Starts the location service.
209 * @remarks There is no limit on number of location managers for which this function was called.
211 * Calling this function invokes a location service event. When the location service is enabled, the service state change callback
212 * (set using #location_manager_set_service_state_changed_cb()) notifies the user with #LOCATIONS_SERVICE_ENABLED as
213 * the first argument, and the service starts. \n
215 * Started service is a requirement for calling these functions:
217 * location_manager_get_position(), location_manager_get_velocity(), location_manager_get_accuracy(),
218 * gps_status_get_nmea(), gps_status_get_satellite_count_in_view(), gps_status_foreach_satellites_in_view(), gps_status_get_active_satellite_count().
220 * Once you stop the service, using #location_manager_stop(), you can no longer call the functions listed above.
222 * Starting and stopping the service is in the scope of the given location manager only (if there's more than one manager,
223 * starting and stopping should be executed for each of them separately).
225 * @param[in] manager The location manager handle
226 * @return 0 on success, otherwise a negative error value.
227 * @retval #LOCATIONS_ERROR_NONE Successful
228 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
229 * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
230 * @retval #LOCATIONS_ERROR_NETWORK_FAILED Network failed
231 * @retval #LOCATIONS_ERROR_GPS_SETTING_OFF GPS is not enabled
232 * @post It invokes location_position_updated_cb(), location_velocity_updated_cb(), location_zone_changed_cb(), and location_service_state_changed_cb().
233 * @see location_manager_stop()
234 * @see location_manager_get_position()
235 * @see location_manager_get_velocity()
236 * @see location_manager_get_accuracy()
237 * @see location_manager_set_service_state_changed_cb()
238 * @see location_manager_set_position_updated_cb()
239 * @see location_position_updated_cb()
240 * @see location_manager_set_velocity_updated_cb()
241 * @see location_velocity_updated_cb()
242 * @see location_manager_set_zone_changed_cb()
243 * @see location_zone_changed_cb()
245 int location_manager_start(location_manager_h manager);
248 * @brief Stops the location service.
249 * @remarks This function initiates the process of stopping the service. When the process is finished, callback set using
250 * #location_manager_set_service_state_changed_cb() will be called, with #LOCATIONS_SERVICE_DISABLED as first argument.
251 * When that happens, the service is stopped and the user is notified.
253 * You can stop and start the location manager as needed.
255 * @param[in] manager The location manager handle
256 * @return 0 on success, otherwise a negative error value.
257 * @retval #LOCATIONS_ERROR_NONE Successful
258 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
259 * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
260 * @retval #LOCATIONS_ERROR_NETWORK_FAILED Network failed
261 * @see location_manager_start()
262 * @see location_manager_set_service_state_changed_cb()
263 * @see location_service_state_changed_cb()
265 int location_manager_stop(location_manager_h manager);
268 * @brief Adds a bounds for a given location manager.
269 * @param[in] manager The location manager handle
270 * @param[in] bounds The location bounds handle
271 * @return 0 on success, otherwise a negative error value.
272 * @retval #LOCATIONS_ERROR_NONE Successful
273 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
274 * @retval #LOCATIONS_ERROR_OUT_OF_MEMORY Out of memory
275 * @post It invokes location_manager_set_zone_changed_cb() when a boundary is entered or exited, if you set a callback with location_manager_set_zone_changed_cb().
276 * @see location_manager_remove_boundary()
277 * @see location_manager_set_zone_changed_cb()
278 * @see location_manager_is_boundary_contains_coordinate()
280 int location_manager_add_boundary(location_manager_h manager, const location_bounds_h bounds);
283 * @brief Deletes a bounds for a given location manager.
284 * @param[in] manager The location manager handle
285 * @param[in] bounds The location bounds handle
286 * @return 0 on success, otherwise a negative error value.
287 * @retval #LOCATIONS_ERROR_NONE Successful
288 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
289 * @retval #LOCATIONS_ERROR_OUT_OF_MEMORY Out of memory
290 * @see location_manager_add_boundary()
292 int location_manager_remove_boundary(location_manager_h manager, const location_bounds_h bounds);
295 * @brief Retrieves all location bounds by invoking a specific callback for each locatoin bounds
296 * @param[in] manager The location manager handle
297 * @param[in] callback The iteration callback
298 * @param[in] user_data The user data to be passed to the callback function
299 * @return 0 on success, otherwise a negative error value.
300 * @retval #LOCATIONS_ERROR_NONE Successful
301 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
302 * @post location_bounds_cb() will be invoked
303 * @see location_manager_add_boundary()
304 * @see location_manager_remove_boundary()
305 * @see location_bounds_cb()
307 int location_manager_foreach_boundary(location_manager_h manager, location_bounds_cb callback, void *user_data);
310 * @brief Gets the given location manager's method.
312 * @param[in] manager The location manager handle
313 * @param[out] method The location method
314 * @return 0 on success, otherwise a negative error value.
315 * @retval #LOCATIONS_ERROR_NONE Successful
316 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
317 * @see location_manager_create()
319 int location_manager_get_method(location_manager_h manager, location_method_e *method);
322 * @brief Gets the current position information.
324 * The result is current altitude, latitude, and longitude, with a measurement timestamp.
326 * If @a altitude is negative, only altitude and latitude are available (fix status is 2D).
327 * If @a altitude is positive, fix status is 3D and returned altitude value is the result of measurement.
329 * @param[in] manager The location manager handle
330 * @param[out] altitude The current altitude (meters)
331 * @param[out] latitude The current latitude [-90.0 ~ 90.0] (degrees)
332 * @param[out] longitude The current longitude [-180.0 ~ 180.0] (degrees)
333 * @param[out] timestamp The timestamp (time when measurement took place or 0 if valid)
334 * @return 0 on success, otherwise a negative error value.
335 * @retval #LOCATIONS_ERROR_NONE Successful
336 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
337 * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
338 * @retval #LOCATIONS_ERROR_GPS_SETTING_OFF GPS is not enabled
339 * @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start()
341 int location_manager_get_position(location_manager_h manager, double *altitude, double *latitude, double *longitude, time_t *timestamp);
344 * @brief Gets the current position information.
346 * The result is current altitude, latitude, longitude, climb, direction, speed, level, horizontal and verticalwith a measurement timestamp.
348 * If @a altitude is negative, only altitude and latitude are available (fix status is 2D).
349 * If @a altitude is positive, fix status is 3D and returned altitude value is the result of measurement.
351 * @param[in] manager The location manager handle
352 * @param[out] altitude The current altitude (meters)
353 * @param[out] latitude The current latitude [-90.0 ~ 90.0] (degrees)
354 * @param[out] longitude The current longitude [-180.0 ~ 180.0] (degrees)
355 * @param[out] climb The climb (km/h)
356 * @param[out] direction The direction, degrees from the north
357 * @param[out] speed The speed (km/h)
358 * @param[out] level The accuracy level
359 * @param[out] horizontal The horizontal accuracy (meters)
360 * @param[out] vertical The vertical accuracy (meters)
361 * @param[out] timestamp The timestamp (time when measurement took place or 0 if valid)
362 * @return 0 on success, otherwise a negative error value.
363 * @retval #LOCATIONS_ERROR_NONE Successful
364 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
365 * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
366 * @retval #LOCATIONS_ERROR_GPS_SETTING_OFF GPS is not enabled
367 * @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start()
369 int location_manager_get_location(location_manager_h manager, double *altitude, double *latitude, double *longitude, double *climb, double *direction, double *speed, location_accuracy_level_e *level, double *horizontal, double *vertical, time_t *timestamp);
372 * @brief Gets the current velocity information.
374 * The result is current climb, direction, and speed, with a measurement timestamp.
376 * @param[in] manager The location manager handle
377 * @param[out] climb The climb (km/h)
378 * @param[out] direction The direction, degrees from the north
379 * @param[out] speed The speed (km/h)
380 * @param[out] timestamp The timestamp (time when measurement took place or 0 if invalid)
381 * @return 0 on success, otherwise a negative error value.
382 * @retval #LOCATIONS_ERROR_NONE Successful
383 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
384 * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
385 * @retval #LOCATIONS_ERROR_GPS_SETTING_OFF GPS is not enabled
386 * @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start()
388 int location_manager_get_velocity(location_manager_h manager, double *climb, double *direction, double *speed, time_t *timestamp);
391 * @brief Gets the current accuracy information.
392 * @param[in] manager The location manager handle
393 * @param[out] level The accuracy level
394 * @param[out] horizontal The horizontal accuracy (meters)
395 * @param[out] vertical The vertical accuracy (meters)
396 * @return 0 on success, otherwise a negative error value.
397 * @retval #LOCATIONS_ERROR_NONE Successful
398 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
399 * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
400 * @retval #LOCATIONS_ERROR_GPS_SETTING_OFF GPS is not enabled
401 * @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start()
403 int location_manager_get_accuracy(location_manager_h manager, location_accuracy_level_e *level, double *horizontal, double *vertical);
406 * @brief Gets the last position information which is recorded.
407 * @details The @a altitude, @a latitude, @a longitude, and @c timestamp values should be 0, if there is no record of any previous position information.
408 * @details If @a altitude is negative, only altitude and latitude are available (fix status is 2D).
409 * @details If @a altitude is positive, fix status is 3D and returned altitude value is the result of measurement.
410 * @param[in] manager The location manager handle
411 * @param[out] altitude The last altitude (meters)
412 * @param[out] latitude The last latitude [-90.0 ~ 90.0] (degrees)
413 * @param[out] longitude The last longitude [-180.0 ~ 180.0] (degrees)
414 * @param[out] timestamp The timestamp (time when measurement took place or 0 if invalid)
415 * @return 0 on success, otherwise a negative error value.
416 * @retval #LOCATIONS_ERROR_NONE Successful
417 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
418 * @pre The location manager handle must be created by location_manager_create()
420 int location_manager_get_last_position(location_manager_h manager, double *altitude, double *latitude, double *longitude, time_t *timestamp);
423 * @brief Gets the last location information.
424 * @details The @a altitude, @a latitude, @a longitude, @a climb, @a direction, @a speed and @c timestamp values should be 0, if there is no record of any previous position information.
425 * @details If @a altitude is negative, only altitude and latitude are available (fix status is 2D).
426 * @details If @a altitude is positive, fix status is 3D and returned altitude value is the result of measurement.
427 * @param[in] manager The location manager handle
428 * @param[out] altitude The current altitude (meters)
429 * @param[out] latitude The current latitude [-90.0 ~ 90.0] (degrees)
430 * @param[out] longitude The current longitude [-180.0 ~ 180.0] (degrees)
431 * @param[out] climb The climb (km/h)
432 * @param[out] direction The direction, degrees from the north
433 * @param[out] speed The speed (km/h)
434 * @param[out] level The accuracy level
435 * @param[out] horizontal The horizontal accuracy (meters)
436 * @param[out] vertical The vertical accuracy (meters)
437 * @param[out] timestamp The timestamp (time when measurement took place or 0 if valid)
438 * @return 0 on success, otherwise a negative error value.
439 * @retval #LOCATIONS_ERROR_NONE Successful
440 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
441 * @pre The location manager handle must be created by location_manager_create()
443 int location_manager_get_last_location(location_manager_h manager, double *altitude, double *latitude, double *longitude, double *climb, double *direction, double *speed, location_accuracy_level_e *level, double *horizontal, double *vertical, time_t *timestamp);
447 * @brief Gets the last velocity information which is recorded.
449 * The @a climb, @a direction and @a speed values should be 0, if there is no record of any previous velocity information.
451 * @param[in] manager The location manager handle
452 * @param[out] climb The last climb (km/h)
453 * @param[out] direction The last direction, degrees from the north
454 * @param[out] speed The last speed (km/h)
455 * @param[out] timestamp The timestamp (time when measurement took place or 0 if invalid)
456 * @return 0 on success, otherwise a negative error value.
457 * @retval #LOCATIONS_ERROR_NONE Successful
458 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
459 * @pre The location manager handle must be created by location_manager_create()
461 int location_manager_get_last_velocity(location_manager_h manager, double *climb, double *direction, double *speed, time_t *timestamp);
464 * @brief Gets the last accuracy information which is recorded.
465 * @param[in] manager The location manager handle
466 * @param[out] level The last accuracy level
467 * @param[out] horizontal The last horizontal accuracy (meters)
468 * @param[out] vertical The last vertical accuracy (meters)
469 * @return 0 on success, otherwise a negative error value.
470 * @retval #LOCATIONS_ERROR_NONE Successful
471 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
472 * @pre The location manager handle must be created by location_manager_create()
474 int location_manager_get_last_accuracy(location_manager_h manager, location_accuracy_level_e *level, double *horizontal, double *vertical);
477 * @brief Gets the current application's location accessibility status.
478 * @param[in] manager The location manager handle
479 * @param[out] state The current location service accessibility status.
480 * @return 0 on success, otherwise a negative error value.
481 * @retval #LOCATIONS_ERROR_NONE Successful
482 * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
483 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
485 int location_manager_get_accessibility_state(location_accessibility_state_e* state);
488 * @brief Registers a callback function to be invoked at defined interval with updated position information.
490 * @param[in] manager The location manager handle
491 * @param[in] callback The callback function to register
492 * @param[in] interval The interval [1 ~ 120] (seconds)
493 * @param[in] user_data The user data to be passed to the callback function
494 * @return 0 on success, otherwise a negative error value.
495 * @retval #LOCATIONS_ERROR_NONE Successful
496 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
497 * @post location_position_updated_cb() will be invoked
498 * @see location_manager_unset_position_updated_cb()
499 * @see location_position_updated_cb()
501 int location_manager_set_position_updated_cb(location_manager_h manager, location_position_updated_cb callback, int interval, void *user_data);
504 * @brief Unregisters the callback function.
506 * @param[in] manager The location manager handle
507 * @return 0 on success, otherwise a negative error value.
508 * @retval #LOCATIONS_ERROR_NONE Successful
509 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
510 * @see location_manager_set_position_updated_cb()
512 int location_manager_unset_position_updated_cb(location_manager_h manager);
515 * @brief Registers a callback function to be invoked at defined interval with updated velocity information.
517 * @param[in] manager The location manager handle
518 * @param[in] callback The callback function to register
519 * @param[in] interval The interval [1 ~ 120] (seconds)
520 * @param[in] user_data The user data to be passed to the callback function
521 * @return 0 on success, otherwise a negative error value.
522 * @retval #LOCATIONS_ERROR_NONE Successful
523 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
524 * @post location_velocity_updated_cb() will be invoked
525 * @see location_manager_unset_velocity_updated_cb()
526 * @see location_velocity_updated_cb()
528 int location_manager_set_velocity_updated_cb(location_manager_h manager, location_velocity_updated_cb callback, int interval, void *user_data);
531 * @brief Unregisters the callback function.
533 * @param[in] manager The location manager handle
534 * @return 0 on success, otherwise a negative error value.
535 * @retval #LOCATIONS_ERROR_NONE Successful
536 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
537 * @see location_manager_set_velocity_updated_cb()
539 int location_manager_unset_velocity_updated_cb(location_manager_h manager);
542 * @brief Registers a callback function to be invoked when the location service state is changed.
544 * @param[in] manager The location manager handle
545 * @param[in] callback The callback function to register
546 * @param[in] user_data The user data to be passed to the callback function
547 * @return 0 on success, otherwise a negative error value.
548 * @retval #LOCATIONS_ERROR_NONE Successful
549 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
550 * @post location_service_state_changed_cb() will be invoked
551 * @see location_manager_unset_service_state_changed_cb()
552 * @see location_service_state_changed_cb()
553 * @see location_manager_start()
554 * @see location_manager_stop()
555 * @see #location_service_state_e
557 int location_manager_set_service_state_changed_cb(location_manager_h manager, location_service_state_changed_cb callback, void *user_data);
560 * @brief Unregisters the callback function.
561 * @param[in] manager The location manager handle
562 * @return 0 on success, otherwise a negative error value.
563 * @retval #LOCATIONS_ERROR_NONE Successful
564 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
565 * @see location_manager_set_service_state_changed_cb()
567 int location_manager_unset_service_state_changed_cb(location_manager_h manager);
570 * @brief Registers a callback function to be invoked when the previously set boundary area is entered or left.
572 * @param[in] manager The location manager handle
573 * @param[in] callback The callback function to register
574 * @param[in] user_data The user data to be passed to the callback function
575 * @return 0 on success, otherwise a negative error value.
576 * @retval #LOCATIONS_ERROR_NONE Successful
577 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
578 * @pre Either location_manager_set_boundary_rect() or location_manager_set_boundary_circle() is called before.
579 * @post location_zone_changed_cb() will be invoked
580 * @see location_manager_unset_zone_changed_cb()
581 * @see location_zone_changed_cb()
583 int location_manager_set_zone_changed_cb(location_manager_h manager, location_zone_changed_cb callback, void *user_data);
586 * @brief Unregisters the callback function.
587 * @param[in] manager The location manager handle
588 * @return 0 on success, otherwise a negative error value.
589 * @retval #LOCATIONS_ERROR_NONE Successful
590 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
591 * @see location_manager_set_zone_changed_cb()
593 int location_manager_unset_zone_changed_cb(location_manager_h manager);
596 * @brief Gets the distance in meters between two locations.
597 * @param[in] start_latitude The starting latitude [-90.0 ~ 90.0] (degrees)
598 * @param[in] start_longitude The starting longitude [-180.0 ~ 180.0] (degrees)
599 * @param[in] end_latitude The ending latitude [-90.0 ~ 90.0] (degrees)
600 * @param[in] end_longitude The ending longitude [-180.0 ~ 180.0] (degrees)
601 * @param[out] distance The distance between two locations (meters)
602 * @return 0 on success, otherwise a negative error value.
603 * @retval #LOCATIONS_ERROR_NONE Successful
604 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
606 int location_manager_get_distance(double start_latitude, double start_longitude, double end_latitude, double end_longitude, double *distance);
609 * @brief Sends command to the server.
610 * @param[in] cmd The command string to be sent
611 * @return 0 on success, otherwise a negative error value.
612 * @retval #LOCATIONS_ERROR_NONE Successful
613 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
615 int location_manager_send_command(const char *cmd);
622 * GPS Status & Satellites
626 * @addtogroup CAPI_LOCATION_GPS_STATUS_MODULE
631 * @brief Called once for each satellite in range.
632 * @param[in] azimuth The azimuth of the satellite (degrees)
633 * @param[in] elevation The elevation of the satellite (meters)
634 * @param[in] prn The PRN of the satellite
635 * @param[in] snr The SNR of the satellite [dB]
636 * @param[in] is_active The flag signaling if satellite is in use
637 * @param[in] user_data The user data passed from the foreach function
638 * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop
639 * @pre gps_status_foreach_satellites_in_view() will invoke this callback.
640 * @pre gps_status_foreach_last_satellites_in_view() will invoke this callback.
641 * @see gps_status_foreach_satellites_in_view()
643 typedef bool(*gps_status_get_satellites_cb)(unsigned int azimuth, unsigned int elevation, unsigned int prn, int snr, bool is_active, void *user_data);
646 * @brief Called at defined interval with updated satellite information.
647 * @param[out] num_of_active The last number of active satellites
648 * @param[out] num_of_inview The last number of satellites in view
649 * @param[out] timestamp The last timestamp (time when last measurement took place or 0 if invalid)
650 * @param[in] user_data The user data passed from the call registration function
651 * @pre location_manager_start() will invoke this callback if you register this callback using location_manager_set_position_updated_cb()
652 * @see location_manager_start()
653 * @see location_manager_set_position_updated_cb()
655 typedef void(*gps_status_satellite_updated_cb)(int num_of_active, int num_of_inview, time_t timestamp, void *user_data);
658 * @brief Gets the GPS NMEA data.
659 * @remarks This call is valid only for location managers with #LOCATIONS_METHOD_GPS method.\n
660 * @a nmea must be released with @c free() by you.
661 * @param[in] manager The location manager handle
662 * @param[out] nmea The NMEA data
663 * @return 0 on success, otherwise a negative error value.
664 * @retval #LOCATIONS_ERROR_NONE Successful
665 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
666 * @retval #LOCATIONS_ERROR_INCORRECT_METHOD Incorrect method
667 * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
668 * @retval #LOCATIONS_ERROR_OUT_OF_MEMORY Out of memory
669 * @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start()
670 * @see location_manager_start()
672 int gps_status_get_nmea(location_manager_h manager, char **nmea);
675 * @brief Gets the information of satellites.
676 * @remarks This call is valid only for location managers with #LOCATIONS_METHOD_GPS method.
677 * @param[in] manager The location manager handle
678 * @param[out] num_of_active The number of active satellites
679 * @param[out] num_of_inview The number of satellites in view
680 * @param[out] timestamp The timestamp (time when measurement took place or 0 if invalid)
681 * @return 0 on success, otherwise a negative error value.
682 * @retval #LOCATIONS_ERROR_NONE Successful
683 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
684 * @retval #LOCATIONS_ERROR_INCORRECT_METHOD Incorrect method
685 * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
686 * @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start()
687 * @see gps_status_foreach_satellites_in_view()
689 int gps_status_get_satellite(location_manager_h manager, int *num_of_active, int *num_of_inview, time_t *timestamp);
692 * @brief Registers a callback function to be invoked at defined interval with updated satellite information.
694 * @param[in] manager The location manager handle
695 * @param[in] callback The callback function to register
696 * @param[in] interval The interval [1 ~ 120] (seconds)
697 * @param[in] user_data The user data to be passed to the callback function
698 * @return 0 on success, otherwise a negative error value.
699 * @retval #LOCATIONS_ERROR_NONE Successful
700 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
701 * @post gps_status_satellite_updated_cb() will be invoked
702 * @see gps_status_unset_satellite_updated_cb()
703 * @see gps_status_satellite_updated_cb()
705 int gps_status_set_satellite_updated_cb(location_manager_h manager, gps_status_satellite_updated_cb callback, int interval, void *user_data);
708 * @brief Unregisters the callback function.
710 * @param[in] manager The location manager handle
711 * @return 0 on success, otherwise a negative error value.
712 * @retval #LOCATIONS_ERROR_NONE Successful
713 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
714 * @see gps_status_set_satellite_updated_cb()
716 int gps_status_unset_satellite_updated_cb(location_manager_h manager);
719 * @brief Invokes the callback function for each satellite.
720 * @remarks This function is valid only for location managers with the #LOCATIONS_METHOD_GPS method.
721 * @param[in] manager The location manager handle
722 * @param[in] callback The iteration callback function
723 * @param[in] user_data The user data to be passed to the callback function
724 * @return 0 on success, otherwise a negative error value.
725 * @retval #LOCATIONS_ERROR_NONE Successful
726 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
727 * @retval #LOCATIONS_ERROR_INCORRECT_METHOD Incorrect method
728 * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
729 * @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start()
730 * @post It invokes gps_status_get_satellites_cb().
731 * @see gps_status_get_satellite()
732 * @see gps_status_get_satellites_cb()
734 int gps_status_foreach_satellites_in_view (location_manager_h manager, gps_status_get_satellites_cb callback, void *user_data);
737 * @brief Gets the last information of satellites.
738 * @remarks This call is valid only for location managers with #LOCATIONS_METHOD_GPS method.
739 * @param[in] manager The location manager handle
740 * @param[out] num_of_active The last number of active satellites
741 * @param[out] num_of_inview The last number of satellites in view
742 * @param[out] timestamp The last timestamp (time when last measurement took place or 0 if invalid)
743 * @return 0 on success, otherwise a negative error value.
744 * @retval #LOCATIONS_ERROR_NONE Successful
745 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
746 * @retval #LOCATIONS_ERROR_INCORRECT_METHOD Incorrect method
747 * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
748 * @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start()
749 * @see gps_status_foreach_satellites_in_view()
751 int gps_status_get_last_satellite(location_manager_h manager, int *num_of_active, int *num_of_inview, time_t *timestamp);
754 * @brief Invokes the callback function for each last satellite which is recorded.
755 * @remarks This function is valid only for location managers with the #LOCATIONS_METHOD_GPS method.
756 * @param[in] manager The location manager handle
757 * @param[in] callback The iteration callback function
758 * @param[in] user_data The user data to be passed to the callback function
759 * @return 0 on success, otherwise a negative error value.
760 * @retval #LOCATIONS_ERROR_NONE Successful
761 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
762 * @retval #LOCATIONS_ERROR_INCORRECT_METHOD Incorrect method
763 * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
764 * @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start()
765 * @post It invokes gps_status_get_satellites_cb().
766 * @see gps_status_get_last_satellite()
767 * @see gps_status_get_satellites_cb()
769 int gps_status_foreach_last_satellites_in_view(location_manager_h manager, gps_status_get_satellites_cb callback, void *user_data);
778 #endif /* __TIZEN_LOCATION_LOCATIONS_H__ */