From: Young-Ae Kang Date: Fri, 22 Jan 2016 05:41:00 +0000 (+0900) Subject: Added checking parameter and changed return value for clear_mock_location(). X-Git-Tag: accepted/tizen/ivi/20160218.022950^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F22%2F57722%2F1;p=platform%2Fcore%2Fapi%2Flocation-manager.git Added checking parameter and changed return value for clear_mock_location(). Change-Id: I66c73206927084333c69814d3334f31f07e39e7d --- diff --git a/src/location_internal.c b/src/location_internal.c index 5c123ad..b1bd492 100644 --- a/src/location_internal.c +++ b/src/location_internal.c @@ -143,7 +143,7 @@ int __unset_callback(_location_event_e type, location_manager_h manager) location_manager_s *handle = (location_manager_s *) manager; handle->user_cb[type] = NULL; handle->user_data[type] = NULL; - LOCATIONS_LOGD("event type : %d. ", type); + LOCATIONS_LOGD("event type : %d", type); return LOCATIONS_ERROR_NONE; } diff --git a/src/locations.c b/src/locations.c index 46e5b13..707c615 100755 --- a/src/locations.c +++ b/src/locations.c @@ -1504,6 +1504,8 @@ EXPORT_API int location_manager_set_mock_location(location_manager_h manager, co EXPORT_API int location_manager_clear_mock_location(location_manager_h manager) { LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported()); + LOCATIONS_NULL_ARG_CHECK(manager); + location_manager_s *handle = (location_manager_s *) manager; int ret = LOCATION_ERROR_NONE; int enabled; @@ -1511,7 +1513,7 @@ EXPORT_API int location_manager_clear_mock_location(location_manager_h manager) ret = location_is_enabled_method(LOCATION_METHOD_MOCK, &enabled); if (ret == LOCATIONS_ERROR_NONE) { if (enabled == 0) { - return __convert_error_code(LOCATIONS_ERROR_SETTING_OFF); + return __convert_error_code(LOCATION_ERROR_SETTING_OFF); } } else { return __convert_error_code(ret); diff --git a/test/location_test.c b/test/location_test.c index 01ba706..6def155 100755 --- a/test/location_test.c +++ b/test/location_test.c @@ -376,11 +376,19 @@ void _location_batch_cb(int num_of_location, void *user_data) } } -static void __setting_cb(location_method_e method, bool enable, void *user_data) +static void _setting_cb(location_method_e method, bool enable, void *user_data) { fprintf(stderr, "method[%d], enable[%d]\n", method, enable); } +void _satellite_updated_cb(int num_of_active, int num_of_inview, time_t timestamp, void *user_data) +{ + fprintf(stderr, "-------------------------- satellite updated --------------------------\n"); + fprintf(stderr, "num_of_active[%d] num_of_inview[%d] timestamp[%ld]\n", num_of_active, num_of_inview, timestamp); + + test_timer = g_timeout_add_seconds(1, wait_test, NULL); +} + static void print_location_status() { fprintf(stderr, "==== LOCATION Setting state =====\n"); @@ -404,7 +412,7 @@ static int enable_method(location_method_e method, bool enable) int ret = 0; fprintf(stderr, "==== LOCATION Setting changed =====\n"); - location_manager_set_setting_changed_cb(LOCATIONS_METHOD_HYBRID, __setting_cb, NULL); + location_manager_set_setting_changed_cb(LOCATIONS_METHOD_HYBRID, _setting_cb, NULL); fprintf(stderr, "method[%d], enable[%d]\n", method, enable); ret = location_manager_enable_method(method, enable); @@ -499,8 +507,14 @@ static int location_test() int method = menu - 1; ret = location_manager_create(method, &manager); fprintf(stderr, "location_manager_create (method: %d): %d\n", method, ret); + ret = location_manager_start(manager); fprintf(stderr, "start: %d\n", ret); + + if (method == LOCATIONS_METHOD_GPS) { + ret = gps_status_set_satellite_updated_cb(manager, _satellite_updated_cb, 1, &manager); + fprintf(stderr, "gps_status_set_satellite_updated_cb: %d\n", ret); + } break; } case 4: @@ -717,6 +731,9 @@ static void location_cleanup() ret = location_manager_unset_position_updated_cb(manager); fprintf(stderr, "unset_position_updated_cb: %d\n", ret); + ret = gps_status_unset_satellite_updated_cb(manager); + fprintf(stderr, "gps_status_unset_satellite_updated_cb: %d\n", ret); + ret = location_manager_destroy(manager); fprintf(stderr, "destroy: %d\n", ret); manager = NULL;