Fixed a bug of location_bounds_create_polygon. 25/47325/1 tizen_3.0.m1_tv accepted/tizen/mobile/20150903.000021 accepted/tizen/tv/20150903.000210 accepted/tizen/wearable/20150903.000427 submit/tizen/20150902.114050 submit/tizen_common/20151015.190624 submit/tizen_common/20151019.135620 submit/tizen_common/20151023.083358 submit/tizen_common/20151026.085049 tizen_3.0.m1_tv_release
authorYoung-Ae Kang <youngae.kang@samsung.com>
Wed, 2 Sep 2015 09:31:11 +0000 (18:31 +0900)
committerYoung-Ae Kang <youngae.kang@samsung.com>
Wed, 2 Sep 2015 09:32:08 +0000 (18:32 +0900)
Change-Id: I44e4b1df21ea3b0986127c2d1361a238a979c0ad

packaging/capi-location-manager.spec
src/location_bounds.c
test/CMakeLists.txt
test/capi-location-manager-test.efl [deleted file]
test/capi-location-manager-test.manifest
test/capi-location-manager-test.xml [new file with mode: 0644]
test/location_test.c

index a93eb9d..2c77208 100755 (executable)
@@ -40,7 +40,7 @@ export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
 
 MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
 #cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER} \
-cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DBUILD_PKGTYPE=rpm -DLIBDIR=%{_libdir} -DINCLUDEDIR=%{_includedir} \
+cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DLIBDIR=%{_libdir} -DINCLUDEDIR=%{_includedir} \
 -DFULLVER=%{version} -DMAJORVER=${MAJORVER} \
 
 make %{?jobs:-j%jobs}
@@ -78,6 +78,6 @@ Test application of Location Manager
 
 %files test
 %manifest test/capi-location-manager-test.manifest
-/etc/smack/accesses.d/capi-location-manager-test.efl
+/usr/share/packages/capi-location-manager-test.xml
 /opt/usr/devel/location/location_test
 %endif
index a3c3919..f4f0201 100755 (executable)
@@ -160,7 +160,10 @@ EXPORT_API int location_bounds_create_polygon(location_coords_s *coords_list, in
                }
                position = location_position_new(0, coords_list[i].latitude, coords_list[i].longitude, 0.0, LOCATION_STATUS_2D_FIX);
                position_list = g_list_append(position_list, position);
+
+               /* We should not remove position
                location_position_free(position);
+               */
                isValid = TRUE;
        }
 
@@ -195,6 +198,7 @@ EXPORT_API int location_bounds_create_polygon(location_coords_s *coords_list, in
                        return LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY;
                }
        }
+
        handle->user_cb = NULL;
        handle->user_data = NULL;
 
