Tizen Native API
5.0
|
This Geofence Manager API provides service related to geofence(geo-fence).
#include <geofence_manager.h>
This Geofence Manager API provides service related to geofence(geo-fence). A geofence is a virtual perimeter for a real-world geographic area. This API provides functions to set geofence with geopoint, MAC address of Wi-Fi, and Bluetooth address. And notifications on events like changing in service status are provided. There are two kinds of places and fences:
This API is related with the following features:
Functions | |
int | geofence_manager_is_supported (bool *supported) |
Checks whether the geofence manager is available or not. | |
int | geofence_manager_create (geofence_manager_h *manager) |
Creates a new geofence manager. | |
int | geofence_manager_destroy (geofence_manager_h manager) |
Releases the geofence manager. | |
int | geofence_manager_start (geofence_manager_h manager, int geofence_id) |
Starts the geofencing service. | |
int | geofence_manager_stop (geofence_manager_h manager, int geofence_id) |
Stops the geofenceing service. | |
int | geofence_manager_add_place (geofence_manager_h manager, const char *place_name, int *place_id) |
Creates a new place for geofencing service. | |
int | geofence_manager_update_place (geofence_manager_h manager, int place_id, const char *place_name) |
Updates the place name of a given place ID. | |
int | geofence_manager_remove_place (geofence_manager_h manager, int place_id) |
Removes the specific place for geofencing service. | |
int | geofence_manager_add_fence (geofence_manager_h manager, const geofence_h fence, int *geofence_id) |
Adds a geofence for a given geofence manager. | |
int | geofence_manager_remove_fence (geofence_manager_h manager, int geofence_id) |
Removes a geofence with a given geofence ID. | |
int | geofence_manager_set_geofence_state_changed_cb (geofence_manager_h manager, geofence_state_changed_cb callback, void *user_data) |
Registers a callback function to be invoked when a device enters or exits the specific geofence. | |
int | geofence_manager_unset_geofence_state_changed_cb (geofence_manager_h manager) |
Unregisters the callback function. | |
int | geofence_manager_set_geofence_event_cb (geofence_manager_h manager, geofence_event_cb callback, void *user_data) |
Registers a callback function to be invoked when a response comes. | |
int | geofence_manager_unset_geofence_event_cb (geofence_manager_h manager) |
Unregisters the callback function. | |
int | geofence_manager_set_geofence_proximity_state_changed_cb (geofence_manager_h manager, geofence_proximity_state_changed_cb callback, void *user_data) |
Registers a callback function to be invoked when a proximity state of device is changed. | |
int | geofence_manager_unset_geofence_proximity_state_changed_cb (geofence_manager_h manager) |
Unregisters the callback function. | |
int | geofence_manager_foreach_geofence_list (geofence_manager_h manager, geofence_manager_fence_cb callback, void *user_data) |
Retrieves a list of fences registered in the specified geofence manager. | |
int | geofence_manager_foreach_place_geofence_list (geofence_manager_h manager, int place_id, geofence_manager_fence_cb callback, void *user_data) |
Retrieves a list of fences registered in the specified place. | |
int | geofence_manager_foreach_place_list (geofence_manager_h manager, geofence_manager_place_cb callback, void *user_data) |
Retrieves a list of places registered in the specified geofence manager. | |
int | geofence_manager_get_place_name (geofence_manager_h manager, int place_id, char **place_name) |
Gets the name of place. | |
Typedefs | |
typedef void(* | geofence_state_changed_cb )(int geofence_id, geofence_state_e state, void *user_data) |
Called when a device enters or exits the given geofence. | |
typedef void(* | geofence_proximity_state_changed_cb )(int geofence_id, geofence_proximity_state_e state, geofence_proximity_provider_e provider, void *user_data) |
Called when a proximity state of device is changed. | |
typedef void(* | geofence_event_cb )(int place_id, int geofence_id, geofence_manager_error_e error, geofence_manage_e manage, void *user_data) |
Called when the some event occurs in geofence and place such as add, update, etc.. | |
typedef bool(* | geofence_manager_fence_cb )(int geofence_id, geofence_h fence, int fence_index, int fence_cnt, void *user_data) |
Called when the fence list is requested. | |
typedef bool(* | geofence_manager_place_cb )(int place_id, const char *place_name, int place_index, int place_cnt, void *user_data) |
Called when the place list is requested. | |
typedef struct geofence_manager_s * | geofence_manager_h |
The geofence manager handle. | |
typedef struct geofence_s * | geofence_h |
The geofence handle. | |
typedef struct geofence_status_s * | geofence_status_h |
The geofence status handle. |
typedef void(* geofence_event_cb)(int place_id, int geofence_id, geofence_manager_error_e error, geofence_manage_e manage, void *user_data) |
Called when the some event occurs in geofence and place such as add, update, etc..
The events of public geofence is also received if there are public geofences.
[in] | place_id | The place ID |
[in] | geofence_id | The specified geofence ID |
[in] | error | The error code for the particular action |
[in] | manage | The result code for the particular place and geofence management |
[in] | user_data | The user data passed from callback registration function |
typedef struct geofence_s* geofence_h |
The geofence handle.
typedef bool(* geofence_manager_fence_cb)(int geofence_id, geofence_h fence, int fence_index, int fence_cnt, void *user_data) |
Called when the fence list is requested.
[in] | geofence_id | The geofence ID |
[in] | fence | The fence handle |
[in] | fence_index | The index number of the fences in the list |
[in] | fence_cnt | The total number of fences that exists for the requester |
[in] | user_data | The user data passed from callback registration function |
true
to continue iterating, otherwise false
typedef struct geofence_manager_s* geofence_manager_h |
The geofence manager handle.
typedef bool(* geofence_manager_place_cb)(int place_id, const char *place_name, int place_index, int place_cnt, void *user_data) |
Called when the place list is requested.
[in] | place_id | The current place ID |
[in] | place_name | The current place name |
[in] | place_index | The index number of the places in the list |
[in] | place_cnt | The total number of places that exists for the requester |
[in] | user_data | The user data passed from callback registration function |
true
to continue iterating, otherwise false
typedef void(* geofence_proximity_state_changed_cb)(int geofence_id, geofence_proximity_state_e state, geofence_proximity_provider_e provider, void *user_data) |
Called when a proximity state of device is changed.
[in] | geofence_id | The specified geofence ID |
[in] | state | The proximity state |
[in] | provider | The proximity provider |
[in] | user_data | The user data passed from callback registration function |
typedef void(* geofence_state_changed_cb)(int geofence_id, geofence_state_e state, void *user_data) |
Called when a device enters or exits the given geofence.
[in] | geofence_id | The specified geofence ID |
[in] | state | The geofence state |
[in] | user_data | The user data passed from callback registration function |
typedef struct geofence_status_s* geofence_status_h |
The geofence status handle.
enum geofence_manage_e |
Enumeration for geofence management events.
Enumeration for Geofence manager of error code.
Enumeration for the provider of proximity.
enum geofence_state_e |
enum geofence_type_e |
int geofence_manager_add_fence | ( | geofence_manager_h | manager, |
const geofence_h | fence, | ||
int * | geofence_id | ||
) |
Adds a geofence for a given geofence manager.
[in] | manager | The geofence manager handle |
[in] | fence | The geofence handle |
[out] | geofence_id | The geofence ID handle to be newly created on success |
0
on success, otherwise a negative error value GEOFENCE_MANAGER_ERROR_NONE | Successful |
GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER | Illegal argument |
GEOFENCE_MANAGER_ERROR_PERMISSION_DENIED | The application does not have the privilege to call this function |
GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED | Not supported |
GEOFENCE_MANAGER_ERROR_NOT_INITIALIZED | Not initialized |
GEOFENCE_MANAGER_ERROR_EXCEPTION | Exception occurred |
int geofence_manager_add_place | ( | geofence_manager_h | manager, |
const char * | place_name, | ||
int * | place_id | ||
) |
Creates a new place for geofencing service.
[in] | manager | The geofence manager handle |
[in] | place_name | A place name to be created |
[out] | place_id | The place ID to be newly created on success |
GEOFENCE_MANAGER_ERROR_NONE | Successful |
GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER | Illegal argument |
GEOFENCE_MANAGER_ERROR_PERMISSION_DENIED | The application does not have the privilege to call this function |
GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED | Not supported |
GEOFENCE_MANAGER_ERROR_NOT_INITIALIZED | Not initialized |
GEOFENCE_MANAGER_ERROR_EXCEPTION | Exception occurred |
int geofence_manager_create | ( | geofence_manager_h * | manager | ) |
Creates a new geofence manager.
[out] | manager | A geofence manager handle to be newly created on success |
0
on success, otherwise a negative error value GEOFENCE_MANAGER_ERROR_NONE | Successful |
GEOFENCE_MANAGER_ERROR_OUT_OF_MEMORY | Out of memory |
GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER | Illegal argument |
GEOFENCE_MANAGER_ERROR_PERMISSION_DENIED | The application does not have the privilege to call this function |
GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED | Not supported |
GEOFENCE_MANAGER_ERROR_NOT_INITIALIZED | Not initialized |
GEOFENCE_MANAGER_ERROR_EXCEPTION | Exception occurred |
int geofence_manager_destroy | ( | geofence_manager_h | manager | ) |
Releases the geofence manager.
[in] | manager | The geofence manager handle |
0
on success, otherwise a negative error value GEOFENCE_MANAGER_ERROR_NONE | Successful |
GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER | Illegal argument |
GEOFENCE_MANAGER_ERROR_PERMISSION_DENIED | The application does not have the privilege to call this function |
GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED | Not supported |
GEOFENCE_MANAGER_ERROR_EXCEPTION | Exception occurred |
int geofence_manager_foreach_geofence_list | ( | geofence_manager_h | manager, |
geofence_manager_fence_cb | callback, | ||
void * | user_data | ||
) |
Retrieves a list of fences registered in the specified geofence manager.
[in] | manager | The geofence manager handle |
[in] | callback | The callback function to deliver each fence |
[in] | user_data | The user data to be passed to the callback function |
0
on success, otherwise a negative error value GEOFENCE_MANAGER_ERROR_NONE | Successful |
GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER | Illegal argument |
GEOFENCE_MANAGER_ERROR_PERMISSION_DENIED | The application does not have the privilege to call this function |
GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED | Not supported |
GEOFENCE_MANAGER_ERROR_DATABASE | Database error |
int geofence_manager_foreach_place_geofence_list | ( | geofence_manager_h | manager, |
int | place_id, | ||
geofence_manager_fence_cb | callback, | ||
void * | user_data | ||
) |
Retrieves a list of fences registered in the specified place.
[in] | manager | The geofence manager handle |
[in] | place_id | The place ID |
[in] | callback | The callback function to deliver each fence of the specified place |
[in] | user_data | The user data to be passed to the callback function |
0
on success, otherwise a negative error value GEOFENCE_MANAGER_ERROR_NONE | Successful |
GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER | Illegal argument |
GEOFENCE_MANAGER_ERROR_PERMISSION_DENIED | The application does not have the privilege to call this function |
GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED | Not supported |
GEOFENCE_MANAGER_ERROR_DATABASE | Database error |
GEOFENCE_MANAGER_ERROR_PLACE_ACCESS_DENIED | Access to specified place is denied |
int geofence_manager_foreach_place_list | ( | geofence_manager_h | manager, |
geofence_manager_place_cb | callback, | ||
void * | user_data | ||
) |
Retrieves a list of places registered in the specified geofence manager.
[in] | manager | The geofence manager handle |
[in] | callback | The callback function to deliver each place of the specified geofence manager |
[in] | user_data | The user data to be passed to the callback function |
0
on success, otherwise a negative error value GEOFENCE_MANAGER_ERROR_NONE | Successful |
GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER | Illegal argument |
GEOFENCE_MANAGER_ERROR_PERMISSION_DENIED | The application does not have the privilege to call this function |
GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED | Not supported |
GEOFENCE_MANAGER_ERROR_DATABASE | Database error |
int geofence_manager_get_place_name | ( | geofence_manager_h | manager, |
int | place_id, | ||
char ** | place_name | ||
) |
Gets the name of place.
[in] | manager | The geofence manager handle |
[in] | place_id | The place ID |
[out] | place_name | The name of the place |
0
on success, otherwise a negative error value GEOFENCE_MANAGER_ERROR_NONE | Successful |
GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER | Illegal argument |
GEOFENCE_MANAGER_ERROR_PERMISSION_DENIED | The application does not have the privilege to call this function |
GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED | Not supported |
GEOFENCE_MANAGER_ERROR_INVALID_ID | Invalid geofence ID |
GEOFENCE_MANAGER_ERROR_DATABASE | Database error |
GEOFENCE_MANAGER_ERROR_PLACE_ACCESS_DENIED | Access to specified place is denied |
int geofence_manager_is_supported | ( | bool * | supported | ) |
Checks whether the geofence manager is available or not.
[out] | supported | true if geofence service is supported, otherwise false |
0
on success, otherwise a negative error value GEOFENCE_MANAGER_ERROR_NONE | Successful |
GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED | Not supported |
int geofence_manager_remove_fence | ( | geofence_manager_h | manager, |
int | geofence_id | ||
) |
Removes a geofence with a given geofence ID.
[in] | manager | The geofence manager handle |
[in] | geofence_id | The specified geofence ID |
0
on success, otherwise a negative error value GEOFENCE_MANAGER_ERROR_NONE | Successful |
GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER | Illegal argument |
GEOFENCE_MANAGER_ERROR_PERMISSION_DENIED | The application does not have the privilege to call this function |
GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED | Not supported |
GEOFENCE_MANAGER_ERROR_NOT_INITIALIZED | Not initialized |
GEOFENCE_MANAGER_ERROR_EXCEPTION | Exception occurred |
GEOFENCE_MANAGER_ERROR_GEOFENCE_ACCESS_DENIED | Access to specified geofence is denied |
int geofence_manager_remove_place | ( | geofence_manager_h | manager, |
int | place_id | ||
) |
Removes the specific place for geofencing service.
[in] | manager | The geofence manager handle |
[in] | place_id | The specified place ID |
GEOFENCE_MANAGER_ERROR_NONE | Successful |
GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER | Illegal argument |
GEOFENCE_MANAGER_ERROR_PERMISSION_DENIED | The application does not have the privilege to call this function |
GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED | Not supported |
GEOFENCE_MANAGER_ERROR_NOT_INITIALIZED | Not initialized |
GEOFENCE_MANAGER_ERROR_EXCEPTION | Exception occurred |
GEOFENCE_MANAGER_ERROR_PLACE_ACCESS_DENIED | Access to specified place is denied |
int geofence_manager_set_geofence_event_cb | ( | geofence_manager_h | manager, |
geofence_event_cb | callback, | ||
void * | user_data | ||
) |
Registers a callback function to be invoked when a response comes.
[in] | manager | The geofence manager 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 GEOFENCE_MANAGER_ERROR_NONE | Successful |
GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER | Illegal argument |
GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED | Not supported |
int geofence_manager_set_geofence_proximity_state_changed_cb | ( | geofence_manager_h | manager, |
geofence_proximity_state_changed_cb | callback, | ||
void * | user_data | ||
) |
Registers a callback function to be invoked when a proximity state of device is changed.
The proximity state is measured from registered position regardless of the geofence boundary.
[in] | manager | The geofence manager 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 GEOFENCE_MANAGER_ERROR_NONE | Successful |
GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER | Illegal argument |
GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED | Not supported |
int geofence_manager_set_geofence_state_changed_cb | ( | geofence_manager_h | manager, |
geofence_state_changed_cb | callback, | ||
void * | user_data | ||
) |
Registers a callback function to be invoked when a device enters or exits the specific geofence.
[in] | manager | The geofence manager 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 GEOFENCE_MANAGER_ERROR_NONE | Successful |
GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER | Illegal argument |
GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED | Not supported |
int geofence_manager_start | ( | geofence_manager_h | manager, |
int | geofence_id | ||
) |
Starts the geofencing service.
[in] | manager | The geofence manager handle |
[in] | geofence_id | The specified geofence ID |
0
on success, otherwise a negative error value GEOFENCE_MANAGER_ERROR_NONE | Successful |
GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER | Illegal argument |
GEOFENCE_MANAGER_ERROR_PERMISSION_DENIED | The application does not have the privilege to call this function |
GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED | Not supported |
GEOFENCE_MANAGER_ERROR_EXCEPTION | Exception occurred |
GEOFENCE_MANAGER_ERROR_GEOFENCE_ACCESS_DENIED | Access to specified geofence is denied |
int geofence_manager_stop | ( | geofence_manager_h | manager, |
int | geofence_id | ||
) |
Stops the geofenceing service.
[in] | manager | The geofence manager handle |
[in] | geofence_id | The specified geofence ID |
0
on success, otherwise a negative error value GEOFENCE_MANAGER_ERROR_NONE | Successful |
GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER | Illegal argument |
GEOFENCE_MANAGER_ERROR_PERMISSION_DENIED | The application does not have the privilege to call this function |
GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED | Not supported |
GEOFENCE_MANAGER_ERROR_NOT_INITIALIZED | Not initialized |
GEOFENCE_MANAGER_ERROR_EXCEPTION | Exception occurred |
GEOFENCE_MANAGER_ERROR_GEOFENCE_ACCESS_DENIED | Access to specified geofence is denied |
int geofence_manager_unset_geofence_event_cb | ( | geofence_manager_h | manager | ) |
Unregisters the callback function.
[in] | manager | The geofence manager handle |
0
on success, otherwise a negative error value GEOFENCE_MANAGER_ERROR_NONE | Successful |
GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER | Illegal argument |
GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED | Not supported |
Unregisters the callback function.
[in] | manager | The geofence manager handle |
0
on success, otherwise a negative error value GEOFENCE_MANAGER_ERROR_NONE | Successful |
GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER | Illegal argument |
GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED | Not supported |
Unregisters the callback function.
[in] | manager | The geofence manager handle |
0
on success, otherwise a negative error value GEOFENCE_MANAGER_ERROR_NONE | Successful |
GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER | Illegal argument |
GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED | Not supported |
int geofence_manager_update_place | ( | geofence_manager_h | manager, |
int | place_id, | ||
const char * | place_name | ||
) |
Updates the place name of a given place ID.
[in] | manager | The geofence manager handle |
[in] | place_id | The specified place ID |
[in] | place_name | A new place name of the place ID |
GEOFENCE_MANAGER_ERROR_NONE | Successful |
GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER | Illegal argument |
GEOFENCE_MANAGER_ERROR_PERMISSION_DENIED | The application does not have the privilege to call this function |
GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED | Not supported |
GEOFENCE_MANAGER_ERROR_NOT_INITIALIZED | Not initialized |
GEOFENCE_MANAGER_ERROR_EXCEPTION | Exception occurred |
GEOFENCE_MANAGER_ERROR_PLACE_ACCESS_DENIED | Access to specified place is denied |