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__
21 #include <tizen_type.h>
22 #include <tizen_error.h>
24 #include <location_bounds.h>
32 * @addtogroup CAPI_LOCATION_MANAGER_MODULE
38 * @brief Enumeration for error code for Location manager.
39 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
42 LOCATIONS_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
43 LOCATIONS_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
44 LOCATIONS_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
45 LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
46 LOCATIONS_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported */
47 LOCATIONS_ERROR_INCORRECT_METHOD = TIZEN_ERROR_LOCATION_MANAGER | 0x01, /**< Location manager contains incorrect method for a given call */
48 LOCATIONS_ERROR_NETWORK_FAILED = TIZEN_ERROR_LOCATION_MANAGER | 0x02, /**< Network unavailable */
49 LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE = TIZEN_ERROR_LOCATION_MANAGER | 0x03, /**< Location service is not available */
50 LOCATIONS_ERROR_GPS_SETTING_OFF = TIZEN_ERROR_LOCATION_MANAGER | 0x04, /**< Setting for GPS, WPS, or MOCK is turned off */
51 LOCATIONS_ERROR_SECURITY_RESTRICTED = TIZEN_ERROR_LOCATION_MANAGER | 0x05, /**< Restricted by security system policy */
52 LOCATIONS_ERROR_SETTING_OFF = LOCATIONS_ERROR_GPS_SETTING_OFF, /**< Setting for GPS, WPS, or MOCK is turned off (Since 3.0) */
57 * @brief Enumeration for Location method type.
58 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
61 LOCATIONS_METHOD_NONE = -1, /**< Undefined method */
62 LOCATIONS_METHOD_HYBRID, /**< This method selects the best method available at the moment */
63 LOCATIONS_METHOD_GPS, /**< This method uses Global Positioning System */
64 LOCATIONS_METHOD_WPS, /**< This method uses WiFi Positioning System */
65 LOCATIONS_METHOD_PASSIVE, /**< This method can be used to passively receive location updates without power consumption (Since 3.0)*/
66 LOCATIONS_METHOD_FUSED, /**< This method uses Fused location (Since 4.0) */
71 * @brief Enumeration for Approximate accuracy level of given information.
72 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
75 LOCATIONS_ACCURACY_NONE = 0, /**< Invalid data */
76 LOCATIONS_ACCURACY_COUNTRY, /**< Country accuracy level */
77 LOCATIONS_ACCURACY_REGION, /**< Regional accuracy level */
78 LOCATIONS_ACCURACY_LOCALITY, /**< Local accuracy level */
79 LOCATIONS_ACCURACY_POSTALCODE, /**< Postal accuracy level */
80 LOCATIONS_ACCURACY_STREET, /**< Street accuracy level */
81 LOCATIONS_ACCURACY_DETAILED, /**< Detailed accuracy level */
82 } location_accuracy_level_e;
86 * @brief Enumeration for the state of the location service.
87 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
90 LOCATIONS_SERVICE_DISABLED, /**< Service is disabled */
91 LOCATIONS_SERVICE_ENABLED, /**< Service is enabled */
92 } location_service_state_e;
96 * @deprecated Deprecated since 3.0
97 * @brief Enumeration for the location service accessibility state.
98 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
101 LOCATIONS_ACCESS_STATE_NONE, /**< Access state is not determined */
102 LOCATIONS_ACCESS_STATE_DENIED, /**< Access denied */
103 LOCATIONS_ACCESS_STATE_ALLOWED, /**< Access authorized */
104 } location_accessibility_state_e;
107 * @brief Enumeration for the fused location service.
111 LOCATIONS_FUSED_HIGH_ACCURACY = 0, /**< High accuracy */
112 LOCATIONS_FUSED_BALANCED_POWER, /**< Balanced power */
113 } location_fused_mode_e;
116 * @brief The location manager handle.
117 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
119 typedef struct location_manager_s *location_manager_h;
131 * @addtogroup CAPI_LOCATION_MANAGER_MODULE
137 * @brief Called at defined interval with updated position information.
138 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
139 * @param[in] latitude The updated latitude [-90.0 ~ 90.0] (degrees)
140 * @param[in] longitude The updated longitude [-180.0 ~ 180.0] (degrees)
141 * @param[in] altitude The updated altitude (meters)
142 * @param[in] timestamp The timestamp (time when measurement took place or @c 0 if valid)
143 * @param[in] user_data The user data passed from the call registration function
144 * @pre location_manager_start() will invoke this callback if you register this callback using location_manager_set_position_updated_cb().
145 * @see location_manager_start()
146 * @see location_manager_set_position_updated_cb()
148 typedef void(*location_position_updated_cb)(double latitude, double longitude, double altitude, time_t timestamp, void *user_data);
152 * @brief Called at defined interval with updated velocity information.
153 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
154 * @param[in] speed The updated speed (km/h)
155 * @param[in] direction The updated direction (in degrees from the north)
156 * @param[in] climb The updated climb (km/h)
157 * @param[in] timestamp The timestamp (time when measurement took place or @c 0 if valid)
158 * @param[in] user_data The user data passed from the callback registration function
159 * @pre location_manager_start() will invoke this callback if you register this callback using location_manager_set_velocity_updated_cb().
160 * @see location_manager_start()
161 * @see location_manager_set_velocity_updated_cb()
163 typedef void(*location_velocity_updated_cb)(double speed, double direction, double climb, time_t timestamp, void *user_data);
167 * @brief Called at defined interval with updated location information.
168 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
169 * @param[in] error #LOCATIONS_ERROR_NONE Successful
170 * @param[in] latitude The updated latitude [-90.0 ~ 90.0] (degrees)
171 * @param[in] longitude The updated longitude [-180.0 ~ 180.0] (degrees)
172 * @param[in] altitude The updated altitude (meters)
173 * @param[in] timestamp The timestamp (time when measurement took place or @c 0 if valid)
174 * @param[in] speed The updated speed (km/h)
175 * @param[in] direction The updated direction (in degrees from the north)
176 * @param[in] climb The updated climb (km/h)
177 * @param[in] user_data The user data passed from the callback registration function
178 * @pre location_manager_request_single_location() will invoke this callback.
179 * @see location_manager_request_single_location()
181 typedef void(*location_updated_cb)(location_error_e error, double latitude, double longitude, double altitude, time_t timestamp, double speed, double direction, double climb, void *user_data);
185 * @brief Called when the state of location service is changed from enabled to disabled or vice versa.
186 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
187 * @param[in] state The service state
188 * @param[in] user_data The user data passed from the callback registration function
189 * @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().
190 * @see location_manager_start()
191 * @see location_manager_stop()
192 * @see location_manager_set_service_state_changed_cb()
193 * @see #location_service_state_e
195 typedef void(*location_service_state_changed_cb)(location_service_state_e state, void *user_data);
199 * @brief Called when the user-defined zones are entered or exited.
200 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
201 * @param[in] state The boundary state
202 * @param[in] latitude The updated latitude [-90.0 ~ 90.0] (degrees)
203 * @param[in] longitude The updated longitude [-180.0 ~ 180.0] (degrees)
204 * @param[in] altitude The updated altitude (meters)
205 * @param[in] timestamp The timestamp (time when measurement took place or @c 0 if valid)
206 * @param[in] user_data The user data passed from the callback registration function
207 * @pre location_manager_start() will invoke this callback if you register this callback using location_manager_set_zone_changed_cb().
208 * @see #location_boundary_state_e
209 * @see location_manager_start()
210 * @see location_manager_set_zone_changed_cb()
212 typedef void(*location_zone_changed_cb)(location_boundary_state_e state, double latitude, double longitude, double altitude, time_t timestamp, void *user_data);
216 * @brief Called when the state of location method is changed.
217 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
218 * @param[in] method The method changed on setting
219 * @param[in] enable The setting value changed
220 * @param[in] user_data The user data passed from the callback registration function
221 * @pre location_setting_changed_cb() will invoke this callback if you register this callback using location_manager_set_setting_changed_cb().
222 * @see location_manager_set_setting_changed_cb()
223 * @see location_manager_unset_setting_changed_cb()
225 typedef void(*location_setting_changed_cb)(location_method_e method, bool enable, void *user_data);
229 * @brief Called once for each location bound.
230 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
231 * @param[in] bounds The location bounds handle
232 * @param[in] user_data The user data passed from the callback registration function
233 * @return @c true to continue with the next iteration of the loop,
234 * otherwise @c false to break out of the loop
235 * @pre location_manager_foreach_boundary() will invoke this callback.
236 * @see location_manager_foreach_boundary()
238 typedef bool(*location_bounds_cb)(location_bounds_h bounds, void *user_data);
242 * @brief Called at defined interval with updated location information.
243 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
244 * @param[in] latitude The updated latitude [-90.0 ~ 90.0] (degrees)
245 * @param[in] longitude The updated longitude [-180.0 ~ 180.0] (degrees)
246 * @param[in] altitude The updated altitude (meters)
247 * @param[in] speed The updated speed (km/h)
248 * @param[in] direction The updated direction (in degrees from the north)
249 * @param[in] horizontal_accuracy The horizontal accuracy (meters)
250 * @param[in] timestamp The timestamp (time when measurement took place or @c 0 if valid)
251 * @param[in] user_data The user data passed from the callback registration function
252 * @pre location_manager_start() will invoke this callback if you register this callback using location_manager_set_position_updated_cb().
253 * @see location_manager_start()
254 * @see location_manager_set_distance_based_location_changed_cb()
255 * @see location_manager_set_location_changed_cb()
257 typedef void(*location_changed_cb)(double latitude, double longitude, double altitude, double speed, double direction, double horizontal_accuracy, time_t timestamp, void *user_data);
261 * @brief Called when the batch interval is expired.
262 * @since_tizen @if MOBILE 3.0 @elseif WEARABLE 2.3.2 @endif
263 * @param[in] num_of_location The number of location batch data
264 * @param[in] user_data The user data passed from the callback registration function
265 * @pre location_manager_start_batch() will invoke this callback if you register this callback using location_manager_set_location_batch_cb().
266 * @see location_manager_start_batch()
267 * @see location_manager_set_location_batch_cb()
269 typedef void(*location_batch_cb)(int num_of_location, void *user_data);
273 * @brief Gets iteratively to receive location batch data.
274 * @since_tizen @if MOBILE 3.0 @elseif WEARABLE 2.3.2 @endif
275 * @param[in] latitude The updated latitude [-90.0 ~ 90.0] (degrees)
276 * @param[in] longitude The updated longitude [-180.0 ~ 180.0] (degrees)
277 * @param[in] altitude The updated altitude (meters)
278 * @param[in] speed The updated speed (km/h)
279 * @param[in] direction The updated direction (in degrees from the north)
280 * @param[in] horizontal The horizontal accuracy (meters)
281 * @param[in] vertical The vertical accuracy (meters)
282 * @param[in] timestamp The timestamp (time when measurement took place or @c 0 if valid)
283 * @param[in] user_data The user data passed from the callback registration function
284 * @return @c true to continue with the next iteration of the loop,
285 * otherwise @c false to break out of the loop
286 * @pre location_manager_foreach_location_batch() will invoke this callback.
287 * @see location_manager_foreach_location_batch()
289 typedef bool(*location_batch_get_location_cb)(double latitude, double longitude, double altitude, double speed, double direction, double horizontal, double vertical, time_t timestamp, void *user_data);
293 * @brief Checks whether the given location method is available.
294 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
295 * @remark The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
296 * @param[in] method The location method to be checked
297 * @return @c true if the specified location method is supported,
298 * otherwise @c false if it is not available
299 * @retval #LOCATIONS_ERROR_NONE Successful
300 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
301 * @retval #LOCATIONS_ERROR_INCORRECT_METHOD Incorrect method
302 * @see location_manager_create()
303 * @see location_manager_get_method()
305 bool location_manager_is_supported_method(location_method_e method);
309 * @brief Checks whether the given location method is enabled or not on setting.
310 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
311 * @param[in] method The location method to be checked
312 * @param[out] enable The result value of checking the given location method
313 * @return @c 0 on success,
314 * otherwise a negative error value
315 * @retval #LOCATIONS_ERROR_NONE Successful
316 * @retval #LOCATIONS_ERROR_INCORRECT_METHOD Incorrect method
317 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
318 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
319 * @see location_manager_create()
320 * @see location_manager_set_setting_changed_cb()
321 * @see location_manager_unset_setting_changed_cb()
323 int location_manager_is_enabled_method(location_method_e method, bool *enable);
328 * @brief Enables the given location method.
330 * @privlevel platform
331 * @privilege %http://tizen.org/privilege/location.enable
332 * @param[in] method The location method to be checked
333 * @param[in] enable The value to set
334 * @return @c 0 on success,
335 * otherwise a negative error value
336 * @retval #LOCATIONS_ERROR_NONE Successful
337 * @retval #LOCATIONS_ERROR_INCORRECT_METHOD Incorrect method
338 * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED Permission denied
339 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
340 * @see location_manager_is_enabled_method()
341 * @see location_manager_create()
343 int location_manager_enable_method(const location_method_e method, const bool enable);
347 * @brief Creates a new location manager.
348 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
349 * @remarks You must release @a manager using location_manager_destroy().
350 * @param[in] method The location method
351 * @param[out] manager The location manager handle that is newly created
352 * @return @c 0 on success,
353 * otherwise a negative error value
354 * @retval #LOCATIONS_ERROR_NONE Successful
355 * @retval #LOCATIONS_ERROR_OUT_OF_MEMORY Out of memory
356 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
357 * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
358 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
359 * @see location_manager_destroy()
361 int location_manager_create(location_method_e method, location_manager_h *manager);
365 * @brief Releases the location manager.
366 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
367 * @param[in] manager The location manager handle
368 * @return @c 0 on success,
369 * otherwise a negative error value
370 * @retval #LOCATIONS_ERROR_NONE Successful
371 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
372 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
373 * @see location_manager_create()
375 int location_manager_destroy(location_manager_h manager);
379 * @brief Requests to update current location once.
380 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
382 * @privilege %http://tizen.org/privilege/location
383 * @remarks Do not request to start the location service using the same manager handler.
384 * Calling this function invokes a location service event. When the location service is updated, location_updated_cb.
385 * @param[in] manager The location manager handle
386 * @param[in] timeout Timeout to stop requesting single location after
387 * @param[in] callback The location callback function to register
388 * @param[in] user_data The user data to be passed to the callback function
389 * @retval #LOCATIONS_ERROR_NONE Successful
390 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
391 * @retval #LOCATIONS_ERROR_INCORRECT_METHOD Incorrect method
392 * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
393 * @retval #LOCATIONS_ERROR_NETWORK_FAILED Network failed
394 * @retval #LOCATIONS_ERROR_GPS_SETTING_OFF GPS is not enabled
395 * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
396 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
397 * @post It invokes location_updated_cb().
399 int location_manager_request_single_location(location_manager_h manager, int timeout, location_updated_cb callback, void *user_data);
403 * @brief Starts the location service.
404 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
406 * @privilege %http://tizen.org/privilege/location
407 * @remarks There is no limit on number of location managers for which this function was called.
408 * @remarks Calling this function invokes a location service event. When the location service is enabled, the service state change callback
409 * (set using location_manager_set_service_state_changed_cb()) notifies the user with #LOCATIONS_SERVICE_ENABLED as
410 * the first argument, and the service starts.
411 * @remarks The started service is a requirement for calling these functions:
412 * location_manager_get_position(), location_manager_get_velocity(), location_manager_get_accuracy(),
413 * gps_status_get_nmea(), gps_status_get_satellite(), gps_status_foreach_satellites_in_view().
414 * @remarks Once you stop the service using location_manager_stop(), you can no longer call the functions listed above.
415 * @remarks Starting and stopping the service is in the scope of the given location manager only (if there is more than one manager,
416 * starting and stopping should be executed for each of them separately).
417 * @param[in] manager The location manager handle
418 * @return @c 0 on success,
419 * otherwise a negative error value
420 * @retval #LOCATIONS_ERROR_NONE Successful
421 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
422 * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
423 * @retval #LOCATIONS_ERROR_NETWORK_FAILED Network failed
424 * @retval #LOCATIONS_ERROR_GPS_SETTING_OFF GPS is not enabled
425 * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
426 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
427 * @post It invokes location_position_updated_cb(), location_velocity_updated_cb(), location_zone_changed_cb(), and location_service_state_changed_cb().
428 * @see location_manager_stop()
429 * @see location_manager_get_position()
430 * @see location_manager_get_velocity()
431 * @see location_manager_get_accuracy()
432 * @see location_manager_set_service_state_changed_cb()
433 * @see location_manager_set_position_updated_cb()
434 * @see location_position_updated_cb()
435 * @see location_manager_set_velocity_updated_cb()
436 * @see location_velocity_updated_cb()
437 * @see location_manager_set_zone_changed_cb()
438 * @see location_zone_changed_cb()
440 int location_manager_start(location_manager_h manager);
444 * @brief Stops the location service.
445 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
446 * @remarks This function initiates the process of stopping the service. When the process is finished, callback set using
447 * #location_manager_set_service_state_changed_cb() will be called, with #LOCATIONS_SERVICE_DISABLED as first argument.
448 * When that happens, the service is stopped and the user is notified.
449 * @remarks You can stop and start the location manager as needed.
450 * @param[in] manager The location manager handle
451 * @return @c 0 on success,
452 * otherwise a negative error value
453 * @retval #LOCATIONS_ERROR_NONE Successful
454 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
455 * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
456 * @retval #LOCATIONS_ERROR_NETWORK_FAILED Network failed
457 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
458 * @see location_manager_start()
459 * @see location_manager_set_service_state_changed_cb()
460 * @see location_service_state_changed_cb()
462 int location_manager_stop(location_manager_h manager);
466 * @brief Adds bounds for a given location manager.
467 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
468 * @param[in] manager The location manager handle
469 * @param[in] bounds The location bounds handle
470 * @return @c 0 on success,
471 * otherwise a negative error value
472 * @retval #LOCATIONS_ERROR_NONE Successful
473 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
474 * @retval #LOCATIONS_ERROR_OUT_OF_MEMORY Out of memory
475 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
476 * @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().
477 * @see location_manager_remove_boundary()
478 * @see location_manager_set_zone_changed_cb()
480 int location_manager_add_boundary(location_manager_h manager, const location_bounds_h bounds);
484 * @brief Deletes bounds for a given location manager.
485 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
486 * @param[in] manager The location manager handle
487 * @param[in] bounds The location bounds handle
488 * @return @c 0 on success,
489 * otherwise a negative error value
490 * @retval #LOCATIONS_ERROR_NONE Successful
491 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
492 * @retval #LOCATIONS_ERROR_OUT_OF_MEMORY Out of memory
493 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
494 * @see location_manager_add_boundary()
496 int location_manager_remove_boundary(location_manager_h manager, const location_bounds_h bounds);
500 * @brief Retrieves all location bounds by invoking a specific callback for each location bounds
501 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
502 * @param[in] manager The location manager handle
503 * @param[in] callback The iteration callback
504 * @param[in] user_data The user data to be passed to the callback function
505 * @return @c 0 on success,
506 * otherwise a negative error value
507 * @retval #LOCATIONS_ERROR_NONE Successful
508 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
509 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
510 * @post location_bounds_cb() will be invoked.
511 * @see location_manager_add_boundary()
512 * @see location_manager_remove_boundary()
513 * @see location_bounds_cb()
515 int location_manager_foreach_boundary(location_manager_h manager, location_bounds_cb callback, void *user_data);
519 * @brief Gets the given location manager's method.
520 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
521 * @param[in] manager The location manager handle
522 * @param[out] method The location method
523 * @return @c 0 on success,
524 * otherwise a negative error value
525 * @retval #LOCATIONS_ERROR_NONE Successful
526 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
527 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
528 * @see location_manager_create()
530 int location_manager_get_method(location_manager_h manager, location_method_e *method);
534 * @brief Gets the current position information.
535 * @details The result contains the current altitude, latitude, and longitude with a measurement timestamp.
536 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
538 * @privilege %http://tizen.org/privilege/location
539 * @param[in] manager The location manager handle
540 * @param[out] altitude The current altitude (meters)
541 * @param[out] latitude The current latitude [-90.0 ~ 90.0] (degrees)
542 * @param[out] longitude The current longitude [-180.0 ~ 180.0] (degrees)
543 * @param[out] timestamp The timestamp (time when measurement took place or @c 0 if valid)
544 * @return @c 0 on success,
545 * otherwise a negative error value
546 * @retval #LOCATIONS_ERROR_NONE Successful
547 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
548 * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
549 * @retval #LOCATIONS_ERROR_GPS_SETTING_OFF GPS is not enabled
550 * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
551 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
552 * @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start().
554 int location_manager_get_position(location_manager_h manager, double *altitude, double *latitude, double *longitude, time_t *timestamp);
558 * @brief Gets the current position information.
559 * @details The result contains the current altitude, latitude, longitude, climb, direction, speed, level, horizontal, and vertical with a measurement timestamp.
560 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
562 * @privilege %http://tizen.org/privilege/location
563 * @param[in] manager The location manager handle
564 * @param[out] altitude The current altitude (meters)
565 * @param[out] latitude The current latitude [-90.0 ~ 90.0] (degrees)
566 * @param[out] longitude The current longitude [-180.0 ~ 180.0] (degrees)
567 * @param[out] climb The climb (km/h)
568 * @param[out] direction The direction, degrees from the north
569 * @param[out] speed The speed (km/h)
570 * @param[out] level The accuracy level
571 * @param[out] horizontal The horizontal accuracy (meters)
572 * @param[out] vertical The vertical accuracy (meters)
573 * @param[out] timestamp The timestamp (time when measurement took place or @c 0 if valid)
574 * @return @c 0 on success,
575 * otherwise a negative error value
576 * @retval #LOCATIONS_ERROR_NONE Successful
577 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
578 * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
579 * @retval #LOCATIONS_ERROR_GPS_SETTING_OFF GPS is not enabled
580 * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
581 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
582 * @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start().
584 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);
588 * @brief Gets the current velocity information.
589 * @details The result contains the current climb, direction, and speed with a measurement timestamp.
590 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
592 * @privilege %http://tizen.org/privilege/location
593 * @param[in] manager The location manager handle
594 * @param[out] climb The climb (km/h)
595 * @param[out] direction The direction, degrees from the north
596 * @param[out] speed The speed (km/h)
597 * @param[out] timestamp The timestamp (time when measurement took place or @c 0 if valid)
598 * @return @c 0 on success,
599 * otherwise a negative error value
600 * @retval #LOCATIONS_ERROR_NONE Successful
601 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
602 * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
603 * @retval #LOCATIONS_ERROR_GPS_SETTING_OFF GPS is not enabled
604 * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
605 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
606 * @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start().
608 int location_manager_get_velocity(location_manager_h manager, double *climb, double *direction, double *speed, time_t *timestamp);
612 * @brief Gets the current accuracy information.
613 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
615 * @privilege %http://tizen.org/privilege/location
616 * @param[in] manager The location manager handle
617 * @param[out] level The accuracy level
618 * @param[out] horizontal The horizontal accuracy (meters)
619 * @param[out] vertical The vertical accuracy (meters)
620 * @return @c 0 on success,
621 * otherwise a negative error value
622 * @retval #LOCATIONS_ERROR_NONE Successful
623 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
624 * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
625 * @retval #LOCATIONS_ERROR_GPS_SETTING_OFF GPS is not enabled
626 * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
627 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
628 * @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start().
630 int location_manager_get_accuracy(location_manager_h manager, location_accuracy_level_e *level, double *horizontal, double *vertical);
634 * @brief Gets the last position information which is recorded.
635 * @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.
636 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
638 * @privilege %http://tizen.org/privilege/location
639 * @param[in] manager The location manager handle
640 * @param[out] altitude The last altitude (meters)
641 * @param[out] latitude The last latitude [-90.0 ~ 90.0] (degrees)
642 * @param[out] longitude The last longitude [-180.0 ~ 180.0] (degrees)
643 * @param[out] timestamp The timestamp (time when measurement took place or @c 0 if valid)
644 * @return @c 0 on success,
645 * otherwise a negative error value
646 * @retval #LOCATIONS_ERROR_NONE Successful
647 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
648 * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
649 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
650 * @pre The location manager handle must be created by location_manager_create().
652 int location_manager_get_last_position(location_manager_h manager, double *altitude, double *latitude, double *longitude, time_t *timestamp);
656 * @brief Gets the last location information.
657 * @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.
658 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
660 * @privilege %http://tizen.org/privilege/location
661 * @param[in] manager The location manager handle
662 * @param[out] altitude The current altitude (meters)
663 * @param[out] latitude The current latitude [-90.0 ~ 90.0] (degrees)
664 * @param[out] longitude The current longitude [-180.0 ~ 180.0] (degrees)
665 * @param[out] climb The climb (km/h)
666 * @param[out] direction The direction, degrees from the north
667 * @param[out] speed The speed (km/h)
668 * @param[out] level The accuracy level
669 * @param[out] horizontal The horizontal accuracy (meters)
670 * @param[out] vertical The vertical accuracy (meters)
671 * @param[out] timestamp The timestamp (time when measurement took place or @c 0 if valid)
672 * @return @c 0 on success,
673 * otherwise a negative error value
674 * @retval #LOCATIONS_ERROR_NONE Successful
675 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
676 * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
677 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
678 * @pre The location manager handle must be created by location_manager_create().
680 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);
684 * @brief Gets the last velocity information which is recorded.
685 * @details The @a climb, @a direction, and @a speed values should be @c 0, if there is no record of any previous velocity information.
686 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
688 * @privilege %http://tizen.org/privilege/location
689 * @param[in] manager The location manager handle
690 * @param[out] climb The last climb (km/h)
691 * @param[out] direction The last direction, degrees from the north
692 * @param[out] speed The last speed (km/h)
693 * @param[out] timestamp The timestamp (time when measurement took place or @c 0 if valid)
694 * @return @c 0 on success,
695 * otherwise a negative error value
696 * @retval #LOCATIONS_ERROR_NONE Successful
697 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
698 * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
699 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
700 * @pre The location manager handle must be created by location_manager_create().
702 int location_manager_get_last_velocity(location_manager_h manager, double *climb, double *direction, double *speed, time_t *timestamp);
706 * @brief Gets the last accuracy information which is recorded.
707 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
709 * @privilege %http://tizen.org/privilege/location
710 * @param[in] manager The location manager handle
711 * @param[out] level The last accuracy level
712 * @param[out] horizontal The last horizontal accuracy (meters)
713 * @param[out] vertical The last vertical accuracy (meters)
714 * @return @c 0 on success,
715 * otherwise a negative error value
716 * @retval #LOCATIONS_ERROR_NONE Successful
717 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
718 * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
719 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
720 * @pre The location manager handle must be created by location_manager_create().
722 int location_manager_get_last_accuracy(location_manager_h manager, location_accuracy_level_e *level, double *horizontal, double *vertical);
726 * @deprecated Deprecated since 3.0
727 * @brief Gets the current application's location accessibility status.
728 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
729 * @param[out] state The current location service accessibility status
730 * @return @c 0 on success,
731 * otherwise a negative error value
732 * @retval #LOCATIONS_ERROR_NONE Successful
733 * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
734 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
735 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
737 int location_manager_get_accessibility_state(location_accessibility_state_e *state) TIZEN_DEPRECATED_API;
741 * @brief Registers a callback function to be invoked at defined interval with updated position information.
742 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
743 * @param[in] manager The location manager handle
744 * @param[in] callback The callback function to register
745 * @param[in] interval The interval [1 ~ 120] (seconds)
746 * @param[in] user_data The user data to be passed to the callback function
747 * @return @c 0 on success,
748 * otherwise a negative error value
749 * @retval #LOCATIONS_ERROR_NONE Successful
750 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
751 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
752 * @post location_position_updated_cb() will be invoked.
753 * @see location_manager_unset_position_updated_cb()
754 * @see location_position_updated_cb()
756 int location_manager_set_position_updated_cb(location_manager_h manager, location_position_updated_cb callback, int interval, void *user_data);
760 * @brief Unregisters the callback function.
761 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
762 * @param[in] manager The location manager handle
763 * @return @c 0 on success,
764 * otherwise a negative error value
765 * @retval #LOCATIONS_ERROR_NONE Successful
766 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
767 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
768 * @see location_manager_set_position_updated_cb()
770 int location_manager_unset_position_updated_cb(location_manager_h manager);
774 * @brief Registers a callback function to be invoked at defined interval with updated velocity information.
775 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
776 * @param[in] manager The location manager handle
777 * @param[in] callback The callback function to register
778 * @param[in] interval The interval [1 ~ 120] (seconds)
779 * @param[in] user_data The user data to be passed to the callback function
780 * @return @c 0 on success,
781 * otherwise a negative error value
782 * @retval #LOCATIONS_ERROR_NONE Successful
783 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
784 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
785 * @post location_velocity_updated_cb() will be invoked.
786 * @see location_manager_unset_velocity_updated_cb()
787 * @see location_velocity_updated_cb()
789 int location_manager_set_velocity_updated_cb(location_manager_h manager, location_velocity_updated_cb callback, int interval, void *user_data);
793 * @brief Unregisters the callback function.
794 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
795 * @param[in] manager The location manager handle
796 * @return @c 0 on success,
797 * otherwise a negative error value
798 * @retval #LOCATIONS_ERROR_NONE Successful
799 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
800 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
801 * @see location_manager_set_velocity_updated_cb()
803 int location_manager_unset_velocity_updated_cb(location_manager_h manager);
807 * @brief Registers a callback function to be invoked when the location service state is changed.
808 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
809 * @param[in] manager The location manager handle
810 * @param[in] callback The callback function to register
811 * @param[in] user_data The user data to be passed to the callback function
812 * @return @c 0 on success,
813 * otherwise a negative error value
814 * @retval #LOCATIONS_ERROR_NONE Successful
815 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
816 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
817 * @post location_service_state_changed_cb() will be invoked.
818 * @see location_manager_unset_service_state_changed_cb()
819 * @see location_service_state_changed_cb()
820 * @see location_manager_start()
821 * @see location_manager_stop()
822 * @see #location_service_state_e
824 int location_manager_set_service_state_changed_cb(location_manager_h manager, location_service_state_changed_cb callback, void *user_data);
828 * @brief Unregisters the callback function.
829 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
830 * @param[in] manager The location manager handle
831 * @return @c 0 on success,
832 * otherwise a negative error value
833 * @retval #LOCATIONS_ERROR_NONE Successful
834 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
835 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
836 * @see location_manager_set_service_state_changed_cb()
838 int location_manager_unset_service_state_changed_cb(location_manager_h manager);
842 * @brief Registers a callback function to be invoked when the previously set boundary area is entered or left.
843 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
844 * @param[in] manager The location manager handle
845 * @param[in] callback The callback function to register
846 * @param[in] user_data The user data to be passed to the callback function
847 * @return @c 0 on success,
848 * otherwise a negative error value
849 * @retval #LOCATIONS_ERROR_NONE Successful
850 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
851 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
852 * @pre location_manager_add_boundary() is called before.
853 * @post location_zone_changed_cb() will be invoked.
854 * @see location_manager_unset_zone_changed_cb()
855 * @see location_zone_changed_cb()
857 int location_manager_set_zone_changed_cb(location_manager_h manager, location_zone_changed_cb callback, void *user_data);
861 * @brief Unregisters the callback function.
862 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
863 * @param[in] manager The location manager handle
864 * @return @c 0 on success,
865 * otherwise a negative error value
866 * @retval #LOCATIONS_ERROR_NONE Successful
867 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
868 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
869 * @see location_manager_set_zone_changed_cb()
871 int location_manager_unset_zone_changed_cb(location_manager_h manager);
875 * @brief Registers a callback function to be invoked when the location setting is changed.
876 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
877 * @param[in] method The method to observe
878 * @param[in] callback The callback function to register
879 * @param[in] user_data The user data to be passed to the callback function
880 * @return @c 0 on success,
881 * otherwise a negative error value
882 * @retval #LOCATIONS_ERROR_NONE Successful
883 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
884 * @retval #LOCATIONS_ERROR_INCORRECT_METHOD Incorrect method
885 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
886 * @post location_setting_changed_cb() will be invoked.
887 * @see location_manager_unset_setting_changed_cb()
888 * @see location_setting_changed_cb()
890 int location_manager_set_setting_changed_cb(location_method_e method, location_setting_changed_cb callback, void *user_data);
894 * @brief Unregisters the callback function.
895 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
896 * @param[in] method The method to observe
897 * @return @c 0 on success,
898 * otherwise a negative error value
899 * @retval #LOCATIONS_ERROR_NONE Successful
900 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
901 * @retval #LOCATIONS_ERROR_INCORRECT_METHOD Incorrect method
902 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
903 * @see location_manager_set_setting_changed_cb()
905 int location_manager_unset_setting_changed_cb(location_method_e method);
909 * @brief Gets the distance in meters between two locations.
910 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
911 * @param[in] start_latitude The starting latitude [-90.0 ~ 90.0] (degrees)
912 * @param[in] start_longitude The starting longitude [-180.0 ~ 180.0] (degrees)
913 * @param[in] end_latitude The ending latitude [-90.0 ~ 90.0] (degrees)
914 * @param[in] end_longitude The ending longitude [-180.0 ~ 180.0] (degrees)
915 * @param[out] distance The distance between two locations (meters)
916 * @return @c 0 on success,
917 * otherwise a negative error value
918 * @retval #LOCATIONS_ERROR_NONE Successful
919 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
920 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
922 int location_manager_get_distance(double start_latitude, double start_longitude, double end_latitude, double end_longitude, double *distance);
926 * @brief Registers a callback function to be invoked at minimum interval or minimum distance with updated position information.
927 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
928 * @param[in] manager The location manager handle
929 * @param[in] callback The callback function to register
930 * @param[in] interval The minimum interval between position updates [1 ~ 120] (seconds)
931 * @param[in] distance The minimum distance between position updates [1 ~ 120] (meters)
932 * @param[in] user_data The user data to be passed to the callback function
933 * @return @c 0 on success,
934 * otherwise a negative error value
935 * @retval #LOCATIONS_ERROR_NONE Successful
936 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
937 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
938 * @post location_changed_cb() will be invoked.
939 * @see location_manager_unset_distance_based_location_changed_cb()
940 * @see location_changed_cb()
942 int location_manager_set_distance_based_location_changed_cb(location_manager_h manager, location_changed_cb callback, int interval, double distance, void *user_data);
946 * @brief Unregisters the callback function.
947 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
948 * @param[in] manager The location manager handle
949 * @return @c 0 on success,
950 * otherwise a negative error value
951 * @retval #LOCATIONS_ERROR_NONE Successful
952 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
953 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
954 * @see location_manager_set_distance_based_location_changed_cb()
956 int location_manager_unset_distance_based_location_changed_cb(location_manager_h manager);
960 * @brief Registers a callback function to be invoked at defined interval with updated location information.
961 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
962 * @param[in] manager The location manager handle
963 * @param[in] callback The callback function to register
964 * @param[in] interval The interval [1 ~ 120] (seconds)
965 * @param[in] user_data The user data to be passed to the callback function
966 * @return @c 0 on success,
967 * otherwise a negative error value
968 * @retval #LOCATIONS_ERROR_NONE Successful
969 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
970 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
971 * @post location_changed_cb() will be invoked.
972 * @see location_manager_unset_location_changed_cb()
973 * @see location_changed_cb()
975 int location_manager_set_location_changed_cb(location_manager_h manager, location_changed_cb callback, int interval, void *user_data);
979 * @brief Unregisters the callback function.
980 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
981 * @param[in] manager The location manager handle
982 * @return @c 0 on success,
983 * otherwise a negative error value
984 * @retval #LOCATIONS_ERROR_NONE Successful
985 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
986 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
987 * @see location_manager_set_location_changed_cb()
989 int location_manager_unset_location_changed_cb(location_manager_h manager);
993 * @brief Registers a callback function to be invoked when batch_period is expired.
994 * @since_tizen @if MOBILE 3.0 @elseif WEARABLE 2.3.2 @endif
995 * @remarks The batch_period should be greater than or equal to the batch_interval.
996 * In addition, sometimes the period may not work as you intended, the maximum permissible value for batch_period is device specific.
997 * @param[in] manager The location manager handle
998 * @param[in] callback The callback function to register
999 * @param[in] batch_interval The batch sampling interval [1 ~ 255] (seconds)
1000 * @param[in] batch_period The batch period [1 ~ 60000] (seconds)
1001 * @param[in] user_data The user data to be passed to the callback function
1002 * @return @c 0 on success,
1003 * otherwise a negative error value
1004 * @retval #LOCATIONS_ERROR_NONE Successful
1005 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
1006 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
1007 * @post location_batch_cb() will be invoked.
1008 * @see location_manager_start_batch()
1009 * @see location_batch_cb()
1010 * @see location_manager_unset_location_batch_cb()
1012 int location_manager_set_location_batch_cb(location_manager_h manager, location_batch_cb callback, int batch_interval, int batch_period, void *user_data);
1016 * @brief Unregisters the callback function.
1017 * @since_tizen @if MOBILE 3.0 @elseif WEARABLE 2.3.2 @endif
1018 * @param[in] manager The location manager handle
1019 * @return @c 0 on success,
1020 * otherwise a negative error value
1021 * @retval #LOCATIONS_ERROR_NONE Successful
1022 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
1023 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
1024 * @see location_manager_set_location_batch_cb()
1026 int location_manager_unset_location_batch_cb(location_manager_h manager);
1030 * @brief Starts the location batch service.
1031 * @details Calling this function starts location batch service, location_batch_cb() will be invoked every @a batch_period seconds.
1032 * After that, you can obtain all locations with location_manager_foreach_location_batch().
1033 * @since_tizen @if MOBILE 3.0 @elseif WEARABLE 2.3.2 @endif
1035 * @privilege %http://tizen.org/privilege/location
1036 * @remarks Calling this function invokes a location service event. When the location service is enabled, the service state change callback
1037 * (set using location_manager_set_service_state_changed_cb()) notifies the user with #LOCATIONS_SERVICE_ENABLED as the first argument, and the service starts.
1038 * @param[in] manager The location manager handle
1039 * @return @c 0 on success,
1040 * otherwise a negative error value
1041 * @retval #LOCATIONS_ERROR_NONE Successful
1042 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
1043 * @retval #LOCATIONS_ERROR_INCORRECT_METHOD Incorrect method
1044 * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
1045 * @retval #LOCATIONS_ERROR_NETWORK_FAILED Network failed
1046 * @retval #LOCATIONS_ERROR_GPS_SETTING_OFF GPS is not enabled
1047 * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
1048 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
1049 * @pre location_manager_set_location_batch_cb()
1050 * @see location_manager_set_service_state_changed_cb()
1051 * @see location_service_state_changed_cb()
1052 * @see location_manager_foreach_location_batch()
1053 * @see location_manager_stop_batch()
1055 int location_manager_start_batch(location_manager_h manager);
1059 * @brief Stops the location batch service.
1060 * @since_tizen @if MOBILE 3.0 @elseif WEARABLE 2.3.2 @endif
1061 * @remarks This function initiates the process of stopping the service. When the process is finished, callback set using
1062 * #location_manager_set_service_state_changed_cb() will be called, with #LOCATIONS_SERVICE_DISABLED as the first argument.
1063 * @param[in] manager The location manager handle
1064 * @return @c 0 on success,
1065 * otherwise a negative error value
1066 * @retval #LOCATIONS_ERROR_NONE Successful
1067 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
1068 * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
1069 * @retval #LOCATIONS_ERROR_NETWORK_FAILED Network failed
1070 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
1071 * @see location_manager_start_batch()
1072 * @see location_manager_set_service_state_changed_cb()
1073 * @see location_service_state_changed_cb()
1075 int location_manager_stop_batch(location_manager_h manager);
1079 * @brief Retrieves all location information by invoking a specific callback for each location data.
1080 * @since_tizen @if MOBILE 3.0 @elseif WEARABLE 2.3.2 @endif
1082 * @privilege %http://tizen.org/privilege/location
1083 * @param[in] manager The location manager handle
1084 * @param[in] callback The iteration callback function
1085 * @param[in] user_data The user data to be passed to the callback function
1086 * @return @c 0 on success,
1087 * otherwise a negative error value
1088 * @retval #LOCATIONS_ERROR_NONE Successful
1089 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
1090 * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
1091 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
1092 * @pre location_manager_foreach_location_batch() is available after location_batch_cb() is invoked.
1093 * @post location_batch_get_location_cb() will be invoked.
1094 * @see location_manager_start_batch()
1095 * @see location_batch_cb()
1096 * @see location_batch_get_location_cb()
1098 int location_manager_foreach_location_batch(location_manager_h manager, location_batch_get_location_cb callback, void *user_data);
1102 * @brief Checks whether the mock location is enabled.
1104 * @param[out] enabled Indicates whether the mock location is enabled
1105 * @return @c 0 on success,
1106 * otherwise a negative error value
1107 * @retval #LOCATIONS_ERROR_NONE Successful
1108 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
1109 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
1110 * @see location_manager_enable_mock_location()
1111 * @see location_manager_set_mock_location()
1112 * @see location_manager_clear_mock_location()
1114 int location_manager_is_enabled_mock_location(bool *enabled);
1118 * @brief Enables mock location.
1119 * @details The mock location is a testing function to make location API and callback deliver a mock location
1120 * set by location_manager_set_mock_location() instead of real positioning data even in the other applications.
1123 * @privilege %http://tizen.org/privilege/location
1124 * @remarks The mock location can only be enabled if developer mode is enabled.
1125 * @param[in] enable The value to set
1126 * @return @c 0 on success,
1127 * otherwise a negative error value
1128 * @retval #LOCATIONS_ERROR_NONE Successful
1129 * @retval #LOCATIONS_ERROR_SETTING_OFF MOCK location is not enabled
1130 * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED Permission denied
1131 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
1132 * @see location_manager_is_enabled_mock_location()
1133 * @see location_manager_set_mock_location()
1134 * @see location_manager_clear_mock_location()
1136 int location_manager_enable_mock_location(const bool enable);
1140 * @brief Sets a mock location for the given location method.
1141 * @details The location sets the given altitude, latitude, longitude, climb, direction, speed, level, horizontal, and vertical accuracy.
1144 * @privilege %http://tizen.org/privilege/location
1145 * @param[in] manager The location manager handle
1146 * @param[in] latitude The current latitude [-90.0 ~ 90.0] (degrees)
1147 * @param[in] longitude The current longitude [-180.0 ~ 180.0] (degrees)
1148 * @param[in] altitude The current altitude (meters)
1149 * @param[in] speed The speed (km/h)
1150 * @param[in] direction The direction, degrees from the north [0.0 ~ 360.0]
1151 * @param[in] accuracy The horizontal accuracy (meters)
1152 * @return @c 0 on success,
1153 * otherwise a negative error value
1154 * @retval #LOCATIONS_ERROR_NONE Successful
1155 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
1156 * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
1157 * @retval #LOCATIONS_ERROR_SETTING_OFF MOCK location is not enabled
1158 * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
1159 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
1160 * @see location_manager_create()
1161 * @see location_manager_is_enabled_mock_location()
1162 * @see location_manager_enable_mock_location()
1163 * @see location_manager_clear_mock_location()
1165 int location_manager_set_mock_location(location_manager_h manager, const double latitude, const double longitude, const double altitude, const double speed, const double direction, const double accuracy);
1169 * @brief Clears a mock location.
1172 * @privilege %http://tizen.org/privilege/location
1173 * @param[in] manager The location manager handle
1174 * @return @c 0 on success,
1175 * otherwise a negative error value
1176 * @retval #LOCATIONS_ERROR_NONE Successful
1177 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
1178 * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
1179 * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
1180 * @retval #LOCATIONS_ERROR_SETTING_OFF MOCK location is not enabled
1181 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
1182 * @see location_manager_create()
1183 * @see location_manager_is_enabled_mock_location()
1184 * @see location_manager_enable_mock_location()
1185 * @see location_manager_set_mock_location()
1187 int location_manager_clear_mock_location(location_manager_h manager);
1190 * @brief Changes behavior of the location source selection in the fused location method.
1192 * @param[in] manager The location manager handle
1193 * @param[in] mode The fused mode.
1194 * @return @c 0 on success, otherwise a negative error value
1195 * @retval #LOCATIONS_ERROR_NONE Successful
1196 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
1197 * @retval #LOCATIONS_ERROR_INCORRECT_METHOD Incorrect method
1198 * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE The service is not available
1199 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
1200 * @see location_manager_create()
1202 int location_manager_set_fused_mode(location_manager_h manager, location_fused_mode_e mode);
1211 * GPS Status & Satellites
1216 * @addtogroup CAPI_LOCATION_GPS_STATUS_MODULE
1222 * @brief Called once for each satellite in range.
1223 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1224 * @param[in] azimuth The azimuth of the satellite (degrees)
1225 * @param[in] elevation The elevation of the satellite (meters)
1226 * @param[in] prn The PRN of the satellite
1227 * @param[in] snr The SNR of the satellite [dB]
1228 * @param[in] is_active The flag signaling if satellite is in use
1229 * @param[in] user_data The user data passed from the foreach function
1230 * @return @c true to continue with the next iteration of the loop, \n
1231 * @c false to break out of the loop
1232 * @pre gps_status_foreach_satellites_in_view() will invoke this callback.
1233 * @pre gps_status_foreach_last_satellites_in_view() will invoke this callback.
1234 * @see gps_status_foreach_satellites_in_view()
1236 typedef bool(*gps_status_get_satellites_cb)(unsigned int azimuth, unsigned int elevation, unsigned int prn, int snr, bool is_active, void *user_data);
1240 * @brief Called at defined interval with updated satellite information.
1241 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1242 * @param[out] num_of_active The last number of active satellites
1243 * @param[out] num_of_inview The last number of satellites in view
1244 * @param[out] timestamp The last timestamp (time when measurement took place or @c 0 if valid)
1245 * @param[in] user_data The user data passed from the call registration function
1246 * @pre location_manager_start() will invoke this callback if you register this callback using location_manager_set_position_updated_cb().
1247 * @see location_manager_start()
1248 * @see location_manager_set_position_updated_cb()
1250 typedef void(*gps_status_satellite_updated_cb)(int num_of_active, int num_of_inview, time_t timestamp, void *user_data);
1254 * @brief Gets the GPS NMEA data.
1255 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1256 * @remarks This call is valid only for location managers with #LOCATIONS_METHOD_GPS method.
1257 * You must release @a nmea using @c free().
1258 * @param[in] manager The location manager handle
1259 * @param[out] nmea The NMEA data
1260 * @return @c 0 on success,
1261 * otherwise a negative error value
1262 * @retval #LOCATIONS_ERROR_NONE Successful
1263 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
1264 * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
1265 * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
1266 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
1267 * @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start().
1268 * @see location_manager_start()
1270 int gps_status_get_nmea(location_manager_h manager, char **nmea);
1274 * @brief Gets the information of satellites.
1275 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1277 * @privilege %http://tizen.org/privilege/location
1278 * @remarks This call is valid only for location managers with #LOCATIONS_METHOD_GPS method.
1279 * @param[in] manager The location manager handle
1280 * @param[out] num_of_active The number of active satellites
1281 * @param[out] num_of_inview The number of satellites in view
1282 * @param[out] timestamp The timestamp (time when measurement took place or @c 0 if valid)
1283 * @return @c 0 on success,
1284 * otherwise a negative error value
1285 * @retval #LOCATIONS_ERROR_NONE Successful
1286 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
1287 * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
1288 * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
1289 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
1290 * @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start().
1291 * @pre The gps_status_satellite_updated_cb must be set with gps_status_set_satellite_updated_cb().
1292 * @see gps_status_foreach_satellites_in_view()
1294 int gps_status_get_satellite(location_manager_h manager, int *num_of_active, int *num_of_inview, time_t *timestamp);
1298 * @brief Registers a callback function to be invoked at defined interval with updated satellite information.
1299 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1301 * @privilege %http://tizen.org/privilege/location
1302 * @param[in] manager The location manager handle
1303 * @param[in] callback The callback function to register
1304 * @param[in] interval The interval [1 ~ 120] (seconds)
1305 * @param[in] user_data The user data to be passed to the callback function
1306 * @return @c 0 on success,
1307 * otherwise a negative error value
1308 * @retval #LOCATIONS_ERROR_NONE Successful
1309 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
1310 * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
1311 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
1312 * @post gps_status_satellite_updated_cb() will be invoked.
1313 * @see gps_status_unset_satellite_updated_cb()
1314 * @see gps_status_satellite_updated_cb()
1315 * @see gps_status_get_satellite()
1316 * @see gps_status_foreach_satellites_in_view()
1317 * @see gps_status_get_last_satellite()
1318 * @see gps_status_foreach_last_satellites_in_view()
1320 int gps_status_set_satellite_updated_cb(location_manager_h manager, gps_status_satellite_updated_cb callback, int interval, void *user_data);
1324 * @brief Unregisters the callback function.
1325 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1326 * @param[in] manager The location manager handle
1327 * @return @c 0 on success,
1328 * otherwise a negative error value
1329 * @retval #LOCATIONS_ERROR_NONE Successful
1330 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
1331 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
1332 * @see gps_status_set_satellite_updated_cb()
1334 int gps_status_unset_satellite_updated_cb(location_manager_h manager);
1338 * @brief Invokes the callback function for each satellite.
1339 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1341 * @privilege %http://tizen.org/privilege/location
1342 * @remarks This function is valid only for location managers with the #LOCATIONS_METHOD_GPS method.
1343 * @param[in] manager The location manager handle
1344 * @param[in] callback The iteration callback function
1345 * @param[in] user_data The user data to be passed to the callback function
1346 * @return @c 0 on success,
1347 * otherwise a negative error value
1348 * @retval #LOCATIONS_ERROR_NONE Successful
1349 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
1350 * @retval #LOCATIONS_ERROR_INCORRECT_METHOD Incorrect method
1351 * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
1352 * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
1353 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
1354 * @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start().
1355 * @pre The gps_status_satellite_updated_cb must be set with gps_status_set_satellite_updated_cb().
1356 * @post It invokes gps_status_get_satellites_cb().
1357 * @see gps_status_get_satellite()
1358 * @see gps_status_get_satellites_cb()
1360 int gps_status_foreach_satellites_in_view(location_manager_h manager, gps_status_get_satellites_cb callback, void *user_data);
1364 * @brief Gets the last information of satellites.
1365 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1367 * @privilege %http://tizen.org/privilege/location
1368 * @remarks This call is valid only for location managers with #LOCATIONS_METHOD_GPS method.
1369 * @param[in] manager The location manager handle
1370 * @param[out] num_of_active The last number of active satellites
1371 * @param[out] num_of_inview The last number of satellites in view
1372 * @param[out] timestamp The last timestamp (time when last measurement took place or @c 0 if valid)
1373 * @return @c 0 on success,
1374 * otherwise a negative error value
1375 * @retval #LOCATIONS_ERROR_NONE Successful
1376 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
1377 * @retval #LOCATIONS_ERROR_INCORRECT_METHOD Incorrect method
1378 * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
1379 * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
1380 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
1381 * @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start().
1382 * @pre The gps_status_satellite_updated_cb must be set with gps_status_set_satellite_updated_cb().
1383 * @see gps_status_foreach_satellites_in_view()
1385 int gps_status_get_last_satellite(location_manager_h manager, int *num_of_active, int *num_of_inview, time_t *timestamp);
1389 * @brief Invokes the callback function for each last satellite which is recorded.
1390 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1392 * @privilege %http://tizen.org/privilege/location
1393 * @remarks This function is valid only for location managers with the #LOCATIONS_METHOD_GPS method.
1394 * @param[in] manager The location manager handle
1395 * @param[in] callback The iteration callback function
1396 * @param[in] user_data The user data to be passed to the callback function
1397 * @return @c 0 on success,
1398 * otherwise a negative error value
1399 * @retval #LOCATIONS_ERROR_NONE Successful
1400 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
1401 * @retval #LOCATIONS_ERROR_INCORRECT_METHOD Incorrect method
1402 * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
1403 * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
1404 * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
1405 * @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start().
1406 * @pre The gps_status_satellite_updated_cb must be set with gps_status_set_satellite_updated_cb().
1407 * @post It invokes gps_status_get_satellites_cb().
1408 * @see gps_status_get_last_satellite()
1409 * @see gps_status_get_satellites_cb()
1411 int gps_status_foreach_last_satellites_in_view(location_manager_h manager, gps_status_get_satellites_cb callback, void *user_data);
1421 #endif /* __TIZEN_LOCATION_LOCATIONS_H__ */