From: kj7.sung Date: Thu, 9 Jun 2016 06:35:19 +0000 (+0900) Subject: [ACR-668] Deprecate get_accessibility API X-Git-Tag: accepted/tizen/common/20160614.143839^0 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fapi%2Flocation-manager.git;a=commitdiff_plain;h=ff12ce87b547e3e29e11b8286f6cecf428556af6 [ACR-668] Deprecate get_accessibility API 2. fixed mock location memory leaks Signed-off-by: kj7.sung Change-Id: I03e76e33130de12c4de130f7159cbf435727a985 --- diff --git a/include/locations.h b/include/locations.h index 2317593..f0a7219 100755 --- a/include/locations.h +++ b/include/locations.h @@ -86,6 +86,7 @@ typedef enum { } location_service_state_e; /** + * @deprecated Deprecated since 3.0 * @brief Enumeration for the location service accessibility state. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ @@ -632,6 +633,7 @@ int location_manager_get_last_velocity(location_manager_h manager, double *climb int location_manager_get_last_accuracy(location_manager_h manager, location_accuracy_level_e *level, double *horizontal, double *vertical); /** + * @deprecated Deprecated since 3.0 * @brief Gets the current application's location accessibility status. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[out] state The current location service accessibility status. diff --git a/src/locations.c b/src/locations.c index 3b094bf..0eb9de5 100755 --- a/src/locations.c +++ b/src/locations.c @@ -77,24 +77,24 @@ static void __cb_service_updated(GObject *self, guint type, gpointer data, gpoin LOCATIONS_LOGD("Current satellite information: timestamp : %d, number of active : %d, number of inview : %d", sat->timestamp, sat->num_of_sat_used, sat->num_of_sat_inview); ((gps_status_satellite_updated_cb) handle->user_cb[_LOCATIONS_EVENT_TYPE_SATELLITE])(sat->num_of_sat_used, sat->num_of_sat_inview, - sat->timestamp, handle->user_data[_LOCATIONS_EVENT_TYPE_SATELLITE]); + sat->timestamp, handle->user_data[_LOCATIONS_EVENT_TYPE_SATELLITE]); } else if (type == DISTANCE_UPDATED && handle->user_cb[_LOCATIONS_EVENT_TYPE_DISTANCE]) { LocationPosition *pos = (LocationPosition *) data; LocationVelocity *vel = (LocationVelocity *) velocity; /* current velocity */ ((location_changed_cb) handle->user_cb[_LOCATIONS_EVENT_TYPE_DISTANCE])(0, pos->latitude, pos->longitude, pos->altitude, - vel->speed, vel->direction, pos->timestamp, handle->user_data[_LOCATIONS_EVENT_TYPE_DISTANCE]); + vel->speed, vel->direction, pos->timestamp, handle->user_data[_LOCATIONS_EVENT_TYPE_DISTANCE]); } else { if (handle->user_cb[_LOCATIONS_EVENT_TYPE_POSITION] && (type & POSITION_UPDATED) != 0) { LocationPosition *pos = (LocationPosition *) data; - ((location_position_updated_cb) handle->user_cb[_LOCATIONS_EVENT_TYPE_POSITION])(pos->latitude, pos->longitude, pos->altitude, pos->timestamp, - handle->user_data[_LOCATIONS_EVENT_TYPE_POSITION]); + ((location_position_updated_cb) handle->user_cb[_LOCATIONS_EVENT_TYPE_POSITION])(pos->latitude, pos->longitude, pos->altitude, + pos->timestamp, handle->user_data[_LOCATIONS_EVENT_TYPE_POSITION]); } if (handle->user_cb[_LOCATIONS_EVENT_TYPE_VELOCITY] && (type & VELOCITY_UPDATED) != 0) { LocationVelocity *vel = (LocationVelocity *) velocity; - ((location_velocity_updated_cb) handle->user_cb[_LOCATIONS_EVENT_TYPE_VELOCITY])(vel->speed, vel->direction, vel->climb, vel->timestamp, - handle->user_data[_LOCATIONS_EVENT_TYPE_VELOCITY]); + ((location_velocity_updated_cb) handle->user_cb[_LOCATIONS_EVENT_TYPE_VELOCITY])(vel->speed, vel->direction, vel->climb, + vel->timestamp, handle->user_data[_LOCATIONS_EVENT_TYPE_VELOCITY]); } if (handle->user_cb[_LOCATIONS_EVENT_TYPE_POS_VEL] && (type & LOCATION_CHANGED) != 0) { @@ -102,7 +102,7 @@ static void __cb_service_updated(GObject *self, guint type, gpointer data, gpoin LocationVelocity *vel = (LocationVelocity *) velocity; LocationAccuracy *acc = (LocationAccuracy *) accuracy; ((location_changed_cb) handle->user_cb[_LOCATIONS_EVENT_TYPE_POS_VEL])(pos->latitude, pos->longitude, pos->altitude, - vel->speed, vel->direction, acc->horizontal_accuracy, pos->timestamp, handle->user_data[_LOCATIONS_EVENT_TYPE_POS_VEL]); + vel->speed, vel->direction, acc->horizontal_accuracy, pos->timestamp, handle->user_data[_LOCATIONS_EVENT_TYPE_POS_VEL]); } } } @@ -405,7 +405,7 @@ EXPORT_API int location_manager_is_enabled_method(location_method_e method, bool { LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported()); - if (LOCATIONS_METHOD_HYBRID > method || LOCATIONS_METHOD_MOCK < method) { + if (method < LOCATIONS_METHOD_HYBRID || method > LOCATIONS_METHOD_MOCK) { LOCATIONS_LOGE("Not supported method [%d]", method); return LOCATIONS_ERROR_INCORRECT_METHOD; } @@ -431,7 +431,7 @@ EXPORT_API int location_manager_enable_method(const location_method_e method, co { LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported()); - if (LOCATIONS_METHOD_HYBRID > method || LOCATIONS_METHOD_MOCK < method) { + if (method < LOCATIONS_METHOD_HYBRID || method > LOCATIONS_METHOD_MOCK) { LOCATIONS_LOGE("Not supported method [%d]", method); return LOCATIONS_ERROR_INCORRECT_METHOD; } @@ -593,7 +593,7 @@ EXPORT_API int location_manager_start(location_manager_h manager) if (!handle->sig_id[_LOCATION_SIGNAL_SERVICE_UPDATED]) handle->sig_id[_LOCATION_SIGNAL_SERVICE_UPDATED] = g_signal_connect(handle->object, "service-updated", G_CALLBACK(__cb_service_updated), handle); - if (LOCATIONS_METHOD_HYBRID <= handle->method && LOCATIONS_METHOD_MOCK >= handle->method) { + if (handle->method >= LOCATIONS_METHOD_HYBRID && handle->method <= LOCATIONS_METHOD_MOCK) { if (!handle->sig_id[_LOCATION_SIGNAL_ZONE_IN]) handle->sig_id[_LOCATION_SIGNAL_ZONE_IN] = g_signal_connect(handle->object, "zone-in", G_CALLBACK(__cb_zone_in), handle); @@ -656,7 +656,7 @@ EXPORT_API int location_manager_stop(location_manager_h manager) handle->sig_id[_LOCATION_SIGNAL_SERVICE_UPDATED] = 0; } - if (LOCATIONS_METHOD_HYBRID <= handle->method && LOCATIONS_METHOD_MOCK >= handle->method) { + if (handle->method >= LOCATIONS_METHOD_HYBRID && handle->method <= LOCATIONS_METHOD_MOCK) { if (handle->sig_id[_LOCATION_SIGNAL_ZONE_IN]) { g_signal_handler_disconnect(handle->object, handle->sig_id[_LOCATION_SIGNAL_ZONE_IN]); handle->sig_id[_LOCATION_SIGNAL_ZONE_IN] = 0; @@ -1477,16 +1477,24 @@ EXPORT_API int location_manager_set_mock_location(location_manager_h manager, co vel = location_velocity_new(0, speed, direction, 0); if (!vel) { LOCATIONS_LOGE("Failed to create volocity"); + location_position_free(pos); return LOCATIONS_ERROR_OUT_OF_MEMORY; } acc = location_accuracy_new(LOCATION_ACCURACY_LEVEL_DETAILED, accuracy, -1); - if (!vel) { + if (!acc) { LOCATIONS_LOGE("Failed to create accuracy"); + location_position_free(pos); + location_velocity_free(vel); return LOCATIONS_ERROR_OUT_OF_MEMORY; } ret = location_set_mock_location(handle->object, pos, vel, acc); + + location_position_free(pos); + location_velocity_free(vel); + location_accuracy_free(acc); + return __convert_error_code(ret); }