2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef __TIZEN_LOCATION_LOCATIONS_H__
18 #define __TIZEN_LOCATION_LOCATIONS_H__
20 #include <tizen_type.h>
21 #include <tizen_error.h>
22 #include <location_bounds.h>
29 * @addtogroup CAPI_LOCATION_MANAGER_MODULE
34 * @brief Enumerations of error code for Location manager.
38 LOCATIONS_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
39 LOCATIONS_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
40 LOCATIONS_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
41 LOCATIONS_ERROR_INCORRECT_METHOD = TIZEN_ERROR_LOCATION_CLASS | 0x01, /**< Location manager contains incorrect method for a given call */
42 LOCATIONS_ERROR_NETWORK_FAILED = TIZEN_ERROR_LOCATION_CLASS | 0x02, /**< Network unavailable */
43 LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE = TIZEN_ERROR_LOCATION_CLASS | 0x03, /**< Location service is not available */
44 LOCATIONS_ERROR_GPS_SETTING_OFF = TIZEN_ERROR_LOCATION_CLASS | 0x04, /**< GPS/WPS setting is not enabled */
45 LOCATIONS_ERROR_SECURITY_RESTRICTED = TIZEN_ERROR_LOCATION_CLASS | 0x05, /**< Restricted by security system policy */
46 LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED = TIZEN_ERROR_LOCATION_CLASS | 0x06, /**< Location service accessibility is not allowed */
50 * @brief Location method type.
54 LOCATIONS_METHOD_NONE=-1, /**< Undefined method. */
55 LOCATIONS_METHOD_HYBRID, /**< This method selects the best method available at the moment. */
56 LOCATIONS_METHOD_GPS, /**< This method uses Global Positioning System. */
57 LOCATIONS_METHOD_WPS, /**< This method uses Wifi Positioning System. */
58 LOCATIONS_METHOD_CPS /**< This method uses Cellular Positioning System. */
62 * @brief Approximate accuracy level of given information.
66 LOCATIONS_ACCURACY_NONE=0, /**< Invalid data. */
67 LOCATIONS_ACCURACY_COUNTRY, /**< Country accuracy level. */
68 LOCATIONS_ACCURACY_REGION, /**< Regional accuracy level. */
69 LOCATIONS_ACCURACY_LOCALITY, /**< Local accuracy level. */
70 LOCATIONS_ACCURACY_POSTALCODE, /**< Postal accuracy level. */
71 LOCATIONS_ACCURACY_STREET, /**< Street accuracy level. */
72 LOCATIONS_ACCURACY_DETAILED, /**< Detailed accuracy level. */
73 } location_accuracy_level_e;
76 * @brief Enumerations of the state of the location service.
80 LOCATIONS_SERVICE_DISABLED, /**< Service is disabled */
81 LOCATIONS_SERVICE_ENABLED /**< Service is enabled */
82 } location_service_state_e;
85 * @brief Enumerations of the location service accessibility state.
89 LOCATIONS_ACCESS_STATE_NONE, /**< Not determined yet */
90 LOCATIONS_ACCESS_STATE_DENIED, /**< Access denied */
91 LOCATIONS_ACCESS_STATE_ALLOWED, /**< Access authorized */
92 } location_accessibility_state_e;
95 * @brief The location manager handle.
97 typedef struct location_manager_s *location_manager_h;
106 * @addtogroup CAPI_LOCATION_MANAGER_MODULE
110 * @brief Called at defined interval with updated position information.
111 * @param[in] latitude The updated latitude [-90.0 ~ 90.0] (degrees)
112 * @param[in] longitude The updated longitude [-180.0 ~ 180.0] (degrees)
113 * @param[in] altitude The updated altitude (meters)
114 * @param[in] timestamp The timestamp (time when measurement took place or 0 if invalid)
115 * @param[in] user_data The user data passed from the call registration function
116 * @pre location_manager_start() will invoke this callback if you register this callback using location_manager_set_position_updated_cb()
117 * @see location_manager_start()
118 * @see location_manager_set_position_updated_cb()
120 typedef void(*location_position_updated_cb)(double latitude, double longitude, double altitude, time_t timestamp, void *user_data);
123 * @brief Called at defined interval with updated velocity information.
124 * @param[in] speed The updated speed (km/h)
125 * @param[in] direction The updated direction (in degrees from the north)
126 * @param[in] climb The updated climb (km/h)
127 * @param[in] timestamp The timestamp (time when measurement took place or 0 if invalid)
128 * @param[in] user_data The user data passed from the callback registration function
129 * @pre location_manager_start() will invoke this callback if you register this callback using location_manager_set_velocity_updated_cb()
130 * @see location_manager_start()
131 * @see location_manager_set_velocity_updated_cb()
133 typedef void(*location_velocity_updated_cb)(double speed, double direction, double climb, time_t timestamp, void *user_data);
136 * @brief Called when the state of location service is changed from enabled to disabled or vice versa.
137 * @param[in] state The service state
138 * @param[in] user_data The user data passed from the callback registration function
139 * @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()
140 * @see location_manager_start()
141 * @see location_manager_stop()
142 * @see location_manager_set_service_state_changed_cb()
143 * @see #location_service_state_e
145 typedef void(*location_service_state_changed_cb)(location_service_state_e state, void *user_data);
148 * @brief Called when the user defined zones are entered or exited.
149 * @param[in] state The boundary state
150 * @param[in] latitude The updated latitude [-90.0 ~ 90.0] (degrees)
151 * @param[in] longitude The updated longitude [-180.0 ~ 180.0] (degrees)
152 * @param[in] altitude The updated altitude (meters)
153 * @param[in] timestamp The timestamp (time when measurement took place or 0 if invalid)
154 * @param[in] user_data The user data passed from the callback registration function
155 * @pre location_manager_start() will invoke this callback if you register this callback using location_manager_set_zone_changed_cb()
156 * @see #location_boundary_state_e
157 * @see location_manager_start()
158 * @see location_manager_set_zone_changed_cb()
160 typedef void(*location_zone_changed_cb)(location_boundary_state_e state, double latitude, double longitude, double altitude, time_t timestamp, void *user_data);
163 * @brief Gets called iteratively to notify you of location bounds.
164 * @param[in] bounds The location bounds handle
165 * @param[in] user_data The user data passed from the callback registration function
166 * @pre location_manager_foreach_boundary() will invoke this callback.
167 * @see location_manager_foreach_boundary()
169 typedef bool(*location_bounds_cb)(location_bounds_h bounds, void *user_data);
172 * @brief Checks whether the given location method is avaliable or not.
173 * @param[in] method The location method to be checked
174 * @return @c true if the specified location method is supported, \n else @c false
175 * @see location_manager_create()
176 * @see location_manager_get_method()
178 bool location_manager_is_supported_method(location_method_e method);
182 * @brief Creates a new location manager.
183 * @remarks @a manager must be released location_manager_destroy() by you.
184 * @param[in] method The location method
185 * @param[out] manager A location manager handle to be newly created on success
186 * @return 0 on success, otherwise a negative error value.
187 * @retval #LOCATIONS_ERROR_NONE Successful
188 * @retval #LOCATIONS_ERROR_OUT_OF_MEMORY Out of memory
189 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
190 * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
191 * @see location_manager_destroy()
193 int location_manager_create(location_method_e method, location_manager_h* manager);
196 * @brief Releases the location manager.
197 * @param[in] manager The location manager handle
198 * @return 0 on success, otherwise a negative error value.
199 * @retval #LOCATIONS_ERROR_NONE Successful
200 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
201 * @see location_manager_create()
203 int location_manager_destroy(location_manager_h manager);
206 * @brief Starts the location service.
208 * @remarks There is no limit on number of location managers for which this function was called.
210 * Calling this function invokes a location service event. When the location service is enabled, the service state change callback
211 * (set using #location_manager_set_service_state_changed_cb()) notifies the user with #LOCATIONS_SERVICE_ENABLED as
212 * the first argument, and the service starts. \n
214 * Started service is a requirement for calling these functions:
216 * location_manager_get_position(), location_manager_get_velocity(), location_manager_get_accuracy(),
217 * gps_status_get_nmea(), gps_status_get_satellite_count_in_view(), gps_status_foreach_satellites_in_view(), gps_status_get_active_satellite_count().
219 * Once you stop the service, using #location_manager_stop(), you can no longer call the functions listed above.
221 * Starting and stopping the service is in the scope of the given location manager only (if there's more than one manager,
222 * starting and stopping should be executed for each of them separately).
224 * @param[in] manager The location manager handle
225 * @return 0 on success, otherwise a negative error value.
226 * @retval #LOCATIONS_ERROR_NONE Successful
227 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
228 * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
229 * @retval #LOCATIONS_ERROR_NETWORK_FAILED Network failed
230 * @retval #LOCATIONS_ERROR_GPS_SETTING_OFF GPS is not enabled
231 * @post It invokes location_position_updated_cb(), location_velocity_updated_cb(), location_zone_changed_cb(), and location_service_state_changed_cb().
232 * @see location_manager_stop()
233 * @see location_manager_get_position()
234 * @see location_manager_get_velocity()
235 * @see location_manager_get_accuracy()
236 * @see location_manager_set_service_state_changed_cb()
237 * @see location_manager_set_position_updated_cb()
238 * @see location_position_updated_cb()
239 * @see location_manager_set_velocity_updated_cb()
240 * @see location_velocity_updated_cb()
241 * @see location_manager_set_zone_changed_cb()
242 * @see location_zone_changed_cb()
244 int location_manager_start(location_manager_h manager);
247 * @brief Stops the location service.
248 * @remarks This function initiates the process of stopping the service. When the process is finished, callback set using
249 * #location_manager_set_service_state_changed_cb() will be called, with #LOCATIONS_SERVICE_DISABLED as first argument.
250 * When that happens, the service is stopped and the user is notified.
252 * You can stop and start the location manager as needed.
254 * @param[in] manager The location manager handle
255 * @return 0 on success, otherwise a negative error value.
256 * @retval #LOCATIONS_ERROR_NONE Successful
257 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
258 * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
259 * @retval #LOCATIONS_ERROR_NETWORK_FAILED Network failed
260 * @see location_manager_start()
261 * @see location_manager_set_service_state_changed_cb()
262 * @see location_service_state_changed_cb()
264 int location_manager_stop(location_manager_h manager);
267 * @brief Adds a bounds for a given location manager.
268 * @param[in] manager The location manager handle
269 * @param[in] bounds The location bounds handle
270 * @return 0 on success, otherwise a negative error value.
271 * @retval #LOCATIONS_ERROR_NONE Successful
272 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
273 * @retval #LOCATIONS_ERROR_OUT_OF_MEMORY Out of memory
274 * @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().
275 * @see location_manager_remove_boundary()
276 * @see location_manager_set_zone_changed_cb()
277 * @see location_manager_is_boundary_contains_coordinate()
279 int location_manager_add_boundary(location_manager_h manager, const location_bounds_h bounds);
282 * @brief Deletes a bounds for a given location manager.
283 * @param[in] manager The location manager handle
284 * @param[in] bounds The location bounds handle
285 * @return 0 on success, otherwise a negative error value.
286 * @retval #LOCATIONS_ERROR_NONE Successful
287 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
288 * @retval #LOCATIONS_ERROR_OUT_OF_MEMORY Out of memory
289 * @see location_manager_add_boundary()
291 int location_manager_remove_boundary(location_manager_h manager, const location_bounds_h bounds);
294 * @brief Retrieves all location bounds by invoking a specific callback for each locatoin bounds
295 * @param[in] manager The location manager handle
296 * @param[in] callback The iteration callback
297 * @param[in] user_data The user data to be passed to the callback function
298 * @return 0 on success, otherwise a negative error value.
299 * @retval #LOCATIONS_ERROR_NONE Successful
300 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
301 * @post location_bounds_cb() will be invoked
302 * @see location_manager_add_boundary()
303 * @see location_manager_remove_boundary()
304 * @see location_bounds_cb()
306 int location_manager_foreach_boundary(location_manager_h manager, location_bounds_cb callback, void *user_data);
309 * @brief Gets the given location manager's method.
311 * @param[in] manager The location manager handle
312 * @param[out] method The location method
313 * @return 0 on success, otherwise a negative error value.
314 * @retval #LOCATIONS_ERROR_NONE Successful
315 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
316 * @see location_manager_create()
318 int location_manager_get_method(location_manager_h manager, location_method_e *method);
321 * @brief Gets the current position information.
323 * The result is current altitude, latitude, and longitude, with a measurement timestamp.
325 * If @a altitude is negative, only altitude and latitude are available (fix status is 2D).
326 * If @a altitude is positive, fix status is 3D and returned altitude value is the result of measurement.
328 * @param[in] manager The location manager handle
329 * @param[out] altitude The current altitude (meters)
330 * @param[out] latitude The current latitude [-90.0 ~ 90.0] (degrees)
331 * @param[out] longitude The current longitude [-180.0 ~ 180.0] (degrees)
332 * @param[out] timestamp The timestamp (time when measurement took place or 0 if valid)
333 * @return 0 on success, otherwise a negative error value.
334 * @retval #LOCATIONS_ERROR_NONE Successful
335 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
336 * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
337 * @retval #LOCATIONS_ERROR_GPS_SETTING_OFF GPS is not enabled
338 * @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start()
340 int location_manager_get_position(location_manager_h manager, double *altitude, double *latitude, double *longitude, time_t *timestamp);
343 * @brief Gets the current velocity information.
345 * The result is current climb, direction, and speed, with a measurement timestamp.
347 * @param[in] manager The location manager handle
348 * @param[out] climb The climb (km/h)
349 * @param[out] direction The direction, degrees from the north
350 * @param[out] speed The speed (km/h)
351 * @param[out] timestamp The timestamp (time when measurement took place or 0 if invalid)
352 * @return 0 on success, otherwise a negative error value.
353 * @retval #LOCATIONS_ERROR_NONE Successful
354 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
355 * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
356 * @retval #LOCATIONS_ERROR_GPS_SETTING_OFF GPS is not enabled
357 * @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start()
359 int location_manager_get_velocity(location_manager_h manager, double *climb, double *direction, double *speed, time_t *timestamp);
362 * @brief Gets the current accuracy information.
363 * @param[in] manager The location manager handle
364 * @param[out] level The accuracy level
365 * @param[out] horizontal The horizontal accuracy (meters)
366 * @param[out] vertical The vertical accuracy (meters)
367 * @return 0 on success, otherwise a negative error value.
368 * @retval #LOCATIONS_ERROR_NONE Successful
369 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
370 * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
371 * @retval #LOCATIONS_ERROR_GPS_SETTING_OFF GPS is not enabled
372 * @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start()
374 int location_manager_get_accuracy(location_manager_h manager, location_accuracy_level_e *level, double *horizontal, double *vertical);
377 * @brief Gets the last position information which is recorded.
378 * @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.
379 * @details If @a altitude is negative, only altitude and latitude are available (fix status is 2D).
380 * @details If @a altitude is positive, fix status is 3D and returned altitude value is the result of measurement.
381 * @param[in] manager The location manager handle
382 * @param[out] altitude The last altitude (meters)
383 * @param[out] latitude The last latitude [-90.0 ~ 90.0] (degrees)
384 * @param[out] longitude The last longitude [-180.0 ~ 180.0] (degrees)
385 * @param[out] timestamp The timestamp (time when measurement took place or 0 if invalid)
386 * @return 0 on success, otherwise a negative error value.
387 * @retval #LOCATIONS_ERROR_NONE Successful
388 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
389 * @pre The location manager handle must be created by location_manager_create()
391 int location_manager_get_last_position(location_manager_h manager, double *altitude, double *latitude, double *longitude, time_t *timestamp);
394 * @brief Gets the last velocity information which is recorded.
396 * The @a climb, @a direction and @a speed values should be 0, if there is no record of any previous velocity information.
398 * @param[in] manager The location manager handle
399 * @param[out] climb The last climb (km/h)
400 * @param[out] direction The last direction, degrees from the north
401 * @param[out] speed The last speed (km/h)
402 * @param[out] timestamp The timestamp (time when measurement took place or 0 if invalid)
403 * @return 0 on success, otherwise a negative error value.
404 * @retval #LOCATIONS_ERROR_NONE Successful
405 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
406 * @pre The location manager handle must be created by location_manager_create()
408 int location_manager_get_last_velocity(location_manager_h manager, double *climb, double *direction, double *speed, time_t *timestamp);
411 * @brief Gets the last accuracy information which is recorded.
412 * @param[in] manager The location manager handle
413 * @param[out] level The last accuracy level
414 * @param[out] horizontal The last horizontal accuracy (meters)
415 * @param[out] vertical The last vertical accuracy (meters)
416 * @return 0 on success, otherwise a negative error value.
417 * @retval #LOCATIONS_ERROR_NONE Successful
418 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
419 * @pre The location manager handle must be created by location_manager_create()
421 int location_manager_get_last_accuracy(location_manager_h manager, location_accuracy_level_e *level, double *horizontal, double *vertical);
424 * @brief Gets the current application's location accessibility status.
425 * @param[in] manager The location manager handle
426 * @param[out] state The current location service accessibility status.
427 * @return 0 on success, otherwise a negative error value.
428 * @retval #LOCATIONS_ERROR_NONE Successful
429 * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
430 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
432 int location_manager_get_accessibility_state(location_accessibility_state_e* state);
435 * @brief Registers a callback function to be invoked at defined interval with updated position information.
437 * @param[in] manager The location manager handle
438 * @param[in] callback The callback function to register
439 * @param[in] interval The interval [1 ~ 120] (seconds)
440 * @param[in] user_data The user data to be passed to the callback function
441 * @return 0 on success, otherwise a negative error value.
442 * @retval #LOCATIONS_ERROR_NONE Successful
443 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
444 * @post location_position_updated_cb() will be invoked
445 * @see location_manager_unset_position_updated_cb()
446 * @see location_position_updated_cb()
448 int location_manager_set_position_updated_cb(location_manager_h manager, location_position_updated_cb callback, int interval, void *user_data);
451 * @brief Unregisters the callback function.
453 * @param[in] manager The location manager handle
454 * @return 0 on success, otherwise a negative error value.
455 * @retval #LOCATIONS_ERROR_NONE Successful
456 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
457 * @see location_manager_set_position_updated_cb()
459 int location_manager_unset_position_updated_cb(location_manager_h manager);
462 * @brief Registers a callback function to be invoked at defined interval with updated velocity information.
464 * @param[in] manager The location manager handle
465 * @param[in] callback The callback function to register
466 * @param[in] interval The interval [1 ~ 120] (seconds)
467 * @param[in] user_data The user data to be passed to the callback function
468 * @return 0 on success, otherwise a negative error value.
469 * @retval #LOCATIONS_ERROR_NONE Successful
470 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
471 * @post location_velocity_updated_cb() will be invoked
472 * @see location_manager_unset_velocity_updated_cb()
473 * @see location_velocity_updated_cb()
475 int location_manager_set_velocity_updated_cb(location_manager_h manager, location_velocity_updated_cb callback, int interval, void *user_data);
478 * @brief Unregisters the callback function.
480 * @param[in] manager The location manager handle
481 * @return 0 on success, otherwise a negative error value.
482 * @retval #LOCATIONS_ERROR_NONE Successful
483 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
484 * @see location_manager_set_velocity_updated_cb()
486 int location_manager_unset_velocity_updated_cb(location_manager_h manager);
489 * @brief Registers a callback function to be invoked when the location service state is changed.
491 * @param[in] manager The location manager handle
492 * @param[in] callback The callback function to register
493 * @param[in] user_data The user data to be passed to the callback function
494 * @return 0 on success, otherwise a negative error value.
495 * @retval #LOCATIONS_ERROR_NONE Successful
496 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
497 * @post location_service_state_changed_cb() will be invoked
498 * @see location_manager_unset_service_state_changed_cb()
499 * @see location_service_state_changed_cb()
500 * @see location_manager_start()
501 * @see location_manager_stop()
502 * @see #location_service_state_e
504 int location_manager_set_service_state_changed_cb(location_manager_h manager, location_service_state_changed_cb callback, void *user_data);
507 * @brief Unregisters the callback function.
508 * @param[in] manager The location manager handle
509 * @return 0 on success, otherwise a negative error value.
510 * @retval #LOCATIONS_ERROR_NONE Successful
511 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
512 * @see location_manager_set_service_state_changed_cb()
514 int location_manager_unset_service_state_changed_cb(location_manager_h manager);
517 * @brief Registers a callback function to be invoked when the previously set boundary area is entered or left.
519 * @param[in] manager The location manager handle
520 * @param[in] callback The callback function to register
521 * @param[in] user_data The user data to be passed to the callback function
522 * @return 0 on success, otherwise a negative error value.
523 * @retval #LOCATIONS_ERROR_NONE Successful
524 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
525 * @pre Either location_manager_set_boundary_rect() or location_manager_set_boundary_circle() is called before.
526 * @post location_zone_changed_cb() will be invoked
527 * @see location_manager_unset_zone_changed_cb()
528 * @see location_zone_changed_cb()
530 int location_manager_set_zone_changed_cb(location_manager_h manager, location_zone_changed_cb callback, void *user_data);
533 * @brief Unregisters the callback function.
534 * @param[in] manager The location manager handle
535 * @return 0 on success, otherwise a negative error value.
536 * @retval #LOCATIONS_ERROR_NONE Successful
537 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
538 * @see location_manager_set_zone_changed_cb()
540 int location_manager_unset_zone_changed_cb(location_manager_h manager);
543 * @brief Gets the distance in meters between two locations.
544 * @param[in] start_latitude The starting latitude [-90.0 ~ 90.0] (degrees)
545 * @param[in] start_longitude The starting longitude [-180.0 ~ 180.0] (degrees)
546 * @param[in] end_latitude The ending latitude [-90.0 ~ 90.0] (degrees)
547 * @param[in] end_longitude The ending longitude [-180.0 ~ 180.0] (degrees)
548 * @param[out] distance The distance between two locations (meters)
549 * @return 0 on success, otherwise a negative error value.
550 * @retval #LOCATIONS_ERROR_NONE Successful
551 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
553 int location_manager_get_distance(double start_latitude, double start_longitude, double end_latitude, double end_longitude, double *distance);
556 * @brief Sends command to the server.
557 * @param[in] cmd The command string to be sent
558 * @return 0 on success, otherwise a negative error value.
559 * @retval #LOCATIONS_ERROR_NONE Successful
560 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
562 int location_manager_send_command(const char *cmd);
569 * GPS Status & Satellites
573 * @addtogroup CAPI_LOCATION_GPS_STATUS_MODULE
578 * @brief Called once for each satellite in range.
579 * @param[in] azimuth The azimuth of the satellite (degrees)
580 * @param[in] elevation The elevation of the satellite (meters)
581 * @param[in] prn The PRN of the satellite
582 * @param[in] snr The SNR of the satellite [dB]
583 * @param[in] is_active The flag signaling if satellite is in use
584 * @param[in] user_data The user data passed from the foreach function
585 * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop
586 * @pre gps_status_foreach_satellites_in_view() will invoke this callback.
587 * @pre gps_status_foreach_last_satellites_in_view() will invoke this callback.
588 * @see gps_status_foreach_satellites_in_view()
590 typedef bool(*gps_status_get_satellites_cb)(unsigned int azimuth, unsigned int elevation, unsigned int prn, int snr, bool is_active, void *user_data);
593 * @brief Called at defined interval with updated satellite information.
594 * @param[out] num_of_active The last number of active satellites
595 * @param[out] num_of_inview The last number of satellites in view
596 * @param[out] timestamp The last timestamp (time when last measurement took place or 0 if invalid)
597 * @param[in] user_data The user data passed from the call registration function
598 * @pre location_manager_start() will invoke this callback if you register this callback using location_manager_set_position_updated_cb()
599 * @see location_manager_start()
600 * @see location_manager_set_position_updated_cb()
602 typedef void(*gps_status_satellite_updated_cb)(int num_of_active, int num_of_inview, time_t timestamp, void *user_data);
605 * @brief Gets the GPS NMEA data.
606 * @remarks This call is valid only for location managers with #LOCATIONS_METHOD_GPS method.\n
607 * @a nmea must be released with @c free() by you.
608 * @param[in] manager The location manager handle
609 * @param[out] nmea The NMEA data
610 * @return 0 on success, otherwise a negative error value.
611 * @retval #LOCATIONS_ERROR_NONE Successful
612 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
613 * @retval #LOCATIONS_ERROR_INCORRECT_METHOD Incorrect method
614 * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
615 * @retval #LOCATIONS_ERROR_OUT_OF_MEMORY Out of memory
616 * @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start()
617 * @see location_manager_start()
619 int gps_status_get_nmea(location_manager_h manager, char **nmea);
622 * @brief Gets the information of satellites.
623 * @remarks This call is valid only for location managers with #LOCATIONS_METHOD_GPS method.
624 * @param[in] manager The location manager handle
625 * @param[out] num_of_active The number of active satellites
626 * @param[out] num_of_inview The number of satellites in view
627 * @param[out] timestamp The timestamp (time when measurement took place or 0 if invalid)
628 * @return 0 on success, otherwise a negative error value.
629 * @retval #LOCATIONS_ERROR_NONE Successful
630 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
631 * @retval #LOCATIONS_ERROR_INCORRECT_METHOD Incorrect method
632 * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
633 * @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start()
634 * @see gps_status_foreach_satellites_in_view()
636 int gps_status_get_satellite(location_manager_h manager, int *num_of_active, int *num_of_inview, time_t *timestamp);
639 * @brief Registers a callback function to be invoked at defined interval with updated satellite information.
641 * @param[in] manager The location manager handle
642 * @param[in] callback The callback function to register
643 * @param[in] interval The interval [1 ~ 120] (seconds)
644 * @param[in] user_data The user data to be passed to the callback function
645 * @return 0 on success, otherwise a negative error value.
646 * @retval #LOCATIONS_ERROR_NONE Successful
647 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
648 * @post gps_status_satellite_updated_cb() will be invoked
649 * @see gps_status_unset_satellite_updated_cb()
650 * @see gps_status_satellite_updated_cb()
652 int gps_status_set_satellite_updated_cb(location_manager_h manager, gps_status_satellite_updated_cb callback, int interval, void *user_data);
655 * @brief Unregisters the callback function.
657 * @param[in] manager The location manager handle
658 * @return 0 on success, otherwise a negative error value.
659 * @retval #LOCATIONS_ERROR_NONE Successful
660 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
661 * @see gps_status_set_satellite_updated_cb()
663 int gps_status_unset_satellite_updated_cb(location_manager_h manager);
666 * @brief Invokes the callback function for each satellite.
667 * @remarks This function is valid only for location managers with the #LOCATIONS_METHOD_GPS method.
668 * @param[in] manager The location manager handle
669 * @param[in] callback The iteration callback function
670 * @param[in] user_data The user data to be passed to the callback function
671 * @return 0 on success, otherwise a negative error value.
672 * @retval #LOCATIONS_ERROR_NONE Successful
673 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
674 * @retval #LOCATIONS_ERROR_INCORRECT_METHOD Incorrect method
675 * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
676 * @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start()
677 * @post It invokes gps_status_get_satellites_cb().
678 * @see gps_status_get_satellite()
679 * @see gps_status_get_satellites_cb()
681 int gps_status_foreach_satellites_in_view (location_manager_h manager, gps_status_get_satellites_cb callback, void *user_data);
684 * @brief Gets the last information of satellites.
685 * @remarks This call is valid only for location managers with #LOCATIONS_METHOD_GPS method.
686 * @param[in] manager The location manager handle
687 * @param[out] num_of_active The last number of active satellites
688 * @param[out] num_of_inview The last number of satellites in view
689 * @param[out] timestamp The last timestamp (time when last measurement took place or 0 if invalid)
690 * @return 0 on success, otherwise a negative error value.
691 * @retval #LOCATIONS_ERROR_NONE Successful
692 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
693 * @retval #LOCATIONS_ERROR_INCORRECT_METHOD Incorrect method
694 * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
695 * @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start()
696 * @see gps_status_foreach_satellites_in_view()
698 int gps_status_get_last_satellite(location_manager_h manager, int *num_of_active, int *num_of_inview, time_t *timestamp);
701 * @brief Invokes the callback function for each last satellite which is recorded.
702 * @remarks This function is valid only for location managers with the #LOCATIONS_METHOD_GPS method.
703 * @param[in] manager The location manager handle
704 * @param[in] callback The iteration callback function
705 * @param[in] user_data The user data to be passed to the callback function
706 * @return 0 on success, otherwise a negative error value.
707 * @retval #LOCATIONS_ERROR_NONE Successful
708 * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
709 * @retval #LOCATIONS_ERROR_INCORRECT_METHOD Incorrect method
710 * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
711 * @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start()
712 * @post It invokes gps_status_get_satellites_cb().
713 * @see gps_status_get_last_satellite()
714 * @see gps_status_get_satellites_cb()
716 int gps_status_foreach_last_satellites_in_view(location_manager_h manager, gps_status_get_satellites_cb callback, void *user_data);
725 #endif /* __TIZEN_LOCATION_LOCATIONS_H__ */