From 496fcbf643550ce1b73fa2bf0553acb372f8822a Mon Sep 17 00:00:00 2001 From: Jinkun Jang Date: Sat, 16 Mar 2013 01:14:46 +0900 Subject: [PATCH] merge with master --- configure.ac | 1 + location/manager/Makefile.am | 6 ++--- location/manager/location-accuracy.c | 16 ++++++----- location/manager/location-boundary.c | 1 - location/manager/location-common-util.c | 4 --- location/manager/location-cps.c | 48 +++++++++++---------------------- location/manager/location-gps.c | 47 +++++++++++--------------------- location/manager/location-gps.h | 1 - location/manager/location-hybrid.c | 35 +++++++++++------------- location/manager/location-setting.c | 10 +++---- location/manager/location-setting.h | 12 +++------ location/manager/location-wps.c | 28 ++++++------------- location/manager/location.c | 15 +++++------ packaging/libslp-location.spec | 10 ++----- tests/location-api-test.c | 2 -- tests/map-service-test.c | 0 16 files changed, 82 insertions(+), 154 deletions(-) mode change 100755 => 100644 tests/map-service-test.c diff --git a/configure.ac b/configure.ac index 06e7dfd..3189dae 100755 --- a/configure.ac +++ b/configure.ac @@ -8,6 +8,7 @@ AC_CONFIG_SRCDIR([location]) AM_INIT_AUTOMAKE([1.10.2 foreign -Wall -Werror]) # Check programs for making executable +m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) AC_PROG_CC AM_PROG_CC_C_O AC_PROG_INSTALL diff --git a/location/manager/Makefile.am b/location/manager/Makefile.am index cce6736..9f8687a 100644 --- a/location/manager/Makefile.am +++ b/location/manager/Makefile.am @@ -17,9 +17,9 @@ liblocation_manager_la_SOURCES = \ location-satellite.c \ location-signaling-util.c \ location-common-util.c \ - location-gps.c \ - location-wps.c \ - location-cps.c \ + location-gps.c \ + location-wps.c \ + location-cps.c \ location-hybrid.c liblocation_manager_la_CFLAGS = \ diff --git a/location/manager/location-accuracy.c b/location/manager/location-accuracy.c index ea70b82..8d04950 100644 --- a/location/manager/location-accuracy.c +++ b/location/manager/location-accuracy.c @@ -61,17 +61,19 @@ location_accuracy_free (LocationAccuracy* accuracy) } static int -comp_int(int a, int b){ +comp_int(int a, int b) +{ if (a < b) return -1; if (a == b) return 0; return 1; } static int -comp_double_reverse(double a, double b) { - if (a > b) return -1; - else if (a == b) return 0; - return 1; +comp_double_reverse(double a, double b) +{ + if (a > b) return -1; + else if (a == b) return 0; + return 1; } int @@ -100,6 +102,6 @@ location_accuracy_copy (const LocationAccuracy *accuracy) { g_return_val_if_fail(accuracy, NULL); return location_accuracy_new(accuracy->level, - accuracy->horizontal_accuracy, - accuracy->vertical_accuracy); + accuracy->horizontal_accuracy, + accuracy->vertical_accuracy); } diff --git a/location/manager/location-boundary.c b/location/manager/location-boundary.c index 78ca1d3..8e7667f 100644 --- a/location/manager/location-boundary.c +++ b/location/manager/location-boundary.c @@ -100,7 +100,6 @@ static void _free_polygon_position(gpointer data) location_position_free(position); } - EXPORT_API LocationBoundary * location_boundary_new_for_rect (LocationPosition* left_top, LocationPosition* right_bottom) diff --git a/location/manager/location-common-util.c b/location/manager/location-common-util.c index 8bf7e67..36b723a 100644 --- a/location/manager/location-common-util.c +++ b/location/manager/location-common-util.c @@ -33,7 +33,6 @@ #include "location-setting.h" #include "location-log.h" - int location_application_get_authority (void) { pid_t pid = getpid(); @@ -297,7 +296,6 @@ int set_prop_boundary(GList **prev_boundary_priv_list, GList *new_boundary_priv_ return LOCATION_ERROR_NONE; } - int set_prop_removal_boundary(GList **prev_boundary_list, LocationBoundary* boundary) { g_return_val_if_fail(*prev_boundary_list, LOCATION_ERROR_PARAMETER); @@ -311,7 +309,6 @@ int set_prop_removal_boundary(GList **prev_boundary_list, LocationBoundary* boun if (check_list) { LOCATION_LOGD("Found"); *prev_boundary_list = g_list_delete_link(*prev_boundary_list, check_list); - g_slice_free(LocationBoundaryPrivate, remove_priv); } if (g_list_length(*prev_boundary_list) == 0 ) { @@ -331,4 +328,3 @@ void free_boundary_list (gpointer data) location_boundary_free(priv->boundary); g_slice_free(LocationBoundaryPrivate, priv); } - diff --git a/location/manager/location-cps.c b/location/manager/location-cps.c index 8595d5f..109ea61 100644 --- a/location/manager/location-cps.c +++ b/location/manager/location-cps.c @@ -64,14 +64,13 @@ enum { static guint32 signals[LAST_SIGNAL] = {0, }; static GParamSpec *properties[PROP_MAX] = {NULL, }; - #define GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), LOCATION_TYPE_CPS, LocationCpsPrivate)) static void location_ielement_interface_init (LocationIElementInterface *iface); G_DEFINE_TYPE_WITH_CODE (LocationCps, location_cps, G_TYPE_OBJECT, - G_IMPLEMENT_INTERFACE (LOCATION_TYPE_IELEMENT, - location_ielement_interface_init)); + G_IMPLEMENT_INTERFACE (LOCATION_TYPE_IELEMENT, + location_ielement_interface_init)); static gboolean _position_timeout_cb (gpointer data) @@ -85,15 +84,13 @@ _position_timeout_cb (gpointer data) if (priv->pos) { pos = location_position_copy(priv->pos); - } - else { + } else { pos = location_position_new (0, 0.0, 0.0, 0.0, LOCATION_STATUS_NO_FIX); } if (priv->acc) { acc = location_accuracy_copy (priv->acc); - } - else { + } else { acc = location_accuracy_new (LOCATION_ACCURACY_LEVEL_NONE, 0.0, 0.0); } @@ -118,15 +115,13 @@ _velocity_timeout_cb (gpointer data) if (priv->vel) { vel = location_velocity_copy(priv->vel); - } - else { + } else { vel = location_velocity_new (0, 0.0, 0.0, 0.0); } if (priv->acc) { acc = location_accuracy_copy (priv->acc); - } - else { + } else { acc = location_accuracy_new (LOCATION_ACCURACY_LEVEL_NONE, 0.0, 0.0); } @@ -228,8 +223,7 @@ location_setting_cps_cb (keynode_t *key, __reset_pos_data_from_priv(priv); } } - } - else { + } else { if (1 == location_setting_get_int (VCONFKEY_LOCATION_NETWORK_ENABLED) && priv->mod->ops.start && !priv->is_started) { LOCATION_LOGD("location resumed by setting"); ret = priv->mod->ops.start (priv->mod->handler, cps_status_cb, cps_position_ext_cb, NULL, self); @@ -308,7 +302,7 @@ location_cps_set_property (GObject *object, switch (property_id) { case PROP_BOUNDARY:{ GList *boundary_list = (GList *)g_list_copy(g_value_get_pointer(value)); - ret = set_prop_boundary(&priv->boundary_list, boundary_list); + ret = set_prop_boundary(&priv->boundary_list, boundary_list); if(ret != 0) LOCATION_LOGD("Set boundary. Error[%d]", ret); break; } @@ -326,8 +320,7 @@ location_cps_set_property (GObject *object, priv->pos_interval = interval; else priv->pos_interval = (guint) LOCATION_UPDATE_INTERVAL_MAX; - } - else { + } else { priv->pos_interval = (guint) LOCATION_UPDATE_INTERVAL_DEFAULT; } @@ -346,8 +339,7 @@ location_cps_set_property (GObject *object, priv->vel_interval = interval; else priv->vel_interval = (guint)LOCATION_UPDATE_INTERVAL_MAX; - } - else + } else priv->vel_interval = (guint)LOCATION_UPDATE_INTERVAL_DEFAULT; if (priv->vel_timer) { @@ -400,12 +392,11 @@ location_cps_start (LocationCps *self) if (priv->is_started == TRUE) return LOCATION_ERROR_NONE; - int ret = LOCATION_ERROR_NONE; + int ret = LOCATION_ERROR_NOT_AVAILABLE; if (!location_setting_get_int (VCONFKEY_LOCATION_NETWORK_ENABLED)) { ret = LOCATION_ERROR_SETTING_OFF; - } - else { + } else { ret = priv->mod->ops.start (priv->mod->handler, cps_status_cb, cps_position_ext_cb, NULL, self); if (ret == LOCATION_ERROR_NONE) { priv->is_started = TRUE; @@ -511,7 +502,6 @@ location_cps_get_position_ext (LocationCps *self, return ret; } - static int location_cps_get_last_position (LocationCps *self, LocationPosition **position, @@ -519,12 +509,10 @@ location_cps_get_last_position (LocationCps *self, { LOCATION_LOGD("location_cps_get_last_position"); - /* Do not need to check GPS_ENABLED and NETWORK_ENABLED */ - LocationCpsPrivate *priv = GET_PRIVATE(self); g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE); - LocationError ret = LOCATION_ERROR_NONE; + int ret = LOCATION_ERROR_NONE; LocationVelocity *_velocity = NULL; LocModCpsOps ops = priv->mod->ops; @@ -532,7 +520,7 @@ location_cps_get_last_position (LocationCps *self, g_return_val_if_fail (ops.get_last_position, LOCATION_ERROR_NOT_AVAILABLE); ret = ops.get_last_position (priv->mod->handler, position, &_velocity, accuracy); - if (!_velocity) location_velocity_free (_velocity); + if (_velocity) location_velocity_free(_velocity); return ret; } @@ -543,15 +531,11 @@ location_cps_get_last_position_ext (LocationCps *self, LocationVelocity **velocity, LocationAccuracy **accuracy) { - LOCATION_LOGD("location_cps_get_last_position"); - - /* Do not need to check GPS_ENABLED and NETWORK_ENABLED */ + LOCATION_LOGD("location_cps_get_last_position_ext"); LocationCpsPrivate *priv = GET_PRIVATE(self); g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE); - LocationError ret = LOCATION_ERROR_NONE; - LocModCpsOps ops = priv->mod->ops; g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE); g_return_val_if_fail (ops.get_last_position, LOCATION_ERROR_NOT_AVAILABLE); @@ -559,7 +543,6 @@ location_cps_get_last_position_ext (LocationCps *self, return ops.get_last_position (priv->mod->handler, position, velocity, accuracy); } - static int location_cps_get_velocity (LocationCps *self, LocationVelocity **velocity, @@ -744,5 +727,4 @@ location_cps_class_init (LocationCpsClass *klass) g_object_class_install_properties (gobject_class, PROP_MAX, properties); - } diff --git a/location/manager/location-gps.c b/location/manager/location-gps.c index 25ede96..10eb252 100644 --- a/location/manager/location-gps.c +++ b/location/manager/location-gps.c @@ -96,15 +96,13 @@ _position_timeout_cb (gpointer data) if (priv->pos) { pos = location_position_copy(priv->pos); - } - else { + } else { pos = location_position_new (0, 0.0, 0.0, 0.0, LOCATION_STATUS_NO_FIX); } if (priv->acc) { acc = location_accuracy_copy (priv->acc); - } - else { + } else { acc = location_accuracy_new (LOCATION_ACCURACY_LEVEL_NONE, 0.0, 0.0); } @@ -129,15 +127,13 @@ _velocity_timeout_cb (gpointer data) if (priv->vel) { vel = location_velocity_copy(priv->vel); - } - else { + } else { vel = location_velocity_new (0, 0.0, 0.0, 0.0); } if (priv->acc) { acc = location_accuracy_copy (priv->acc); - } - else { + } else { acc = location_accuracy_new (LOCATION_ACCURACY_LEVEL_NONE, 0.0, 0.0); } @@ -238,8 +234,7 @@ location_setting_search_cb (keynode_t *key, gpointer self) if (location_setting_get_key_val(key) == VCONFKEY_LOCATION_GPS_SEARCHING) { if (!priv->pos_timer) priv->pos_timer = g_timeout_add (priv->pos_interval * 1000, _position_timeout_cb, self); if (!priv->vel_timer) priv->vel_timer = g_timeout_add (priv->vel_interval * 1000, _velocity_timeout_cb, self); - } - else { + } else { if (priv->pos_timer) g_source_remove (priv->pos_timer); if (priv->vel_timer) g_source_remove (priv->vel_timer); priv->pos_timer = 0; @@ -267,8 +262,7 @@ location_setting_gps_cb (keynode_t *key, priv->is_started = FALSE; __reset_pos_data_from_priv(priv); } - } - else if (1 == location_setting_get_key_val(key) && priv->mod->ops.start && !priv->is_started) { + } else if (1 == location_setting_get_key_val(key) && priv->mod->ops.start && !priv->is_started) { LOCATION_LOGD("location resumed by setting"); ret = priv->mod->ops.start (priv->mod->handler, gps_status_cb, gps_position_ext_cb, gps_satellite_cb, self); if (ret == LOCATION_ERROR_NONE) { @@ -292,13 +286,11 @@ location_gps_start (LocationGps *self) if (!location_setting_get_int(VCONFKEY_LOCATION_ENABLED)) { ret = LOCATION_ERROR_SETTING_OFF; - } - else { + } else { ret = priv->mod->ops.start (priv->mod->handler, gps_status_cb, gps_position_ext_cb, gps_satellite_cb, self); if (ret == LOCATION_ERROR_NONE) { priv->is_started = TRUE; - } - else { + } else { return ret; } } @@ -323,12 +315,11 @@ location_gps_stop (LocationGps *self) int ret = LOCATION_ERROR_NONE; - if ( priv->is_started == TRUE) { + if (priv->is_started == TRUE) { ret = priv->mod->ops.stop (priv->mod->handler); if (ret == LOCATION_ERROR_NONE) { priv->is_started = FALSE; - } - else { + } else { LOCATION_LOGD("Failed to stop. Error[%d]", ret); } } @@ -365,7 +356,6 @@ location_gps_dispose (GObject *gobject) location_setting_ignore_notify (VCONFKEY_LOCATION_GPS_STATE, location_setting_search_cb); priv->set_noti = FALSE; } - } static void @@ -625,27 +615,24 @@ location_gps_get_position_ext (LocationGps *self, return ret; } - static int location_gps_get_last_position (LocationGps *self, LocationPosition **position, LocationAccuracy **accuracy) { LOCATION_LOGD("location_gps_get_last_position"); - // Enable to get a last position even though GPS_ENABLE dose not set on LocationGpsPrivate *priv = GET_PRIVATE (self); g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE); - LocationError ret = LOCATION_ERROR_NOT_AVAILABLE; + int ret = LOCATION_ERROR_NONE; LocationVelocity *_velocity = NULL; LocModGpsOps ops = priv->mod->ops; g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE); g_return_val_if_fail (ops.get_last_position, LOCATION_ERROR_NOT_AVAILABLE); ret = ops.get_last_position(priv->mod->handler, position, &_velocity, accuracy); - - if (!_velocity) return LOCATION_ERROR_NOT_AVAILABLE; + if (_velocity) location_velocity_free(_velocity); return ret; } @@ -656,8 +643,7 @@ location_gps_get_last_position_ext (LocationGps *self, LocationVelocity **velocity, LocationAccuracy **accuracy) { - LOCATION_LOGD("location_gps_get_last_position"); - // Enable to get a last position even though GPS_ENABLE dose not set on + LOCATION_LOGD("location_gps_get_last_position_ext"); LocationGpsPrivate *priv = GET_PRIVATE (self); g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE); @@ -666,7 +652,6 @@ location_gps_get_last_position_ext (LocationGps *self, g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE); g_return_val_if_fail (ops.get_last_position, LOCATION_ERROR_NOT_AVAILABLE); return ops.get_last_position(priv->mod->handler, position, velocity, accuracy); - } @@ -710,14 +695,14 @@ location_gps_get_last_velocity (LocationGps *self, g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE); setting_retval_if_fail(VCONFKEY_LOCATION_ENABLED); - LocationError ret = LOCATION_ERROR_NONE; + int ret = LOCATION_ERROR_NONE; LocationPosition *_position = NULL; LocModGpsOps ops = priv->mod->ops; g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE); g_return_val_if_fail (ops.get_last_position, LOCATION_ERROR_NOT_AVAILABLE); ret = ops.get_last_position(priv->mod->handler, &_position, velocity, accuracy); - if (!_position) return LOCATION_ERROR_NOT_AVAILABLE; + if (_position) location_position_free(_position); return ret; } @@ -806,7 +791,6 @@ location_gps_init (LocationGps *self) priv->pos_timer = 0; priv->vel_timer = 0; - } static void @@ -950,5 +934,4 @@ location_gps_class_init (LocationGpsClass *klass) g_object_class_install_properties (gobject_class, PROP_MAX, properties); - } diff --git a/location/manager/location-gps.h b/location/manager/location-gps.h index 1f18268..188e990 100644 --- a/location/manager/location-gps.h +++ b/location/manager/location-gps.h @@ -24,7 +24,6 @@ #include - /** * @file location-gps.h * @brief This file contains the internal definitions and structures related to GPS. diff --git a/location/manager/location-hybrid.c b/location/manager/location-hybrid.c index 096c063..fab9bbd 100644 --- a/location/manager/location-hybrid.c +++ b/location/manager/location-hybrid.c @@ -367,20 +367,18 @@ location_hybrid_start (LocationHybrid *self) { LOCATION_LOGD("location_hybrid_start"); - int ret_gps = LOCATION_ERROR_NONE; - int ret_wps = LOCATION_ERROR_NONE; + int ret_gps = LOCATION_ERROR_NOT_AVAILABLE; + int ret_wps = LOCATION_ERROR_NOT_AVAILABLE; LocationHybridPrivate* priv = GET_PRIVATE(self); if (priv->is_started == TRUE) return LOCATION_ERROR_NONE; - if(priv->gps) ret_gps = location_start(priv->gps); - if(priv->wps) ret_wps = location_start(priv->wps); + if (priv->gps) ret_gps = location_start(priv->gps); + if (priv->wps) ret_wps = location_start(priv->wps); - if (ret_gps != LOCATION_ERROR_NONE && - ret_wps != LOCATION_ERROR_NONE) { - if (ret_gps == LOCATION_ERROR_SECURITY_DENIED || - ret_wps == LOCATION_ERROR_SECURITY_DENIED) { + if (ret_gps != LOCATION_ERROR_NONE && ret_wps != LOCATION_ERROR_NONE) { + if (ret_gps == LOCATION_ERROR_SECURITY_DENIED || ret_wps == LOCATION_ERROR_SECURITY_DENIED) { return LOCATION_ERROR_SECURITY_DENIED; } else if (ret_gps == LOCATION_ERROR_SETTING_OFF && ret_wps == LOCATION_ERROR_SETTING_OFF) { return LOCATION_ERROR_SETTING_OFF; @@ -396,7 +394,6 @@ location_hybrid_start (LocationHybrid *self) priv->set_noti = TRUE; } - return LOCATION_ERROR_NONE; } @@ -406,19 +403,18 @@ location_hybrid_stop (LocationHybrid *self) LOCATION_LOGD("location_hybrid_stop"); LocationHybridPrivate* priv = GET_PRIVATE(self); - if( priv->is_started == FALSE) + if (priv->is_started == FALSE) return LOCATION_ERROR_NONE; - int ret_gps = LOCATION_ERROR_NONE; - int ret_wps = LOCATION_ERROR_NONE; + int ret_gps = LOCATION_ERROR_NOT_AVAILABLE; + int ret_wps = LOCATION_ERROR_NOT_AVAILABLE; - if(priv->gps) ret_gps = location_stop(priv->gps); - if(priv->wps) ret_wps = location_stop(priv->wps); + if (priv->gps) ret_gps = location_stop(priv->gps); + if (priv->wps) ret_wps = location_stop(priv->wps); priv->is_started = FALSE; - if (ret_gps != LOCATION_ERROR_NONE && - ret_wps != LOCATION_ERROR_NONE) + if (ret_gps != LOCATION_ERROR_NONE && ret_wps != LOCATION_ERROR_NONE) return LOCATION_ERROR_NOT_AVAILABLE; if (priv->pos_timer) g_source_remove (priv->pos_timer); @@ -771,7 +767,6 @@ location_hybrid_get_last_position_ext (LocationHybrid *self, return ret; } - static int location_hybrid_get_velocity (LocationHybrid *self, LocationVelocity **velocity, @@ -868,8 +863,9 @@ location_hybrid_get_last_satellite (LocationHybrid *self, int ret = LOCATION_ERROR_NONE; LocationHybridPrivate *priv = GET_PRIVATE (self); - if (priv->gps) ret = location_get_last_satellite (priv->gps, satellite); - else { + if (priv->gps) { + ret = location_get_last_satellite (priv->gps, satellite); + } else { *satellite = NULL; ret = LOCATION_ERROR_NOT_AVAILABLE; } @@ -1063,5 +1059,4 @@ location_hybrid_class_init (LocationHybridClass *klass) g_object_class_install_properties (gobject_class, PROP_MAX, properties); - } diff --git a/location/manager/location-setting.c b/location/manager/location-setting.c index dee52a3..60ce035 100644 --- a/location/manager/location-setting.c +++ b/location/manager/location-setting.c @@ -49,9 +49,8 @@ gint location_setting_get_int(const gchar* path) { g_return_val_if_fail(path, -1); int val = -1; - if( vconf_get_int(path, &val)){ + if(vconf_get_int(path, &val)){ LOCATION_LOGW("vconf_get_int: failed [%s]", path); - val = -1; } else if (val == 0) LOCATION_LOGD("vconf_get_int: [%s]:[%d]", path, val); return val; @@ -61,9 +60,8 @@ gboolean location_setting_get_bool(const gchar* path) { g_return_val_if_fail(path, -1); gboolean val = FALSE; - if( vconf_get_bool(path, &val)){ + if(vconf_get_bool(path, &val)){ LOCATION_LOGW("vconf_get_int: failed [%s]", path); - val = FALSE; } return val; } @@ -79,7 +77,7 @@ gint location_setting_add_notify(const gchar* path, SettingCB setting_cb, gpoint g_return_val_if_fail(path, -1); g_return_val_if_fail(self, -1); - if( vconf_notify_key_changed(path, setting_cb, self)){ + if(vconf_notify_key_changed(path, setting_cb, self)){ LOCATION_LOGW("vconf notify add failed [%s]", path); return -1; } @@ -92,7 +90,7 @@ gint location_setting_ignore_notify(const gchar* path, SettingCB setting_cb) g_return_val_if_fail(path, -1); g_return_val_if_fail(setting_cb, -1); - if( vconf_ignore_key_changed(path, setting_cb)){ + if(vconf_ignore_key_changed(path, setting_cb)){ LOCATION_LOGW("vconf notify remove failed [%s]", path); return -1; } diff --git a/location/manager/location-setting.h b/location/manager/location-setting.h index 631df65..f54541e 100644 --- a/location/manager/location-setting.h +++ b/location/manager/location-setting.h @@ -44,16 +44,12 @@ gint location_setting_add_notify(const gchar* path, SettingCB setting_cb, gpoint gint location_setting_ignore_notify(const gchar* path, SettingCB setting_cb); #define setting_retval_if_fail(path) {\ - if(!location_setting_get_int(path)){\ + int val = location_setting_get_int(path);\ + if (val == -1){\ return LOCATION_ERROR_UNKNOWN;\ + } else if (val == 0) {\ + return LOCATION_ERROR_SETTING_OFF;\ }\ } -#define setting_ret_if_fail(path) {\ - if(!location_setting_get_int(path)){\ - return;\ - }\ -} - - #endif diff --git a/location/manager/location-wps.c b/location/manager/location-wps.c index c439fa9..511102c 100644 --- a/location/manager/location-wps.c +++ b/location/manager/location-wps.c @@ -88,15 +88,13 @@ _position_timeout_cb (gpointer data) if (priv->pos) { pos = location_position_copy(priv->pos); - } - else { + } else { pos = location_position_new (0, 0.0, 0.0, 0.0, LOCATION_STATUS_NO_FIX); } if (priv->acc) { acc = location_accuracy_copy (priv->acc); - } - else { + } else { acc = location_accuracy_new (LOCATION_ACCURACY_LEVEL_NONE, 0.0, 0.0); } @@ -121,15 +119,13 @@ _velocity_timeout_cb (gpointer data) if (priv->vel) { vel = location_velocity_copy(priv->vel); - } - else { + } else { vel = location_velocity_new (0, 0.0, 0.0, 0.0); } if (priv->acc) { acc = location_accuracy_copy (priv->acc); - } - else { + } else { acc = location_accuracy_new (LOCATION_ACCURACY_LEVEL_NONE, 0.0, 0.0); } @@ -256,8 +252,7 @@ location_wps_start (LocationWps *self) if (!location_setting_get_int(VCONFKEY_LOCATION_NETWORK_ENABLED)) { ret = LOCATION_ERROR_SETTING_OFF; - } - else { + } else { ret = priv->mod->ops.start (priv->mod->handler, wps_status_cb, wps_position_ext_cb, NULL, self); if (ret == LOCATION_ERROR_NONE) { priv->is_started = TRUE; @@ -516,12 +511,10 @@ location_wps_get_last_position (LocationWps *self, { LOCATION_LOGD("location_wps_get_last_position"); - /* Do not need to check VCONFKEY_LOCATION_ENABLED and VCONFKEY_LOCATION_NETWORK_ENABLED */ - LocationWpsPrivate *priv = GET_PRIVATE (self); g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE); - LocationError ret = LOCATION_ERROR_NONE; + int ret = LOCATION_ERROR_NONE; LocationVelocity *_velocity = NULL; LocModWpsOps ops = priv->mod->ops; @@ -529,7 +522,7 @@ location_wps_get_last_position (LocationWps *self, g_return_val_if_fail (ops.get_last_position, LOCATION_ERROR_NOT_AVAILABLE); ret = ops.get_last_position(priv->mod->handler, position, &_velocity, accuracy); - if (!_velocity) location_velocity_free (_velocity); + if (_velocity) location_velocity_free(_velocity); return ret; } @@ -542,8 +535,6 @@ location_wps_get_last_position_ext (LocationWps *self, { LOCATION_LOGD("location_wps_get_last_position_ext"); - /* Do not need to check VCONFKEY_LOCATION_ENABLED and VCONFKEY_LOCATION_NETWORK_ENABLED */ - LocationWpsPrivate *priv = GET_PRIVATE (self); g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE); @@ -552,7 +543,6 @@ location_wps_get_last_position_ext (LocationWps *self, g_return_val_if_fail (ops.get_last_position, LOCATION_ERROR_NOT_AVAILABLE); return ops.get_last_position(priv->mod->handler, position, velocity, accuracy); - } @@ -590,12 +580,10 @@ location_wps_get_last_velocity (LocationWps *self, { LOCATION_LOGD("location_wps_get_last_velocity"); - /* Do not need to check VCONFKEY_LOCATION_ENABLED and VCONFKEY_LOCATION_NETWORK_ENABLED */ - LocationWpsPrivate *priv = GET_PRIVATE (self); g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE); - LocationError ret = LOCATION_ERROR_NONE; + int ret = LOCATION_ERROR_NONE; LocationPosition *_position = NULL; LocModWpsOps ops = priv->mod->ops; diff --git a/location/manager/location.c b/location/manager/location.c index 7155d7e..958a137 100644 --- a/location/manager/location.c +++ b/location/manager/location.c @@ -236,7 +236,6 @@ location_get_satellite (LocationObject *obj, LocationSatellite **satellite) g_return_val_if_fail (satellite, LOCATION_ERROR_PARAMETER); int ret = LOCATION_ERROR_NONE; - ret = location_ielement_get_satellite (LOCATION_IELEMENT(obj), satellite); if (ret != LOCATION_ERROR_NONE) LOCATION_LOGD("Fail to get_satellite. Error [%d]", ret); @@ -341,30 +340,28 @@ EXPORT_API int location_send_command(const char *cmd) { g_return_val_if_fail (cmd, LOCATION_ERROR_PARAMETER); - int ret = 0; + int ret = LOCATION_ERROR_NOT_AVAILABLE; if (0 == g_strcmp0(cmd, "ADD_APPLIST")) { - ret = location_application_add_app_to_applist (); - if (ret == FALSE) { + if (location_application_add_app_to_applist () == FALSE) { LOCATION_LOGD("Fail to add to applist"); - return LOCATION_ERROR_UNKNOWN; + ret = LOCATION_ERROR_UNKNOWN; + } else { + ret = LOCATION_ERROR_NONE; } } else if (0 == g_strcmp0(cmd, "ACCESSIBILITY:1")) { ret = location_set_accessibility_state(LOCATION_ACCESS_ALLOWED); if (ret != LOCATION_ERROR_NONE) { LOCATION_LOGD("Fail to set ACCESSIBILITY:1 [ret = %d]", ret); - return ret; } } else if (0 == g_strcmp0(cmd, "ACCESSIBILITY:0")) { ret = location_set_accessibility_state(LOCATION_ACCESS_DENIED); if (ret != LOCATION_ERROR_NONE) { LOCATION_LOGD("Fail to set ACCESSIBILITY:0 [ret = %d]", ret); - return ret; } } else { LOCATION_LOGD("Invalid CMD[%s]", cmd); } - return LOCATION_ERROR_NONE; + return ret; } - diff --git a/packaging/libslp-location.spec b/packaging/libslp-location.spec index 98dee06..9f8babf 100755 --- a/packaging/libslp-location.spec +++ b/packaging/libslp-location.spec @@ -1,6 +1,6 @@ Name: libslp-location Summary: Location Based Service -Version: 0.4.4 +Version: 0.4.6 Release: 1 Group: System/Libraries License: Apache Licensc, Version 2.0 @@ -38,21 +38,15 @@ Location Based Service Development Package %build ./autogen.sh -./configure --prefix=%{_prefix} --enable-dlog --enable-debug +%configure --enable-dlog --enable-debug -# Call make instruction with smp support make %{?jobs:-j%jobs} %install -rm -rf %{buildroot} %make_install -%clean -rm -rf %{buildroot} - - %post /sbin/ldconfig vconftool set -t int db/location/last/gps/Timestamp "0" -f diff --git a/tests/location-api-test.c b/tests/location-api-test.c index bc0ae94..03bee4a 100644 --- a/tests/location-api-test.c +++ b/tests/location-api-test.c @@ -406,8 +406,6 @@ static void print_menu() g_printf("10. location_is_supported_method\n"); g_printf("11. location_is_enabled_gps\n"); g_printf("99. location_send_command\n"); - g_printf("99a. location_send_command(get_auth)\n"); - g_printf("99b. location_send_command(add_to_list)\n"); g_printf("a?. signals:(1)'service-enabled',(2)'service-disabled',(3)'service-updated',(4)'zone-in',(5)'zone-out'\n"); g_printf("b?. disconnect signals:(1)'service-enabled',(2)'service-disabled',(3)'service-updated',(4)'zone-in',(5)'zone-out'\n"); g_printf("c?. (1)Set boundary, (2)Get boundary, (3) Remove boundary, (4) Remove all boundaries, (5)Set device name, \n"); diff --git a/tests/map-service-test.c b/tests/map-service-test.c old mode 100755 new mode 100644 -- 2.7.4