[ACR-450] Adding new geofence API for proximity 65/51365/11 accepted/tizen/mobile/20151207.123847 accepted/tizen/tv/20151207.123903 accepted/tizen/wearable/20151207.123927 submit/tizen/20151204.080713 submit/tizen/20151207.112925 submit/tizen/20151207.113951
authorjomui <jongmun.woo@samsung.com>
Mon, 9 Nov 2015 06:56:07 +0000 (15:56 +0900)
committerjomui <jongmun.woo@samsung.com>
Wed, 2 Dec 2015 02:29:55 +0000 (11:29 +0900)
Signed-off-by: jomui <jongmun.woo@samsung.com>
Change-Id: I28397b23b7f16493682346a59b93a7b94d32f654

doc/geofence-manager-doc.h
include/geofence_manager.h
include/geofence_type.h
packaging/capi-geofence-manager.spec
src/geofence_manager.c
src/manager/geofence-ielement.h
src/manager/geofence-internal.c
src/manager/geofence-internal.h
src/manager/geofence-type-private.h
src/manager/include/geofence_module.h

index c62560e..c297cbe 100644 (file)
@@ -47,7 +47,7 @@
  * The geofence type property of geofence manager (#geofence_type_e) specified the type of virtual perimeter.
  *
  * The status property describes the current state and duration of a geofence.
- * state (#geofence_state_e) can be uncertain, in, or out.
+ * State (#geofence_state_e) can be uncertain, in, or out.
  *
  * @section CAPI_GEOFENCE_MANAGER_MODULE_FEATURE Related Features
  * This API is related with the following features:\n
@@ -60,7 +60,7 @@
  *
  * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
  *
- * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a>
+ * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/tools/native-tools/manifest-text-editor#feature"><b>Feature Element</b>.</a>
  *
  */
 
@@ -78,9 +78,9 @@
  * Geo-fence defines a virtual perimeter for a real-world geographic area.
  * If you create a geofence, you can trigger some activities when a device enters(or exits) the geofences defined by you.
  *
- * You can create a geofence with the information of Geopoint, WiFi, or BT.
+ * You can create a geofence with the information of Geopoint, Wi-Fi, or BT.
  *
- * 1. Geopoint: Gefence is specified by cooridinates (Latitude and Longitude) and Radius\n
+ * 1. Geopoint: Geofence is specified by coordinates (Latitude and Longitude) and Radius\n
  * 2. WIFI: Geofence is specified by BSSID of Wi-Fi access point\n
  * 3. BT: Geofence is specified by Bluetooth address\n
  *
@@ -99,7 +99,7 @@
  *
  * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
  *
- * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a>
+ * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/tools/native-tools/manifest-text-editor#feature"><b>Feature Element</b>.</a>
  *
  */
 
index 8ca12fb..c8b4029 100644 (file)
@@ -42,6 +42,21 @@ extern "C" {
 typedef void(*geofence_state_changed_cb)(int geofence_id, geofence_state_e state, void *user_data);
 
 /**
+ * @brief Called when a proximity state of device is changed.
+ * @since_tizen 3.0
+ * @param[in] geofence_id  The specified geofence id
+ * @param[in] state  The proximity state
+ * @param[in] provider  The proximity provider
+ * @param[in] user_data  The user data passed from callback registration function
+ * @pre geofence_manager_start() will invoke this callback if you register this callback using geofence_manager_set_geofence_proximity_state_changed_cb().
+ * @see geofence_proximity_state_e
+ * @see geofence_proximity_provider_e
+ * @see geofence_manager_start()
+ * @see geofence_manager_set_geofence_proximity_state_changed_cb()
+ */
+typedef void(*geofence_proximity_state_changed_cb)(int geofence_id, geofence_proximity_state_e state, geofence_proximity_provider_e provider, void *user_data);
+
+/**
  * @brief Called when the some event occurs in geofence and place such as add, update, etc..
  * @details The events of public geofence is also received if there are public geofences.
  *
@@ -52,10 +67,10 @@ typedef void(*geofence_state_changed_cb)(int geofence_id, geofence_state_e state
  * @param[in] error The error code for the particular action
  * @param[in] manage The result code for the particular place and geofence management
  * @param[in] user_data The user data passed from callback registration function
- * @pre geofence_manager_start() will invoke this callback if you register this callback using geofence_manager_set_geofence_state_changed_cb()
+ * @pre geofence_manager_start() will invoke this callback if you register this callback using geofence_manager_set_geofence_event_cb()
  * @see geofence_manage_e
  * @see geofence_manager_start()
- * @see geofence_manager_set_geofence_state_changed_cb()
+ * @see geofence_manager_set_geofence_event_cb()
  */
 typedef void(*geofence_event_cb)(int place_id, int geofence_id, geofence_manager_error_e error, geofence_manage_e manage, void *user_data);
 
@@ -71,7 +86,7 @@ typedef void(*geofence_event_cb)(int place_id, int geofence_id, geofence_manager
  * @pre geofence_manager_foreach_geofence_list() and geofence_manager_foreach_place_geofence_list() will invoke this callback if you specify this callback using geofence_manager_foreach_geofence_list().
  * @see geofence_manager_foreach_geofence_list()
  * @see geofence_manager_foreach_place_geofence_list()
- * @see geofence_manager_add()
+ * @see geofence_manager_add_fence()
  */
 typedef bool(*geofence_manager_fence_cb)(int geofence_id, geofence_h fence, int fence_index, int fence_cnt, void *user_data);
 
@@ -97,6 +112,7 @@ typedef bool(*geofence_manager_place_cb)(int place_id, const char *place_name, i
  * @param[out] supported  @c true if geofence service is supported, otherwise @c false
  * @return 0 on success, otherwise a negative error value
  * @retval #GEOFENCE_MANAGER_ERROR_NONE Successful
+ * @retval #GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED Not supported
  * @see        geofence_manager_create()
  */
 int geofence_manager_is_supported(bool *supported);
@@ -110,11 +126,12 @@ int geofence_manager_is_supported(bool *supported);
  * @param[out] manager  A geofence manager handle to be newly created on success
  * @return 0 on success, otherwise a negative error value
  * @retval #GEOFENCE_MANAGER_ERROR_NONE Successful
- * @retval #GEOFENCE_MANAGER_ERROR_OUT_OF_MEMORY    Out of memory
+ * @retval #GEOFENCE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
  * @retval #GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER Illegal argument
  * @retval #GEOFENCE_MANAGER_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED Not supported
  * @retval #GEOFENCE_MANAGER_ERROR_NOT_INITIALIZED Not initialized
- * @retval #GEOFENCE_MANAGER_ERROR_EXCEPTION   Exception occurred
+ * @retval #GEOFENCE_MANAGER_ERROR_EXCEPTION Exception occurred
  * @see geofence_manager_destroy()
  */
 int geofence_manager_create(geofence_manager_h *manager);
@@ -129,7 +146,8 @@ int geofence_manager_create(geofence_manager_h *manager);
  * @retval #GEOFENCE_MANAGER_ERROR_NONE Successful
  * @retval #GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER Illegal argument
  * @retval #GEOFENCE_MANAGER_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
- * @retval #GEOFENCE_MANAGER_ERROR_EXCEPTION    Exception occurred
+ * @retval #GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED Not supported
+ * @retval #GEOFENCE_MANAGER_ERROR_EXCEPTION Exception occurred
  * @pre geofence_manager_stop() is called before.
  * @see geofence_manager_create()
  * @see geofence_manager_stop()
@@ -154,6 +172,7 @@ int geofence_manager_destroy(geofence_manager_h manager);
  * @retval #GEOFENCE_MANAGER_ERROR_NONE Successful
  * @retval #GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER Illegal argument
  * @retval #GEOFENCE_MANAGER_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED Not supported
  * @retval #GEOFENCE_MANAGER_ERROR_EXCEPTION Exception occurred
  * @retval #GEOFENCE_MANAGER_ERROR_GEOFENCE_ACCESS_DENIED Access to specified geofence is denied
  * @see geofence_manager_stop()
@@ -177,6 +196,7 @@ int geofence_manager_start(geofence_manager_h manager, int geofence_id);
  * @retval #GEOFENCE_MANAGER_ERROR_NONE Successful
  * @retval #GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER Illegal argument
  * @retval #GEOFENCE_MANAGER_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED Not supported
  * @retval #GEOFENCE_MANAGER_ERROR_NOT_INITIALIZED Not initialized
  * @retval #GEOFENCE_MANAGER_ERROR_EXCEPTION Exception occurred
  * @retval #GEOFENCE_MANAGER_ERROR_GEOFENCE_ACCESS_DENIED Access to specified geofence is denied
@@ -195,6 +215,7 @@ int geofence_manager_stop(geofence_manager_h manager, int geofence_id);
  * @retval #GEOFENCE_MANAGER_ERROR_NONE Successful
  * @retval #GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER Illegal argument
  * @retval #GEOFENCE_MANAGER_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED Not supported
  * @retval #GEOFENCE_MANAGER_ERROR_NOT_INITIALIZED Not initialized
  * @retval #GEOFENCE_MANAGER_ERROR_EXCEPTION Exception occurred
  * @see   geofence_manager_update_place()
@@ -213,6 +234,7 @@ int geofence_manager_add_place(geofence_manager_h manager, const char *place_nam
  * @retval #GEOFENCE_MANAGER_ERROR_NONE Successful
  * @retval #GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER Illegal argument
  * @retval #GEOFENCE_MANAGER_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED Not supported
  * @retval #GEOFENCE_MANAGER_ERROR_NOT_INITIALIZED Not initialized
  * @retval #GEOFENCE_MANAGER_ERROR_EXCEPTION Exception occurred
  * @retval #GEOFENCE_MANAGER_ERROR_PLACE_ACCESS_DENIED Access to specified place is denied
@@ -232,6 +254,7 @@ int geofence_manager_update_place(geofence_manager_h manager, int place_id, cons
  * @retval #GEOFENCE_MANAGER_ERROR_NONE Successful
  * @retval #GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER Illegal argument
  * @retval #GEOFENCE_MANAGER_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED Not supported
  * @retval #GEOFENCE_MANAGER_ERROR_NOT_INITIALIZED Not initialized
  * @retval #GEOFENCE_MANAGER_ERROR_EXCEPTION Exception occurred
  * @retval #GEOFENCE_MANAGER_ERROR_PLACE_ACCESS_DENIED Access to specified place is denied
@@ -253,6 +276,7 @@ int geofence_manager_remove_place(geofence_manager_h manager, int place_id);
  * @retval #GEOFENCE_MANAGER_ERROR_NONE Successful
  * @retval #GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER Illegal argument
  * @retval #GEOFENCE_MANAGER_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED Not supported
  * @retval #GEOFENCE_MANAGER_ERROR_NOT_INITIALIZED Not initialized
  * @retval #GEOFENCE_MANAGER_ERROR_EXCEPTION Exception occurred
  * @see geofence_manager_remove_fence()
@@ -274,6 +298,7 @@ int geofence_manager_add_fence(geofence_manager_h manager, const geofence_h fenc
  * @retval #GEOFENCE_MANAGER_ERROR_NONE Successful
  * @retval #GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER Illegal argument
  * @retval #GEOFENCE_MANAGER_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED Not supported
  * @retval #GEOFENCE_MANAGER_ERROR_NOT_INITIALIZED Not initialized
  * @retval #GEOFENCE_MANAGER_ERROR_EXCEPTION Exception occurred
  * @retval #GEOFENCE_MANAGER_ERROR_GEOFENCE_ACCESS_DENIED Access to specified geofence is denied
@@ -291,6 +316,7 @@ int geofence_manager_remove_fence(geofence_manager_h manager, int geofence_id);
  * @return 0 on success, otherwise a negative error value
  * @retval #GEOFENCE_MANAGER_ERROR_NONE Successful
  * @retval #GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER Illegal argument
+ * @retval #GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED Not supported
  * @post This function invokes geofence_state_changed_cb().
  * @see geofence_manager_unset_geofence_state_changed_cb()
  * @see geofence_state_changed_cb()
@@ -304,6 +330,7 @@ int geofence_manager_set_geofence_state_changed_cb(geofence_manager_h manager, g
  * @return 0 on success, otherwise a negative error value
  * @retval #GEOFENCE_MANAGER_ERROR_NONE Successful
  * @retval #GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER Illegal argument
+ * @retval #GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED Not supported
  * @see geofence_state_changed_cb()
  */
 int geofence_manager_unset_geofence_state_changed_cb(geofence_manager_h manager);
@@ -317,6 +344,7 @@ int geofence_manager_unset_geofence_state_changed_cb(geofence_manager_h manager)
  * @return 0 on success, otherwise a negative error value
  * @retval #GEOFENCE_MANAGER_ERROR_NONE Successful
  * @retval #GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER Illegal argument
+ * @retval #GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED Not supported
  * @post This function invokes geofence_event_cb().
  * @see geofence_manager_unset_geofence_event_cb()
  */
@@ -329,11 +357,40 @@ int geofence_manager_set_geofence_event_cb(geofence_manager_h manager, geofence_
  * @return 0 on success, otherwise a negative error value
  * @retval #GEOFENCE_MANAGER_ERROR_NONE Successful
  * @retval #GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER Illegal argument
+ * @retval #GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED Not supported
  * @see geofence_event_cb()
  */
 int geofence_manager_unset_geofence_event_cb(geofence_manager_h manager);
 
 /**
+ * @brief Registers a callback function to be invoked when a proximity state of device is changed.
+ * @details The proximity state is measured from registered position regardless of the geofence boundary.
+ * @since_tizen 3.0
+ * @param[in] manager The geofence manager handle
+ * @param[in] callback The callback function to register
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return 0 on success, otherwise a negative error value
+ * @retval #GEOFENCE_MANAGER_ERROR_NONE Successful
+ * @retval #GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER Illegal argument
+ * @retval #GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED Not supported
+ * @post This function invokes geofence_proximity_state_changed_cb().
+ * @see geofence_manager_unset_geofence_proximity_state_changed_cb()
+ */
+int geofence_manager_set_geofence_proximity_state_changed_cb(geofence_manager_h manager, geofence_proximity_state_changed_cb callback, void *user_data);
+
+/**
+ * @brief Unregisters the callback function.
+ * @since_tizen 3.0
+ * @param[in] manager The geofence manager handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #GEOFENCE_MANAGER_ERROR_NONE Successful
+ * @retval #GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER Illegal argument
+ * @retval #GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED Not supported
+ * @see geofence_manager_set_geofence_proximity_state_changed_cb()
+ */
+int geofence_manager_unset_geofence_proximity_state_changed_cb(geofence_manager_h manager);
+
+/**
  * @brief Retrieves a list of fences registered in the specified geofence manager.
  * @since_tizen 2.4
  * @privlevel public
@@ -345,10 +402,11 @@ int geofence_manager_unset_geofence_event_cb(geofence_manager_h manager);
  * @retval #GEOFENCE_MANAGER_ERROR_NONE Successful
  * @retval #GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER Illegal argument
  * @retval #GEOFENCE_MANAGER_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED Not supported
  * @retval #GEOFENCE_MANAGER_ERROR_DATABASE Database error
  * @post This function invokes geofence_manager_fence_cb().
  * @see geofence_manager_fence_cb()
- * @see geofence_manager_add()
+ * @see geofence_manager_add_fence()
  */
 int geofence_manager_foreach_geofence_list(geofence_manager_h manager, geofence_manager_fence_cb callback, void *user_data);
 
@@ -357,6 +415,7 @@ int geofence_manager_foreach_geofence_list(geofence_manager_h manager, geofence_
  * @since_tizen 2.4
  * @privlevel public
  * @privilege %http://tizen.org/privilege/location
+ * @param[in] manager The geofence manager handle
  * @param[in] place_id The place id
  * @param[in] callback The callback function to deliver each fence of the specified place
  * @param[in] user_data The user data to be passed to the callback function
@@ -364,16 +423,17 @@ int geofence_manager_foreach_geofence_list(geofence_manager_h manager, geofence_
  * @retval #GEOFENCE_MANAGER_ERROR_NONE Successful
  * @retval #GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER Illegal argument
  * @retval #GEOFENCE_MANAGER_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED Not supported
  * @retval #GEOFENCE_MANAGER_ERROR_DATABASE Database error
  * @retval #GEOFENCE_MANAGER_ERROR_PLACE_ACCESS_DENIED Access to specified place is denied
  * @post This function invokes geofence_manager_fence_cb().
- * @see geofence_manager_fence_at_place_cb()
+ * @see geofence_manager_fence_cb()
  * @see geofence_manager_add_place()
  */
 int geofence_manager_foreach_place_geofence_list(geofence_manager_h manager, int place_id, geofence_manager_fence_cb callback, void *user_data);
 
 /**
- * @brief Retrieves a list of place registered in the specified geofence manager.
+ * @brief Retrieves a list of places registered in the specified geofence manager.
  * @since_tizen 2.4
  * @privlevel public
  * @privilege %http://tizen.org/privilege/location
@@ -384,6 +444,7 @@ int geofence_manager_foreach_place_geofence_list(geofence_manager_h manager, int
  * @retval #GEOFENCE_MANAGER_ERROR_NONE Successful
  * @retval #GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER Illegal argument
  * @retval #GEOFENCE_MANAGER_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED Not supported
  * @retval #GEOFENCE_MANAGER_ERROR_DATABASE Database error
  * @post This function invokes geofence_manager_place_cb().
  * @see geofence_manager_place_cb()
@@ -404,7 +465,8 @@ int geofence_manager_foreach_place_list(geofence_manager_h manager, geofence_man
  * @retval #GEOFENCE_MANAGER_ERROR_NONE Successful
  * @retval #GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER Illegal argument
  * @retval #GEOFENCE_MANAGER_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
- * @retval #GEOFENCE_MANAGER_ERROR_INVALI_ID
+ * @retval #GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED Not supported
+ * @retval #GEOFENCE_MANAGER_ERROR_INVALID_ID Invalid geofence ID
  * @retval #GEOFENCE_MANAGER_ERROR_DATABASE Database error
  * @retval #GEOFENCE_MANAGER_ERROR_PLACE_ACCESS_DENIED Access to specified place is denied
  * @see geofence_manager_add_place()
@@ -437,6 +499,7 @@ int geofence_manager_get_place_name(geofence_manager_h manager, int place_id, ch
  * @return 0 on success, otherwise a negative error value
  * @retval #GEOFENCE_MANAGER_ERROR_NONE Successful
  * @retval #GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER Illegal argument
+ * @retval #GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED Not supported
  * @retval #GEOFENCE_MANAGER_ERROR_EXCEPTION Exception occurred
  * @retval #GEOFENCE_MANAGER_ERROR_PLACE_ACCESS_DENIED Access to specified place is denied
  * @see geofence_create_bluetooth()
@@ -458,6 +521,7 @@ int geofence_create_geopoint(int place_id, double latitude, double longitude, in
  * @return 0 on success, otherwise a negative error value
  * @retval #GEOFENCE_MANAGER_ERROR_NONE Successful
  * @retval #GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER Illegal argument
+ * @retval #GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED Not supported
  * @retval #GEOFENCE_MANAGER_ERROR_EXCEPTION Exception occurred
  * @retval #GEOFENCE_MANAGER_ERROR_PLACE_ACCESS_DENIED Access to specified place is denied
  * @see geofence_create_geopoint()
@@ -479,6 +543,7 @@ int geofence_create_bluetooth(int place_id, const char *bssid, const char *ssid,
  * @return 0 on success, otherwise a negative error value
  * @retval #GEOFENCE_MANAGER_ERROR_NONE Successful
  * @retval #GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER Illegal argument
+ * @retval #GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED Not supported
  * @retval #GEOFENCE_MANAGER_ERROR_EXCEPTION Exception occurred
  * @retval #GEOFENCE_MANAGER_ERROR_PLACE_ACCESS_DENIED Access to specified place is denied
  * @see geofence_create_geopoint()
@@ -496,6 +561,7 @@ int geofence_create_wifi(int place_id, const char *bssid, const char *ssid, geof
  * @return 0 on success, otherwise a negative error value
  * @retval #GEOFENCE_MANAGER_ERROR_NONE Successful
  * @retval #GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER Illegal argument
+ * @retval #GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED Not supported
  * @see geofence_create_geopoint()
  * @see geofence_create_bluetooth()
  * @see geofence_create_wifi()
@@ -510,6 +576,7 @@ int geofence_destroy(geofence_h fence);
  * @return 0 on success, otherwise a negative error value
  * @retval #GEOFENCE_MANAGER_ERROR_NONE Successful
  * @retval #GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER Illegal argument
+ * @retval #GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED Not supported
  * @see geofence_get_geopoint()
  * @see geofence_get_radius()
  * @see geofence_get_bssid()
@@ -524,6 +591,7 @@ int geofence_get_type(geofence_h fence, geofence_type_e *type);
  * @return 0 on success, otherwise a negative error value
  * @retval #GEOFENCE_MANAGER_ERROR_NONE Successful
  * @retval #GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER Illegal argument
+ * @retval #GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED Not supported
  * @see geofence_create_geopoint()
  * @see geofence_create_bluetooth()
  * @see geofence_create_wifi()
@@ -539,6 +607,7 @@ int geofence_get_place_id(geofence_h fence, int *place_id);
  * @return 0 on success, otherwise a negative error value
  * @retval #GEOFENCE_MANAGER_ERROR_NONE Successful
  * @retval #GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER Illegal argument.
+ * @retval #GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED Not supported
  * @see geofence_get_longitude()
  * @see geofence_get_radius()
  * @see geofence_get_address()
@@ -556,6 +625,7 @@ int geofence_get_latitude(geofence_h fence, double *latitude);
  * @return 0 on success, otherwise a negative error value
  * @retval #GEOFENCE_MANAGER_ERROR_NONE Successful
  * @retval #GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER Illegal argument
+ * @retval #GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED Not supported
  * @see geofence_get_latitude()
  * @see geofence_get_radius()
  * @see geofence_get_address()
@@ -574,6 +644,7 @@ int geofence_get_longitude(geofence_h fence, double *longitude);
  * @return 0 on success, otherwise a negative error value
  * @retval #GEOFENCE_MANAGER_ERROR_NONE Successful
  * @retval #GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER Illegal argument
+ * @retval #GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED Not supported
  * @see geofence_get_latitude()
  * @see geofence_get_longitude()
  * @see geofence_get_address()
@@ -591,6 +662,7 @@ int geofence_get_radius(geofence_h fence, int *radius);
  * @return 0 on success, otherwise a negative error value
  * @retval #GEOFENCE_MANAGER_ERROR_NONE Successful
  * @retval #GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER Illegal argument
+ * @retval #GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED Not supported
  * @see geofence_get_latitude()
  * @see geofence_get_longitude()
  * @see geofence_get_radius()
@@ -608,6 +680,7 @@ int geofence_get_address(geofence_h fence, char **address);
  * @return 0 on success, otherwise a negative error value
  * @retval #GEOFENCE_MANAGER_ERROR_NONE Successful
  * @retval #GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER Illegal argument
+ * @retval #GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED Not supported
  * @see geofence_get_type()
  * @see geofence_create_bluetooth()
  * @see geofence_create_wifi()
@@ -624,6 +697,7 @@ int geofence_get_bssid(geofence_h fence, char **bssid);
  * @return 0 on success, otherwise a negative error value
  * @retval #GEOFENCE_MANAGER_ERROR_NONE Successful
  * @retval #GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER Illegal argument
+ * @retval #GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED Not supported
  * @see geofence_get_type()
  * @see geofence_create_bluetooth()
  * @see geofence_create_wifi()
@@ -641,6 +715,7 @@ int geofence_get_ssid(geofence_h fence, char **ssid);
  * @retval #GEOFENCE_MANAGER_ERROR_NONE Successful
  * @retval #GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER Illegal argument
  * @retval #GEOFENCE_MANAGER_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED Not supported
  * @retval #GEOFENCE_MANAGER_ERROR_GEOFENCE_ACCESS_DENIED Access to specified geofence is denied
  * @see geofence_status_destroy()
  * @see geofence_manager_start()
@@ -655,6 +730,7 @@ int geofence_status_create(int geofence_id, geofence_status_h *status);
  * @return 0 on success, otherwise a negative error value
  * @retval #GEOFENCE_MANAGER_ERROR_NONE Successful
  * @retval #GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER Illegal argument
+ * @retval #GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED Not supported
  * @see geofence_status_create()
  * @see geofence_status_get_state()
  * @see geofence_status_get_duration()
@@ -669,6 +745,7 @@ int geofence_status_destroy(geofence_status_h status);
  * @return 0 on success, otherwise a negative error value
  * @retval #GEOFENCE_MANAGER_ERROR_NONE Successful
  * @retval #GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER Illegal argument
+ * @retval #GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED Not supported
  * @see geofence_status_get_duration()
  */
 int geofence_status_get_state(geofence_status_h status, geofence_state_e *state);
@@ -681,6 +758,7 @@ int geofence_status_get_state(geofence_status_h status, geofence_state_e *state)
  * @return 0 on success, otherwise a negative error value
  * @retval #GEOFENCE_MANAGER_ERROR_NONE Successful
  * @retval #GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER Illegal argument
+ * @retval #GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED Not supported
  * @see geofence_status_get_state()
  */
 int geofence_status_get_duration(geofence_status_h status, int *seconds);
index a3b0394..db7c2ab 100644 (file)
@@ -64,13 +64,36 @@ typedef enum {
 
 
 /**
+ * @brief Enumeration for the state of proximity.
+ * @since_tizen 3.0
+ */
+typedef enum {
+    GEOFENCE_PROXIMITY_STATE_UNCERTAIN = 0,            /**< Uncertain state of proximity */
+    GEOFENCE_PROXIMITY_STATE_FAR,                              /**< Far state of proximity */
+    GEOFENCE_PROXIMITY_STATE_NEAR,                             /**< Near state of proximity */
+    GEOFENCE_PROXIMITY_STATE_IMMEDIATE,                        /**< Immediate state of proximity */
+} geofence_proximity_state_e;
+
+/**
+ * @brief Enumeration for the provider of proximity.
+ * @since_tizen 3.0
+ */
+typedef enum {
+    GEOFENCE_PROXIMITY_PROVIDER_LOCATION = 0,  /**< Proximity is specified by geospatial coordinate */
+    GEOFENCE_PROXIMITY_PROVIDER_WIFI,                  /**< Proximity is specified by Wi-Fi access point */
+    GEOFENCE_PROXIMITY_PROVIDER_BLUETOOTH,             /**< Proximity is specified by Bluetooth device */
+    GEOFENCE_PROXIMITY_PROVIDER_BLE,                   /**< Proximity is specified by Bluetooth low energy device */
+    GEOFENCE_PROXIMITY_PROVIDER_SENSOR,                        /**< Proximity is specified by Sensor */
+} geofence_proximity_provider_e;
+
+/**
  * @brief Enumeration for geofence type.
  * @since_tizen 2.4
  */
 typedef enum {
     GEOFENCE_TYPE_GEOPOINT = 1,                /**< Geofence is specified by geospatial coordinate */
     GEOFENCE_TYPE_WIFI,                                /**< Geofence is specified by Wi-Fi access point */
-    GEOFENCE_TYPE_BT,                          /**< Geofence is specified by Blutetooth device */
+    GEOFENCE_TYPE_BT,                          /**< Geofence is specified by Bluetooth device */
 } geofence_type_e;
 
 /**
index d6568bb..0417b97 100644 (file)
@@ -1,7 +1,7 @@
 #sbs-git:slp/api/geofence-manager capi-geofence-manager 0.1.0 d1ee09a32e8bc0e9ed48ece37c641a7393c086c5
 Name:       capi-geofence-manager
 Summary:    A Geofence Manager library in Tizen Native API
-Version:    0.3.1
+Version:    0.3.2
 Release:    1
 Group:      Location/Libraries
 License:    Apache-2.0
index 4a98410..e2a89ea 100644 (file)
@@ -143,6 +143,23 @@ static void __cb_fence_evt(GObject *self, guint place_id, guint geofence_id, gui
                ((geofence_event_cb) handle->user_event_cb)(place_id, geofence_id, error, action, handle->user_data);
 }
 
+static void __cb_fence_proximity(GObject *self, guint geofence_id, geofence_proximity_state_e state, geofence_proximity_provider_e provider, gpointer userdata)
+{
+       GEOFENCE_LOGD("geofence_id: %d, proximity_state: %d, proximity_provider: %d", geofence_id, state, provider);
+       geofence_manager_s *handle = (geofence_manager_s *) userdata;
+       GList *fence_list = g_list_first(tracking_list);
+
+       while (fence_list) {
+               if (GPOINTER_TO_INT(fence_list->data) == geofence_id) {
+                       if (handle->user_proximity_cb) {
+                               ((geofence_proximity_state_changed_cb) handle->user_proximity_cb)(geofence_id, state, provider, handle->user_data);
+                               break;
+                       }
+               }
+               fence_list = g_list_next(fence_list);
+       }
+}
+
 static int __set_callback(geofence_manager_h manager, void *callback, void *user_data)
 {
        GEOFENCE_LOGD("__set_callback");
@@ -193,6 +210,31 @@ static int __unset_event_callback(geofence_manager_h manager)
        return GEOFENCE_MANAGER_ERROR_NONE;
 }
 
+static int __set_proximity_callback(geofence_manager_h manager, void *callback, void *user_data)
+{
+       GEOFENCE_LOGD("__set_proximity_callback");
+       GEOFENCE_NULL_ARG_CHECK(manager);
+       GEOFENCE_NULL_ARG_CHECK(callback);
+
+       geofence_manager_s *handle = (geofence_manager_s *) manager;
+       handle->user_proximity_cb = callback;
+       handle->user_data = user_data;
+
+       return GEOFENCE_MANAGER_ERROR_NONE;
+}
+
+static int __unset_proximity_callback(geofence_manager_h manager)
+{
+       GEOFENCE_LOGD("__unset_proximity_callback");
+       GEOFENCE_NULL_ARG_CHECK(manager);
+
+       geofence_manager_s *handle = (geofence_manager_s *) manager;
+       handle->user_proximity_cb = NULL;
+       handle->user_data = NULL;
+
+       return GEOFENCE_MANAGER_ERROR_NONE;
+}
+
 static bool __is_fence_started(int fence_id)
 {
        GEOFENCE_LOGD("__is_fence_started");
@@ -268,6 +310,8 @@ EXPORT_API int geofence_manager_create(geofence_manager_h *manager)
                        handle->sig_id[_GEOFENCE_SIGNAL_ZONE_OUT] = g_signal_connect(handle->object, "zone-out", G_CALLBACK(__cb_zone_out), handle);
                if (!handle->sig_id[_GEOFENCE_SIGNAL_EVENT])
                        handle->sig_id[_GEOFENCE_SIGNAL_EVENT] = g_signal_connect(handle->object, "geofence-event", G_CALLBACK(__cb_fence_evt), handle);
+               if (!handle->sig_id[_GEOFENCE_SIGNAL_PROXIMITY])
+                       handle->sig_id[_GEOFENCE_SIGNAL_PROXIMITY] = g_signal_connect(handle->object, "geofence-proximity", G_CALLBACK(__cb_fence_proximity), handle);
 
                ret = geofence_ielement_create(GEOFENCE_IELEMENT(handle->object));
                if (ret != GEOFENCE_MANAGER_ERROR_NONE) {
@@ -515,7 +559,7 @@ EXPORT_API int geofence_manager_remove_fence(geofence_manager_h manager, int geo
        GEOFENCE_LOGD("geofence_manager_remove_geofence");
 
        if (__is_geofence_feature_enabled() == false)
-                       return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
+               return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
 
        GEOFENCE_NULL_ARG_CHECK(manager);
        GEOFENCE_CHECK_CONDITION(geofence_id > 0, GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER, "GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER");
@@ -540,7 +584,7 @@ EXPORT_API int geofence_manager_remove_place(geofence_manager_h manager, int pla
        GEOFENCE_LOGD("geofence_manager_remove_place");
 
        if (__is_geofence_feature_enabled() == false)
-                       return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
+               return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
 
        GEOFENCE_NULL_ARG_CHECK(manager);
        GEOFENCE_CHECK_CONDITION(place_id > 0, GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER, "GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER");
@@ -566,7 +610,7 @@ EXPORT_API int geofence_manager_get_place_name(geofence_manager_h manager, int p
        GEOFENCE_LOGD("geofence_manager_remove_place");
 
        if (__is_geofence_feature_enabled() == false)
-                       return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
+               return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
 
        GEOFENCE_NULL_ARG_CHECK(manager);
        GEOFENCE_NULL_ARG_CHECK(place_name);
@@ -593,19 +637,31 @@ EXPORT_API int geofence_manager_set_geofence_state_changed_cb(geofence_manager_h
        GEOFENCE_LOGD("geofence_manager_set_geofence_state_changed_cb");
 
        if (__is_geofence_feature_enabled() == false)
-                       return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
+               return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
 
        GEOFENCE_NULL_ARG_CHECK(manager);
 
        return __set_callback(manager, callback, user_data);
 }
 
+EXPORT_API int geofence_manager_set_geofence_proximity_state_changed_cb(geofence_manager_h manager, geofence_proximity_state_changed_cb callback, void *user_data)
+{
+       GEOFENCE_LOGD("geofence_manager_set_geofence_proximity_state_changed_cb");
+
+       if (__is_geofence_feature_enabled() == false)
+               return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
+
+       GEOFENCE_NULL_ARG_CHECK(manager);
+
+       return __set_proximity_callback(manager, callback, user_data);
+}
+
 EXPORT_API int geofence_manager_set_geofence_event_cb(geofence_manager_h manager, geofence_event_cb callback, void *user_data)
 {
        GEOFENCE_LOGD("geofence_manager_set_geofence_event_cb");
 
        if (__is_geofence_feature_enabled() == false)
-                       return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
+               return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
 
        GEOFENCE_NULL_ARG_CHECK(manager);
 
@@ -617,19 +673,31 @@ EXPORT_API int geofence_manager_unset_geofence_state_changed_cb(geofence_manager
        GEOFENCE_LOGD("geofence_manager_unset_geofence_state_changed_cb");
 
        if (__is_geofence_feature_enabled() == false)
-                       return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
+               return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
 
        GEOFENCE_NULL_ARG_CHECK(manager);
 
        return __unset_callback(manager);
 }
 
+EXPORT_API int geofence_manager_unset_geofence_proximity_state_changed_cb(geofence_manager_h manager)
+{
+       GEOFENCE_LOGD("geofence_manager_unset_geofence_proximity_state_changed_cb");
+
+       if (__is_geofence_feature_enabled() == false)
+               return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
+
+       GEOFENCE_NULL_ARG_CHECK(manager);
+
+       return __unset_proximity_callback(manager);
+}
+
 EXPORT_API int geofence_manager_unset_geofence_event_cb(geofence_manager_h manager)
 {
        GEOFENCE_LOGD("geofence_manager_unset_geofence_event_cb");
 
        if (__is_geofence_feature_enabled() == false)
-                       return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
+               return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
 
        GEOFENCE_NULL_ARG_CHECK(manager);
 
@@ -641,7 +709,7 @@ EXPORT_API int geofence_manager_foreach_geofence_list(geofence_manager_h manager
        GEOFENCE_LOGD(">>> Start");
 
        if (__is_geofence_feature_enabled() == false)
-                       return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
+               return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
 
        GEOFENCE_NULL_ARG_CHECK(manager);
        GEOFENCE_NULL_ARG_CHECK(callback);
@@ -694,7 +762,7 @@ EXPORT_API int geofence_manager_foreach_place_geofence_list(geofence_manager_h m
        GEOFENCE_LOGD(">>> Start");
 
        if (__is_geofence_feature_enabled() == false)
-                       return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
+               return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
 
        GEOFENCE_NULL_ARG_CHECK(manager);
        GEOFENCE_NULL_ARG_CHECK(callback);
@@ -744,7 +812,7 @@ EXPORT_API int geofence_manager_foreach_place_list(geofence_manager_h manager, g
        GEOFENCE_LOGD(">>> Start");
 
        if (__is_geofence_feature_enabled() == false)
-                       return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
+               return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
 
        GEOFENCE_NULL_ARG_CHECK(manager);
        GEOFENCE_NULL_ARG_CHECK(callback);
@@ -792,7 +860,7 @@ EXPORT_API int geofence_create_geopoint(int place_id, double latitude, double lo
        GEOFENCE_LOGD("geofence_manager_create_geopoint");
 
        if (__is_geofence_feature_enabled() == false)
-                       return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
+               return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
 
        GEOFENCE_NULL_ARG_CHECK(fence);
        GEOFENCE_NULL_ARG_CHECK(address);
@@ -810,7 +878,7 @@ EXPORT_API int geofence_create_bluetooth(int place_id, const char *bssid, const
        GEOFENCE_LOGD("geofence_create_bluetooth");
 
        if (__is_geofence_feature_enabled() == false)
-                       return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
+               return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
 
        GEOFENCE_NULL_ARG_CHECK(fence);
        GEOFENCE_NULL_ARG_CHECK(bssid);
@@ -826,7 +894,7 @@ EXPORT_API int geofence_create_wifi(int place_id, const char *bssid, const char
        GEOFENCE_LOGD("geofence_create_wifi");
 
        if (__is_geofence_feature_enabled() == false)
-                       return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
+               return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
 
        GEOFENCE_NULL_ARG_CHECK(fence);
        GEOFENCE_NULL_ARG_CHECK(bssid);
@@ -840,7 +908,7 @@ EXPORT_API int geofence_create_wifi(int place_id, const char *bssid, const char
 EXPORT_API int geofence_destroy(geofence_h fence)
 {
        if (__is_geofence_feature_enabled() == false)
-                       return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
+               return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
 
        GEOFENCE_NULL_ARG_CHECK(fence);
        geofence_parameter_free((geofence_s *)fence);
@@ -850,7 +918,7 @@ EXPORT_API int geofence_destroy(geofence_h fence)
 EXPORT_API int geofence_get_type(geofence_h fence, geofence_type_e *type)
 {
        if (__is_geofence_feature_enabled() == false)
-                       return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
+               return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
 
        GEOFENCE_NULL_ARG_CHECK(fence);
        GEOFENCE_NULL_ARG_CHECK(type);
@@ -863,7 +931,7 @@ EXPORT_API int geofence_get_type(geofence_h fence, geofence_type_e *type)
 EXPORT_API int geofence_get_place_id(geofence_h fence, int *place_id)
 {
        if (__is_geofence_feature_enabled() == false)
-                       return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
+               return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
 
        GEOFENCE_NULL_ARG_CHECK(fence);
        GEOFENCE_NULL_ARG_CHECK(place_id);
@@ -876,7 +944,7 @@ EXPORT_API int geofence_get_place_id(geofence_h fence, int *place_id)
 EXPORT_API int geofence_get_latitude(geofence_h fence, double *latitude)
 {
        if (__is_geofence_feature_enabled() == false)
-                       return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
+               return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
 
        GEOFENCE_NULL_ARG_CHECK(fence);
        GEOFENCE_NULL_ARG_CHECK(latitude);
@@ -889,7 +957,7 @@ EXPORT_API int geofence_get_latitude(geofence_h fence, double *latitude)
 EXPORT_API int geofence_get_longitude(geofence_h fence, double *longitude)
 {
        if (__is_geofence_feature_enabled() == false)
-                       return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
+               return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
 
        GEOFENCE_NULL_ARG_CHECK(fence);
        GEOFENCE_NULL_ARG_CHECK(longitude);
@@ -902,7 +970,7 @@ EXPORT_API int geofence_get_longitude(geofence_h fence, double *longitude)
 EXPORT_API int geofence_get_radius(geofence_h fence, int *radius)
 {
        if (__is_geofence_feature_enabled() == false)
-                       return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
+               return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
 
        GEOFENCE_NULL_ARG_CHECK(fence);
        GEOFENCE_NULL_ARG_CHECK(radius);
@@ -915,7 +983,7 @@ EXPORT_API int geofence_get_radius(geofence_h fence, int *radius)
 EXPORT_API int geofence_get_address(geofence_h fence, char **address)
 {
        if (__is_geofence_feature_enabled() == false)
-                       return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
+               return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
 
        GEOFENCE_NULL_ARG_CHECK(fence);
        GEOFENCE_NULL_ARG_CHECK(address);
@@ -928,7 +996,7 @@ EXPORT_API int geofence_get_address(geofence_h fence, char **address)
 EXPORT_API int geofence_get_bssid(geofence_h fence, char **bssid)
 {
        if (__is_geofence_feature_enabled() == false)
-                       return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
+               return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
 
        GEOFENCE_NULL_ARG_CHECK(fence);
        GEOFENCE_NULL_ARG_CHECK(bssid);
@@ -941,7 +1009,7 @@ EXPORT_API int geofence_get_bssid(geofence_h fence, char **bssid)
 EXPORT_API int geofence_get_ssid(geofence_h fence, char **ssid)
 {
        if (__is_geofence_feature_enabled() == false)
-                       return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
+               return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
 
        GEOFENCE_NULL_ARG_CHECK(fence);
        GEOFENCE_NULL_ARG_CHECK(ssid);
@@ -954,7 +1022,7 @@ EXPORT_API int geofence_get_ssid(geofence_h fence, char **ssid)
 EXPORT_API int geofence_status_create(int geofence_id, geofence_status_h *status)
 {
        if (__is_geofence_feature_enabled() == false)
-                       return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
+               return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
 
        GEOFENCE_NULL_ARG_CHECK(status);
        GEOFENCE_CHECK_CONDITION(geofence_id > 0, GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER, "GEOFENCE_MANAGER_ERROR_INVALID_PARAMETER");
@@ -974,7 +1042,7 @@ EXPORT_API int geofence_status_create(int geofence_id, geofence_status_h *status
 EXPORT_API int geofence_status_destroy(geofence_status_h status)
 {
        if (__is_geofence_feature_enabled() == false)
-                       return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
+               return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
 
        GEOFENCE_NULL_ARG_CHECK(status);
 
@@ -985,7 +1053,7 @@ EXPORT_API int geofence_status_destroy(geofence_status_h status)
 EXPORT_API int geofence_status_get_state(geofence_status_h status, geofence_state_e *state)
 {
        if (__is_geofence_feature_enabled() == false)
-                       return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
+               return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
 
        GEOFENCE_NULL_ARG_CHECK(status);
        GEOFENCE_NULL_ARG_CHECK(state);
@@ -1004,7 +1072,7 @@ EXPORT_API int geofence_status_get_state(geofence_status_h status, geofence_stat
 EXPORT_API int geofence_status_get_duration(geofence_status_h status, int *seconds)
 {
        if (__is_geofence_feature_enabled() == false)
-                       return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
+               return GEOFENCE_MANAGER_ERROR_NOT_SUPPORTED;
 
        GEOFENCE_NULL_ARG_CHECK(status);
        GEOFENCE_NULL_ARG_CHECK(seconds);
index 549753a..b4dc845 100644 (file)
@@ -29,6 +29,7 @@ G_BEGIN_DECLS
 enum {
     ZONE_IN,
     ZONE_OUT,
+    GEOFENCE_PROXIMITY,
     GEOFENCE_EVENT,
     LAST_SIGNAL
 };
index 96c7b87..d18351e 100644 (file)
@@ -124,10 +124,7 @@ static void geofence_internal_get_property(GObject *object,
        }
 }
 
-void geofence_signaling(GeofenceObject *obj,
-                        guint32 signals[LAST_SIGNAL],
-                        guint geofence_id,
-                        guint state)
+void geofence_signaling(GeofenceObject *obj, guint32 signals[LAST_SIGNAL], guint geofence_id, guint state)
 {
        GEOFENCE_LOGD("geofence_signaling");
 
@@ -144,6 +141,17 @@ void geofence_signaling(GeofenceObject *obj,
        }
 }
 
+void geofence_proximity_signaling(GeofenceObject *obj, guint32 signals[LAST_SIGNAL], guint geofence_id, guint proximity_state, guint provider)
+{
+       GEOFENCE_LOGD("geofence_proxmity_signaling");
+
+       g_return_if_fail(obj);
+       g_return_if_fail(signals);
+       g_return_if_fail(proximity_state);
+
+       g_signal_emit(obj, signals[GEOFENCE_PROXIMITY], 0, geofence_id, proximity_state, provider, NULL);
+}
+
 void geofence_event_signaling(GeofenceObject *obj,
                               guint32 signals[LAST_SIGNAL],
                               guint place_id,
@@ -169,6 +177,16 @@ static void _state_cb(int geofence_id, int state, gpointer userdata)
        geofence_signaling(userdata, signals, geofence_id, state);
 }
 
+static void _proximity_cb(int geofence_id, int proximity_state, int provider, gpointer userdata)
+{
+       GEOFENCE_LOGD("_proximity_cb");
+       g_return_if_fail(userdata);
+       GeofenceInternalPrivate *priv = GET_PRIVATE(userdata);
+       g_return_if_fail(priv);
+       GEOFENCE_LOGD("geofence id [%d] proximity_state [%d]", geofence_id, proximity_state);
+       geofence_proximity_signaling(userdata, signals, geofence_id, proximity_state, provider);
+}
+
 static void _geofence_event_cb(int place_id, int geofence_id, int error, int state, gpointer userdata)
 {
        GEOFENCE_LOGD("_geofence_event_cb");
@@ -190,7 +208,7 @@ static int geofence_internal_create(GeofenceInternal *self)
        int ret = GEOFENCE_MANAGER_ERROR_NONE;
 
        if (gIsCreated == 0) {
-               ret = priv->mod->ops.create(priv->mod->handler, _state_cb, _geofence_event_cb, self);
+               ret = priv->mod->ops.create(priv->mod->handler, _state_cb, _proximity_cb, _geofence_event_cb, self);
                if (ret != GEOFENCE_MANAGER_ERROR_NONE) {
                        GEOFENCE_LOGE("Fail to create. Error[%d]", ret);
                }
@@ -518,6 +536,18 @@ static void geofence_internal_class_init(GeofenceInternalClass *klass)
                                         G_TYPE_NONE, 1,
                                         G_TYPE_UINT);
 
+       signals[GEOFENCE_PROXIMITY] = g_signal_new("geofence-proximity",
+                                               G_TYPE_FROM_CLASS(klass),
+                                               G_SIGNAL_RUN_FIRST |
+                                               G_SIGNAL_NO_RECURSE,
+                                               G_STRUCT_OFFSET(GeofenceInternalClass, geofence_event),
+                                               NULL, NULL,
+                                               g_cclosure_marshal_generic,
+                                               G_TYPE_NONE, 3,
+                                               G_TYPE_UINT,
+                                               G_TYPE_UINT,
+                                               G_TYPE_UINT);
+
        signals[GEOFENCE_EVENT] = g_signal_new("geofence-event",
                                               G_TYPE_FROM_CLASS(klass),
                                               G_SIGNAL_RUN_FIRST |
index c3f5cde..3b479de 100644 (file)
@@ -44,6 +44,7 @@ struct _GeofenceInternalClass {
 
        void (* zone_in)(guint geofence_id);
        void (* zone_out)(guint geofence_id);
+       void (* geofence_proximity)(guint geofence_id, guint proximity_state, guint provider);
        void (* geofence_event)(guint place_id, guint geofence_id, guint error, guint state);
 };
 
index 6cb2252..82a6919 100644 (file)
@@ -37,6 +37,7 @@ typedef GObject GeofenceObject;
 typedef enum {
     _GEOFENCE_SIGNAL_ZONE_IN,
     _GEOFENCE_SIGNAL_ZONE_OUT,
+    _GEOFENCE_SIGNAL_PROXIMITY,
     _GEOFENCE_SIGNAL_EVENT,
     _GEOFENCE_SIGNAL_NUM
 } _geofence_signal_e;
@@ -47,6 +48,7 @@ typedef enum {
 typedef struct _geofence_manager_s {
        GeofenceObject *object;
        const void *user_cb;
+       const void *user_proximity_cb;
        const void *user_event_cb;
        void *user_data;
        gulong sig_id[_GEOFENCE_SIGNAL_NUM];
index 0d2512d..cf17fe6 100644 (file)
@@ -33,13 +33,15 @@ extern "C" {
  */
 typedef void (*GeofenceModCB)(int fence_id, int state, gpointer userdata);
 
+typedef void (*GeofenceModProximityCB)(int fence_id, int proximity_state, int provider, gpointer userdata);
+
 typedef void (*GeofenceModEventCB)(int place_id, int fence_id, int error, int state, gpointer userdata);
 
 /**
  * @brief This represents APIs declared in a Geofence plug-in for Geofence modules.
  */
 typedef struct {
-       int (*create)(void *handle, GeofenceModCB geofence_cb, GeofenceModEventCB geofence_event_cb, void *userdata);
+       int (*create)(void *handle, GeofenceModCB geofence_cb, GeofenceModProximityCB geofence_proximity_cb, GeofenceModEventCB geofence_event_cb, void *userdata);
        int (*destroy)(void *handle);
        int (*enable_service)(void *handle, int fence_id, bool enable);
        int (*start_geofence)(void *handle, int fence_id);