index 475882f..9ff83b7 100644 (file)
@@ -7,7 +7,7 @@ FOREACH(flag ${${fw_test}_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
 ENDFOREACH(flag)
 
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -Werror")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall")
 
 aux_source_directory(. sources)
 FOREACH(src ${sources})
@@ -18,6 +18,4 @@ FOREACH(src ${sources})
 ENDFOREACH()
 
 INSTALL(TARGETS ${src_name} DESTINATION /opt/usr/devel/location/)
-INSTALL(FILES ${fw_test}.efl DESTINATION /etc/smack/accesses.d)
-
-
+INSTALL(FILES ${fw_test}.xml DESTINATION /usr/share/packages)
diff --git a/test/capi-location-manager-test.efl b/test/capi-location-manager-test.efl
deleted file mode 100644 (file)
index 0c12eb3..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-capi-location-manager-test sys-assert::core rwxat- ------
-org.tizen.crash-popup capi-location-manager-test --x--- ------
-capi-location-manager-test privacy-manager::db rwxa-- ------
-capi-location-manager-test privacy-manager::daemon -w---- ------
-capi-location-manager-test sdbd rwx--l ------
-capi-location-manager-test wrt-security-daemon rwx--l ------
-capi-location-manager-test aul::launch --x--- ------
-capi-location-manager-test org.tizen.browser --x--- ------
-capi-location-manager-test xorg -w---- ------
-capi-location-manager-test aul r----- ------
-capi-location-manager-test isf r----- ------
-capi-location-manager-test pkgmgr::db r----l ------
-capi-location-manager-test pkgmgr::info r----- ------
-capi-location-manager-test ail::db r----- ------
-capi-location-manager-test system::vconf_inhouse r----l ------
-capi-location-manager-test system::vconf_system r----l ------
-capi-location-manager-test system::vconf_setting r----l ------
-capi-location-manager-test system::vconf_multimedia r----l ------
-capi-location-manager-test system::vconf_misc rwx--l ------
-capi-location-manager-test system::vconf_privacy rwx--- ------
-capi-location-manager-test system::vconf rwxat- ------
-capi-location-manager-test system::vconf_network rw---- ------
-capi-location-manager-test system::share rwxat- ------
-capi-location-manager-test system::hwcodec rw---- ------
-capi-location-manager-test system::crash -wx--- ------
-capi-location-manager-test system::use_internet rw---- ------
-capi-location-manager-test system::app_logging -w---- ------
-capi-location-manager-test location_fw::vconf rw---- ------
-capi-location-manager-test location_fw::client rw---- ------
-capi-location-manager-test location_fw::server r----- ------
index be3e59b..a76fdba 100755 (executable)
@@ -1,19 +1,5 @@
 <manifest>
-       <define>
-               <domain name="capi-location-manager-test"/>
-               <request>
-                       <smack request="sys-assert::core" type="rwxat"/>
-                       <smack request="deviced::display" type="rw"/>
-                       <smack request="device::app_logging" type="w"/>
-                       <smack request="device::sys_logging" type="w"/>
-                       <smack request="system::vconf_setting" type="r" />
-                       <smack request="system::vconf" type="r" />
-                       <smack request="location_fw::vconf" type="rwx"/>
-                       <smack request="location_fw::client" type="rwx" />
-                       <smack request="location_fw::server" type="r"/>
-               </request>
-               <permit>
-                       <smack permit="sdbd" type="rx"/>
-               </permit>
-       </define>
+       <request>
+               <domain name="_" />
+       </request>
 </manifest>
diff --git a/test/capi-location-manager-test.xml b/test/capi-location-manager-test.xml
new file mode 100644 (file)
index 0000000..1a8da2b
--- /dev/null
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" package="capi-location-manager-test" version="1.0.0" install-location="internal-only">
+       <label>Location</label>
+       <author email="youngae.kang@samsung.com" href="www.samsung.com">Youngae kang</author>
+       <author email="kj7.sung@samsung.com" href="www.samsung.com">Kyoungjun Sung</author>
+       <description>Location Manager Test</description>
+       <privileges>
+               <privilege>http://tizen.org/privilege/location</privilege>
+               <privilege>http://tizen.org/privilege/location.enable</privilege>
+       </privileges>
+       <ui-application appid="capi-location-manager-test" exec="/opt/usr/devel/location/location-test" nodisplay="true" multiple="false" type="capp" taskmanage="false" launch_mode="single">
+               <label>Location Manager Test</label>
+       </ui-application>
+</manifest>
index 500a73c..e4aacf4 100755 (executable)
 #include <glib.h>
 #include <locations.h>
 #include <location_bounds.h>
+#include <location_batch.h>
 
 static location_manager_h manager;
 static GMainLoop *g_mainloop = NULL;
-static char *menu;
+static int menu;
 
+static int repeat_count;
 static void location_cleanup();
 static int location_test();
 
@@ -65,71 +67,7 @@ static bool last_satellites_foreach_cb(unsigned int azimuth, unsigned int elevat
               prn, snr, is_in_use);
        return true;
 }
-#endif
-
-static bool satellites_foreach_cb(unsigned int azimuth, unsigned int elevation, unsigned int prn, int snr, bool is_in_use,
-                                  void *user_data)
-{
-       printf("[Satellite information] azimuth : %d, elevation: %d, prn: %d, snr: %d, used: %d\n", azimuth, elevation, prn,
-              snr, is_in_use);
-       return true;
-}
 
