diff options
-rw-r--r-- | src/location_batch.c | 2 | ||||
-rw-r--r-- | src/location_bounds.c | 26 | ||||
-rw-r--r-- | src/location_internal.c | 12 | ||||
-rwxr-xr-x | src/locations.c | 148 |
4 files changed, 132 insertions, 56 deletions
diff --git a/src/location_batch.c b/src/location_batch.c index f852f1a..c87a6c7 100644 --- a/src/location_batch.c +++ b/src/location_batch.c @@ -25,9 +25,11 @@ /* * Internal Implementation */ +//LCOV_EXCL_START EXPORT_API int location_manager_enable_restriction(bool enable) { int ret = LOCATION_ERROR_NONE; ret = location_enable_restriction(enable); return __convert_error_code(ret); } +//LCOV_EXCL_STOP diff --git a/src/location_bounds.c b/src/location_bounds.c index d39ca3a..3106db0 100644 --- a/src/location_bounds.c +++ b/src/location_bounds.c @@ -22,6 +22,7 @@ #include "location_internal.h" +//LCOV_EXCL_START static void __free_position_list(gpointer data) { if (data == NULL) @@ -30,6 +31,7 @@ static void __free_position_list(gpointer data) LocationPosition *position = (LocationPosition *) data; location_position_free(position); } +//LCOV_EXCL_STOP static location_bounds_type_e __convert_bounds_type(LocationBoundaryType type) { @@ -69,23 +71,29 @@ EXPORT_API int location_bounds_create_rect(location_coords_s top_left, location_ LocationPosition *lt = location_position_new(0, top_left.latitude, top_left.longitude, 0, LOCATION_STATUS_2D_FIX); if (lt == NULL) { + //LCOV_EXCL_START LOCATIONS_LOGE("LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY(0x%08x) : fail to location_position_new", LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY); return LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY; + //LCOV_EXCL_STOP } LocationPosition *rb = location_position_new(0, bottom_right.latitude, bottom_right.longitude, 0, LOCATION_STATUS_2D_FIX); if (rb == NULL) { + //LCOV_EXCL_START LOCATIONS_LOGE("LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY(0x%08x) : fail to location_position_new", LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY); location_position_free(lt); return LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY; + //LCOV_EXCL_STOP } location_bounds_s *handle = (location_bounds_s *) malloc(sizeof(location_bounds_s)); if (handle == NULL) { + //LCOV_EXCL_START LOCATIONS_LOGE("OUT_OF_MEMORY(0x%08x)", LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY); location_position_free(rb); location_position_free(lt); return LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY; + //LCOV_EXCL_STOP } memset(handle, 0, sizeof(location_bounds_s)); @@ -94,9 +102,11 @@ EXPORT_API int location_bounds_create_rect(location_coords_s top_left, location_ location_position_free(rb); location_position_free(lt); if (handle->boundary == NULL) { + //LCOV_EXCL_START LOCATIONS_LOGE("LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY(0x%08x) : fail to location_boundary_new_for_rect", LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY); free(handle); return LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY; + //LCOV_EXCL_STOP } *bounds = (location_bounds_h) handle; @@ -113,15 +123,19 @@ EXPORT_API int location_bounds_create_circle(location_coords_s center, double ra LocationPosition *ct = location_position_new(0, center.latitude, center.longitude, 0, LOCATION_STATUS_2D_FIX); if (ct == NULL) { + //LCOV_EXCL_START LOCATIONS_LOGE("LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY(0x%08x) : fail to location_position_new", LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY); return LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY; + //LCOV_EXCL_STOP } location_bounds_s *handle = (location_bounds_s *) malloc(sizeof(location_bounds_s)); if (handle == NULL) { + //LCOV_EXCL_START LOCATIONS_LOGE("OUT_OF_MEMORY(0x%08x)", LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY); location_position_free(ct); return LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY; + //LCOV_EXCL_STOP } memset(handle, 0, sizeof(location_bounds_s)); @@ -129,9 +143,11 @@ EXPORT_API int location_bounds_create_circle(location_coords_s center, double ra handle->boundary = location_boundary_new_for_circle(ct, radius); location_position_free(ct); if (handle->boundary == NULL) { + //LCOV_EXCL_START free(handle); LOCATIONS_LOGE("LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY(0x%08x) : fail to location_boundary_new_for_circle", LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY); return LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY; + //LCOV_EXCL_STOP } *bounds = (location_bounds_h) handle; @@ -170,24 +186,30 @@ EXPORT_API int location_bounds_create_polygon(location_coords_s *coords_list, in } if (position_list == NULL) { + //LCOV_EXCL_START LOCATIONS_LOGE("LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY(0x%08x) : fail to location_position_new", LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY); g_list_free_full(position_list, (GDestroyNotify) __free_position_list); return LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY; + //LCOV_EXCL_STOP } location_bounds_s *handle = (location_bounds_s *) malloc(sizeof(location_bounds_s)); if (handle == NULL) { + //LCOV_EXCL_START LOCATIONS_LOGE("OUT_OF_MEMORY(0x%08x)", LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY); return LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY; + //LCOV_EXCL_STOP } memset(handle, 0, sizeof(location_bounds_s)); handle->is_added = FALSE; handle->boundary = location_boundary_new_for_polygon(position_list); if (handle->boundary == NULL) { + //LCOV_EXCL_START free(handle); LOCATIONS_LOGE("LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY(0x%08x) : fail to location_boundary_new_for_polygon", LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY); return LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY; + //LCOV_EXCL_STOP } *bounds = (location_bounds_h) handle; @@ -197,8 +219,10 @@ EXPORT_API int location_bounds_create_polygon(location_coords_s *coords_list, in EXPORT_API bool location_bounds_contains_coordinates(location_bounds_h bounds, location_coords_s coords) { if (__is_location_supported() == LOCATIONS_ERROR_NOT_SUPPORTED) { + //LCOV_EXCL_START set_last_result(LOCATIONS_ERROR_NOT_SUPPORTED); return FALSE; + //LCOV_EXCL_STOP } if (!bounds) { @@ -213,9 +237,11 @@ EXPORT_API bool location_bounds_contains_coordinates(location_bounds_h bounds, l LocationPosition *pos = location_position_new(0, coords.latitude, coords.longitude, 0, LOCATION_STATUS_2D_FIX); if (pos == NULL) { + //LCOV_EXCL_START LOCATIONS_LOGE("LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY(0x%08x) : fail to location_position_new", LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY); set_last_result(LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY); return FALSE; + //LCOV_EXCL_STOP } location_bounds_s *handle = (location_bounds_s *) bounds; gboolean is_inside = location_boundary_if_inside(handle->boundary, pos); diff --git a/src/location_internal.c b/src/location_internal.c index 0beb7f5..9cc78fe 100644 --- a/src/location_internal.c +++ b/src/location_internal.c @@ -33,6 +33,7 @@ int __convert_error_code(int code) ret = LOCATIONS_ERROR_INVALID_PARAMETER; msg = "LOCATIONS_ERROR_INVALID_PARAMETER"; break; + //LCOV_EXCL_START case LOCATION_ERROR_NOT_ALLOWED: ret = LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED; msg = "LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED"; @@ -60,6 +61,7 @@ int __convert_error_code(int code) default: msg = "LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE"; ret = LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE; + //LCOV_EXCL_STOP } if (ret != LOCATIONS_ERROR_NONE) @@ -75,7 +77,7 @@ int __is_gps_supported(void) retval = system_info_get_platform_bool("http://tizen.org/feature/location.gps", &is_supported); if (retval != SYSTEM_INFO_ERROR_NONE) - LOCATIONS_LOGW("system_info_get_platform_bool failed: retval = %d", retval); + LOCATIONS_LOGW("system_info_get_platform_bool failed: retval = %d", retval); //LCOV_EXCL_LINE if (is_supported == false) return LOCATIONS_ERROR_NOT_SUPPORTED; @@ -90,7 +92,7 @@ int __is_gps_satellite_supported(void) retval = system_info_get_platform_bool("http://tizen.org/feature/location.gps.satellite", &is_supported); if (retval != SYSTEM_INFO_ERROR_NONE) - LOCATIONS_LOGW("system_info_get_platform_bool failed: retval = %d", retval); + LOCATIONS_LOGW("system_info_get_platform_bool failed: retval = %d", retval); //LCOV_EXCL_LINE if (is_supported == false) return LOCATIONS_ERROR_NOT_SUPPORTED; @@ -105,21 +107,25 @@ int __is_wps_supported(void) retval = system_info_get_platform_bool("http://tizen.org/feature/location.wps", &is_supported); if (retval != SYSTEM_INFO_ERROR_NONE) + //LCOV_EXCL_START LOCATIONS_LOGW("system_info_get_platform_bool failed: retval = %d", retval); if (is_supported == false) return LOCATIONS_ERROR_NOT_SUPPORTED; return LOCATIONS_ERROR_NONE; + //LCOV_EXCL_STOP } int __is_location_supported(void) { if (__is_gps_supported() == LOCATIONS_ERROR_NOT_SUPPORTED) { + //LCOV_EXCL_START if (__is_wps_supported() == LOCATIONS_ERROR_NOT_SUPPORTED) return LOCATIONS_ERROR_NOT_SUPPORTED; else return LOCATIONS_ERROR_NONE; + //LCOV_EXCL_STOP } return LOCATIONS_ERROR_NONE; @@ -137,7 +143,7 @@ int __is_batch_supported(void) if (is_supported == false) return LOCATIONS_ERROR_NOT_SUPPORTED; - return LOCATIONS_ERROR_NONE; + return LOCATIONS_ERROR_NONE; //LCOV_EXCL_LINE } int __set_callback(_location_event_e type, location_manager_h manager, void *callback, void *user_data) diff --git a/src/locations.c b/src/locations.c index a5437ab..cc42d6c 100755 --- a/src/locations.c +++ b/src/locations.c @@ -25,7 +25,7 @@ static location_setting_changed_s g_location_setting[LOCATIONS_METHOD_PASSIVE + static location_method_e __convert_location_method_e(LocationMethod method) { - location_method_e _method = LOCATIONS_METHOD_NONE; + location_method_e _method = LOCATIONS_METHOD_NONE; //LCOV_EXCL_LINE switch (method) { case LOCATION_METHOD_HYBRID: _method = LOCATIONS_METHOD_HYBRID; @@ -124,11 +124,14 @@ static void __cb_location_updated(GObject *self, int error, gpointer position, g } if (error != LOCATION_ERROR_NONE) { +//LCOV_EXCL_START location_position_free(pos); location_velocity_free(vel); +//LCOV_EXCL_STOP } } +//LCOV_EXCL_START static void __cb_batch_updated(GObject *self, guint num_of_location, gpointer userdata) { LOCATIONS_LOGD("Batch callback function has been invoked."); @@ -137,6 +140,7 @@ static void __cb_batch_updated(GObject *self, guint num_of_location, gpointer us if (handle->user_cb[_LOCATIONS_EVENT_TYPE_BATCH]) ((location_batch_cb) handle->user_cb[_LOCATIONS_EVENT_TYPE_BATCH])(num_of_location, handle->user_data[_LOCATIONS_EVENT_TYPE_BATCH]); } +//LCOV_EXCL_STOP static void __cb_service_enabled(GObject *self, guint status, gpointer userdata) { @@ -163,7 +167,7 @@ static int __compare_position(gconstpointer a, gconstpointer b) if (location_position_equal((LocationPosition *) a, (LocationPosition *)b) == TRUE) return 0; - return -1; + return -1; //LCOV_EXCL_LINE } static int __boundary_compare(LocationBoundary *bound1, LocationBoundary *bound2) @@ -332,7 +336,7 @@ static void __foreach_boundary(LocationBoundary *boundary, void *user_data) } if (ret != LOCATIONS_ERROR_NONE) { - LOCATIONS_LOGI("Failed to create location_bounds : (0x%08x) ", ret); + LOCATIONS_LOGI("Failed to create location_bounds : (0x%08x) ", ret); //LCOV_EXCL_LINE } else { if (handle->is_continue_foreach_bounds) { handle->is_continue_foreach_bounds = @@ -344,10 +348,11 @@ static void __foreach_boundary(LocationBoundary *boundary, void *user_data) location_bounds_destroy(bounds); } } else { - LOCATIONS_LOGD("__foreach_boundary() has been failed"); + LOCATIONS_LOGD("__foreach_boundary() has been failed"); //LCOV_EXCL_LINE } } +//LCOV_EXCL_START static void __setting_changed_cb(LocationMethod method, gboolean enable, void *user_data) { LOCATIONS_LOGD("method: [%d]", method); @@ -361,6 +366,7 @@ static void __setting_changed_cb(LocationMethod method, gboolean enable, void *u if (_setting_changed[_method].callback != NULL) _setting_changed[_method].callback(_method, enable, _setting_changed[_method].user_data); } +//LCOV_EXCL_STOP /*/////////////////////////////////////// */ /* Location Manager */ @@ -370,14 +376,14 @@ EXPORT_API bool location_manager_is_supported_method(location_method_e method) { LOCATIONS_LOGD("location_manager_is_supported_method %d", method); if (__is_location_supported() == LOCATIONS_ERROR_NOT_SUPPORTED) { - set_last_result(LOCATIONS_ERROR_NOT_SUPPORTED); - return false; + set_last_result(LOCATIONS_ERROR_NOT_SUPPORTED); //LCOV_EXCL_LINE + return false; //LCOV_EXCL_LINE } if (method == LOCATIONS_METHOD_GPS) { if (__is_gps_supported() == LOCATIONS_ERROR_NOT_SUPPORTED) { - set_last_result(LOCATIONS_ERROR_NOT_SUPPORTED); - return false; + set_last_result(LOCATIONS_ERROR_NOT_SUPPORTED); //LCOV_EXCL_LINE + return false; //LCOV_EXCL_LINE } } else if (method == LOCATIONS_METHOD_WPS) { if (__is_wps_supported() == LOCATIONS_ERROR_NOT_SUPPORTED) { @@ -418,11 +424,13 @@ EXPORT_API int location_manager_is_enabled_method(location_method_e method, bool LocationMethod _method = __convert_LocationMethod(method); int ret = location_is_enabled_method(_method, &is_enabled_val); if (ret != LOCATION_ERROR_NONE) { + //LCOV_EXCL_START if (ret == LOCATION_ERROR_NOT_SUPPORTED) { LOCATIONS_LOGE("LOCATIONS_ERROR_INCORRECT_METHOD"); return LOCATIONS_ERROR_INCORRECT_METHOD; } return __convert_error_code(ret); + //LCOV_EXCL_STOP } if (is_enabled_val == -1) @@ -432,6 +440,7 @@ EXPORT_API int location_manager_is_enabled_method(location_method_e method, bool return LOCATIONS_ERROR_NONE; } +//LCOV_EXCL_START EXPORT_API int location_manager_enable_method(const location_method_e method, const bool enable) { LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported()); @@ -471,6 +480,7 @@ EXPORT_API int location_manager_enable_method(const location_method_e method, co return __convert_error_code(ret); } } +//LCOV_EXCL_STOP EXPORT_API int location_manager_create(location_method_e method, location_manager_h *manager) { @@ -500,23 +510,25 @@ EXPORT_API int location_manager_create(location_method_e method, location_manage LOCATIONS_NULL_ARG_CHECK(manager); if (location_init() != LOCATION_ERROR_NONE) { - LOCATIONS_LOGE("LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE(0x%08x) : fail to location_init", LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE); - return LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE; + LOCATIONS_LOGE("LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE(0x%08x) : fail to location_init", LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE); //LCOV_EXCL_LINE + return LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE; //LCOV_EXCL_LINE } location_manager_s *handle = (location_manager_s *) malloc(sizeof(location_manager_s)); if (handle == NULL) { - LOCATIONS_LOGE("OUT_OF_MEMORY(0x%08x)", LOCATIONS_ERROR_OUT_OF_MEMORY); - return LOCATIONS_ERROR_OUT_OF_MEMORY; + LOCATIONS_LOGE("OUT_OF_MEMORY(0x%08x)", LOCATIONS_ERROR_OUT_OF_MEMORY); //LCOV_EXCL_LINE + return LOCATIONS_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE } memset(handle, 0, sizeof(location_manager_s)); handle->object = location_new(_method, FALSE); if (handle->object == NULL) { + //LCOV_EXCL_START LOCATIONS_LOGE("LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE(0x%08x) : fail to location_new", LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE); free(handle); return LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE; + //LCOV_EXCL_STOP } handle->method = method; handle->is_continue_foreach_bounds = TRUE; @@ -550,13 +562,13 @@ EXPORT_API int location_manager_destroy(location_manager_h manager) } if (handle->sig_id[_LOCATION_SIGNAL_ERROR_EMITTED]) { - g_signal_handler_disconnect(handle->object, handle->sig_id[_LOCATION_SIGNAL_ERROR_EMITTED]); - handle->sig_id[_LOCATION_SIGNAL_ERROR_EMITTED] = 0; + g_signal_handler_disconnect(handle->object, handle->sig_id[_LOCATION_SIGNAL_ERROR_EMITTED]); //LCOV_EXCL_LINE + handle->sig_id[_LOCATION_SIGNAL_ERROR_EMITTED] = 0; //LCOV_EXCL_LINE } int ret = location_free(handle->object, FALSE); if (ret != LOCATIONS_ERROR_NONE) - return __convert_error_code(ret); + return __convert_error_code(ret); //LCOV_EXCL_LINE free(handle); return LOCATIONS_ERROR_NONE; @@ -579,7 +591,7 @@ EXPORT_API int location_manager_start(location_manager_h manager) if (!handle->sig_id[_LOCATION_SIGNAL_ZONE_OUT]) handle->sig_id[_LOCATION_SIGNAL_ZONE_OUT] = g_signal_connect(handle->object, "zone-out", G_CALLBACK(__cb_zone_out), handle); } else { - LOCATIONS_LOGI("This method [%d] is not supported zone-in, zone-out signal.", handle->method); + LOCATIONS_LOGI("This method [%d] is not supported zone-in, zone-out signal.", handle->method); //LCOV_EXCL_LINE } if (handle->user_cb[_LOCATIONS_EVENT_TYPE_SATELLITE] != NULL) { @@ -589,7 +601,7 @@ EXPORT_API int location_manager_start(location_manager_h manager) int ret = location_start(handle->object); if (ret != LOCATION_ERROR_NONE) - return __convert_error_code(ret); + return __convert_error_code(ret); //LCOV_EXCL_LINE return LOCATIONS_ERROR_NONE; } @@ -617,11 +629,13 @@ EXPORT_API int location_manager_request_single_location(location_manager_h manag ret = location_request_single_location(handle->object, timeout); if (ret != LOCATION_ERROR_NONE) { + //LCOV_EXCL_START if (ret == LOCATION_ERROR_NOT_SUPPORTED) { LOCATIONS_LOGE("LOCATIONS_ERROR_INCORRECT_METHOD : method - %d", handle->method); return LOCATIONS_ERROR_INCORRECT_METHOD; } return __convert_error_code(ret); + //LCOV_EXCL_STOP } return LOCATIONS_ERROR_NONE; @@ -654,7 +668,7 @@ EXPORT_API int location_manager_stop(location_manager_h manager) int ret = location_stop(handle->object); if (ret != LOCATION_ERROR_NONE) - return __convert_error_code(ret); + return __convert_error_code(ret); //LCOV_EXCL_LINE return LOCATIONS_ERROR_NONE; } @@ -670,7 +684,7 @@ EXPORT_API int location_manager_add_boundary(location_manager_h manager, locatio location_bounds_s *bound_handle = (location_bounds_s *) bounds; int ret = location_boundary_add(handle->object, bound_handle->boundary); if (ret != LOCATION_ERROR_NONE) - return __convert_error_code(ret); + return __convert_error_code(ret); //LCOV_EXCL_LINE bound_handle->is_added = TRUE; handle->bounds_list = g_list_append(handle->bounds_list, bound_handle); @@ -688,7 +702,7 @@ EXPORT_API int location_manager_remove_boundary(location_manager_h manager, loca location_bounds_s *bound_handle = (location_bounds_s *) bounds; int ret = location_boundary_remove(handle->object, bound_handle->boundary); if (ret != LOCATION_ERROR_NONE) - return __convert_error_code(ret); + return __convert_error_code(ret); //LCOV_EXCL_LINE handle->bounds_list = g_list_remove(handle->bounds_list, bound_handle); bound_handle->is_added = FALSE; @@ -708,7 +722,7 @@ EXPORT_API int location_manager_foreach_boundary(location_manager_h manager, loc handle->is_continue_foreach_bounds = TRUE; int ret = location_boundary_foreach(handle->object, __foreach_boundary, handle); if (ret != LOCATION_ERROR_NONE) - return __convert_error_code(ret); + return __convert_error_code(ret); //LCOV_EXCL_LINE return LOCATIONS_ERROR_NONE; } @@ -734,14 +748,14 @@ EXPORT_API int location_manager_get_method(location_manager_h manager, location_ *method = LOCATIONS_METHOD_GPS; break; case LOCATION_METHOD_WPS: - *method = LOCATIONS_METHOD_WPS; - break; + *method = LOCATIONS_METHOD_WPS; //LCOV_EXCL_LINE + break; //LCOV_EXCL_LINE case LOCATION_METHOD_PASSIVE: *method = LOCATIONS_METHOD_PASSIVE; break; default: { - LOCATIONS_LOGE("[LOCATIONS_ERROR_INVALID_PARAMETER] method : %d ", method); - return LOCATIONS_ERROR_INVALID_PARAMETER; + LOCATIONS_LOGE("[LOCATIONS_ERROR_INVALID_PARAMETER] method : %d ", method); //LCOV_EXCL_LINE + return LOCATIONS_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE } } return LOCATIONS_ERROR_NONE; @@ -763,10 +777,10 @@ EXPORT_API int location_manager_get_position(location_manager_h manager, double LocationAccuracy *acc = NULL; int ret = location_get_position(handle->object, &pos, &acc); if (ret != LOCATION_ERROR_NONE) - return __convert_error_code(ret); + return __convert_error_code(ret); //LCOV_EXCL_LINE if (pos->status == LOCATION_STATUS_NO_FIX) { - return LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE; + return LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE; //LCOV_EXCL_LINE } else { *latitude = pos->latitude; *longitude = pos->longitude; @@ -800,10 +814,10 @@ EXPORT_API int location_manager_get_location(location_manager_h manager, double LocationAccuracy *acc = NULL; int ret = location_get_position_ext(handle->object, &pos, &vel, &acc); if (ret != LOCATION_ERROR_NONE) - return __convert_error_code(ret); + return __convert_error_code(ret); //LCOV_EXCL_LINE if (pos->status == LOCATION_STATUS_NO_FIX) { - return __convert_error_code(LOCATION_ERROR_NOT_AVAILABLE); + return __convert_error_code(LOCATION_ERROR_NOT_AVAILABLE); //LCOV_EXCL_LINE } else { *latitude = pos->latitude; *longitude = pos->longitude; @@ -839,7 +853,7 @@ EXPORT_API int location_manager_get_velocity(location_manager_h manager, double int ret = location_get_velocity(handle->object, &vel, &acc); if (ret != LOCATION_ERROR_NONE) - return __convert_error_code(ret); + return __convert_error_code(ret); //LCOV_EXCL_LINE *climb = vel->climb; *direction = vel->direction; @@ -866,10 +880,10 @@ EXPORT_API int location_manager_get_accuracy(location_manager_h manager, locatio LocationAccuracy *acc = NULL; ret = location_get_position(handle->object, &pos, &acc); if (ret != LOCATION_ERROR_NONE) - return __convert_error_code(ret); + return __convert_error_code(ret); //LCOV_EXCL_LINE if (acc == NULL) - return __convert_error_code(LOCATION_ERROR_NOT_AVAILABLE); + return __convert_error_code(LOCATION_ERROR_NOT_AVAILABLE); //LCOV_EXCL_LINE *level = acc->level; *horizontal = acc->horizontal_accuracy; @@ -896,7 +910,7 @@ EXPORT_API int location_manager_get_last_position(location_manager_h manager, do LocationAccuracy *last_acc = NULL; ret = location_get_last_position(handle->object, &last_pos, &last_acc); if (ret != LOCATION_ERROR_NONE) - return __convert_error_code(ret); + return __convert_error_code(ret); //LCOV_EXCL_LINE if (last_pos->status == LOCATION_STATUS_NO_FIX) { return LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE; @@ -935,7 +949,7 @@ EXPORT_API int location_manager_get_last_location(location_manager_h manager, do LocationAccuracy *last_acc = NULL; ret = location_get_last_position_ext(handle->object, &last_pos, &last_vel, &last_acc); if (ret != LOCATION_ERROR_NONE) - return __convert_error_code(ret); + return __convert_error_code(ret); //LCOV_EXCL_LINE if (last_pos->status == LOCATION_STATUS_NO_FIX) { return LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE; @@ -974,7 +988,7 @@ EXPORT_API int location_manager_get_last_velocity(location_manager_h manager, do LocationAccuracy *last_acc = NULL; ret = location_get_last_velocity(handle->object, &last_vel, &last_acc); if (ret != LOCATION_ERROR_NONE) - return __convert_error_code(ret); + return __convert_error_code(ret); //LCOV_EXCL_LINE *climb = last_vel->climb; *direction = last_vel->direction; @@ -1000,7 +1014,7 @@ EXPORT_API int location_manager_get_last_accuracy(location_manager_h manager, lo LocationAccuracy *last_acc = NULL; ret = location_get_last_position(handle->object, &last_pos, &last_acc); if (ret != LOCATION_ERROR_NONE) - return __convert_error_code(ret); + return __convert_error_code(ret); //LCOV_EXCL_LINE *level = last_acc->level; *horizontal = last_acc->horizontal_accuracy; @@ -1021,11 +1035,12 @@ EXPORT_API int location_manager_get_accessibility_state(location_accessibility_s LocationAccessState auth = LOCATION_ACCESS_NONE; ret = location_get_accessibility_state(&auth); if (ret != LOCATION_ERROR_NONE) { - *state = LOCATIONS_ACCESS_STATE_NONE; - return __convert_error_code(ret); + *state = LOCATIONS_ACCESS_STATE_NONE; //LCOV_EXCL_LINE + return __convert_error_code(ret); //LCOV_EXCL_LINE } switch (auth) { + //LCOV_EXCL_START case LOCATION_ACCESS_DENIED: *state = LOCATIONS_ACCESS_STATE_DENIED; break; @@ -1036,6 +1051,7 @@ EXPORT_API int location_manager_get_accessibility_state(location_accessibility_s default: *state = LOCATIONS_ACCESS_STATE_NONE; break; + //LCOV_EXCL_STOP } return LOCATIONS_ERROR_NONE; @@ -1157,8 +1173,8 @@ EXPORT_API int location_manager_set_setting_changed_cb(location_method_e method, if (_method == LOCATION_METHOD_NONE) { return __convert_error_code(LOCATION_ERROR_PARAMETER); } else if (_method == LOCATION_METHOD_PASSIVE) { - LOCATIONS_LOGE("LOCATIONS_ERROR_INCORRECT_METHOD"); - return LOCATIONS_ERROR_INCORRECT_METHOD; + LOCATIONS_LOGE("LOCATIONS_ERROR_INCORRECT_METHOD"); //LCOV_EXCL_LINE + return LOCATIONS_ERROR_INCORRECT_METHOD; //LCOV_EXCL_LINE } g_location_setting[_method].callback = callback; @@ -1166,7 +1182,7 @@ EXPORT_API int location_manager_set_setting_changed_cb(location_method_e method, ret = location_add_setting_notify(_method, __setting_changed_cb, &g_location_setting); if (ret != LOCATION_ERROR_NONE) - return __convert_error_code(ret); + return __convert_error_code(ret); //LCOV_EXCL_LINE return LOCATIONS_ERROR_NONE; } @@ -1181,14 +1197,14 @@ EXPORT_API int location_manager_unset_setting_changed_cb(location_method_e metho if (_method == LOCATION_METHOD_NONE) { return __convert_error_code(LOCATION_ERROR_PARAMETER); } else if (_method == LOCATION_METHOD_PASSIVE) { - LOCATIONS_LOGE("LOCATIONS_ERROR_INCORRECT_METHOD"); - return LOCATIONS_ERROR_INCORRECT_METHOD; + LOCATIONS_LOGE("LOCATIONS_ERROR_INCORRECT_METHOD"); //LCOV_EXCL_LINE + return LOCATIONS_ERROR_INCORRECT_METHOD; //LCOV_EXCL_LINE } ret = location_ignore_setting_notify(_method, __setting_changed_cb); if (ret != LOCATION_ERROR_NONE) { - LOCATIONS_LOGE("Fail to ignore notify. Error[%d]", ret); - ret = __convert_error_code(ret); + LOCATIONS_LOGE("Fail to ignore notify. Error[%d]", ret); //LCOV_EXCL_LINE + ret = __convert_error_code(ret); //LCOV_EXCL_LINE } g_location_setting[method].callback = NULL; @@ -1215,7 +1231,7 @@ EXPORT_API int location_manager_get_distance(double start_latitude, double start ret = location_get_distance(start, end, &u_distance); if (ret != LOCATION_ERROR_NONE) - return __convert_error_code(ret); + return __convert_error_code(ret); //LCOV_EXCL_LINE *distance = (double)u_distance; @@ -1237,6 +1253,7 @@ EXPORT_API int gps_status_get_nmea(location_manager_h manager, char **nmea) int ret = location_get_nmea(handle->object, &nmea_data); if (ret != LOCATION_ERROR_NONE || nmea == NULL) { + //LCOV_EXCL_START if (ret == LOCATION_ERROR_NOT_ALLOWED) { LOCATIONS_LOGE("LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED"); return LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED; @@ -1244,6 +1261,7 @@ EXPORT_API int gps_status_get_nmea(location_manager_h manager, char **nmea) LOCATIONS_LOGE("LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE(0x%08x) : NMEA is NULL ", LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE); return LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE; + //LCOV_EXCL_STOP } *nmea = g_strdup(nmea_data); @@ -1264,6 +1282,7 @@ EXPORT_API int gps_status_get_satellite(location_manager_h manager, int *num_of_ LocationSatellite *sat = NULL; int ret = location_get_satellite(handle->object, &sat); if (ret != LOCATION_ERROR_NONE || sat == NULL) { + //LCOV_EXCL_START if (ret == LOCATION_ERROR_NOT_ALLOWED) { LOCATIONS_LOGE("LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED"); return LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED; @@ -1271,6 +1290,7 @@ EXPORT_API int gps_status_get_satellite(location_manager_h manager, int *num_of_ LOCATIONS_LOGE("LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE(0x%08x) : satellite is NULL ", LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE); return LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE; + //LCOV_EXCL_STOP } *num_of_active = sat->num_of_sat_used; @@ -1292,11 +1312,13 @@ EXPORT_API int gps_status_set_satellite_updated_cb(location_manager_h manager, g location_manager_s *handle = (location_manager_s *) manager; int ret = location_set_option(handle->object, "USE_SV"); if (ret != LOCATION_ERROR_NONE) { + //LCOV_EXCL_START if (ret == LOCATION_ERROR_NOT_ALLOWED) { LOCATIONS_LOGE("LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED"); return LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED; } return ret; + //LCOV_EXCL_STOP } g_object_set(handle->object, "sat-interval", interval, NULL); return __set_callback(_LOCATIONS_EVENT_TYPE_SATELLITE, manager, callback, user_data); @@ -1319,6 +1341,7 @@ EXPORT_API int gps_status_foreach_satellites_in_view(location_manager_h manager, location_manager_s *handle = (location_manager_s *) manager; LocationSatellite *sat = NULL; int ret = location_get_satellite(handle->object, &sat); + //LCOV_EXCL_START if (ret != LOCATION_ERROR_NONE || sat == NULL) { if (ret == LOCATION_ERROR_NOT_SUPPORTED) { LOCATIONS_LOGE("LOCATIONS_ERROR_INCORRECT_METHOD(0x%08x) : method - %d", LOCATIONS_ERROR_INCORRECT_METHOD, handle->method); @@ -1331,6 +1354,7 @@ EXPORT_API int gps_status_foreach_satellites_in_view(location_manager_h manager, LOCATIONS_LOGE("LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE(0x%08x) : satellite is NULL ", LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE); return LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE; } + //LCOV_EXCL_STOP int i; for (i = 0; i < sat->num_of_sat_inview; i++) { @@ -1362,6 +1386,7 @@ EXPORT_API int gps_status_get_last_satellite(location_manager_h manager, int *nu LocationSatellite *last_sat = NULL; ret = location_get_last_satellite(handle->object, &last_sat); if (ret != LOCATION_ERROR_NONE || last_sat == NULL) { + //LCOV_EXCL_START if (ret == LOCATION_ERROR_NOT_SUPPORTED) { LOCATIONS_LOGE("LOCATIONS_ERROR_INCORRECT_METHOD(0x%08x) : method - %d", LOCATIONS_ERROR_INCORRECT_METHOD, handle->method); return LOCATIONS_ERROR_INCORRECT_METHOD; @@ -1372,6 +1397,7 @@ EXPORT_API int gps_status_get_last_satellite(location_manager_h manager, int *nu LOCATIONS_LOGE("LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE(0x%08x) : satellite is NULL ", LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE); return LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE; + //LCOV_EXCL_STOP } *num_of_active = last_sat->num_of_sat_used; @@ -1393,6 +1419,7 @@ EXPORT_API int gps_status_foreach_last_satellites_in_view(location_manager_h man ret = location_get_last_satellite(handle->object, &last_sat); if (ret != LOCATION_ERROR_NONE || last_sat == NULL) { + //LCOV_EXCL_START if (ret == LOCATION_ERROR_NOT_SUPPORTED) { LOCATIONS_LOGE("LOCATIONS_ERROR_INCORRECT_METHOD(0x%08x) : method - %d", LOCATIONS_ERROR_INCORRECT_METHOD, handle->method); return LOCATIONS_ERROR_INCORRECT_METHOD; @@ -1400,6 +1427,7 @@ EXPORT_API int gps_status_foreach_last_satellites_in_view(location_manager_h man LOCATIONS_LOGE("LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE(0x%08x) : satellite is NULL ", LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE); return LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE; + //LCOV_EXCL_STOP } int i; @@ -1426,6 +1454,7 @@ EXPORT_API int location_manager_set_location_batch_cb(location_manager_h manager LOCATIONS_LOGD("location_manager_set_location_batch_cb"); LOCATIONS_NOT_SUPPORTED_CHECK(__is_batch_supported()); +//LCOV_EXCL_START LOCATIONS_CHECK_CONDITION(batch_interval >= 1 && batch_interval <= 255, LOCATIONS_ERROR_INVALID_PARAMETER, "LOCATIONS_ERROR_INVALID_PARAMETER"); LOCATIONS_CHECK_CONDITION(batch_period >= 1 && batch_period <= 60000, LOCATIONS_ERROR_INVALID_PARAMETER, "LOCATIONS_ERROR_INVALID_PARAMETER"); LOCATIONS_CHECK_CONDITION(batch_interval <= batch_period, LOCATIONS_ERROR_INVALID_PARAMETER, "LOCATIONS_ERROR_INVALID_PARAMETER"); @@ -1435,19 +1464,22 @@ EXPORT_API int location_manager_set_location_batch_cb(location_manager_h manager g_object_set(handle->object, "batch-period", batch_period, NULL); g_object_set(handle->object, "batch-interval", batch_interval, NULL); return __set_callback(_LOCATIONS_EVENT_TYPE_BATCH, manager, callback, user_data); +//LCOV_EXCL_STOP } EXPORT_API int location_manager_unset_location_batch_cb(location_manager_h manager) { LOCATIONS_LOGD("location_manager_unset_location_batch_cb"); LOCATIONS_NOT_SUPPORTED_CHECK(__is_batch_supported()); - return __unset_callback(_LOCATIONS_EVENT_TYPE_BATCH, manager); + return __unset_callback(_LOCATIONS_EVENT_TYPE_BATCH, manager); //LCOV_EXCL_LINE } EXPORT_API int location_manager_start_batch(location_manager_h manager) { LOCATIONS_LOGD("location_manager_start_batch"); LOCATIONS_NOT_SUPPORTED_CHECK(__is_batch_supported()); + +//LCOV_EXCL_START LOCATIONS_NULL_ARG_CHECK(manager); location_manager_s *handle = (location_manager_s *) manager; @@ -1467,12 +1499,15 @@ EXPORT_API int location_manager_start_batch(location_manager_h manager) return __convert_error_code(ret); return LOCATIONS_ERROR_NONE; +//LCOV_EXCL_STOP } EXPORT_API int location_manager_stop_batch(location_manager_h manager) { LOCATIONS_LOGD("location_manager_stop_batch"); LOCATIONS_NOT_SUPPORTED_CHECK(__is_batch_supported()); + +//LCOV_EXCL_START LOCATIONS_NULL_ARG_CHECK(manager); location_manager_s *handle = (location_manager_s *) manager; @@ -1488,12 +1523,14 @@ EXPORT_API int location_manager_stop_batch(location_manager_h manager) return __convert_error_code(ret); return LOCATIONS_ERROR_NONE; +//LCOV_EXCL_STOP } EXPORT_API int location_manager_foreach_location_batch(location_manager_h manager, location_batch_get_location_cb callback, void *user_data) { LOCATIONS_LOGD("location_manager_foreach_location_batch"); LOCATIONS_NOT_SUPPORTED_CHECK(__is_batch_supported()); +//LCOV_EXCL_START LOCATIONS_NULL_ARG_CHECK(manager); LOCATIONS_NULL_ARG_CHECK(callback); location_manager_s *handle = (location_manager_s *) manager; @@ -1528,6 +1565,7 @@ EXPORT_API int location_manager_foreach_location_batch(location_manager_h manage location_batch_free(batch); batch = NULL; return LOCATIONS_ERROR_NONE; +//LCOV_EXCL_STOP } EXPORT_API int location_manager_is_enabled_mock_location(bool *enabled) @@ -1537,10 +1575,10 @@ EXPORT_API int location_manager_is_enabled_mock_location(bool *enabled) int is_enabled_val = -1; int ret = location_is_enabled_method(INTERNAL_METHOD_MOCK, &is_enabled_val); if (ret != LOCATION_ERROR_NONE) - return __convert_error_code(ret); + return __convert_error_code(ret); //LCOV_EXCL_LINE if (is_enabled_val == -1) - return TIZEN_ERROR_PERMISSION_DENIED; + return TIZEN_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE *enabled = (is_enabled_val == 0) ? FALSE : TRUE; return LOCATIONS_ERROR_NONE; @@ -1579,27 +1617,31 @@ EXPORT_API int location_manager_set_mock_location(location_manager_h manager, co if (enabled == 0) return __convert_error_code(LOCATION_ERROR_SETTING_OFF); } else { - return __convert_error_code(ret); + return __convert_error_code(ret); //LCOV_EXCL_LINE } pos = location_position_new(0, latitude, longitude, 0, LOCATION_STATUS_3D_FIX); if (!pos) { - LOCATIONS_LOGE("Failed to create position"); - return LOCATIONS_ERROR_OUT_OF_MEMORY; + LOCATIONS_LOGE("Failed to create position"); //LCOV_EXCL_LINE + return LOCATIONS_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE } vel = location_velocity_new(0, speed, direction, 0); if (!vel) { + //LCOV_EXCL_START LOCATIONS_LOGE("Failed to create velocity"); location_position_free(pos); return LOCATIONS_ERROR_OUT_OF_MEMORY; + //LCOV_EXCL_STOP } acc = location_accuracy_new(LOCATION_ACCURACY_LEVEL_DETAILED, accuracy, -1); if (!acc) { + //LCOV_EXCL_START LOCATIONS_LOGE("Failed to create accuracy"); location_position_free(pos); location_velocity_free(vel); return LOCATIONS_ERROR_OUT_OF_MEMORY; + //LCOV_EXCL_STOP } ret = location_set_mock_location(handle->object, pos, vel, acc); @@ -1629,7 +1671,7 @@ EXPORT_API int location_manager_clear_mock_location(location_manager_h manager) if (enabled == 0) return __convert_error_code(LOCATION_ERROR_SETTING_OFF); } else { - return __convert_error_code(ret); + return __convert_error_code(ret); //LCOV_EXCL_LINE } ret = location_clear_mock_location(handle->object); |