add new geofence API for proximity(except BLE) 14/53114/1 accepted/tizen/mobile/20151206.224133 accepted/tizen/tv/20151206.224149 accepted/tizen/wearable/20151206.224208 submit/tizen/20151204.080727
authorjomui <jongmun.woo@samsung.com>
Wed, 2 Dec 2015 02:33:06 +0000 (11:33 +0900)
committerjomui <jongmun.woo@samsung.com>
Wed, 2 Dec 2015 02:33:32 +0000 (11:33 +0900)
Signed-off-by: jomui <jongmun.woo@samsung.com>
Change-Id: Ib879f1ec195a890df5f52050141aa74f9b77c56b

geofence/src/geofence_client.c
introspection/geofence.xml
packaging/geofence-dbus.spec
server/include/geofence_dbus_server.h
server/src/geofence_dbus_server.c

index 0e25521f7917835a06a63e5d748396a451b7805b..eca2942b926030ccaa8aec2bda0ba2a17f3609fb 100644 (file)
@@ -28,6 +28,7 @@ typedef struct _geofence_client_dbus_s {
        gchar *service_path;
        gchar *signal_path;
        int geofence_evt_id;
+       int geofence_proximity_id;
        int geofence_evt_status_id;
        geofence_client_cb user_cb;
        void *user_data;
@@ -432,6 +433,14 @@ EXPORT_API int geo_client_start(geofence_client_dbus_h geofence_client, geofence
                        GEOFENCE_CLIENT_LOGD("Fail to listen GeofenceInout");
                }
 
+               handle->geofence_proximity_id = g_dbus_connection_signal_subscribe(handle->conn, handle->service_name, GEOFENCE_INTERFACE_NAME, "GeofenceProximity", handle->signal_path, NULL, G_DBUS_SIGNAL_FLAGS_NONE, __geofence_signal_callback, handle, NULL);
+
+               if (handle->geofence_proximity_id) {
+                       GEOFENCE_CLIENT_LOGD("Listening GeofenceProximity");
+               } else {
+                       GEOFENCE_CLIENT_LOGD("Fail to listen GeofenceProximity");
+               }
+
                handle->geofence_evt_status_id = g_dbus_connection_signal_subscribe(handle->conn, handle->service_name, GEOFENCE_INTERFACE_NAME, "GeofenceEvent", handle->signal_path,  NULL, G_DBUS_SIGNAL_FLAGS_NONE, __geofence_signal_callback, handle, NULL);
 
                if (handle->geofence_evt_status_id) {
@@ -482,6 +491,10 @@ static void __geo_client_signal_unsubcribe(geofence_client_dbus_h geofence_clien
                g_dbus_connection_signal_unsubscribe(handle->conn, handle->geofence_evt_status_id);
                handle->geofence_evt_status_id = 0;
        }
+       if (handle->geofence_proximity_id) {
+               g_dbus_connection_signal_unsubscribe(handle->conn, handle->geofence_proximity_id);
+               handle->geofence_proximity_id = 0;
+       }
 }
 
 EXPORT_API int geo_client_stop(geofence_client_dbus_h geofence_client)
index 391f37e951b7260bcc022c9c7f83fbac06d67245..8a9a7e5f7a963fed329f81e3d6c9a337c2ea55c4 100644 (file)
                        <arg direction="out" type="i" name="access_type"/>
                        <arg direction="out" type="i" name="fence_state"/>
                </signal>
+               <signal name="GeofenceProximity">
+                       <arg direction="out" type="s" name="app_id"/>
+                       <arg direction="out" type="i" name="fence_id"/>
+                       <arg direction="out" type="i" name="access_type"/>
+                       <arg direction="out" type="i" name="fence_proximity_state"/>
+                       <arg direction="out" type="i" name="provider"/>
+               </signal>
 
                <!-- Place Management -->
                <method name="AddPlace">
index a8ab983307d5c827b46a91e0abc6cb6f424e4ded..eb8de106885a3e03f7864aa1d25a63617b256688 100644 (file)
@@ -1,6 +1,6 @@
 Name: geofence-dbus
 Summary: Dbus interface for Geofence service
-Version: 0.3.1
+Version: 0.3.2
 Release:    1
 Group:      Location/Libraries
 License:    Apache-2.0
index 7448c2e3d3c4b7cc1cec71c5dedff76520a710ca..15049363cc82cca9912553d96231bf830423088a 100644 (file)
@@ -122,6 +122,8 @@ typedef GVariant *(*GeofenceGetPlacesCB)(const gchar *app_id, int *fence_cnt, in
 */
 int geofence_dbus_server_send_geofence_inout_changed(geofence_dbus_server_h geofence_dbus_server, const gchar *app_id, gint fence_id, gint access_type, gint fence_state);
 
+int geofence_dbus_server_send_geofence_proximity_changed(geofence_dbus_server_h geofence_dbus_server, const gchar *app_id, gint fence_id, gint access_type, gint fence_proximity_state, gint provider);
+
 int geofence_dbus_server_send_geofence_event_changed(geofence_dbus_server_h geofence_dbus_server, gint place_id, gint fence_id, gint access_type, const gchar *app_id, gint error, gint state);
 
 typedef struct {
index f3a6bd1b483952c189ac9d3c6e40f0bb42e690da..441dc75770883ee382eb121a849400b30bb29b80 100644 (file)
@@ -443,6 +443,25 @@ EXPORT_API int geofence_dbus_server_send_geofence_inout_changed(geofence_dbus_se
        return GEOFENCE_DBUS_SERVER_ERROR_NONE;
 }
 
+EXPORT_API int geofence_dbus_server_send_geofence_proximity_changed(geofence_dbus_server_h geofence_dbus_server, const gchar *app_id, gint fence_id, gint access_type, gint fence_proximity_state, gint provider)
+{
+       GEOFENCE_DBUS_SERVER_LOGD("ENTER >>>");
+       g_return_val_if_fail(geofence_dbus_server, GEOFENCE_DBUS_SERVER_ERROR_PARAMETER);
+
+       geofence_dbus_server_s *handle = (geofence_dbus_server_s *)geofence_dbus_server;
+       g_return_val_if_fail(handle->obj_skeleton, GEOFENCE_DBUS_SERVER_ERROR_PARAMETER);
+
+       SLocGeofence *geofence = NULL;
+       geofence = sloc_object_get_geofence(SLOC_OBJECT(handle->obj_skeleton));
+       g_return_val_if_fail(geofence, GEOFENCE_DBUS_SERVER_ERROR_PARAMETER);
+
+       sloc_geofence_emit_geofence_proximity(geofence, app_id, fence_id, access_type, fence_proximity_state, provider);
+       g_object_unref(geofence);
+
+       return GEOFENCE_DBUS_SERVER_ERROR_NONE;
+}
+
+
 EXPORT_API int geofence_dbus_server_send_geofence_event_changed(geofence_dbus_server_h geofence_dbus_server, gint place_id, gint fence_id, gint access_type, const gchar *app_id, gint error, gint state)
 {
        GEOFENCE_DBUS_SERVER_LOGD("ENTER >>>");