-static void _state_change_cb(location_service_state_e state, void *user_data)
-{
-       fprintf(stderr, "--------------------------state change %d---------\n", state);
-       location_manager_h lm = (location_manager_h) user_data;
-       if (state == LOCATIONS_SERVICE_ENABLED) {
-               int ret;
-               double altitude;
-               double latitude;
-               double longitude;
-               time_t timestamp;
-               ret = location_manager_get_position(lm, &altitude, &latitude, &longitude, &timestamp);
-               if (ret != LOCATIONS_ERROR_NONE) {
-                       printf(" Fail: location_manager_get_position ---> %d \n", ret);
-               } else {
-                       printf("[%ld] alt: %g, lat %g, long %g\n", timestamp, altitude, latitude, longitude);
-               }
-
-               location_accuracy_level_e level;
-               double horizontal;
-               double vertical;
-               ret = location_manager_get_accuracy(lm, &level, &horizontal, &vertical);
-               if (ret != LOCATIONS_ERROR_NONE) {
-                       printf(" Fail: location_manager_get_accuracy ---> %d \n", ret);
-               } else {
-                       printf("Level: %d, horizontal: %g, vertical %g\n", level, horizontal, vertical);
-               }
-
-               char *nmea;
-               ret = gps_status_get_nmea(lm, &nmea);
-               if (ret != LOCATIONS_ERROR_NONE) {
-                       printf(" Fail: gps_status_get_nmea ---> %d \n", ret);
-               } else {
-                       printf("NMEA: %s\n", nmea);
-                       free(nmea);
-               }
-
-               int num_of_view = 0, num_of_active = 0;
-               ret = gps_status_get_satellite(lm, &num_of_active, &num_of_view, &timestamp);
-               if (ret != LOCATIONS_ERROR_NONE) {
-                       printf(" Fail: gps_status_get_satellite_count_in_view ---> %d \n", ret);
-               } else {
-                       printf("[%ld] Satellite number of active: %d, in view: %d\n", timestamp, num_of_active, num_of_view);
-               }
-
-               if (num_of_view) {
-                       ret = gps_status_foreach_satellites_in_view(lm, satellites_foreach_cb, user_data);
-                       if (ret != LOCATIONS_ERROR_NONE) {
-                               printf(" Fail: gps_status_foreach_satellites_in_view ---> %d \n", ret);
-                       }
-               }
-               g_timeout_add_seconds(1, wait_test, NULL);
-       }
-}
-
-#if 0
 static bool __poly_coords_cb(location_coords_s coords, void *user_data)
 {
        printf("location_bounds_foreach_rect_coords(latitude: %lf, longitude: %lf) \n", coords.latitude, coords.longitude);
@@ -316,7 +254,65 @@ void location_get_last_information_test()
 }
 #endif
 
