|
Tizen Native API
5.0
|
The Location Bounds APIs provides functions related to geographic bounds information.
#include <locations.h>
Boundary defines geographical boundary. It is same as geo-fence which is a virtual perimeter for a real-world geographic area. If you create a boundary, you can trigger some activities when a device enters(or exits) the boundaries defined by you.
This API is related with the following features:
Functions | |
| int | location_bounds_create_rect (location_coords_s top_left, location_coords_s bottom_right, location_bounds_h *bounds) |
| Creates a rect type of new location bounds. | |
| int | location_bounds_create_circle (location_coords_s center, double radius, location_bounds_h *bounds) |
| Creates a circle type of new location bounds. | |
| int | location_bounds_create_polygon (location_coords_s *coords_list, int length, location_bounds_h *bounds) |
| Creates a polygon type of new location bounds. | |
| bool | location_bounds_contains_coordinates (location_bounds_h bounds, location_coords_s coords) |
| Checks whether the bounds contains the specified coordinates. | |
| int | location_bounds_get_type (location_bounds_h bounds, location_bounds_type_e *type) |
| Gets the type of location bounds. | |
| int | location_bounds_get_rect_coords (location_bounds_h bounds, location_coords_s *top_left, location_coords_s *bottom_right) |
| Gets the center position and radius of circle bounds. | |
| int | location_bounds_get_circle_coords (location_bounds_h bounds, location_coords_s *center, double *radius) |
| Gets the center position and radius of circle bounds. | |
| int | location_bounds_foreach_polygon_coords (location_bounds_h bounds, polygon_coords_cb callback, void *user_data) |
| Get the coordinates of a polygon. | |
| int | location_bounds_destroy (location_bounds_h bounds) |
| Releases the location bounds. | |
| int | location_bounds_set_state_changed_cb (location_bounds_h bounds, location_bounds_state_changed_cb callback, void *user_data) |
| Registers a callback function to be invoked when the boundary area is entered or exited. | |
| int | location_bounds_unset_state_changed_cb (location_bounds_h bounds) |
| Unregisters the callback function. | |
Typedefs | |
| typedef struct location_bounds_s * | location_bounds_h |
| The location boundary handle. | |
| typedef bool(* | polygon_coords_cb )(location_coords_s coords, void *user_data) |
| Gets called iteratively to notify you of coordinates of a polygon. | |
| typedef void(* | location_bounds_state_changed_cb )(location_boundary_state_e state, void *user_data) |
| Called when the given boundary is entered or exited. | |
| typedef struct location_bounds_s* location_bounds_h |
The location boundary handle.
| typedef void(* location_bounds_state_changed_cb)(location_boundary_state_e state, void *user_data) |
Called when the given boundary is entered or exited.
| [in] | state | The boundary state |
| typedef bool(* polygon_coords_cb)(location_coords_s coords, void *user_data) |
Gets called iteratively to notify you of coordinates of a polygon.
| [in] | coords | The coordinates |
| [in] | user_data | The user data passed from the foreach function |
true to continue with the next iteration of the loop, false to break out of the loop Enumeration for error code for Location manager.
| bool location_bounds_contains_coordinates | ( | location_bounds_h | bounds, |
| location_coords_s | coords | ||
| ) |
Checks whether the bounds contains the specified coordinates.
| [in] | bounds | The location bounds handle |
| [in] | coords | The coordinates |
true if the bounds contains the specified coordinates, otherwise else false | LOCATION_BOUNDS_ERROR_NONE | Successful |
| LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY | Out of memory |
| LOCATION_BOUNDS_ERROR_INVALID_PARAMETER | Invalid parameter |
| LOCATION_BOUNDS_ERROR_NOT_SUPPORTED | Not supported |
| int location_bounds_create_circle | ( | location_coords_s | center, |
| double | radius, | ||
| location_bounds_h * | bounds | ||
| ) |
Creates a circle type of new location bounds.
| [in] | center | The center position |
| [in] | radius | The radius of a circle (meters) |
| [out] | bounds | The location bounds handle that is newly created |
0 on success, otherwise a negative error value | LOCATION_BOUNDS_ERROR_NONE | Successful |
| LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY | Out of memory |
| LOCATION_BOUNDS_ERROR_INVALID_PARAMETER | Invalid parameter |
| LOCATION_BOUNDS_ERROR_NOT_SUPPORTED | Not supported |
| int location_bounds_create_polygon | ( | location_coords_s * | coords_list, |
| int | length, | ||
| location_bounds_h * | bounds | ||
| ) |
Creates a polygon type of new location bounds.
3 to represent polygon. | [in] | coords_list | The list of coordinates |
| [in] | length | The length of the coordinates list |
| [out] | bounds | The location bounds handle that is newly created on success |
0 on success, otherwise a negative error value | LOCATION_BOUNDS_ERROR_NONE | Successful |
| LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY | Out of memory |
| LOCATION_BOUNDS_ERROR_INVALID_PARAMETER | Invalid parameter |
| LOCATION_BOUNDS_ERROR_NOT_SUPPORTED | Not supported |
| int location_bounds_create_rect | ( | location_coords_s | top_left, |
| location_coords_s | bottom_right, | ||
| location_bounds_h * | bounds | ||
| ) |
Creates a rect type of new location bounds.
| [in] | top_left | The top left position |
| [in] | bottom_right | The bottom right position |
| [out] | bounds | The location bounds handle that is newly created |
0 on success, otherwise a negative error value | LOCATION_BOUNDS_ERROR_NONE | Successful |
| LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY | Out of memory |
| LOCATION_BOUNDS_ERROR_INVALID_PARAMETER | Invalid parameter |
| LOCATION_BOUNDS_ERROR_NOT_SUPPORTED | Not supported |
| int location_bounds_destroy | ( | location_bounds_h | bounds | ) |
Releases the location bounds.
| [in] | bounds | The location bounds handle |
0 on success, otherwise a negative error value | LOCATION_BOUNDS_ERROR_NONE | Successful |
| LOCATION_BOUNDS_ERROR_INVALID_PARAMETER | Invalid parameter |
| LOCATION_BOUNDS_ERROR_NOT_SUPPORTED | Not supported |
| int location_bounds_foreach_polygon_coords | ( | location_bounds_h | bounds, |
| polygon_coords_cb | callback, | ||
| void * | user_data | ||
| ) |
Get the coordinates of a polygon.
| [in] | bounds | The location bounds handle |
| [in] | callback | The iteration callback |
| [in] | user_data | The user data to be passed to the callback function |
0 on success, otherwise a negative error value | LOCATION_BOUNDS_ERROR_NONE | Successful |
| LOCATION_BOUNDS_ERROR_INVALID_PARAMETER | Invalid parameter |
| LOCATION_BOUNDS_ERROR_NOT_SUPPORTED | Not supported |
| LOCATION_BOUNDS_ERROR_INCORRECT_TYPE | Incorrect bounds type |
| int location_bounds_get_circle_coords | ( | location_bounds_h | bounds, |
| location_coords_s * | center, | ||
| double * | radius | ||
| ) |
Gets the center position and radius of circle bounds.
| [in] | bounds | The location bounds handle |
| [out] | center | The center position of the circle |
| [out] | radius | The radius of the circle |
0 on success, otherwise a negative error value | LOCATION_BOUNDS_ERROR_NONE | Successful |
| LOCATION_BOUNDS_ERROR_INVALID_PARAMETER | Invalid parameter |
| LOCATION_BOUNDS_ERROR_NOT_SUPPORTED | Not supported |
| LOCATION_BOUNDS_ERROR_INCORRECT_TYPE | Incorrect bounds type |
| int location_bounds_get_rect_coords | ( | location_bounds_h | bounds, |
| location_coords_s * | top_left, | ||
| location_coords_s * | bottom_right | ||
| ) |
Gets the center position and radius of circle bounds.
| [in] | bounds | The location bounds handle |
| [out] | top_left | The top left position |
| [out] | bottom_right | The bottom right position |
0 on success, otherwise a negative error value | LOCATION_BOUNDS_ERROR_NONE | Successful |
| LOCATION_BOUNDS_ERROR_INVALID_PARAMETER | Invalid parameter |
| LOCATION_BOUNDS_ERROR_NOT_SUPPORTED | Not supported |
| LOCATION_BOUNDS_ERROR_INCORRECT_TYPE | Incorrect bounds type |
| int location_bounds_get_type | ( | location_bounds_h | bounds, |
| location_bounds_type_e * | type | ||
| ) |
Gets the type of location bounds.
| [in] | bounds | The location bounds handle |
| [out] | type | The type of location bounds |
0 on success, otherwise a negative error value | LOCATION_BOUNDS_ERROR_NONE | Successful |
| LOCATION_BOUNDS_ERROR_INVALID_PARAMETER | Invalid parameter |
| LOCATION_BOUNDS_ERROR_NOT_SUPPORTED | Not supported |
| int location_bounds_set_state_changed_cb | ( | location_bounds_h | bounds, |
| location_bounds_state_changed_cb | callback, | ||
| void * | user_data | ||
| ) |
Registers a callback function to be invoked when the boundary area is entered or exited.
| [in] | bounds | The location bounds handle |
| [in] | callback | The callback function to register |
| [in] | user_data | The user data to be passed to the callback function |
0 on success, otherwise a negative error value | LOCATION_BOUNDS_ERROR_NONE | Successful |
| LOCATION_BOUNDS_ERROR_INVALID_PARAMETER | Invalid parameter |
| LOCATION_BOUNDS_ERROR_NOT_SUPPORTED | Not supported |
| int location_bounds_unset_state_changed_cb | ( | location_bounds_h | bounds | ) |
Unregisters the callback function.
| [in] | bounds | The location bounds handle |
0 on success, otherwise a negative error value | LOCATION_BOUNDS_ERROR_NONE | Successful |
| LOCATION_BOUNDS_ERROR_INVALID_PARAMETER | Invalid parameter |
| LOCATION_BOUNDS_ERROR_NOT_SUPPORTED | Not supported |