f0a72198e776bb167e412696ad6574dd343f9ca9
[platform/core/api/location-manager.git] / include / locations.h
1 /*
2  * Copyright (c) 2011-2013 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef __TIZEN_LOCATION_LOCATIONS_H__
18 #define __TIZEN_LOCATION_LOCATIONS_H__
19
20 #include <tizen_type.h>
21 #include <tizen_error.h>
22 #include <time.h>
23 #include <location_bounds.h>
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29 /**
30  * @addtogroup CAPI_LOCATION_MANAGER_MODULE
31  * @{
32  */
33
34 /**
35  * @brief Enumeration for error code for Location manager.
36  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
37  */
38 typedef enum {
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_ACCESSIBILITY_NOT_ALLOWED       = TIZEN_ERROR_PERMISSION_DENIED,                /**< Permission denied */
43         LOCATIONS_ERROR_NOT_SUPPORTED                           = TIZEN_ERROR_NOT_SUPPORTED,                    /**< Not supported */
44         LOCATIONS_ERROR_INCORRECT_METHOD                        = TIZEN_ERROR_LOCATION_MANAGER | 0x01,  /**< Location manager contains incorrect method for a given call */
45         LOCATIONS_ERROR_NETWORK_FAILED                          = TIZEN_ERROR_LOCATION_MANAGER | 0x02,  /**< Network unavailable */
46         LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE           = TIZEN_ERROR_LOCATION_MANAGER | 0x03,  /**< Location service is not available */
47         LOCATIONS_ERROR_GPS_SETTING_OFF                         = TIZEN_ERROR_LOCATION_MANAGER | 0x04,  /**< Setting for GPS, WPS, or MOCK is turned off */
48         LOCATIONS_ERROR_SECURITY_RESTRICTED                     = TIZEN_ERROR_LOCATION_MANAGER | 0x05,  /**< Restricted by security system policy */
49         LOCATIONS_ERROR_SETTING_OFF                                     = LOCATIONS_ERROR_GPS_SETTING_OFF,              /**< Setting for GPS, WPS, or MOCK is turned off (Since 3.0) */
50 } location_error_e;
51
52
53 /**
54  * @brief Enumeration for Location method type.
55  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
56  */
57 typedef enum {
58         LOCATIONS_METHOD_NONE = -1,     /**< Undefined method */
59         LOCATIONS_METHOD_HYBRID,        /**< This method selects the best method available at the moment */
60         LOCATIONS_METHOD_GPS,           /**< This method uses Global Positioning System */
61         LOCATIONS_METHOD_WPS,           /**< This method uses WiFi Positioning System */
62         LOCATIONS_METHOD_MOCK,          /**< This method uses mock location for testing (Since 3.0)*/
63 } location_method_e;
64
65 /**
66  * @brief Enumeration for Approximate accuracy level of given information.
67  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
68  */
69 typedef enum {
70         LOCATIONS_ACCURACY_NONE = 0,    /**< Invalid data */
71         LOCATIONS_ACCURACY_COUNTRY,             /**< Country accuracy level */
72         LOCATIONS_ACCURACY_REGION,              /**< Regional accuracy level */
73         LOCATIONS_ACCURACY_LOCALITY,    /**< Local accuracy level */
74         LOCATIONS_ACCURACY_POSTALCODE,  /**< Postal accuracy level */
75         LOCATIONS_ACCURACY_STREET,              /**< Street accuracy level */
76         LOCATIONS_ACCURACY_DETAILED,    /**< Detailed accuracy level */
77 } location_accuracy_level_e;
78
79 /**
80  * @brief Enumeration for the state of the location service.
81  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
82  */
83 typedef enum {
84         LOCATIONS_SERVICE_DISABLED,                     /**< Service is disabled */
85         LOCATIONS_SERVICE_ENABLED,                      /**< Service is enabled */
86 } location_service_state_e;
87
88 /**
89  * @deprecated Deprecated since 3.0
90  * @brief Enumeration for the location service accessibility state.
91  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
92  */
93 typedef enum {
94         LOCATIONS_ACCESS_STATE_NONE,            /**< Access state is not determined */
95         LOCATIONS_ACCESS_STATE_DENIED,          /**< Access denied */
96         LOCATIONS_ACCESS_STATE_ALLOWED,         /**< Access authorized */
97 } location_accessibility_state_e;
98
99 /**
100  * @brief The location manager handle.
101  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
102  */
103 typedef struct location_manager_s *location_manager_h;
104
105 /**
106  * @}
107  */
108 /*
109  * Location Manager
110 */
111 /**
112  * @addtogroup CAPI_LOCATION_MANAGER_MODULE
113  * @{
114  */
115 /**
116  * @brief Called at defined interval with updated position information.
117  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
118  * @param[in] latitude          The updated latitude [-90.0 ~ 90.0] (degrees)
119  * @param[in] longitude         The updated longitude [-180.0 ~ 180.0] (degrees)
120  * @param[in] altitude          The updated altitude (meters)
121  * @param[in] timestamp         The timestamp (time when measurement took place or @c 0 if valid)
122  * @param[in] user_data         The user data passed from the call registration function
123  * @pre location_manager_start() will invoke this callback if you register this callback using location_manager_set_position_updated_cb().
124  * @see location_manager_start()
125  * @see location_manager_set_position_updated_cb()
126  */
127 typedef void(*location_position_updated_cb)(double latitude, double longitude, double altitude, time_t timestamp, void *user_data);
128
129 /**
130  * @brief Called at defined interval with updated velocity information.
131  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
132  * @param[in] speed                     The updated speed (km/h)
133  * @param[in] direction         The updated direction (in degrees from the north)
134  * @param[in] climb                     The updated climb (km/h)
135  * @param[in] timestamp         The timestamp (time when measurement took place or @c 0 if valid)
136  * @param[in] user_data         The user data passed from the callback registration function
137  * @pre location_manager_start() will invoke this callback if you register this callback using location_manager_set_velocity_updated_cb().
138  * @see location_manager_start()
139  * @see location_manager_set_velocity_updated_cb()
140  */
141 typedef void(*location_velocity_updated_cb)(double speed, double direction, double climb, time_t timestamp, void *user_data);
142
143 /**
144  * @brief Called at defined interval with updated location information.
145  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
146  * @param[in] error                     #LOCATIONS_ERROR_NONE Successful
147  * @param[in] latitude          The updated latitude [-90.0 ~ 90.0] (degrees)
148  * @param[in] longitude         The updated longitude [-180.0 ~ 180.0] (degrees)
149  * @param[in] altitude          The updated altitude (meters)
150  * @param[in] timestamp         The timestamp (time when measurement took place or @c 0 if valid)
151  * @param[in] speed                     The updated speed (km/h)
152  * @param[in] direction         The updated direction (in degrees from the north)
153  * @param[in] climb                     The updated climb (km/h)
154  * @param[in] user_data         The user data passed from the callback registration function
155  * @pre location_manager_request_single_location() will invoke this callback.
156  * @see location_manager_request_single_location()
157  */
158 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);
159
160 /**
161  * @brief Called when the state of location service is changed from enabled to disabled or vice versa.
162  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
163  * @param[in] state                     The service state
164  * @param[in] user_data         The user data passed from the callback registration function
165  * @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()
166  * @see location_manager_start()
167  * @see location_manager_stop()
168  * @see location_manager_set_service_state_changed_cb()
169  * @see #location_service_state_e
170  */
171 typedef void(*location_service_state_changed_cb)(location_service_state_e state, void *user_data);
172
173 /**
174  * @brief Called when the user defined zones are entered or exited.
175  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
176  * @param[in] state                     The boundary state
177  * @param[in] latitude          The updated latitude [-90.0 ~ 90.0] (degrees)
178  * @param[in] longitude         The updated longitude [-180.0 ~ 180.0] (degrees)
179  * @param[in] altitude          The updated altitude (meters)
180  * @param[in] timestamp         The timestamp (time when measurement took place or @c 0 if valid)
181  * @param[in] user_data         The user data passed from the callback registration function
182  * @pre location_manager_start() will invoke this callback if you register this callback using location_manager_set_zone_changed_cb().
183  * @see #location_boundary_state_e
184  * @see location_manager_start()
185  * @see location_manager_set_zone_changed_cb()
186  */
187 typedef void(*location_zone_changed_cb)(location_boundary_state_e state, double latitude, double longitude, double altitude, time_t timestamp, void *user_data);
188
189 /**
190  * @brief Called when the state of location method is changed.
191  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
192  * @param[in] method            The method changed on setting
193  * @param[in] enable            The setting value changed
194  * @param[in] user_data         The user data passed from the callback registration function
195  * @pre location_setting_changed_cb() will invoke this callback if you register this callback using location_manager_set_setting_changed_cb()
196  * @see location_manager_set_setting_changed_cb()
197  * @see location_manager_unset_setting_changed_cb()
198  */
199 typedef void(*location_setting_changed_cb)(location_method_e method, bool enable, void *user_data);
200
201 /**
202  * @brief Called once for each location bound.
203  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
204  * @param[in] bounds            The location bounds handle
205  * @param[in] user_data         The user data passed from the callback registration function
206  * @pre location_manager_foreach_boundary() will invoke this callback.
207  * @see location_manager_foreach_boundary()
208  */
209 typedef bool(*location_bounds_cb)(location_bounds_h bounds, void *user_data);
210
211 /**
212  * @brief Called at defined interval with updated location information.
213  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
214  * @param[in] latitude          The updated latitude [-90.0 ~ 90.0] (degrees)
215  * @param[in] longitude         The updated longitude [-180.0 ~ 180.0] (degrees)
216  * @param[in] altitude          The updated altitude (meters)
217  * @param[in] speed                     The updated speed (km/h)
218  * @param[in] direction         The updated direction (in degrees from the north)
219  * @param[in] horizontal_accuracy               The horizontal accuracy (meters)
220  * @param[in] timestamp         The timestamp (time when measurement took place or @c 0 if valid)
221  * @param[in] user_data         The user data passed from the callback registration function
222  * @pre location_manager_start() will invoke this callback if you register this callback using location_manager_set_position_updated_cb()
223  * @see location_manager_start()
224  * @see location_manager_set_distance_based_location_changed_cb()
225  * @see location_manager_set_location_changed_cb()
226  */
227 typedef void(*location_changed_cb)(double latitude, double longitude, double altitude, double speed, double direction, double horizontal_accuracy, time_t timestamp, void *user_data);
228
229 /**
230  * @brief Checks whether the given location method is available.
231  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
232  * @remark The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
233  * @param[in] method The location method to be checked
234  * @return @c true if the specified location method is supported, otherwise @c false if it is not available
235  * @retval #LOCATIONS_ERROR_NONE Successful
236  * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
237  * @retval #LOCATIONS_ERROR_INCORRECT_METHOD Incorrect method
238  * @see location_manager_create()
239  * @see location_manager_get_method()
240  */
241 bool location_manager_is_supported_method(location_method_e method);
242
243 /**
244  * @brief Checks whether the given location method is enabled or not on setting.
245  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
246  * @param[in] method            The location method to be checked
247  * @param[out] enable           The result value of checking the given location method
248  * @return 0 on success, otherwise a negative error value
249  * @retval #LOCATIONS_ERROR_NONE Successful
250  * @retval #LOCATIONS_ERROR_INCORRECT_METHOD Incorrect method
251  * @retval #LOCATIONS_ERROR_INVALID_PARAMETER   Invalid parameter
252  * @retval #LOCATIONS_ERROR_NOT_SUPPORTED       Not supported
253  * @see location_manager_create()
254  * @see location_manager_set_setting_changed_cb()
255  * @see location_manager_unset_setting_changed_cb()
256  */
257 int location_manager_is_enabled_method(location_method_e method, bool *enable);
258
259 /**
260  * @platform
261  * @brief Enables the given location method.
262  * @since_tizen 2.3.1
263  * @privlevel platform
264  * @privilege %http://tizen.org/privilege/location.enable
265  * @param[in] method            The location method to be checked
266  * @param[in] enable            The value to set
267  * @return 0 on success, otherwise a negative error value
268  * @retval #LOCATIONS_ERROR_NONE Successful
269  * @retval #LOCATIONS_ERROR_INCORRECT_METHOD Incorrect method
270  * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED Permission denied
271  * @retval #LOCATIONS_ERROR_NOT_SUPPORTED       Not supported
272  * @see location_manager_is_enabled_method()
273  * @see location_manager_create()
274  */
275 int location_manager_enable_method(const location_method_e method, const bool enable);
276
277 /**
278  * @brief Creates a new location manager.
279  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
280  * @remarks You must release @a manager using location_manager_destroy().
281  * @param[in] method            The location method
282  * @param[out] manager          The location manager handle that is newly created
283  * @return @c 0 on success, otherwise a negative error value
284  * @retval #LOCATIONS_ERROR_NONE                                Successful
285  * @retval #LOCATIONS_ERROR_OUT_OF_MEMORY               Out of memory
286  * @retval #LOCATIONS_ERROR_INVALID_PARAMETER   Invalid parameter
287  * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
288  * @retval #LOCATIONS_ERROR_NOT_SUPPORTED       Not supported
289  * @see location_manager_destroy()
290  */
291 int location_manager_create(location_method_e method, location_manager_h *manager);
292
293 /**
294  * @brief Releases the location manager.
295  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
296  * @param[in] manager The location manager handle
297  * @return @c 0 on success, otherwise a negative error value
298  * @retval #LOCATIONS_ERROR_NONE                                Successful
299  * @retval #LOCATIONS_ERROR_INVALID_PARAMETER   Invalid parameter
300  * @retval #LOCATIONS_ERROR_NOT_SUPPORTED       Not supported
301  * @see location_manager_create()
302 */
303 int location_manager_destroy(location_manager_h manager);
304
305 /**
306  * @brief Request to update current location once.
307  * @remarks Do not request to start the location service using the same manager handler
308  * Calling this function invokes a location service event. When the location service is updated, location_updated_cb
309  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
310  * @privlevel public
311  * @privilege %http://tizen.org/privilege/location
312  * @param[in] manager           The location manager handle
313  * @param[in] timeout           Timeout to stop requesting single location after
314  * @param[in] callback          The location callback function to register
315  * @param[in] user_data         The user data to be passed to the callback function
316  * @retval #LOCATIONS_ERROR_NONE                                                Successful
317  * @retval #LOCATIONS_ERROR_INVALID_PARAMETER                   Invalid parameter
318  * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE               Service not available
319  * @retval #LOCATIONS_ERROR_NETWORK_FAILED                              Network failed
320  * @retval #LOCATIONS_ERROR_GPS_SETTING_OFF                             GPS is not enabled
321  * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED   The application does not have the privilege to call this method
322  * @retval #LOCATIONS_ERROR_NOT_SUPPORTED                               Not supported
323  * @post It invokes location_updated_cb().
324  */
325 int location_manager_request_single_location(location_manager_h manager, int timeout, location_updated_cb callback, void *user_data);
326
327 /**
328  * @brief Starts the location service.
329  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
330  * @privlevel public
331  * @privilege %http://tizen.org/privilege/location
332  *
333  * @remarks There is no limit on number of location managers for which this function was called.
334  *
335  * @remarks Calling this function invokes a location service event. When the location service is enabled, the service state change callback
336  *              (set using location_manager_set_service_state_changed_cb()) notifies the user with #LOCATIONS_SERVICE_ENABLED as
337  *              the first argument, and the service starts.
338  *
339  * @remarks The started service is a requirement for calling these functions:
340  *              location_manager_get_position(), location_manager_get_velocity(), location_manager_get_accuracy(),
341  *              gps_status_get_nmea(), gps_status_get_satellite(), gps_status_foreach_satellites_in_view().
342  *
343  * @remarks Once you stop the service using location_manager_stop(), you can no longer call the functions listed above.
344  *
345  * @remarks Starting and stopping the service is in the scope of the given location manager only (if there is more than one manager,
346  *              starting and stopping should be executed for each of them separately).
347  *
348  * @param[in] manager           The location manager handle
349  * @return 0 on success, otherwise a negative error value
350  * @retval #LOCATIONS_ERROR_NONE                                        Successful
351  * @retval #LOCATIONS_ERROR_INVALID_PARAMETER           Invalid parameter
352  * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE       Service not available
353  * @retval #LOCATIONS_ERROR_NETWORK_FAILED                      Network failed
354  * @retval #LOCATIONS_ERROR_GPS_SETTING_OFF                     GPS is not enabled
355  * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
356  * @retval #LOCATIONS_ERROR_NOT_SUPPORTED                       Not supported
357  * @post It invokes location_position_updated_cb(), location_velocity_updated_cb(), location_zone_changed_cb(), and location_service_state_changed_cb().
358  * @see location_manager_stop()
359  * @see location_manager_get_position()
360  * @see location_manager_get_velocity()
361  * @see location_manager_get_accuracy()
362  * @see location_manager_set_service_state_changed_cb()
363  * @see location_manager_set_position_updated_cb()
364  * @see location_position_updated_cb()
365  * @see location_manager_set_velocity_updated_cb()
366  * @see location_velocity_updated_cb()
367  * @see location_manager_set_zone_changed_cb()
368  * @see location_zone_changed_cb()
369  */
370 int location_manager_start(location_manager_h manager);
371
372 /**
373  * @brief Stops the location service.
374  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
375  * @remarks This function initiates the process of stopping the service. When the process is finished, callback set using
376  * #location_manager_set_service_state_changed_cb() will be called, with #LOCATIONS_SERVICE_DISABLED as first argument.
377  * When that happens, the service is stopped and the user is notified.
378  *
379  * @remarks You can stop and start the location manager as needed.
380  *
381  * @param[in] manager           The location manager handle
382  * @return 0 on success, otherwise a negative error value
383  * @retval #LOCATIONS_ERROR_NONE                                                Successful
384  * @retval #LOCATIONS_ERROR_INVALID_PARAMETER                   Invalid parameter
385  * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE               Service not available
386  * @retval #LOCATIONS_ERROR_NETWORK_FAILED                              Network failed
387  * @retval #LOCATIONS_ERROR_NOT_SUPPORTED                               Not supported
388  * @see location_manager_start()
389  * @see location_manager_set_service_state_changed_cb()
390  * @see location_service_state_changed_cb()
391  */
392 int location_manager_stop(location_manager_h manager);
393
394 /**
395  * @brief Adds a bounds for a given location manager.
396  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
397  * @param[in] manager           The location manager handle
398  * @param[in] bounds            The location bounds handle
399  * @return @c 0 on success, otherwise a negative error value
400  * @retval #LOCATIONS_ERROR_NONE Successful
401  * @retval #LOCATIONS_ERROR_INVALID_PARAMETER                   Invalid parameter
402  * @retval #LOCATIONS_ERROR_OUT_OF_MEMORY                               Out of memory
403  * @retval #LOCATIONS_ERROR_NOT_SUPPORTED                               Not supported
404  * @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().
405  * @see location_manager_remove_boundary()
406  * @see location_manager_set_zone_changed_cb()
407  */
408 int location_manager_add_boundary(location_manager_h manager, const location_bounds_h bounds);
409
410 /**
411  * @brief Deletes a bounds for a given location manager.
412  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
413  * @param[in] manager           The location manager handle
414  * @param[in] bounds            The location bounds handle
415  * @return @c 0 on success, otherwise a negative error value
416  * @retval #LOCATIONS_ERROR_NONE                                                Successful
417  * @retval #LOCATIONS_ERROR_INVALID_PARAMETER                   Invalid parameter
418  * @retval #LOCATIONS_ERROR_OUT_OF_MEMORY                               Out of memory
419  * @retval #LOCATIONS_ERROR_NOT_SUPPORTED                               Not supported
420  * @see location_manager_add_boundary()
421  */
422 int location_manager_remove_boundary(location_manager_h manager, const location_bounds_h bounds);
423
424 /**
425  * @brief Retrieves all location bounds by invoking a specific callback for each location bounds
426  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
427  * @param[in] manager           The location manager handle
428  * @param[in] callback          The iteration callback
429  * @param[in] user_data         The user data to be passed to the callback function
430  * @return      @c 0 on success, otherwise a negative error value
431  * @retval #LOCATIONS_ERROR_NONE                                                Successful
432  * @retval #LOCATIONS_ERROR_INVALID_PARAMETER                   Invalid parameter
433  * @retval #LOCATIONS_ERROR_NOT_SUPPORTED                               Not supported
434  * @post location_bounds_cb() will be invoked
435  * @see location_manager_add_boundary()
436  * @see location_manager_remove_boundary()
437  * @see location_bounds_cb()
438  */
439 int location_manager_foreach_boundary(location_manager_h manager, location_bounds_cb callback, void *user_data);
440
441 /**
442  * @brief Gets the given location manager's method.
443  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
444  * @param[in] manager           The location manager handle
445  * @param[out] method           The location method
446  * @return @c 0 on success, otherwise a negative error value
447  * @retval #LOCATIONS_ERROR_NONE                                Successful
448  * @retval #LOCATIONS_ERROR_INVALID_PARAMETER   Invalid parameter
449  * @retval #LOCATIONS_ERROR_NOT_SUPPORTED               Not supported
450  * @see location_manager_create()
451  */
452 int location_manager_get_method(location_manager_h manager, location_method_e *method);
453
454 /**
455  * @brief Gets the current position information.
456  * @details The result contains the current altitude, latitude, and longitude, with a measurement timestamp.
457  *
458  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
459  * @privlevel public
460  * @privilege %http://tizen.org/privilege/location
461  * @param[in] manager           The location manager handle
462  * @param[out] altitude         The current altitude (meters)
463  * @param[out] latitude         The current latitude [-90.0 ~ 90.0] (degrees)
464  * @param[out] longitude        The current longitude [-180.0 ~ 180.0] (degrees)
465  * @param[out] timestamp        The timestamp (time when measurement took place or @c 0 if valid)
466  * @return 0 on success, otherwise a negative error value
467  * @retval #LOCATIONS_ERROR_NONE                                        Successful
468  * @retval #LOCATIONS_ERROR_INVALID_PARAMETER           Invalid argument
469  * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE       Service not available
470  * @retval #LOCATIONS_ERROR_GPS_SETTING_OFF                     GPS is not enabled
471  * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
472  * @retval #LOCATIONS_ERROR_NOT_SUPPORTED                       Not supported
473  * @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start()
474  */
475 int location_manager_get_position(location_manager_h manager, double *altitude, double *latitude, double *longitude, time_t *timestamp);
476
477 /**
478  * @brief Gets the current position information.
479  * @details The result contains the current altitude, latitude, longitude, climb, direction, speed, level, horizontal and vertical with a measurement timestamp.
480  *
481  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
482  * @privlevel public
483  * @privilege %http://tizen.org/privilege/location
484  * @param[in] manager           The location manager handle
485  * @param[out] altitude         The current altitude (meters)
486  * @param[out] latitude         The current latitude [-90.0 ~ 90.0] (degrees)
487  * @param[out] longitude        The current longitude [-180.0 ~ 180.0] (degrees)
488  * @param[out] climb            The climb (km/h)
489  * @param[out] direction        The direction, degrees from the north
490  * @param[out] speed            The speed (km/h)
491  * @param[out] level            The accuracy level
492  * @param[out] horizontal       The horizontal accuracy (meters)
493  * @param[out] vertical         The vertical accuracy (meters)
494  * @param[out] timestamp        The timestamp (time when measurement took place or @c 0 if valid)
495  * @return 0 on success, otherwise a negative error value
496  * @retval #LOCATIONS_ERROR_NONE                                        Successful
497  * @retval #LOCATIONS_ERROR_INVALID_PARAMETER           Invalid argument
498  * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE       Service not available
499  * @retval #LOCATIONS_ERROR_GPS_SETTING_OFF                     GPS is not enabled
500  * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
501  * @retval #LOCATIONS_ERROR_NOT_SUPPORTED                       Not supported
502  * @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start()
503  */
504 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);
505
506 /**
507  * @brief Gets the current velocity information.
508  * @details The result contains the current climb, direction, and speed, with a measurement timestamp.
509  *
510  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
511  * @privlevel public
512  * @privilege %http://tizen.org/privilege/location
513  * @param[in] manager           The location manager handle
514  * @param[out] climb            The climb (km/h)
515  * @param[out] direction        The direction, degrees from the north
516  * @param[out] speed            The speed (km/h)
517  * @param[out] timestamp        The timestamp (time when measurement took place or @c 0 if valid)
518  * @return @c 0 on success, otherwise a negative error value
519  * @retval #LOCATIONS_ERROR_NONE                                        Successful
520  * @retval #LOCATIONS_ERROR_INVALID_PARAMETER           Invalid argument
521  * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE       Service not available
522  * @retval #LOCATIONS_ERROR_GPS_SETTING_OFF                     GPS is not enabled
523  * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
524  * @retval #LOCATIONS_ERROR_NOT_SUPPORTED                       Not supported
525  * @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start()
526  */
527 int location_manager_get_velocity(location_manager_h manager, double *climb, double *direction, double *speed, time_t *timestamp);
528
529 /**
530  * @brief Gets the current accuracy information.
531  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
532  * @privlevel public
533  * @privilege %http://tizen.org/privilege/location
534  * @param[in] manager           The location manager handle
535  * @param[out] level            The accuracy level
536  * @param[out] horizontal       The horizontal accuracy (meters)
537  * @param[out] vertical         The vertical accuracy (meters)
538  * @return 0 on success, otherwise a negative error value
539  * @retval #LOCATIONS_ERROR_NONE                                        Successful
540  * @retval #LOCATIONS_ERROR_INVALID_PARAMETER           Invalid argument
541  * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE       Service not available
542  * @retval #LOCATIONS_ERROR_GPS_SETTING_OFF                     GPS is not enabled
543  * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
544  * @retval #LOCATIONS_ERROR_NOT_SUPPORTED                       Not supported
545  * @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start()
546  */
547 int location_manager_get_accuracy(location_manager_h manager, location_accuracy_level_e *level, double *horizontal, double *vertical);
548
549 /**
550  * @brief Gets the last position information which is recorded.
551  * @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.
552  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
553  * @privlevel public
554  * @privilege %http://tizen.org/privilege/location
555  * @param[in] manager           The location manager handle
556  * @param[out] altitude         The last altitude (meters)
557  * @param[out] latitude         The last latitude [-90.0 ~ 90.0] (degrees)
558  * @param[out] longitude        The last longitude [-180.0 ~ 180.0] (degrees)
559  * @param[out] timestamp        The timestamp (time when measurement took place or @c 0 if valid)
560  * @return @c 0 on success, otherwise a negative error value
561  * @retval #LOCATIONS_ERROR_NONE                                Successful
562  * @retval #LOCATIONS_ERROR_INVALID_PARAMETER   Invalid argument
563  * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
564  * @retval #LOCATIONS_ERROR_NOT_SUPPORTED               Not supported
565  * @pre The location manager handle must be created by location_manager_create()
566  */
567 int location_manager_get_last_position(location_manager_h manager, double *altitude, double *latitude, double *longitude, time_t *timestamp);
568
569 /**
570  * @brief Gets the last location information.
571  * @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.
572  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
573  * @privlevel public
574  * @privilege %http://tizen.org/privilege/location
575  * @param[in] manager           The location manager handle
576  * @param[out] altitude         The current altitude (meters)
577  * @param[out] latitude         The current latitude [-90.0 ~ 90.0] (degrees)
578  * @param[out] longitude        The current longitude [-180.0 ~ 180.0] (degrees)
579  * @param[out] climb            The climb (km/h)
580  * @param[out] direction        The direction, degrees from the north
581  * @param[out] speed            The speed (km/h)
582  * @param[out] level            The accuracy level
583  * @param[out] horizontal       The horizontal accuracy (meters)
584  * @param[out] vertical         The vertical accuracy (meters)
585  * @param[out] timestamp        The timestamp (time when measurement took place or @c 0 if valid)
586  * @return @c 0 on success, otherwise a negative error value
587  * @retval #LOCATIONS_ERROR_NONE                                Successful
588  * @retval #LOCATIONS_ERROR_INVALID_PARAMETER   Invalid argument
589  * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
590  * @retval #LOCATIONS_ERROR_NOT_SUPPORTED               Not supported
591  * @pre The location manager handle must be created by location_manager_create()
592  */
593 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);
594
595
596 /**
597  * @brief Gets the last velocity information which is recorded.
598  * @details The @a climb, @a direction and @a speed values should be @c 0, if there is no record of any previous velocity information.
599  *
600  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
601  * @privlevel public
602  * @privilege %http://tizen.org/privilege/location
603  * @param[in] manager           The location manager handle
604  * @param[out] climb            The last climb (km/h)
605  * @param[out] direction        The last direction, degrees from the north
606  * @param[out] speed            The last speed (km/h)
607  * @param[out] timestamp        The timestamp (time when measurement took place or @c 0 if valid)
608  * @return @c 0 on success, otherwise a negative error value
609  * @retval #LOCATIONS_ERROR_NONE                                Successful
610  * @retval #LOCATIONS_ERROR_INVALID_PARAMETER   Invalid argument
611  * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
612  * @retval #LOCATIONS_ERROR_NOT_SUPPORTED               Not supported
613  * @pre The location manager handle must be created by location_manager_create()
614  */
615 int location_manager_get_last_velocity(location_manager_h manager, double *climb, double *direction, double *speed, time_t *timestamp);
616
617 /**
618  * @brief Gets the last accuracy information which is recorded.
619  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
620  * @privlevel public
621  * @privilege %http://tizen.org/privilege/location
622  * @param[in] manager           The location manager handle
623  * @param[out] level            The last accuracy level
624  * @param[out] horizontal       The last horizontal accuracy (meters)
625  * @param[out] vertical         The last vertical accuracy (meters)
626  * @return 0 on success, otherwise a negative error value
627  * @retval #LOCATIONS_ERROR_NONE                                Successful
628  * @retval #LOCATIONS_ERROR_INVALID_PARAMETER   Invalid argument
629  * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
630  * @retval #LOCATIONS_ERROR_NOT_SUPPORTED       Not supported
631  * @pre The location manager handle must be created by location_manager_create()
632  */
633 int location_manager_get_last_accuracy(location_manager_h manager, location_accuracy_level_e *level, double *horizontal, double *vertical);
634
635 /**
636  * @deprecated Deprecated since 3.0
637  * @brief Gets the current application's location accessibility status.
638  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
639  * @param[out] state            The current location service accessibility status.
640  * @return 0 on success, otherwise a negative error value
641  * @retval #LOCATIONS_ERROR_NONE                                        Successful
642  * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE       Service not available
643  * @retval #LOCATIONS_ERROR_INVALID_PARAMETER           Invalid argument
644  * @retval #LOCATIONS_ERROR_NOT_SUPPORTED                       Not supported
645  */
646 int location_manager_get_accessibility_state(location_accessibility_state_e *state);
647
648 /**
649  * @brief Registers a callback function to be invoked at defined interval with updated position information.
650  *
651  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
652  * @param[in] manager           The location manager handle
653  * @param[in] callback          The callback function to register
654  * @param[in] interval          The interval [1 ~ 120] (seconds)
655  * @param[in] user_data         The user data to be passed to the callback function
656  * @return @c 0 on success, otherwise a negative error value
657  * @retval #LOCATIONS_ERROR_NONE                                Successful
658  * @retval #LOCATIONS_ERROR_INVALID_PARAMETER   Invalid parameter
659  * @retval      #LOCATIONS_ERROR_NOT_SUPPORTED          Not supported
660  * @post location_position_updated_cb() will be invoked
661  * @see location_manager_unset_position_updated_cb()
662  * @see location_position_updated_cb()
663  */
664 int location_manager_set_position_updated_cb(location_manager_h manager, location_position_updated_cb callback, int interval, void *user_data);
665
666 /**
667  * @brief       Unregisters the callback function.
668  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
669  * @param[in] manager           The location manager handle
670  * @return @c 0 on success, otherwise a negative error value
671  * @retval #LOCATIONS_ERROR_NONE                                Successful
672  * @retval #LOCATIONS_ERROR_INVALID_PARAMETER   Invalid parameter
673  * @retval      #LOCATIONS_ERROR_NOT_SUPPORTED          Not supported
674  * @see location_manager_set_position_updated_cb()
675  */
676 int location_manager_unset_position_updated_cb(location_manager_h manager);
677
678 /**
679  * @brief Registers a callback function to be invoked at defined interval with updated velocity information.
680  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
681  * @param[in] manager           The location manager handle
682  * @param[in] callback          The callback function to register
683  * @param[in] interval          The interval [1 ~ 120] (seconds)
684  * @param[in] user_data         The user data to be passed to the callback function
685  * @return @c 0 on success, otherwise a negative error value
686  * @retval #LOCATIONS_ERROR_NONE                                Successful
687  * @retval #LOCATIONS_ERROR_INVALID_PARAMETER   Invalid parameter
688  * @retval      #LOCATIONS_ERROR_NOT_SUPPORTED          Not supported
689  * @post location_velocity_updated_cb() will be invoked
690  * @see location_manager_unset_velocity_updated_cb()
691  * @see location_velocity_updated_cb()
692  */
693 int location_manager_set_velocity_updated_cb(location_manager_h manager, location_velocity_updated_cb callback, int interval, void *user_data);
694
695 /**
696  * @brief       Unregisters the callback function.
697  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
698  * @param[in] manager           The location manager handle
699  * @return @c 0 on success, otherwise a negative error value
700  * @retval #LOCATIONS_ERROR_NONE                                Successful
701  * @retval #LOCATIONS_ERROR_INVALID_PARAMETER   Invalid parameter
702  * @retval      #LOCATIONS_ERROR_NOT_SUPPORTED          Not supported
703  * @see location_manager_set_velocity_updated_cb()
704  */
705 int location_manager_unset_velocity_updated_cb(location_manager_h manager);
706
707 /**
708  * @brief Registers a callback function to be invoked when the location service state is changed.
709  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
710  * @param[in] manager           The location manager handle
711  * @param[in] callback          The callback function to register
712  * @param[in] user_data         The user data to be passed to the callback function
713  * @return @c 0 on success, otherwise a negative error value
714  * @retval #LOCATIONS_ERROR_NONE                                Successful
715  * @retval #LOCATIONS_ERROR_INVALID_PARAMETER   Invalid parameter
716  * @retval      #LOCATIONS_ERROR_NOT_SUPPORTED          Not supported
717  * @post location_service_state_changed_cb() will be invoked
718  * @see location_manager_unset_service_state_changed_cb()
719  * @see location_service_state_changed_cb()
720  * @see location_manager_start()
721  * @see location_manager_stop()
722  * @see #location_service_state_e
723 */
724 int location_manager_set_service_state_changed_cb(location_manager_h manager, location_service_state_changed_cb callback, void *user_data);
725
726 /**
727  * @brief       Unregisters the callback function.
728  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
729  * @param[in] manager           The location manager handle
730  * @return @c 0 on success, otherwise a negative error value
731  * @retval #LOCATIONS_ERROR_NONE                                Successful
732  * @retval #LOCATIONS_ERROR_INVALID_PARAMETER   Invalid parameter
733  * @retval      #LOCATIONS_ERROR_NOT_SUPPORTED          Not supported
734  * @see location_manager_set_service_state_changed_cb()
735  */
736 int location_manager_unset_service_state_changed_cb(location_manager_h manager);
737
738 /**
739  * @brief Registers a callback function to be invoked when the previously set boundary area is entered or left.
740  *
741  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
742  * @param[in] manager           The location manager handle
743  * @param[in] callback          The callback function to register
744  * @param[in] user_data         The user data to be passed to the callback function
745  * @return @c 0 on success, otherwise a negative error value
746  * @retval #LOCATIONS_ERROR_NONE                                Successful
747  * @retval #LOCATIONS_ERROR_INVALID_PARAMETER   Invalid parameter
748  * @retval      #LOCATIONS_ERROR_NOT_SUPPORTED          Not supported
749  * @pre         location_manager_add_boundary() is called before.
750  * @post location_zone_changed_cb() will be invoked
751  * @see location_manager_unset_zone_changed_cb()
752  * @see location_zone_changed_cb()
753  */
754 int location_manager_set_zone_changed_cb(location_manager_h manager, location_zone_changed_cb callback, void *user_data);
755
756 /**
757  * @brief       Unregisters the callback function.
758  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
759  * @param[in] manager           The location manager handle
760  * @return 0 on success, otherwise a negative error value
761  * @retval #LOCATIONS_ERROR_NONE                                Successful
762  * @retval #LOCATIONS_ERROR_INVALID_PARAMETER   Invalid parameter
763  * @retval      #LOCATIONS_ERROR_NOT_SUPPORTED          Not supported
764  * @see location_manager_set_zone_changed_cb()
765  */
766 int location_manager_unset_zone_changed_cb(location_manager_h manager);
767
768 /**
769  * @brief Registers a callback function to be invoked when the location setting is changed.
770  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
771  * @param[in] method            The method to observe
772  * @param[in] callback          The callback function to register
773  * @param[in] user_data         The user data to be passed to the callback function
774  * @return 0 on success, otherwise a negative error value
775  * @retval #LOCATIONS_ERROR_NONE                                Successful
776  * @retval #LOCATIONS_ERROR_INVALID_PARAMETER   Invalid parameter
777  * @retval      #LOCATIONS_ERROR_NOT_SUPPORTED          Not supported
778  * @post location_setting_changed_cb() will be invoked
779  * @see location_manager_unset_setting_changed_cb()
780  * @see location_setting_changed_cb()
781  */
782 int location_manager_set_setting_changed_cb(location_method_e method, location_setting_changed_cb callback, void *user_data);
783
784 /**
785  * @brief Unregisters the callback function.
786  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
787  * @param[in] method            The method to observe
788  * @return 0 on success, otherwise a negative error value
789  * @retval #LOCATIONS_ERROR_NONE                                Successful
790  * @retval #LOCATIONS_ERROR_INVALID_PARAMETER   Invalid parameter
791  * @retval      #LOCATIONS_ERROR_NOT_SUPPORTED          Not supported
792  * @see location_manager_set_setting_changed_cb()
793  */
794 int location_manager_unset_setting_changed_cb(location_method_e method);
795
796 /**
797  * @brief Gets the distance in meters between two locations.
798  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
799  * @param[in] start_latitude            The starting latitude [-90.0 ~ 90.0] (degrees)
800  * @param[in] start_longitude           The starting longitude [-180.0 ~ 180.0] (degrees)
801  * @param[in] end_latitude                      The ending latitude [-90.0 ~ 90.0] (degrees)
802  * @param[in] end_longitude                     The ending longitude [-180.0 ~ 180.0] (degrees)
803  * @param[out] distance                         The distance between two locations (meters)
804  * @return 0 on success, otherwise a negative error value
805  * @retval #LOCATIONS_ERROR_NONE                                Successful
806  * @retval #LOCATIONS_ERROR_INVALID_PARAMETER   Invalid argument
807  * @retval #LOCATIONS_ERROR_NOT_SUPPORTED               Not supported
808  */
809 int location_manager_get_distance(double start_latitude, double start_longitude, double end_latitude, double end_longitude, double *distance);
810
811 /**
812  * @brief Registers a callback function to be invoked at minimum interval or minimum distance with updated position information.
813  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
814  * @param[in] manager           The location manager handle
815  * @param[in] callback          The callback function to register
816  * @param[in] interval          The minimum interval between position updates [1 ~ 120] (seconds)
817  * @param[in] distance          The minimum distance between position updates [1 ~ 120] (meters)
818  * @param[in] user_data         The user data to be passed to the callback function
819  * @return @c 0 on success, otherwise a negative error value
820  * @retval #LOCATIONS_ERROR_NONE                                Successful
821  * @retval #LOCATIONS_ERROR_INVALID_PARAMETER   Invalid parameter
822  * @retval #LOCATIONS_ERROR_NOT_SUPPORTED               Not supported
823  * @post location_changed_cb() will be invoked
824  * @see location_manager_unset_distance_based_location_changed_cb()
825  * @see location_changed_cb()
826  */
827 int location_manager_set_distance_based_location_changed_cb(location_manager_h manager, location_changed_cb callback, int interval, double distance, void *user_data);
828
829 /**
830  * @brief Unregisters the callback function.
831  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
832  * @param[in] manager           The location manager handle
833  * @return @c 0 on success, otherwise a negative error value
834  * @retval #LOCATIONS_ERROR_NONE                                Successful
835  * @retval #LOCATIONS_ERROR_INVALID_PARAMETER   Invalid parameter
836  * @retval #LOCATIONS_ERROR_NOT_SUPPORTED               Not supported
837  * @see location_manager_set_distance_based_location_changed_cb()
838  */
839 int location_manager_unset_distance_based_location_changed_cb(location_manager_h manager);
840
841 /**
842  * @brief Registers a callback function to be invoked at defined interval with updated location information.
843  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
844  * @param[in] manager           The location manager handle
845  * @param[in] callback          The callback function to register
846  * @param[in] interval          The interval [1 ~ 120] (seconds)
847  * @param[in] user_data         The user data to be passed to the callback function
848  * @return @c 0 on success, 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  * @post location_changed_cb() will be invoked
853  * @see location_manager_unset_location_changed_cb()
854  * @see location_changed_cb()
855  */
856 int location_manager_set_location_changed_cb(location_manager_h manager, location_changed_cb callback, int interval, void *user_data);
857
858 /**
859  * @brief       Unregisters the callback function.
860  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
861  * @param[in] manager           The location manager handle
862  * @return @c 0 on success, otherwise a negative error value
863  * @retval #LOCATIONS_ERROR_NONE                                Successful
864  * @retval #LOCATIONS_ERROR_INVALID_PARAMETER   Invalid parameter
865  * @retval #LOCATIONS_ERROR_NOT_SUPPORTED               Not supported
866  * @see location_manager_set_location_changed_cb()
867  */
868 int location_manager_unset_location_changed_cb(location_manager_h manager);
869
870 /**
871  * @brief Enables mock location.
872  * @remarks You can enable the mock location when developer mode is enabled.
873  * @since_tizen 3.0
874  * @privlevel public
875  * @privilege %http://tizen.org/privilege/location
876  * @param[in] enable            The value to set
877  * @return 0 on success, otherwise a negative error value
878  * @retval #LOCATIONS_ERROR_NONE Successful
879  * @retval #LOCATIONS_ERROR_SETTING_OFF MOCK location is not enabled
880  * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED Permission denied
881  * @retval #LOCATIONS_ERROR_NOT_SUPPORTED       Not supported
882  * @see location_manager_is_enabled_method()
883  * @see location_manager_create()
884  * @see location_manager_set_mock_location()
885  */
886 int location_manager_enable_mock_location(const bool enable);
887
888 /**
889  * @brief Sets a mock location for the given location method.
890  * @details The location sets the given altitude, latitude, longitude, climb, direction, speed, level, horizontal and vertical accuracy.
891  *
892  * @since_tizen 3.0
893  * @privlevel public
894  * @privilege %http://tizen.org/privilege/location
895  * @param[in] manager           The location manager handle
896  * @param[in] latitude          The current latitude [-90.0 ~ 90.0] (degrees)
897  * @param[in] longitude The current longitude [-180.0 ~ 180.0] (degrees)
898  * @param[in] altitude          The current altitude (meters)
899  * @param[in] speed             The speed (km/h)
900  * @param[in] direction The direction, degrees from the north [0.0 ~ 360.0]
901  * @param[in] accuracy          The horizontal accuracy (meters)
902  * @return 0 on success, otherwise a negative error value
903  * @retval #LOCATIONS_ERROR_NONE                                        Successful
904  * @retval #LOCATIONS_ERROR_INVALID_PARAMETER           Invalid argument
905  * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE       Service not available
906  * @retval #LOCATIONS_ERROR_SETTING_OFF                         MOCK location is not enabled
907  * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
908  * @retval #LOCATIONS_ERROR_NOT_SUPPORTED                       Not supported
909  * @see location_manager_is_enabled_method()
910  * @see location_manager_enable_mock_location()
911  * @see location_manager_create()
912  * @see location_manager_clear_mock_location()
913  */
914 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);
915
916 /**
917  * @brief Clears a mock location.
918  *
919  * @since_tizen 3.0
920  * @privlevel public
921  * @privilege %http://tizen.org/privilege/location
922  * @param[in] manager           The location manager handle
923  * @return 0 on success, otherwise a negative error value
924  * @retval #LOCATIONS_ERROR_NONE                                        Successful
925  * @retval #LOCATIONS_ERROR_INVALID_PARAMETER           Invalid argument
926  * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE       Service not available
927  * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
928  * @retval #LOCATIONS_ERROR_SETTING_OFF                         MOCK location is not enabled
929  * @retval #LOCATIONS_ERROR_NOT_SUPPORTED                       Not supported
930  * @see location_manager_is_enabled_method()
931  * @see location_manager_enable_mock_location()
932  * @see location_manager_create()
933  * @see location_manager_set_mock_location()
934  */
935 int location_manager_clear_mock_location(location_manager_h manager);
936
937 /**
938  * @}
939  */
940
941 /*
942  * GPS Status & Satellites
943  */
944
945 /**
946  * @addtogroup CAPI_LOCATION_GPS_STATUS_MODULE
947  * @{
948  */
949
950 /**
951  * @brief Called once for each satellite in range.
952  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
953  * @param[in] azimuth           The azimuth of the satellite (degrees)
954  * @param[in] elevation         The elevation of the satellite (meters)
955  * @param[in] prn                       The PRN of the satellite
956  * @param[in] snr                       The SNR of the satellite [dB]
957  * @param[in] is_active         The flag signaling if satellite is in use
958  * @param[in] user_data         The user data passed from the foreach function
959  * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop
960  * @pre gps_status_foreach_satellites_in_view() will invoke this callback.
961  * @pre gps_status_foreach_last_satellites_in_view() will invoke this callback.
962  * @see gps_status_foreach_satellites_in_view()
963  */
964 typedef bool(*gps_status_get_satellites_cb)(unsigned int azimuth, unsigned int elevation, unsigned int prn, int snr, bool is_active, void *user_data);
965
966 /**
967  * @brief Called at defined interval with updated satellite information.
968  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
969  * @param[out] num_of_active    The last number of active satellites
970  * @param[out] num_of_inview    The last number of satellites in view
971  * @param[out] timestamp                The last timestamp (time when measurement took place or @c 0 if valid)
972  * @param[in] user_data                 The user data passed from the call registration function
973  * @pre location_manager_start() will invoke this callback if you register this callback using location_manager_set_position_updated_cb()
974  * @see location_manager_start()
975  * @see location_manager_set_position_updated_cb()
976  */
977 typedef void(*gps_status_satellite_updated_cb)(int num_of_active, int num_of_inview, time_t timestamp, void *user_data);
978
979 /**
980  * @brief Gets the GPS NMEA data.
981  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
982  * @remarks This call is valid only for location managers with #LOCATIONS_METHOD_GPS method.
983  *               You must release @a nmea using @c free().
984  * @param[in] manager   The location manager handle
985  * @param[out] nmea             The NMEA data
986  * @return @c 0 on success, otherwise a negative error value
987  * @retval #LOCATIONS_ERROR_NONE                                        Successful
988  * @retval #LOCATIONS_ERROR_INVALID_PARAMETER           Invalid argument
989  * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE       Service not available
990  * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
991  * @retval #LOCATIONS_ERROR_NOT_SUPPORTED                       Not supported
992  * @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start()
993  * @see location_manager_start()
994  */
995 int gps_status_get_nmea(location_manager_h manager, char **nmea);
996
997 /**
998  * @brief Gets the information of satellites.
999  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1000  * @privlevel public
1001  * @privilege %http://tizen.org/privilege/location
1002  * @remarks This call is valid only for location managers with #LOCATIONS_METHOD_GPS method.
1003  * @param[in] manager                   The location manager handle
1004  * @param[out] num_of_active    The number of active satellites
1005  * @param[out] num_of_inview    The number of satellites in view
1006  * @param[out] timestamp                The timestamp (time when measurement took place or @c 0 if valid)
1007  * @return @c 0 on success, otherwise a negative error value
1008  * @retval #LOCATIONS_ERROR_NONE                                        Successful
1009  * @retval #LOCATIONS_ERROR_INVALID_PARAMETER           Invalid argument
1010  * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE       Service not available
1011  * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
1012  * @retval #LOCATIONS_ERROR_NOT_SUPPORTED                       Not supported
1013  * @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start()
1014  * @pre The gps_status_satellite_updated_cb must be set with gps_status_set_satellite_updated_cb()
1015  * @see gps_status_foreach_satellites_in_view()
1016  */
1017 int gps_status_get_satellite(location_manager_h manager, int *num_of_active, int *num_of_inview, time_t *timestamp);
1018
1019 /**
1020  * @brief Registers a callback function to be invoked at defined interval with updated satellite information.
1021  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1022  * @privlevel public
1023  * @privilege %http://tizen.org/privilege/location
1024  * @param[in] manager           The location manager handle
1025  * @param[in] callback          The callback function to register
1026  * @param[in] interval          The interval [1 ~ 120] (seconds)
1027  * @param[in] user_data         The user data to be passed to the callback function
1028  * @return 0 on success, otherwise a negative error value
1029  * @retval #LOCATIONS_ERROR_NONE                                Successful
1030  * @retval #LOCATIONS_ERROR_INVALID_PARAMETER   Invalid parameter
1031  * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
1032  * @retval #LOCATIONS_ERROR_NOT_SUPPORTED               Not supported
1033  * @post gps_status_satellite_updated_cb() will be invoked
1034  * @see gps_status_unset_satellite_updated_cb()
1035  * @see gps_status_satellite_updated_cb()
1036  * @see gps_status_get_satellite()
1037  * @see gps_status_foreach_satellites_in_view()
1038  * @see gps_status_get_last_satellite()
1039  * @see gps_status_foreach_last_satellites_in_view()
1040  */
1041 int gps_status_set_satellite_updated_cb(location_manager_h manager, gps_status_satellite_updated_cb callback, int interval, void *user_data);
1042
1043 /**
1044  * @brief       Unregisters the callback function.
1045  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1046  * @param[in] manager           The location manager handle
1047  * @return @c 0 on success, otherwise a negative error value
1048  * @retval #LOCATIONS_ERROR_NONE                                Successful
1049  * @retval #LOCATIONS_ERROR_INVALID_PARAMETER   Invalid parameter
1050  * @retval #LOCATIONS_ERROR_NOT_SUPPORTED               Not supported
1051  * @see gps_status_set_satellite_updated_cb()
1052  */
1053 int gps_status_unset_satellite_updated_cb(location_manager_h manager);
1054
1055 /**
1056  * @brief Invokes the callback function for each satellite.
1057  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1058  * @privlevel public
1059  * @privilege %http://tizen.org/privilege/location
1060  * @remarks This function is valid only for location managers with the #LOCATIONS_METHOD_GPS method.
1061  * @param[in] manager           The location manager handle
1062  * @param[in] callback          The iteration callback function
1063  * @param[in] user_data         The user data to be passed to the callback function
1064  * @return @c 0 on success, otherwise a negative error value
1065  * @retval #LOCATIONS_ERROR_NONE                                        Successful
1066  * @retval #LOCATIONS_ERROR_INVALID_PARAMETER           Invalid argument
1067  * @retval #LOCATIONS_ERROR_INCORRECT_METHOD            Incorrect method
1068  * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE       Service not available
1069  * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
1070  * @retval #LOCATIONS_ERROR_NOT_SUPPORTED                       Not supported
1071  * @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start()
1072  * @pre The gps_status_satellite_updated_cb must be set with gps_status_set_satellite_updated_cb()
1073  * @post It invokes gps_status_get_satellites_cb().
1074  * @see gps_status_get_satellite()
1075  * @see gps_status_get_satellites_cb()
1076  */
1077 int gps_status_foreach_satellites_in_view(location_manager_h manager, gps_status_get_satellites_cb callback, void *user_data);
1078
1079 /**
1080  * @brief Gets the last information of satellites.
1081  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1082  * @privlevel public
1083  * @privilege %http://tizen.org/privilege/location
1084  * @remarks This call is valid only for location managers with #LOCATIONS_METHOD_GPS method.
1085  * @param[in] manager                   The location manager handle
1086  * @param[out] num_of_active    The last number of active satellites
1087  * @param[out] num_of_inview    The last number of satellites in view
1088  * @param[out] timestamp                The last timestamp (time when last measurement took place or @c 0 if valid)
1089  * @return @c 0 on success, otherwise a negative error value
1090  * @retval #LOCATIONS_ERROR_NONE                                        Successful
1091  * @retval #LOCATIONS_ERROR_INVALID_PARAMETER           Invalid argument
1092  * @retval #LOCATIONS_ERROR_INCORRECT_METHOD            Incorrect method
1093  * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE       Service not available
1094  * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
1095  * @retval #LOCATIONS_ERROR_NOT_SUPPORTED                       Not supported
1096  * @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start()
1097  * @pre The gps_status_satellite_updated_cb must be set with gps_status_set_satellite_updated_cb()
1098  * @see gps_status_foreach_satellites_in_view()
1099  */
1100 int gps_status_get_last_satellite(location_manager_h manager, int *num_of_active, int *num_of_inview, time_t *timestamp);
1101
1102 /**
1103  * @brief Invokes the callback function for each last satellite which is recorded.
1104  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1105  * @privlevel public
1106  * @privilege %http://tizen.org/privilege/location
1107  * @remarks This function is valid only for location managers with the #LOCATIONS_METHOD_GPS method.
1108  * @param[in] manager           The location manager handle
1109  * @param[in] callback          The iteration callback function
1110  * @param[in] user_data         The user data to be passed to the callback function
1111  * @return @c 0 on success, otherwise a negative error value
1112  * @retval #LOCATIONS_ERROR_NONE                                        Successful
1113  * @retval #LOCATIONS_ERROR_INVALID_PARAMETER           Invalid argument
1114  * @retval #LOCATIONS_ERROR_INCORRECT_METHOD            Incorrect method
1115  * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE       Service not available
1116  * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
1117  * @retval #LOCATIONS_ERROR_NOT_SUPPORTED                       Not supported
1118  * @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start()
1119  * @pre The gps_status_satellite_updated_cb must be set with gps_status_set_satellite_updated_cb()
1120  * @post It invokes gps_status_get_satellites_cb().
1121  * @see gps_status_get_last_satellite()
1122  * @see gps_status_get_satellites_cb()
1123  */
1124 int gps_status_foreach_last_satellites_in_view(location_manager_h manager, gps_status_get_satellites_cb callback, void *user_data);
1125
1126 /**
1127  * @}
1128  */
1129 #ifdef __cplusplus
1130 }
1131 #endif
1132
1133 #endif /* __TIZEN_LOCATION_LOCATIONS_H__ */