summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjomui <jongmun.woo@samsung.com>2017-08-24 10:38:40 +0900
committerjomui <jongmun.woo@samsung.com>2017-08-24 10:39:05 +0900
commit77932b75db99ba9eac9555db2f4b041b5d5b1a28 (patch)
tree935b4b7dec86cf63355b8e972c6521084d4da7d9
parentdcb6c8caf7b31c3fbc307ed937818cb22d74fc4e (diff)
downloadgeofence-server-77932b75db99ba9eac9555db2f4b041b5d5b1a28.tar.gz
geofence-server-77932b75db99ba9eac9555db2f4b041b5d5b1a28.tar.bz2
geofence-server-77932b75db99ba9eac9555db2f4b041b5d5b1a28.zip
Signed-off-by: jomui <jongmun.woo@samsung.com> Change-Id: Ic4a77b7092b97e49e288fd8a2058213892e51a55
-rw-r--r--AUTHORS3
-rw-r--r--geofence-server/CMakeLists.txt2
-rw-r--r--geofence-server/src/geofence_server.c42
-rw-r--r--geofence-server/src/geofence_server_bluetooth.c4
-rw-r--r--geofence-server/src/geofence_server_wifi.c6
-rw-r--r--packaging/geofence-server.spec2
6 files changed, 29 insertions, 30 deletions
diff --git a/AUTHORS b/AUTHORS
index ce0e4ee..3d8b966 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,5 +1,6 @@
Jongmun Woo <jongmun.woo@samsung.com>
-Young-Ae Kang <youngae.kang@samsung.com>
Kyoungjun Sung <kj7.sung@samsung.com>
+Seechan Kim <cbible.kim@samsung.com>
+Young-Ae Kang <youngae.kang@samsung.com>
Karthik Paulraj <p.karthik@samsung.com>
VENKATAKOTIVIJAYALAKSHMINARAYA <lnarayana.k@samsung.com>
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 339d41b..fc039c0 100644
--- a/geofence-server/src/geofence_server.c
+++ b/geofence-server/src/geofence_server.c
@@ -20,7 +20,6 @@
#include <glib.h>
#include <glib-object.h>
#include <geofence_client.h>
-#include <dd-display.h>
#include <vconf.h>
#include <vconf-internal-wifi-keys.h>
#include <vconf-internal-dnet-keys.h>
@@ -304,7 +303,7 @@ static int __emit_fence_inout(GeofenceServer *geofence_server, int fence_id, geo
if (state == GEOFENCE_FENCE_STATE_IN) {
/*LOGD_GEOFENCE("FENCE_IN to be set, current state: %d", item_data->common_info.status);*/
if (item_data->common_info.status != GEOFENCE_FENCE_STATE_IN) {
- geofence_dbus_server_send_geofence_inout_changed(geofence_server->geofence_dbus_server, item_data->common_info.appid, fence_id, item_data->common_info.access_type, GEOFENCE_EMIT_STATE_IN);
+ geofence_dbus_server_send_geofence_inout_changed(geofence_server->geofence_dbus_server, item_data->common_info.appid, fence_id, item_data->common_info.access_type, GEOFENCE_EMIT_STATE_IN);
if (item_data->client_status == GEOFENCE_CLIENT_STATUS_START)
item_data->client_status = GEOFENCE_CLIENT_STATUS_RUNNING;
@@ -404,7 +403,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);
@@ -1114,7 +1113,6 @@ static int __gps_alarm_cb(alarm_id_t alarm_id, void *user_data)
if (geofence_server->gps_alarm_id != -1) {
/*LOGI_GEOFENCE("GPS interval timer removed. ID[%d]", geofence_server->gps_alarm_id);*/
geofence_server->gps_alarm_id = _geofence_remove_alarm(geofence_server->gps_alarm_id);
- geofence_server->gps_alarm_id = -1;
}
if (geofence_server->loc_gps_started_by_wps == true) {
ret = __start_gps_positioning(geofence_server, __geofence_gps_position_changed_cb);
@@ -1142,7 +1140,6 @@ static int __wps_timeout_cb(alarm_id_t alarm_id, void *user_data)
/*Stop the wps for sometime when there is no fix*/
__stop_wps_positioning(geofence_server);
geofence_server->wps_alarm_id = _geofence_add_alarm(10, __wps_alarm_cb, geofence_server);
- /*display_unlock_state(LCD_OFF, PM_RESET_TIMER);*/
return 0;
}
@@ -1281,7 +1278,7 @@ static void __free_geofence_list(gpointer userdata)
static int __check_fence_permission(int fence_id, const char *app_id)
{
access_type_e access_type = ACCESS_TYPE_PUBLIC;
- char *appid;
+ char *appid = NULL;
int ret = FENCE_ERR_NONE;
ret = geofence_manager_get_access_type(fence_id, -1, &access_type);
if (ret != FENCE_ERR_NONE) {
@@ -1295,17 +1292,19 @@ static int __check_fence_permission(int fence_id, const char *app_id)
return -1;
}
if (g_strcmp0(appid, app_id)) {
- LOGE("Not authorized to access this private fence[%d]", fence_id);
+ LOGE("Not authorized to access this private fence[%d]", fence_id);
+ g_free(appid);
return 0;
}
}
+ g_free(appid);
return 1;
}
static int __check_place_permission(int place_id, const char *app_id)
{
access_type_e access_type = ACCESS_TYPE_PUBLIC;
- char *appid;
+ char *appid = NULL;
int ret = FENCE_ERR_NONE;
ret = geofence_manager_get_access_type(-1, place_id, &access_type);
if (ret != FENCE_ERR_NONE) {
@@ -1319,10 +1318,12 @@ static int __check_place_permission(int place_id, const char *app_id)
return -1;
}
if (g_strcmp0(appid, app_id)) {
- LOGE("Not authorized to access this private place[%d]", place_id);
+ LOGE("Not authorized to access this private place[%d]", place_id);
+ g_free(appid);
return 0;
}
}
+ g_free(appid);
return 1;
}
@@ -1572,7 +1573,7 @@ static int dbus_add_fence_cb(const gchar *app_id,
g_strlcpy(geocoordinate_info->address, address, ADDRESS_LEN);
/*Geopoint information is saved in the DB*/
- ret = geofence_manager_set_geocoordinate_info(fence_id, geocoordinate_info);
+ ret = geofence_manager_set_geocoordinate_info(fence_id, geocoordinate_info);
if (ret != FENCE_ERR_NONE) {
LOGI_GEOFENCE("Fail to set geocoordinate_info");
ret = geofence_manager_delete_fence_info(fence_id);
@@ -1796,7 +1797,7 @@ static void dbus_remove_fence_cb(gint fence_id, const gchar *app_id, gpointer us
g_return_if_fail(geofence_server);
int ret = FENCE_ERR_NONE;
int place_id = -1;
- char *app_id_db;
+ char *app_id_db = NULL;
access_type_e access_type = ACCESS_TYPE_UNKNOWN;
/*//////////Required to be sent in the event callback////////////////--*/
@@ -2152,7 +2153,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*/
@@ -2160,7 +2161,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) {
@@ -2456,20 +2457,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);
- if (place_info)
- 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);
}
- if (place_info)
- 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");
@@ -2716,10 +2715,9 @@ int __copy_geofence_to_item_data(int fence_id, GeofenceItemData *item_data)
if (FENCE_ERR_NONE != geofence_manager_get_enable_status(fence_id, &item_data->common_info.enable))
return FENCE_ERR_SQLITE_FAIL;
- if (FENCE_ERR_NONE != geofence_manager_get_appid_from_geofence(fence_id, &app_id)) {
- g_free(app_id);
+ if (FENCE_ERR_NONE != geofence_manager_get_appid_from_geofence(fence_id, &app_id))
return FENCE_ERR_SQLITE_FAIL;
- } else {
+ else {
g_strlcpy(item_data->common_info.appid, app_id, APP_ID_LEN);
g_free(app_id);
}
@@ -2779,6 +2777,10 @@ static void __add_left_fences(gpointer user_data)
* } */
GeofenceItemData *item_data = (GeofenceItemData *)g_malloc0(sizeof(GeofenceItemData));
+ if (item_data == NULL) {
+ LOGI_GEOFENCE("Unable to add the fence because of malloc fail");
+ return;
+ }
if (FENCE_ERR_NONE != __copy_geofence_to_item_data(fence_id, item_data)) {
g_free(item_data);
return;
diff --git a/geofence-server/src/geofence_server_bluetooth.c b/geofence-server/src/geofence_server_bluetooth.c
index ccb689a..30dbf51 100644
--- a/geofence-server/src/geofence_server_bluetooth.c
+++ b/geofence-server/src/geofence_server_bluetooth.c
@@ -107,9 +107,7 @@ static void emit_bt_geofence_proximity_changed(GeofenceServer *geofence_server,
}
item_data->common_info.proximity_status = fence_proximity_status;
}
-
- if (app_id)
- free(app_id);
+ g_free(app_id);
}
diff --git a/geofence-server/src/geofence_server_wifi.c b/geofence-server/src/geofence_server_wifi.c
index 13fc92f..eea14bc 100644
--- a/geofence-server/src/geofence_server_wifi.c
+++ b/geofence-server/src/geofence_server_wifi.c
@@ -54,8 +54,7 @@ static void emit_wifi_geofence_inout_changed(GeofenceServer *geofence_server, in
item_data->common_info.status = GEOFENCE_FENCE_STATE_OUT;
}
}
- if (app_id)
- free(app_id);
+ g_free(app_id);
}
static bool __check_for_match(char *str1, char *str2)
@@ -132,8 +131,7 @@ static void emit_wifi_geofence_proximity_changed(GeofenceServer *geofence_server
}
item_data->common_info.proximity_status = fence_proximity_status;
}
- if (app_id)
- free(app_id);
+ g_free(app_id);
}
void wifi_rssi_level_changed(wifi_rssi_level_e rssi_level, void *user_data)
diff --git a/packaging/geofence-server.spec b/packaging/geofence-server.spec
index d51348d..33a4a22 100644
--- a/packaging/geofence-server.spec
+++ b/packaging/geofence-server.spec
@@ -1,6 +1,6 @@
Name: geofence-server
Summary: Geofence Server for Tizen
-Version: 0.4.6
+Version: 0.4.7
Release: 1
Group: Location/Service
License: Apache-2.0