From 7f9fda3707c5d5f49a8d89541b251b7b0ad747bd Mon Sep 17 00:00:00 2001 From: jomui Date: Mon, 24 Jul 2017 13:54:43 +0900 Subject: [PATCH] fix for no AppId Signed-off-by: jomui Change-Id: I5edafd2e2e8a4f9d7c4d36eb24227c6f1a284801 --- geofence-server/CMakeLists.txt | 2 +- geofence-server/src/geofence_server.c | 10 +++++----- module/module_geofence_server.c | 3 ++- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/geofence-server/CMakeLists.txt b/geofence-server/CMakeLists.txt index 6d66d70..9f3786d 100644 --- a/geofence-server/CMakeLists.txt +++ b/geofence-server/CMakeLists.txt @@ -1,5 +1,5 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.0) -PROJECT(geofence-server) +PROJECT(geofence-server) SET(server_pkgs_LDFLAGS "${server_pkgs_LDFLAGS} -ldl") SET(SERVER_EXTRA_CFLAGS "${SERVER_EXTRA_CFLAGS} -D_GNU_SOURCE") diff --git a/geofence-server/src/geofence_server.c b/geofence-server/src/geofence_server.c index 2d17c64..2ecba0a 100644 --- a/geofence-server/src/geofence_server.c +++ b/geofence-server/src/geofence_server.c @@ -412,7 +412,7 @@ static void __check_inout_by_gps(double latitude, double longitude, int fence_id geofence_fence_state_e status = GEOFENCE_FENCE_STATE_OUT; geocoordinate_info_s *geocoordinate_info = (geocoordinate_info_s *)item_data->priv; /* get_current_position/ check_fence_in/out for geoPoint */ - location_manager_get_distance(latitude, longitude, geocoordinate_info->latitude, geocoordinate_info->longitude, &distance); + location_manager_get_distance(latitude, longitude, geocoordinate_info->latitude, geocoordinate_info->longitude, &distance); if (distance >= geocoordinate_info->radius) { LOGD_GEOFENCE("FENCE_OUT : based on distance. Distance[%f] for fence id: %d at (%f, %f)", distance, fence_id, latitude, longitude); @@ -2164,7 +2164,7 @@ static void dbus_start_geofence_cb(gint fence_id, const gchar *app_id, gpointer } else if (adapter_state == BT_ADAPTER_ENABLED) { bt_device_info_s *bt_device_info = NULL; if (bt_info != NULL) { - ret = bt_adapter_get_bonded_device_info(bt_info->bssid, &bt_device_info); + ret = bt_adapter_get_bonded_device_info(bt_info->bssid, &bt_device_info); if (ret != BT_ERROR_NONE) { LOGE_GEOFENCE("Fail to get the bonded device info/ Not bonded with any device. Error[%d]", ret); /*NEED TO BE DECIDED WHETHER TO REQUEST FOR A SCAN HERE OR JUST EMIT OUT AS STATUS*/ @@ -2172,7 +2172,7 @@ static void dbus_start_geofence_cb(gint fence_id, const gchar *app_id, gpointer status_to_be_emitted = GEOFENCE_FENCE_STATE_OUT; } else { if (bt_device_info == NULL) { - LOGI_GEOFENCE("bt_adapter_get_bonded_device_info [%s] failed.", bt_info->bssid); + LOGI_GEOFENCE("bt_adapter_get_bonded_device_info [%s] failed.", bt_info->bssid); status_to_be_emitted = GEOFENCE_FENCE_STATE_OUT; } else { if (bt_device_info->is_bonded == TRUE && bt_device_info->is_connected == TRUE) { @@ -2468,18 +2468,18 @@ static GVariant *dbus_get_geofences_cb(int place_id, const gchar *app_id, int *f if ((place_info != NULL) && (place_info->access_type == ACCESS_TYPE_PRIVATE)) { if (g_strcmp0(app_id, place_info->appid) != 0) { LOGI_GEOFENCE("Not authorized to access this private place[%d]", place_id); - g_free(place_info); /* Send ZERO data gvariant*/ *errorCode = GEOFENCE_SERVER_ERROR_PLACE_ACCESS_DENIED; *fenceCnt = fence_cnt; g_variant_builder_init(&b, G_VARIANT_TYPE("aa{sv}")); + g_free(place_info); return g_variant_builder_end(&b); } - g_free(place_info); } ret = geofence_manager_get_fence_list_from_db(&count, &fence_list, place_id); } LOGI_GEOFENCE("count = %d", count); + g_free(place_info); if (ret != FENCE_ERR_NONE) { LOGI_GEOFENCE("get list failed"); diff --git a/module/module_geofence_server.c b/module/module_geofence_server.c index 0a1cc92..ff80d10 100644 --- a/module/module_geofence_server.c +++ b/module/module_geofence_server.c @@ -491,7 +491,8 @@ static void __get_caller_app_id(void *handle) pid = getpid(); ret = app_manager_get_app_id(pid, &app_id); if (ret != APP_MANAGER_ERROR_NONE) { - MOD_LOGE("Fail to get app_id from module_geofence_server. Err[%d]", ret); + MOD_LOGE("No app_id. Set app_id to RequestbyFramework"); + geofence_manager->app_id = g_strdup("RequestbyFramework"); } else { MOD_LOGD("app_id: %s", app_id); geofence_manager->app_id = app_id; -- 2.7.4