From: kj7.sung Date: Fri, 2 Dec 2016 03:03:22 +0000 (+0900) Subject: Fix distance callback X-Git-Tag: accepted/tizen/common/20161202.233320^0 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fapi%2Flocation-manager.git;a=commitdiff_plain;h=19237616d63b7c2be8e10d44904e5cb0baad6ca9 Fix distance callback Change-Id: I27566660cc770e697c1b130433f2b66f4b2d79fc Signed-off-by: kj7.sung --- diff --git a/packaging/capi-location-manager.changes b/packaging/capi-location-manager.changes index 77b2ac3..2a85062 100644 --- a/packaging/capi-location-manager.changes +++ b/packaging/capi-location-manager.changes @@ -1,3 +1,9 @@ +[Version] capi-location-manager_0.7.6 +[Date] 2 Dec 2016 +[Title] Fix distance based callback +[Developer] Kyoungjun Sung + +================================================================================ [Version] capi-location-manager_0.7.5 [Date] 28 Oct 2016 [Title] Dynamic interval table for multi handle diff --git a/packaging/capi-location-manager.spec b/packaging/capi-location-manager.spec index 2c26358..4bb8433 100644 --- a/packaging/capi-location-manager.spec +++ b/packaging/capi-location-manager.spec @@ -1,6 +1,6 @@ Name: capi-location-manager Summary: A Location Manager library in Tizen Native API -Version: 0.7.5 +Version: 0.7.6 Release: 1 Group: Location/API License: Apache-2.0 @@ -41,7 +41,7 @@ export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE" MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DLIBDIR=%{_libdir} -DINCLUDEDIR=%{_includedir} \ --DFULLVER=%{version} -DMAJORVER=${MAJORVER} -DTZ_SYS_RO_PACKAGES=%{TZ_SYS_RO_PACKAGES} -DTZ_SYS_RW_APP=%{TZ_SYS_RW_APP} \ +-DFULLVER=%{version} -DMAJORVER=${MAJORVER} -DTZ_SYS_RO_PACKAGES=%{TZ_SYS_RO_PACKAGES} -DTZ_SYS_SHARE=%{TZ_SYS_SHARE} \ make %{?jobs:-j%jobs} @@ -79,5 +79,5 @@ Test application of Location Manager %files test %manifest test/capi-location-manager-test.manifest %{TZ_SYS_RO_PACKAGES}/capi-location-manager-test.xml -%{TZ_SYS_RW_APP}/test/location/location_test +%{TZ_SYS_SHARE}/location/location_test %endif diff --git a/src/locations.c b/src/locations.c index ef839e5..1efd9b0 100755 --- a/src/locations.c +++ b/src/locations.c @@ -80,9 +80,10 @@ static void __cb_service_updated(GObject *self, guint type, gpointer data, gpoin 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]); + LocationVelocity *vel = (LocationVelocity *) velocity; + LocationAccuracy *acc = (LocationAccuracy *) accuracy; + ((location_changed_cb) handle->user_cb[_LOCATIONS_EVENT_TYPE_DISTANCE])(pos->latitude, pos->longitude, pos->altitude, + vel->speed, vel->direction, acc->horizontal_accuracy, pos->timestamp, handle->user_data[_LOCATIONS_EVENT_TYPE_DISTANCE]); } else { if (handle->user_cb[_LOCATIONS_EVENT_TYPE_POSITION] && (type & POSITION_UPDATED) != 0) { @@ -151,26 +152,6 @@ static void __cb_service_disabled(GObject *self, guint status, gpointer userdata } } -#if 0 -static void __cb_service_status_changed(GObject *self, guint status, gpointer userdata) -{ - LOCATIONS_LOGD("Invoked. status = %u", status); - location_manager_s *handle = (location_manager_s *) userdata; - - if (handle->user_cb[_LOCATIONS_EVENT_TYPE_SERVICE_STATE]) { - if (status == LOCATION_STATUS_2D_FIX || status == LOCATION_STATUS_3D_FIX) - ((location_service_state_changed_cb) - handle->user_cb[_LOCATIONS_EVENT_TYPE_SERVICE_STATE])(LOCATIONS_SERVICE_ENABLED, handle->user_data[_LOCATIONS_EVENT_TYPE_SERVICE_STATE]); - else if (status == LOCATION_STATUS_NO_FIX) - ((location_service_state_changed_cb) - handle->user_cb[_LOCATIONS_EVENT_TYPE_SERVICE_STATE])(LOCATIONS_SERVICE_DISABLED, handle->user_data[_LOCATIONS_EVENT_TYPE_SERVICE_STATE]); - else if (status == LOCATION_STATUS_MOCK_FAIL) - ((location_service_state_changed_cb) - handle->user_cb[_LOCATIONS_EVENT_TYPE_SERVICE_STATE])(LOCATIONS_SERVICE_ERROR, handle->user_data[_LOCATIONS_EVENT_TYPE_SERVICE_STATE]); - } -} -#endif - static int __compare_position(gconstpointer a, gconstpointer b) { if (location_position_equal((LocationPosition *) a, (LocationPosition *)b) == TRUE) @@ -560,13 +541,6 @@ EXPORT_API int location_manager_destroy(location_manager_h manager) handle->sig_id[_LOCATION_SIGNAL_SERVICE_DISABLED] = 0; } -#if 0 - if (handle->sig_id[_LOCATION_SIGNAL_STATUS_CHANGED]) { - g_signal_handler_disconnect(handle->object, handle->sig_id[_LOCATION_SIGNAL_STATUS_CHANGED]); - handle->sig_id[_LOCATION_SIGNAL_STATUS_CHANGED] = 0; - } -#endif - 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; diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 6f1e359..a442ad9 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -17,5 +17,5 @@ FOREACH(src ${sources}) TARGET_LINK_LIBRARIES(${src_name} ${fw_name} ${${fw_test}_LDFLAGS}) ENDFOREACH() -INSTALL(TARGETS ${src_name} DESTINATION ${TZ_SYS_RW_APP}/test/location/) +INSTALL(TARGETS ${src_name} DESTINATION ${TZ_SYS_SHARE}/location/) INSTALL(FILES ${fw_test}.xml DESTINATION ${TZ_SYS_RO_PACKAGES}/) diff --git a/test/capi-location-manager-test.xml b/test/capi-location-manager-test.xml index c1ed32e..17d722d 100644 --- a/test/capi-location-manager-test.xml +++ b/test/capi-location-manager-test.xml @@ -8,7 +8,7 @@ http://tizen.org/privilege/location http://tizen.org/privilege/location.enable - + diff --git a/test/location_test.c b/test/location_test.c index 2a901ff..75d69c7 100755 --- a/test/location_test.c +++ b/test/location_test.c @@ -368,10 +368,12 @@ static void _setting_cb(location_method_e method, bool enable, void *user_data) 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); +/* 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); + repeat_count++; + if (repeat_count > 60) + test_timer = g_timeout_add_seconds(1, wait_test, NULL); } static void print_location_status() @@ -495,11 +497,11 @@ static int location_test() fprintf(stderr, "gps_status_set_satellite_updated_cb: %d\n", ret); } break; - } + } case 4: case 5: case 6: { - int timeout = 30; + int timeout = 60; fprintf(stderr, "\n Input timeout ==> "); ret = scanf("%d", &timeout); @@ -509,7 +511,7 @@ static int location_test() ret = location_manager_request_single_location(manager, timeout, _location_cb, manager); fprintf(stderr, "request single_location (method: %d): %d\n", method, ret); break; - } + } case 11: case 12: case 13: {