summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjomui <jongmun.woo@samsung.com>2015-12-02 02:33:06 (GMT)
committerjomui <jongmun.woo@samsung.com>2015-12-02 02:33:32 (GMT)
commit7d21d7e0d7a3650f498b5fdf6c0fde59e7be4451 (patch)
tree7299e3c7e07d07a36b9aba52d81f8b09d0d40fab
parentb1ad881d50f5ed6c1abee43baacb3cddd1311ade (diff)
downloadgeofence-dbus-7d21d7e0d7a3650f498b5fdf6c0fde59e7be4451.zip
geofence-dbus-7d21d7e0d7a3650f498b5fdf6c0fde59e7be4451.tar.gz
geofence-dbus-7d21d7e0d7a3650f498b5fdf6c0fde59e7be4451.tar.bz2
Signed-off-by: jomui <jongmun.woo@samsung.com> Change-Id: Ib879f1ec195a890df5f52050141aa74f9b77c56b
-rw-r--r--geofence/src/geofence_client.c13
-rw-r--r--introspection/geofence.xml7
-rw-r--r--packaging/geofence-dbus.spec2
-rw-r--r--server/include/geofence_dbus_server.h2
-rw-r--r--server/src/geofence_dbus_server.c19
5 files changed, 42 insertions, 1 deletions
diff --git a/geofence/src/geofence_client.c b/geofence/src/geofence_client.c
index 0e25521..eca2942 100644
--- a/geofence/src/geofence_client.c
+++ b/geofence/src/geofence_client.c
@@ -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)
diff --git a/introspection/geofence.xml b/introspection/geofence.xml
index 391f37e..8a9a7e5 100644
--- a/introspection/geofence.xml
+++ b/introspection/geofence.xml
@@ -42,6 +42,13 @@
<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">
diff --git a/packaging/geofence-dbus.spec b/packaging/geofence-dbus.spec
index a8ab983..eb8de10 100644
--- a/packaging/geofence-dbus.spec
+++ b/packaging/geofence-dbus.spec
@@ -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
diff --git a/server/include/geofence_dbus_server.h b/server/include/geofence_dbus_server.h
index 7448c2e..1504936 100644
--- a/server/include/geofence_dbus_server.h
+++ b/server/include/geofence_dbus_server.h
@@ -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 {
diff --git a/server/src/geofence_dbus_server.c b/server/src/geofence_dbus_server.c
index f3a6bd1..441dc75 100644
--- a/server/src/geofence_dbus_server.c
+++ b/server/src/geofence_dbus_server.c
@@ -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 >>>");