Added checking parameter and changed return value for clear_mock_location(). 22/57722/1 devel/native_js accepted/tizen/ivi/20160218.022950 accepted/tizen/mobile/20160122.080928 accepted/tizen/tv/20160122.080948 accepted/tizen/wearable/20160122.081020 submit/tizen/20160122.055041 submit/tizen_common/20160218.142243 submit/tizen_ivi/20160217.000000 submit/tizen_ivi/20160217.000001
authorYoung-Ae Kang <youngae.kang@samsung.com>
Fri, 22 Jan 2016 05:41:00 +0000 (14:41 +0900)
committerYoung-Ae Kang <youngae.kang@samsung.com>
Fri, 22 Jan 2016 05:43:59 +0000 (14:43 +0900)
Change-Id: I66c73206927084333c69814d3334f31f07e39e7d

src/location_internal.c
src/locations.c
test/location_test.c

index 5c123ad..b1bd492 100644 (file)
@@ -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;
 }
 
index 46e5b13..707c615 100755 (executable)
@@ -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);
index 01ba706..6def155 100755 (executable)
@@ -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;