1 /* Copyright 2014 Samsung Electronics Co., Ltd All Rights Reserved
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
17 #include "geofence_client.h"
18 #include "geofence_client_priv.h"
20 #define GEOFENCE_SERVICE_NAME "org.tizen.lbs.Providers.GeofenceServer"
21 #define GEOFENCE_SERVICE_PATH "/org/tizen/lbs/Providers/GeofenceServer"
22 #define GEOFENCE_INTERFACE_NAME "org.tizen.lbs.Geofence"
25 typedef struct _geofence_client_dbus_s {
26 GDBusConnection *conn;
31 int geofence_evt_status_id;
32 geofence_client_cb user_cb;
34 } geofence_client_dbus_s;
36 static void __geofence_signal_callback(GDBusConnection *conn, const gchar *name, const gchar *path, const gchar *interface, const gchar *sig, GVariant *param, gpointer user_data)
38 GEOFENCE_CLIENT_SECLOG("name: %s, path: %s, interface: %s, sig: %s, handle[%p]", name, path, interface, sig, user_data);
39 geofence_client_dbus_s *handle = (geofence_client_dbus_s *) user_data;
41 GEOFENCE_CLIENT_LOGD("Invalid handle");
45 handle->user_cb(sig, param, handle->user_data);
48 EXPORT_API int geo_client_add_geofence(geofence_client_dbus_h geofence_client, gchar *app_id, gint place_id, gint geofence_type, gdouble latitude, gdouble longitude, gint radius, const gchar *address, const gchar *bssid, const gchar *ssid)
50 GEOFENCE_CLIENT_LOGD("ENTER >>>");
51 g_return_val_if_fail(geofence_client, GEOFENCE_CLIENT_ERROR_PARAMETER);
53 geofence_client_dbus_s *handle = (geofence_client_dbus_s *)geofence_client;
56 GDBusProxy *proxy = NULL;
59 proxy = g_dbus_proxy_new_sync(handle->conn, G_DBUS_PROXY_FLAGS_NONE, NULL, handle->service_name, handle->signal_path, GEOFENCE_INTERFACE_NAME, NULL, &error);
61 GEOFENCE_CLIENT_LOGD("proxy: %p", proxy);
63 reg = g_dbus_proxy_call_sync(proxy, "AddGeofence", g_variant_new("(siiddisss)", app_id, place_id, geofence_type, latitude, longitude, radius, address, bssid, ssid), G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
65 g_variant_get(reg, "(i)", &fence_id);
70 GEOFENCE_CLIENT_LOGE("Fail to add geofence Error[%s]", error->message);
74 g_object_unref(proxy);
77 GEOFENCE_CLIENT_LOGE("Fail to get proxy Error[%s]", error->message);
82 GEOFENCE_CLIENT_LOGD("fence_id: %d", fence_id);
87 EXPORT_API int geo_client_delete_geofence(geofence_client_dbus_h geofence_client, gchar *app_id, gint fence_id)
89 GEOFENCE_CLIENT_LOGD("ENTER >>>");
90 g_return_val_if_fail(geofence_client, GEOFENCE_CLIENT_ERROR_PARAMETER);
92 geofence_client_dbus_s *handle = (geofence_client_dbus_s *) geofence_client;
94 GDBusProxy *proxy = NULL;
95 int ret = GEOFENCE_CLIENT_ERROR_NONE;
97 proxy = g_dbus_proxy_new_sync(handle->conn, G_DBUS_PROXY_FLAGS_NONE, NULL, handle->service_name, handle->signal_path, GEOFENCE_INTERFACE_NAME, NULL, &error);
99 g_dbus_proxy_call(proxy, "DeleteGeofence", g_variant_new("(is)", fence_id, app_id), G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, &error);
102 GEOFENCE_CLIENT_LOGE("Fail to get proxy Error[%s]", error->message);
104 ret = GEOFENCE_CLIENT_ERROR_DBUS_CALL;
111 EXPORT_API int geo_client_get_geofences(geofence_client_dbus_h geofence_client, gchar *app_id, gint place_id, GVariantIter **iter, gint *fence_cnt, gint *error_code)
113 GEOFENCE_CLIENT_LOGD("ENTER >>>");
114 g_return_val_if_fail(geofence_client, GEOFENCE_CLIENT_ERROR_PARAMETER);
116 geofence_client_dbus_s *handle = (geofence_client_dbus_s *)geofence_client;
118 GVariant *reg = NULL;
119 GError *error = NULL;
120 GDBusProxy *proxy = NULL;
121 int ret = GEOFENCE_CLIENT_ERROR_NONE;
122 GVariantIter *iterator;
123 int new_error_code = 0;
124 int new_fence_cnt = 0;
126 proxy = g_dbus_proxy_new_sync(handle->conn, G_DBUS_PROXY_FLAGS_NONE, NULL, handle->service_name, handle->signal_path, GEOFENCE_INTERFACE_NAME, NULL, &error);
128 GEOFENCE_CLIENT_LOGD("proxy: %p", proxy);
130 reg = g_dbus_proxy_call_sync(proxy, "GetGeofences", g_variant_new("(is)", place_id, app_id), G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
132 g_variant_get(reg, "(iiaa{sv})", &new_fence_cnt, &new_error_code, &iterator);
133 *error_code = new_error_code;
134 *fence_cnt = new_fence_cnt;
135 if (iterator == NULL)
136 GEOFENCE_CLIENT_LOGE("Iterator is null");
138 g_variant_unref(reg);
141 GEOFENCE_CLIENT_LOGE("Fail to get the list Error[%s]", error->message);
143 ret = GEOFENCE_CLIENT_ERROR_DBUS_CALL;
146 g_object_unref(proxy);
149 GEOFENCE_CLIENT_LOGE("Fail to get proxy Error[%s]", error->message);
151 ret = GEOFENCE_CLIENT_ERROR_DBUS_CALL;
158 EXPORT_API int geo_client_enable_geofence(geofence_client_dbus_h geofence_client, gchar *app_id, gint geofence_id, gboolean onoff)
160 GEOFENCE_CLIENT_LOGD("ENTER >>>");
161 g_return_val_if_fail(geofence_client, GEOFENCE_CLIENT_ERROR_PARAMETER);
163 geofence_client_dbus_s *handle = (geofence_client_dbus_s *)geofence_client;
164 GError *error = NULL;
165 GDBusProxy *proxy = NULL;
166 int ret = GEOFENCE_CLIENT_ERROR_NONE;
168 proxy = g_dbus_proxy_new_sync(handle->conn, G_DBUS_PROXY_FLAGS_NONE, NULL, handle->service_name, handle->signal_path, GEOFENCE_INTERFACE_NAME, NULL, &error);
170 g_dbus_proxy_call(proxy, "EnableGeofence", g_variant_new("(isb)", geofence_id, app_id, onoff), G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, &error);
173 GEOFENCE_CLIENT_LOGE("Fail to get proxy Error[%s]", error->message);
175 ret = GEOFENCE_CLIENT_ERROR_DBUS_CALL;
182 EXPORT_API int geo_client_start_geofence(geofence_client_dbus_h geofence_client, gchar *app_id, gint geofence_id)
184 GEOFENCE_CLIENT_LOGD("ENTER >>>");
185 g_return_val_if_fail(geofence_client, GEOFENCE_CLIENT_ERROR_PARAMETER);
187 geofence_client_dbus_s *handle = (geofence_client_dbus_s *)geofence_client;
188 GError *error = NULL;
189 GDBusProxy *proxy = NULL;
190 int ret = GEOFENCE_CLIENT_ERROR_NONE;
192 GEOFENCE_CLIENT_LOGD("handle->conn: %p, geofence_id", handle->conn, geofence_id);
194 proxy = g_dbus_proxy_new_sync(handle->conn, G_DBUS_PROXY_FLAGS_NONE, NULL, handle->service_name, handle->signal_path, GEOFENCE_INTERFACE_NAME, NULL, &error);
196 g_dbus_proxy_call(proxy, "StartGeofence", g_variant_new("(is)", geofence_id, app_id), G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, &error);
199 GEOFENCE_CLIENT_LOGE("Fail to get proxy Error[%s]", error->message);
201 ret = GEOFENCE_CLIENT_ERROR_DBUS_CALL;
207 EXPORT_API int geo_client_stop_geofence(geofence_client_dbus_h geofence_client, gchar *app_id, gint geofence_id)
209 GEOFENCE_CLIENT_LOGD("ENTER >>>");
210 g_return_val_if_fail(geofence_client, GEOFENCE_CLIENT_ERROR_PARAMETER);
212 geofence_client_dbus_s *handle = (geofence_client_dbus_s *)geofence_client;
213 int ret = GEOFENCE_CLIENT_ERROR_NONE;
214 GError *error = NULL;
215 GDBusProxy *proxy = NULL;
217 GEOFENCE_CLIENT_LOGD("handle->conn: %p", handle->conn);
219 proxy = g_dbus_proxy_new_sync(handle->conn, G_DBUS_PROXY_FLAGS_NONE, NULL, handle->service_name, handle->signal_path, GEOFENCE_INTERFACE_NAME, NULL, &error);
221 g_dbus_proxy_call(proxy, "StopGeofence", g_variant_new("(is)", geofence_id, app_id), G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, &error);
224 GEOFENCE_CLIENT_LOGE("Fail to get proxy Error[%s]", error->message);
226 ret = GEOFENCE_CLIENT_ERROR_DBUS_CALL;
233 EXPORT_API int geo_client_add_place(geofence_client_dbus_h geofence_client, gchar *app_id, const gchar *place_name)
235 /* add fence interface between App & geofence-server */
236 GEOFENCE_CLIENT_LOGD("ENTER >>>");
237 g_return_val_if_fail(geofence_client, GEOFENCE_CLIENT_ERROR_PARAMETER);
239 geofence_client_dbus_s *handle = (geofence_client_dbus_s *)geofence_client;
240 GVariant *reg = NULL;
241 GError *error = NULL;
242 GDBusProxy *proxy = NULL;
245 GEOFENCE_CLIENT_LOGI("APP ID: %s", app_id);
247 proxy = g_dbus_proxy_new_sync(handle->conn, G_DBUS_PROXY_FLAGS_NONE, NULL, handle->service_name, handle->signal_path, GEOFENCE_INTERFACE_NAME, NULL, &error);
249 GEOFENCE_CLIENT_LOGD("proxy: %p", proxy);
250 reg = g_dbus_proxy_call_sync(proxy, "AddPlace", g_variant_new("(ss)", app_id, place_name), G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
252 g_variant_get(reg, "(i)", &place_id);
253 g_variant_unref(reg);
257 GEOFENCE_CLIENT_LOGE("Fail to add place Error[%s]", error->message);
261 g_object_unref(proxy);
264 GEOFENCE_CLIENT_LOGE("Fail to get proxy Error[%s]", error->message);
269 GEOFENCE_CLIENT_LOGD("place_id: %d", place_id);
274 EXPORT_API int geo_client_update_place(geofence_client_dbus_h geofence_client, gchar *app_id, gint place_id, const gchar *place_name)
276 GEOFENCE_CLIENT_LOGD("ENTER >>>");
277 g_return_val_if_fail(geofence_client, GEOFENCE_CLIENT_ERROR_PARAMETER);
279 geofence_client_dbus_s *handle = (geofence_client_dbus_s *)geofence_client;
280 GError *error = NULL;
281 GDBusProxy *proxy = NULL;
282 int ret = GEOFENCE_CLIENT_ERROR_NONE;
284 proxy = g_dbus_proxy_new_sync(handle->conn, G_DBUS_PROXY_FLAGS_NONE, NULL, handle->service_name, handle->signal_path, GEOFENCE_INTERFACE_NAME, NULL, &error);
286 g_dbus_proxy_call(proxy, "UpdatePlace", g_variant_new("(iss)", place_id, app_id, place_name), G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, &error);
289 GEOFENCE_CLIENT_LOGE("Fail to get proxy Error[%s]", error->message);
291 ret = GEOFENCE_CLIENT_ERROR_DBUS_CALL;
298 EXPORT_API int geo_client_delete_place(geofence_client_dbus_h geofence_client, gchar *app_id, gint place_id)
300 GEOFENCE_CLIENT_LOGD("ENTER >>>");
301 g_return_val_if_fail(geofence_client, GEOFENCE_CLIENT_ERROR_PARAMETER);
303 geofence_client_dbus_s *handle = (geofence_client_dbus_s *)geofence_client;
304 GError *error = NULL;
305 GDBusProxy *proxy = NULL;
306 int ret = GEOFENCE_CLIENT_ERROR_NONE;
308 proxy = g_dbus_proxy_new_sync(handle->conn, G_DBUS_PROXY_FLAGS_NONE, NULL, handle->service_name, handle->signal_path, GEOFENCE_INTERFACE_NAME, NULL, &error);
310 g_dbus_proxy_call(proxy, "DeletePlace", g_variant_new("(is)", place_id, app_id), G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, &error);
313 GEOFENCE_CLIENT_LOGE("Fail to get proxy Error[%s]", error->message);
315 ret = GEOFENCE_CLIENT_ERROR_DBUS_CALL;
322 EXPORT_API int geo_client_get_place_name(geofence_client_dbus_h geofence_client, gchar *app_id, gint place_id, gchar **place_name, gint *error_code)
324 GEOFENCE_CLIENT_LOGD("ENTER >>>");
325 g_return_val_if_fail(geofence_client, GEOFENCE_CLIENT_ERROR_PARAMETER);
327 geofence_client_dbus_s *handle = (geofence_client_dbus_s *)geofence_client;
328 GVariant *reg = NULL;
329 GError *error = NULL;
330 GDBusProxy *proxy = NULL;
331 int ret = GEOFENCE_CLIENT_ERROR_NONE;
332 char *new_place_name = NULL;
333 int new_error_code = 0;
335 proxy = g_dbus_proxy_new_sync(handle->conn, G_DBUS_PROXY_FLAGS_NONE, NULL, handle->service_name, handle->signal_path, GEOFENCE_INTERFACE_NAME, NULL, &error);
337 reg = g_dbus_proxy_call_sync(proxy, "GetPlaceName", g_variant_new("(is)", place_id, app_id), G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
339 g_variant_get(reg, "(is)", &new_error_code, &new_place_name);
340 *error_code = new_error_code;
341 *place_name = g_strdup(new_place_name);
342 g_free(new_place_name);
343 g_variant_unref(reg);
346 GEOFENCE_CLIENT_LOGE("Fail to get the place name Error[%s]", error->message);
348 ret = GEOFENCE_CLIENT_ERROR_DBUS_CALL;
351 g_object_unref(proxy);
354 GEOFENCE_CLIENT_LOGE("Fail to get proxy Error[%s]", error->message);
356 ret = GEOFENCE_CLIENT_ERROR_DBUS_CALL;
363 EXPORT_API int geo_client_get_places(geofence_client_dbus_h geofence_client, gchar *app_id, GVariantIter **iter, gint *place_cnt, gint *error_code)
365 GEOFENCE_CLIENT_LOGD("ENTER >>>");
366 g_return_val_if_fail(geofence_client, GEOFENCE_CLIENT_ERROR_PARAMETER);
368 geofence_client_dbus_s *handle = (geofence_client_dbus_s *)geofence_client;
369 GVariant *reg = NULL;
370 GError *error = NULL;
371 GDBusProxy *proxy = NULL;
373 int ret = GEOFENCE_CLIENT_ERROR_NONE;
374 GVariantIter *iterator;
375 int new_error_code = 0;
376 int new_place_cnt = 0;
378 GEOFENCE_CLIENT_LOGD("handle->conn: %p", handle->conn);
379 GEOFENCE_CLIENT_LOGI("APP ID: %s", app_id);
381 proxy = g_dbus_proxy_new_sync(handle->conn, G_DBUS_PROXY_FLAGS_NONE, NULL, handle->service_name, handle->signal_path, GEOFENCE_INTERFACE_NAME, NULL, &error);
383 reg = g_dbus_proxy_call_sync(proxy, "GetPlaces", g_variant_new("(s)", app_id), G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
385 g_variant_get(reg, "(iiaa{sv})", &new_place_cnt, &new_error_code, &iterator);
386 *place_cnt = new_place_cnt;
387 *error_code = new_error_code;
388 if (iterator == NULL)
389 GEOFENCE_CLIENT_LOGE("Iterator is null");
391 g_variant_unref(reg);
394 GEOFENCE_CLIENT_LOGE("Fail to get the place list Error[%s]", error->message);
396 ret = GEOFENCE_CLIENT_ERROR_DBUS_CALL;
399 g_object_unref(proxy);
402 GEOFENCE_CLIENT_LOGE("Fail to get proxy Error[%s]", error->message);
404 ret = GEOFENCE_CLIENT_ERROR_DBUS_CALL;
411 EXPORT_API int geo_client_start(geofence_client_dbus_h geofence_client, geofence_client_cb callback, void *user_data)
413 GEOFENCE_CLIENT_LOGD("ENTER >>>");
414 g_return_val_if_fail(geofence_client, GEOFENCE_CLIENT_ERROR_PARAMETER);
416 geofence_client_dbus_s *handle = (geofence_client_dbus_s *)geofence_client;
417 gchar *signal_path = NULL;
419 handle->service_name = g_strdup(GEOFENCE_SERVICE_NAME);
420 handle->service_path = g_strdup(GEOFENCE_SERVICE_PATH);
421 handle->signal_path = g_strdup_printf("%s/%s", handle->service_path, "SAMSUNG");
422 GEOFENCE_CLIENT_LOGD("Object Path [%s]", handle->signal_path);
425 handle->user_cb = callback;
426 handle->user_data = user_data;
427 handle->geofence_evt_id = g_dbus_connection_signal_subscribe(handle->conn, handle->service_name, GEOFENCE_INTERFACE_NAME, "GeofenceInout", handle->signal_path, NULL, G_DBUS_SIGNAL_FLAGS_NONE, __geofence_signal_callback, handle, NULL);
429 if (handle->geofence_evt_id) {
430 GEOFENCE_CLIENT_LOGD("Listening GeofenceInout");
432 GEOFENCE_CLIENT_LOGD("Fail to listen GeofenceInout");
435 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);
437 if (handle->geofence_evt_status_id) {
438 GEOFENCE_CLIENT_LOGD("Listening Geofence event");
440 GEOFENCE_CLIENT_LOGD("Fail to listen Geofence event");
441 return GEOFENCE_CLIENT_ERROR_DBUS_CALL;
447 #if SUPPORT_MULTI_CLIENT
448 GVariant *param = NULL;
449 GVariantBuilder *builder = NULL;
452 GEOFENCE_CLIENT_LOGD("START: CMD-START");
453 builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
454 g_variant_builder_add(builder, "{sv}", "CMD", g_variant_new_string("START"));
456 param = g_variant_ref_sink(g_variant_new("(@a{sv})", g_variant_builder_end(builder)));
458 g_variant_unref(param);
461 return GEOFENCE_CLIENT_ERROR_NONE;
464 static void __geo_client_signal_unsubcribe(geofence_client_dbus_h geofence_client)
466 GEOFENCE_CLIENT_LOGD("ENTER >>>");
468 geofence_client_dbus_s *handle = (geofence_client_dbus_s *)geofence_client;
469 if (handle == NULL) {
470 GEOFENCE_CLIENT_LOGE("Invalid handle");
473 if (handle->conn == NULL) {
474 GEOFENCE_CLIENT_LOGE("Invalid dbus_connection");
477 if (handle->geofence_evt_id) {
478 g_dbus_connection_signal_unsubscribe(handle->conn, handle->geofence_evt_id);
479 handle->geofence_evt_id = 0;
481 if (handle->geofence_evt_status_id) {
482 g_dbus_connection_signal_unsubscribe(handle->conn, handle->geofence_evt_status_id);
483 handle->geofence_evt_status_id = 0;
487 EXPORT_API int geo_client_stop(geofence_client_dbus_h geofence_client)
489 GEOFENCE_CLIENT_LOGD("ENTER >>>");
491 geofence_client_dbus_s *handle = (geofence_client_dbus_s *)geofence_client;;
492 g_return_val_if_fail(handle, GEOFENCE_CLIENT_ERROR_PARAMETER);
494 __geo_client_signal_unsubcribe(handle);
496 #if SUPPORT_MULTI_CLIENT
497 GVariant *param = NULL;
498 GVariantBuilder *builder = NULL;
501 GEOFENCE_CLIENT_LOGD("STOP: CMD-STOP");
502 builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
503 g_variant_builder_add(builder, "{sv}", "CMD", g_variant_new_string("STOP"));
504 param = g_variant_ref_sink(g_variant_new("(@a{sv})", g_variant_builder_end(builder)));
506 g_variant_unref(param);
510 return GEOFENCE_CLIENT_ERROR_NONE;
513 static int __geofence_client_create_connection(geofence_client_dbus_s *client)
515 GEOFENCE_CLIENT_LOGD("ENTER >>>");
517 g_return_val_if_fail(client, GEOFENCE_CLIENT_ERROR_PARAMETER);
518 GError *error = NULL;
521 client->conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
524 char *bus_addr = NULL;
525 bus_addr = g_dbus_address_get_for_bus_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
527 GEOFENCE_CLIENT_LOGD("Fail to get addr of bus.");
528 return GEOFENCE_CLIENT_ERROR_CONNECTION;
531 GEOFENCE_CLIENT_LOGD("bus_addr: %s", bus_addr);
533 client->conn = g_dbus_connection_new_for_address_sync(bus_addr,
534 G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT |
535 G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION,
540 if (error && error->message) {
541 GEOFENCE_CLIENT_LOGD("Fail to get GBus. ErrCode[%d], Msg[%s]", error->code, error->message);
545 return GEOFENCE_CLIENT_ERROR_CONNECTION;
547 GEOFENCE_CLIENT_LOGD("client->conn: %p", client->conn);
549 return GEOFENCE_CLIENT_ERROR_NONE;
552 static void __glib_log(const gchar *log_domain, GLogLevelFlags log_level, const gchar *msg, gpointer user_data)
554 geofence_client_dbus_s *client = (geofence_client_dbus_s *)user_data;
555 if (client != NULL) {
556 GEOFENCE_CLIENT_LOGD("client->conn: %p", client->conn);
558 GEOFENCE_CLIENT_LOGE("GLIB[%d]: %s", log_level, msg);
561 /* The reason why we seperate this from start is to support IPC for db operation between a server and a client.*/
562 EXPORT_API int geo_client_create(geofence_client_dbus_h *geofence_client)
564 GEOFENCE_CLIENT_LOGD("ENTER >>>");
566 int ret = GEOFENCE_CLIENT_ERROR_NONE;
567 geofence_client_dbus_s *client = g_new0(geofence_client_dbus_s, 1);
568 g_return_val_if_fail(client, GEOFENCE_CLIENT_ERROR_MEMORY);
569 g_log_set_default_handler(__glib_log, client);
571 ret = __geofence_client_create_connection(client);
572 if (ret != GEOFENCE_CLIENT_ERROR_NONE) {
576 *geofence_client = (geofence_client_dbus_s *) client;
578 return GEOFENCE_CLIENT_ERROR_NONE;
581 EXPORT_API int geo_client_destroy(geofence_client_dbus_h geofence_client)
583 GEOFENCE_CLIENT_LOGD("ENTER >>>");
584 g_return_val_if_fail(geofence_client, GEOFENCE_CLIENT_ERROR_PARAMETER);
586 geofence_client_dbus_s *handle = (geofence_client_dbus_s *)geofence_client;
589 g_object_unref(handle->conn);
592 g_free(handle->service_path);
593 g_free(handle->service_name);
594 g_free(handle->signal_path);
597 return GEOFENCE_CLIENT_ERROR_NONE;