-void location_cb(int error, double latitude, double longitude, double altitude, time_t timestamp, double speed, double climb, double direction, void *user_data)
+static void _state_change_cb(location_service_state_e state, void *user_data)
+{
+       fprintf(stderr, "--------------------------state change: %d---------\n", state);
+       location_manager_h lm = (location_manager_h) user_data;
+       if (state == LOCATIONS_SERVICE_ENABLED) {
+               int ret;
+               double altitude;
+               double latitude;
+               double longitude;
+               time_t timestamp;
+               ret = location_manager_get_position(lm, &altitude, &latitude, &longitude, &timestamp);
+               if (ret != LOCATIONS_ERROR_NONE) {
+                       printf(" Fail: location_manager_get_position ---> %d \n", ret);
+               } else {
+                       printf("[%ld] alt: %g, lat %g, long %g\n", timestamp, altitude, latitude, longitude);
+               }
+
+               location_accuracy_level_e level;
+               double horizontal;
+               double vertical;
+               ret = location_manager_get_accuracy(lm, &level, &horizontal, &vertical);
+               if (ret != LOCATIONS_ERROR_NONE) {
+                       printf(" Fail: location_manager_get_accuracy ---> %d \n", ret);
+               } else {
+                       printf("Level: %d, horizontal: %g, vertical %g\n", level, horizontal, vertical);
+               }
+#if 0
+               char *nmea;
+               ret = gps_status_get_nmea(lm, &nmea);
+               if (ret != LOCATIONS_ERROR_NONE) {
+                       printf(" Fail: gps_status_get_nmea ---> %d \n", ret);
+               } else {
+                       printf("NMEA: %s\n", nmea);
+                       free(nmea);
+               }
+#endif
+       }
+
+}
+
+void _position_updated_cb(double latitude, double longitude, double altitude, time_t timestamp, void *user_data)
+{
+       fprintf(stderr, "-------------------------- position updated --------------------------\n");
+       printf("[%ld] lat[%f] lon[%f] alt[%f]\n", timestamp, latitude, longitude, altitude);
+
+       repeat_count++;
+
+       if (repeat_count > 2) {
+               g_timeout_add_seconds(1, wait_test, NULL);
+       }
+}
+
+void _velocity_updated_cb(double speed, double direction, double climb, time_t timestamp, void *user_data)
+{
+       fprintf(stderr, "-------------------------- velocity updated --------------------------\n");
+       printf("[%ld] speed[%f] direction[%f] climb[%f]\n", timestamp, speed, direction, climb);
+}
+
+void _location_cb(int error, double latitude, double longitude, double altitude, time_t timestamp, double speed, double climb, double direction, void *user_data)
 {
        printf("error[%d]\n", error);
        printf("location_cb: lat[%f] lon[%f] alt[%f]\n", latitude, longitude, altitude);
@@ -325,44 +321,49 @@ void location_cb(int error, double latitude, double longitude, double altitude,
        g_timeout_add_seconds(1, wait_test, NULL);
 }
 
-static void __setting_cb(location_method_e method, bool enable, void *user_data)
+void _location_changed_cb(double latitude, double longitude, double altitude, double speed, double direction, double horizontal_accuracy, time_t timestamp, void *user_data)
 {
-       printf("method[%d], enable[%d]\n", method, enable);
+       fprintf(stderr, "-------------------------- location changed --------------------------\n");
+       printf("[%ld] lat[%f] lon[%f] alt[%f] speed[%lf] direction[%lf], horizontal_accuracy[%lf]\n", timestamp, latitude, longitude, altitude, speed, direction, horizontal_accuracy);
+
+       repeat_count++;
+
+       if (repeat_count > 2) {
+               g_timeout_add_seconds(1, wait_test, NULL);
+       }
 }
 
-static void select_menu()
+bool _get_location_cb(double latitude, double longitude, double altitude, double speed, double direction, double horizontal, double vertical, time_t timestamp, void *user_data)
 {
-       char buf[256];
-       int len = 0;
-       char *str = NULL;
+       fprintf(stderr, "-------------------------- batch: get location --------------------------\n");
+       printf("[%ld] lat[%f] lon[%f] alt[%f] speed[%lf] direction[%lf], horizontal_accuracy[%lf]\n", timestamp, latitude, longitude, altitude, speed, direction, horizontal);
+       return TRUE;
+}
+
+void _location_batch_cb(int num_of_location, void *user_data)
+{
+       fprintf(stderr, "-------------------------- location batch --------------------------\n");
+       printf("num_of_location: [%d]\n", num_of_location);
 
-       str = fgets(buf, 255, stdin);
-       if (NULL == str) {
-               printf("fgets return NULL. \n");
+       location_manager_h manager = user_data;
+
+       if (num_of_location > 0) {
+               location_manager_foreach_location_batch(manager, _get_location_cb, user_data);
        }
-       len = g_utf8_strlen(buf, -1);
-       buf[len - 1] = '\0';
+       repeat_count++;
 
-       g_free(menu);
-       menu = g_strdup(buf);
+       if (repeat_count > 1) {
+               g_timeout_add_seconds(1, wait_test, NULL);
+       }
 }
 
-static void print_menu()
+static void __setting_cb(location_method_e method, bool enable, void *user_data)
 {
-       printf("==== LOCATION TEST ======\n");
-       printf("[1] LOCATIONS_METHOD_HYBRID: Get location\n");
-       printf("[2] LOCATIONS_METHOD_GPS: Get location\n");
-       printf("[3] LOCATIONS_METHOD_WPS: Get location\n");
-       printf("[4] LOCATIONS_METHOD_HYBRID: Single location\n");
-       printf("[5] LOCATIONS_METHOD_GPS: Single location\n");
-       printf("[x] Exit!!!\n\n");
-       printf("Select menu: ");
+       printf("method[%d], enable[%d]\n", method, enable);
 }
 
-static int location_test()
+static void print_location_status()
 {
-       int ret = LOCATIONS_ERROR_NONE;
-
        printf("==== LOCATION STATUS ======\n");
        bool is_enabled = FALSE;
        location_manager_is_enabled_method(LOCATIONS_METHOD_HYBRID, &is_enabled);
@@ -373,43 +374,210 @@ static int location_test()
 
        location_manager_is_enabled_method(LOCATIONS_METHOD_WPS, &is_enabled);
        printf("wps: %d\n", is_enabled);
+}
+
+static int enable_method(location_method_e method, bool enable)
+{
+       int ret = 0;
+       printf("==== LOCATION STATUS ======\n");
 
+       location_manager_set_setting_changed_cb(LOCATIONS_METHOD_HYBRID, __setting_cb, NULL);
        location_manager_set_setting_changed_cb(LOCATIONS_METHOD_GPS, __setting_cb, NULL);
        location_manager_set_setting_changed_cb(LOCATIONS_METHOD_WPS, __setting_cb, NULL);
 
+       ret = location_manager_enable_method(method, enable);
+       printf("method[%d]: %d\n", method, enable);
+       return ret;
+}
+
+static void print_menu()
+{
+       printf("==== LOCATION TEST ======\n");
+       printf("[1] Get location: LOCATIONS_METHOD_HYBRID\n");
+       printf("[2] Get location: LOCATIONS_METHOD_GPS\n");
+       printf("[3] Get location: LOCATIONS_METHOD_WPS\n");
+       printf("[4] Single location: LOCATIONS_METHOD_HYBRID\n");
+       printf("[5] Single location: LOCATIONS_METHOD_GPS\n");
+       printf("[6] Single location: LOCATIONS_METHOD_WPS\n\n");
+       printf("[11] Change update interval: LOCATIONS_METHOD_HYBRID\n");
+       printf("[12] Change update interval: LOCATIONS_METHOD_GPS\n\n");
+       printf("[21] Distance based location update: LOCATIONS_METHOD_HYBRID\n");
+       printf("[22] Distance based location update: LOCATIONS_METHOD_GPS\n");
+       printf("[23] Distance based location update: LOCATIONS_METHOD_WPS\n\n");
+       printf("[31] Location batch update: LOCATIONS_METHOD_GPS\n\n");
+       printf("[41] Turn on/off method: LOCATIONS_METHOD_HYBRID\n");
+       printf("[42] Turn on/off method: LOCATIONS_METHOD_GPS\n");
+       printf("[43] Turn on/off method: LOCATIONS_METHOD_WPS\n\n");
+       printf("[51] Boundary Test\n\n");
+       printf("[0] Exit!!!\n\n");
+       printf("Select menu: ");
+
+       if (scanf("%d", &menu) < 0) {
+               printf("Can't read menu !!!\n");
+       }
+}
+
+static int location_test()
+{
+       int ret = LOCATIONS_ERROR_NONE;
+       int basic = 0;
+       int interval = 1;
+
+       print_location_status();
        print_menu();
-       select_menu();
-
-       if (strcmp(menu, "1") == 0) {
-               ret = location_manager_create(LOCATIONS_METHOD_HYBRID, &manager);
-               printf("LOCATIONS_METHOD_HYBRID create: %d\n", ret);
-               ret = location_manager_start(manager);
-               printf("start:  %d\n", ret);
-       } else if (strcmp(menu, "2") == 0) {
-               ret = location_manager_create(LOCATIONS_METHOD_GPS, &manager);
-               printf("LOCATIONS_METHOD_GPS create: %d\n", ret);
-               ret = location_manager_start(manager);
-               printf("start:  %d\n", ret);
-       } else if (strcmp(menu, "3") == 0) {
-               ret = location_manager_create(LOCATIONS_METHOD_WPS, &manager);
-               printf("LOCATIONS_METHOD_WPS create: %d\n", ret);
-       } else if (strcmp(menu, "4") == 0) {
-               ret = location_manager_create(LOCATIONS_METHOD_HYBRID, &manager);
-               printf("LOCATIONS_METHOD_HYBRID create: %d\n", ret);
-               ret = location_manager_request_single_location(manager, 60, location_cb, manager);
-               printf("single_location create: %d\n", ret);
-       } else if (strcmp(menu, "5") == 0) {
-               ret = location_manager_create(LOCATIONS_METHOD_GPS, &manager);
-               printf("LOCATIONS_METHOD_HYBRID create: %d\n", ret);
-               ret = location_manager_request_single_location(manager, 60, location_cb, manager);
-               printf("single_location create: %d\n", ret);
-       } else if (strcmp(menu, "x") == 0) {
-               g_timeout_add_seconds(0.1, exit_program, NULL);
-               return 0;
-       } else {
-               printf("Exit!!! Input: %s\n", menu);
-               g_timeout_add_seconds(0.1, exit_program, NULL);
-               return 0;
+
+       switch (menu) {
+               case 1:
+                       basic = 1;
+                       ret = location_manager_create(LOCATIONS_METHOD_HYBRID, &manager);
+                       printf("LOCATIONS_METHOD_HYBRID create: %d\n", ret);
+                       ret = location_manager_start(manager);
+                       printf("start: %d\n", ret);
+                       break;
+               case 2:
+                       basic = 1;
+                       ret = location_manager_create(LOCATIONS_METHOD_GPS, &manager);
+                       printf("LOCATIONS_METHOD_GPS create: %d\n", ret);
+                       ret = location_manager_start(manager);
+                       printf("start: %d\n", ret);
+                       break;
+               case 3:
+                       basic = 1;
+                       ret = location_manager_create(LOCATIONS_METHOD_WPS, &manager);
+                       ret = location_manager_start(manager);
+                       printf("start: %d\n", ret);
+                       break;
+               case 4:
+               case 5:
+               case 6: {
+                       int timeout = 30;
+
+                       printf("\n      Input timeout ==> ");
+                       ret = scanf("%d", &timeout);
+
+                       int method = menu - 4;
+                       ret = location_manager_create(method, &manager);
+                       ret = location_manager_request_single_location(manager, timeout, _location_cb, manager);
+                       printf("request single_location (method: %d): %d\n", method, ret);
+                       break;
+                       }
+               case 11:
+               case 12:
+               case 13: {
+                       repeat_count = 0;
+                       int interval = 1;
+
+                       printf("\n      Input position interval ==> ");
+                       ret = scanf("%d", &interval);
+
+                       int method = menu - 4;
+                       ret = location_manager_create(method, &manager);
+                       printf("location_manager_create (method: %d): %d\n", method, ret);
+
+                       ret = location_manager_set_position_updated_cb(manager, _position_updated_cb, interval, (void *)manager);
+                       printf("set position changed callback: %d\n", ret);
+
+                       /*
+                       ret = location_manager_set_velocity_updated_cb(manager, _velocity_updated_cb, interval*2, (void *)manager);
+                       printf("set velocity changed callback: %d\n", ret);
+                       */
+
+                       ret = location_manager_set_location_changed_cb(manager, _location_changed_cb, interval * 2, (void *)manager);
+                       printf("set location changed callback: %d\n", ret);
+
+                       ret = location_manager_start(manager);
+                       repeat_count = 0;
+                       break;
+                       }
+               case 21:
+               case 22:
+               case 23: {
+                       repeat_count = 0;
+                       int interval = 1;
+                       int method = menu - 21;
+
+                       printf("\n      Input position interval ==> ");
+                       ret = scanf("%d", &interval);
+
+                       ret = location_manager_create(method, &manager);
+                       printf("location_manager_create (method : %d)", method);
+
+                       /*ret = location_manager_set_position_updated_cb(manager, _position_updated_cb, interval, (void *)manager); */
+                       /*printf("set position changed callback: %d\n", ret); */
+
+                       ret = location_manager_set_distance_based_location_changed_cb(manager, _location_changed_cb, interval, 30, (void *)manager);
+                       printf("set location changed callback: %d\n", ret);
+
+                       ret = location_manager_start(manager);
+                       break;
+                       }
+               case 31: {
+                       repeat_count = 0;
+                       int interval = 1;
+                       printf("\n      Input batch interval ==> ");
+                       ret = scanf("%d", &interval);
+
+                       int period = 60;
+                       printf("        Input batch period ==> ");
+                       ret = scanf("%d", &period);
+
+
+                       ret = location_manager_create(LOCATIONS_METHOD_GPS, &manager);
+                       printf("location_manager_create (method : %d)\n", LOCATIONS_METHOD_GPS);
+
+                       ret = location_manager_set_location_batch_cb(manager, _location_batch_cb, interval, period, (void *)manager);
+                       printf("set location batch callback: %d\n", ret);
+
+                       ret = location_manager_start_batch(manager);
+                       break;
+                       }
+               case 41:
+               case 42:
+               case 43: {
+                       int method = menu - 41;
+                       int onoff = 1;
+
+                       printf("\n      Input ON: 1 or OFF: 0 ==> ");
+                       ret = scanf("%d", &onoff);
+
+                       ret = enable_method(method, onoff);
+                       printf("Enabling method[%d]: %d\n", method, ret);
+                       break;
+                       }
+
+               case 51: {
+                       location_bounds_h hPolyLocationBound = NULL;
+                       bool bIsContained = false;
+                       int nPolySize = 3;
+                       location_coords_s location_coord_list[nPolySize];
+                       location_coord_list[0].latitude = 10;
+                       location_coord_list[0].longitude = 10;
+                       location_coord_list[1].latitude = 20;
+                       location_coord_list[1].longitude = 20;
+                       location_coord_list[2].latitude = 30;
+                       location_coord_list[2].longitude = 10;
+
+                       //Checking coordinates in location boundary
+                       location_coords_s testLocationCoordinates;
+                       testLocationCoordinates.latitude = 20;
+                       testLocationCoordinates.longitude = 12;
+                       location_bound_error_e nRet = location_bounds_create_polygon(location_coord_list, nPolySize, &hPolyLocationBound);
+
+                       printf("location_bounds_create_polygon= %d\n", nRet);
+
+                       bIsContained = location_bounds_contains_coordinates(hPolyLocationBound, testLocationCoordinates);// Target API
+                       printf("bIsContained : %d\n", bIsContained);
+
+                       location_bounds_destroy(hPolyLocationBound);
+                       break;
+                       }
+               case 0:
+                       g_timeout_add_seconds(0.1, exit_program, NULL);
+                       return 0;
+               default:
+                       printf("Exit!!! Input: %d\n", menu);
+                       g_timeout_add_seconds(0.1, exit_program, NULL);
+                       return 0;
        }
 
        if (ret != LOCATIONS_ERROR_NONE) {
@@ -417,23 +585,36 @@ static int location_test()
                g_timeout_add_seconds(0.1, exit_program, NULL);
                return 0;
        }
-       ret = location_manager_set_service_state_changed_cb(manager, _state_change_cb, (void *)manager);
-       printf("set state callback: %d\n", ret);
-
-       /* location_bounds_test(); */
-       /* set zone changed callback */
-       /*
-       ret = location_manager_set_zone_changed_cb(manager, zone_event_cb, (void *)manager);
-       printf("set zone callback: %d\n", ret);
-       */
+
+       if (menu < 40) {
+               ret = location_manager_set_service_state_changed_cb(manager, _state_change_cb, (void *)manager);
+               printf("set state changed callback: %d\n", ret);
+
+               if (basic) {
+                       ret = location_manager_set_position_updated_cb(manager, _position_updated_cb, interval, (void *)manager);
+                       printf("set position changed callback: %d\n", ret);
+               }
+       }
+       else {
+               g_timeout_add_seconds(0.1, wait_test, NULL);
+       }
+
        return 0;
 }
 
 static void location_cleanup()
 {
+       int ret = 0;
        if (manager != NULL) {
-               int ret = location_manager_stop(manager);
+               ret = location_manager_stop(manager);
                printf("stop: %d\n", ret);
+
+               ret = location_manager_unset_service_state_changed_cb(manager);
+               printf("unset: %d\n", ret);
+
+               ret = location_manager_unset_position_updated_cb(manager);
+               printf("unset: %d\n", ret);
+
                ret = location_manager_destroy(manager);
                printf("destroy: %d\n", ret);
                manager = NULL;