--- /dev/null
+#!/bin/sh
+
+. ./config
+export TET_INSTALL_PATH=$TET_INSTALL_HOST_PATH # tetware root path
+export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target # tetware target path
+export PATH=$TET_TARGET_PATH/bin:$PATH
+export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
+export TET_ROOT=$TET_TARGET_PATH
--- /dev/null
+#!/bin/sh
+. ./config
+export TET_INSTALL_PATH=$TET_INSTALL_TARGET_PATH # path to path
+export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target
+export PATH=$TET_TARGET_PATH/bin:$PATH
+export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
+export TET_ROOT=$TET_TARGET_PATH
--- /dev/null
+#!/bin/sh
+
+. ./_export_env.sh # setting environment variables
+
+export TET_SUITE_ROOT=`pwd`
+FILE_NAME_EXTENSION=`date +%s`
+
+RESULT_DIR=results
+HTML_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.html
+JOURNAL_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.journal
+
+mkdir -p $RESULT_DIR
+
+tcc -c -p ./
+tcc -b -j $JOURNAL_RESULT -p ./
+grw -c 7 -f chtml -o $HTML_RESULT $JOURNAL_RESULT
--- /dev/null
+#!/bin/sh
+
+. ./_export_env.sh # setting environment variables
+
+export TET_SUITE_ROOT=`pwd`
+RESULT_DIR=results
+
+tcc -c -p ./ # executing tcc, with clean option (-c)
+rm -r $RESULT_DIR
+rm -r tet_tmp_dir
+rm testcase/tet_captured
--- /dev/null
+TET_INSTALL_HOST_PATH=/home/rookiejava/dts_tool/TETware
+TET_INSTALL_TARGET_PATH=/mnt/nfs/dts_tool/TETware
--- /dev/null
+#!/bin/sh
+
+. ./_export_target_env.sh # setting environment variables
+
+export TET_SUITE_ROOT=`pwd`
+FILE_NAME_EXTENSION=`date +%s`
+
+RESULT_DIR=results
+HTML_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.html
+JOURNAL_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.journal
+
+mkdir -p $RESULT_DIR
+
+tcc -e -j $JOURNAL_RESULT -p ./
+grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT
--- /dev/null
+CC ?= gcc
+
+C_FILES = $(shell ls *.c)
+
+PKGS = capi-location-manager dlog glib-2.0 gthread-2.0 capi-location-geocoder
+
+LDFLAGS = `pkg-config --libs $(PKGS)`
+LDFLAGS += $(TET_ROOT)/lib/tet3/tcm_s.o
+LDFLAGS += -L$(TET_ROOT)/lib/tet3 -ltcm_s
+LDFLAGS += -L$(TET_ROOT)/lib/tet3 -lapi_s
+
+CFLAGS = -I. `pkg-config --cflags $(PKGS)`
+CFLAGS += -I$(TET_ROOT)/inc/tet3
+CFLAGS += -Wall
+
+#TARGETS = $(C_FILES:%.c=tc-%)
+TCS := $(shell ls -1 *.c | cut -d. -f1)
+
+all: $(TCS)
+
+%: %.c
+ $(CC) -o $@ $< $(CFLAGS) $(LDFLAGS)
+
+clean:
+ rm -f $(TCS)
--- /dev/null
+/testcase/utc_location_location_manager
+/testcase/utc_location_gps_status
+/testcase/utc_location_location_manager_callback
+/testcase/utc_location_preference
--- /dev/null
+/*
+* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#include <tet_api.h>
+#include <locations.h>
+#include <glib.h>
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_location_gps_status_get_nmea_p(void);
+static void utc_location_gps_status_get_nmea_n(void);
+static void utc_location_gps_status_get_nmea_n_02(void);
+static void utc_location_gps_status_get_nmea_n_03(void);
+static void utc_location_gps_status_get_satellite_p(void);
+static void utc_location_gps_status_get_satellite_n(void);
+static void utc_location_gps_status_get_satellite_n_02(void);
+static void utc_location_gps_status_get_satellite_n_03(void);
+static void utc_location_gps_status_get_satellite_n_04(void);
+static void utc_location_gps_status_get_satellite_n_05(void);
+static void utc_location_gps_status_get_satellite_n_06(void);
+static void utc_location_gps_status_foreach_satellites_in_view_p(void);
+static void utc_location_gps_status_foreach_satellites_in_view_n(void);
+static void utc_location_gps_status_foreach_satellites_in_view_n_02(void);
+static void utc_location_gps_status_foreach_satellites_in_view_n_03(void);
+static void utc_location_gps_status_foreach_last_satellites_in_view_p(void);
+static void utc_location_gps_status_foreach_last_satellites_in_view_n(void);
+static void utc_location_gps_status_foreach_last_satellites_in_view_n_02(void);
+static void utc_location_gps_status_get_last_satellite_p(void);
+static void utc_location_gps_status_get_last_satellite_n(void);
+static void utc_location_gps_status_get_last_satellite_n_02(void);
+static void utc_location_gps_status_get_last_satellite_n_03(void);
+static void utc_location_gps_status_get_last_satellite_n_04(void);
+
+
+
+struct tet_testlist tet_testlist[] = {
+ {utc_location_gps_status_get_nmea_p, POSITIVE_TC_IDX},
+ {utc_location_gps_status_get_nmea_n, NEGATIVE_TC_IDX},
+ {utc_location_gps_status_get_nmea_n_02, NEGATIVE_TC_IDX},
+// {utc_location_gps_status_get_nmea_n_03, NEGATIVE_TC_IDX}, //Can't check created location_manager_h
+ {utc_location_gps_status_get_satellite_p, POSITIVE_TC_IDX},
+ {utc_location_gps_status_get_satellite_n, NEGATIVE_TC_IDX},
+ {utc_location_gps_status_get_satellite_n_02, NEGATIVE_TC_IDX},
+// {utc_location_gps_status_get_satellite_n_03, NEGATIVE_TC_IDX}, //Can't check created location_manager_h
+ {utc_location_gps_status_get_satellite_n_04, NEGATIVE_TC_IDX},
+ {utc_location_gps_status_get_satellite_n_05, NEGATIVE_TC_IDX},
+ {utc_location_gps_status_get_satellite_n_06, NEGATIVE_TC_IDX},
+ {utc_location_gps_status_foreach_satellites_in_view_p, POSITIVE_TC_IDX},
+ {utc_location_gps_status_foreach_satellites_in_view_n, NEGATIVE_TC_IDX},
+ {utc_location_gps_status_foreach_satellites_in_view_n_02, NEGATIVE_TC_IDX},
+// {utc_location_gps_status_foreach_satellites_in_view_n_03, NEGATIVE_TC_IDX }, //Can't check created location_manager_h
+ {utc_location_gps_status_foreach_last_satellites_in_view_p, POSITIVE_TC_IDX},
+ {utc_location_gps_status_foreach_last_satellites_in_view_n, NEGATIVE_TC_IDX},
+ {utc_location_gps_status_foreach_last_satellites_in_view_n_02, NEGATIVE_TC_IDX},
+ {utc_location_gps_status_get_last_satellite_p, POSITIVE_TC_IDX},
+ {utc_location_gps_status_get_last_satellite_n, NEGATIVE_TC_IDX},
+ {utc_location_gps_status_get_last_satellite_n_02, NEGATIVE_TC_IDX},
+ {utc_location_gps_status_get_last_satellite_n_03, NEGATIVE_TC_IDX},
+ {utc_location_gps_status_get_last_satellite_n_04, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static GMainLoop *g_mainloop = NULL;
+static GThread *event_thread;
+
+gpointer GmainThread(gpointer data)
+{
+ g_mainloop = g_main_loop_new(NULL, 0);
+ g_main_loop_run(g_mainloop);
+
+ return NULL;
+}
+
+static bool service_enabled = false;
+
+static void validate_and_next(char *api_name, int act_ret, int ext_ret, char *fail_msg)
+{
+ dts_message(api_name, "Actual Result : %d, Expected Result : %d", act_ret, ext_ret);
+ if (act_ret != ext_ret) {
+ dts_message(api_name, "Fail Message: %s", fail_msg);
+ dts_fail(api_name);
+ }
+}
+
+static void validate_eq(char *api_name, int act_ret, int ext_ret)
+{
+ dts_message(api_name, "Actual Result : %d, Expected Result : %d", act_ret, ext_ret);
+ if (act_ret == ext_ret) {
+ dts_pass(api_name);
+ } else {
+ dts_fail(api_name);
+ }
+}
+
+static void unprepare(location_manager_h manager)
+{
+ location_manager_unset_service_state_changed_cb(manager);
+ location_manager_destroy(manager);
+ service_enabled = false;
+}
+
+static void wait_for_service(char *api_name)
+{
+ int timeout = 0;
+ for (timeout; timeout < 30; timeout++) {
+ if (service_enabled) {
+ dts_message(api_name, "Location Service Enabled!!!!");
+ break;
+ } else {
+ dts_message(api_name, "Location Service Disabled!!!!");
+ sleep(1);
+ }
+ }
+}
+
+static void capi_state_changed_cb(location_service_state_e state, void *user_data)
+{
+ switch (state) {
+ case LOCATIONS_SERVICE_ENABLED:
+ service_enabled = true;
+ break;
+ case LOCATIONS_SERVICE_DISABLED:
+ service_enabled = false;
+ break;
+ default:
+ break;
+ }
+}
+
+static location_manager_h manager;
+
+static void startup(void)
+{
+ g_setenv("PKG_NAME", "com.samsung.capi-location-gps-status-test", 1);
+ g_setenv("LOCATION_TEST_ENABLE", "1", 1);
+
+#if !GLIB_CHECK_VERSION (2, 31, 0)
+ if (!g_thread_supported()) {
+ g_thread_init(NULL);
+ }
+#endif
+
+ GError *gerr = NULL;
+ event_thread = g_thread_create(GmainThread, NULL, 1, &gerr);
+
+ int ret;
+ ret = location_manager_create(LOCATIONS_METHOD_GPS, &manager);
+ validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_manager_create() is failed");
+
+ /* You don't need it
+ ret = location_manager_set_service_state_changed_cb(manager, capi_state_changed_cb, NULL);
+ validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_manager_set_service_state_changed_cb() is failed");
+ */
+
+ ret = location_manager_start(manager);
+ validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_manager_start() is failed");
+
+ wait_for_service(__func__);
+}
+
+static void cleanup(void)
+{
+ unprepare(manager);
+ g_main_loop_quit(g_mainloop);
+ g_thread_join(event_thread);
+}
+
+static void utc_location_gps_status_get_nmea_p(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ char *nmea;
+ ret = gps_status_get_nmea(manager, &nmea);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
+}
+
+static void utc_location_gps_status_get_nmea_n(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ ret = gps_status_get_nmea(manager, NULL);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_gps_status_get_nmea_n_02(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ char *nmea;
+ ret = gps_status_get_nmea(NULL, &nmea);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+
+}
+
+static void utc_location_gps_status_get_nmea_n_03(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ char *nmea;
+ location_manager_h manager_02;
+ ret = gps_status_get_nmea(manager_02, &nmea);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+
+}
+
+static void utc_location_gps_status_get_satellite_p(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ int num_of_active, num_of_inview;
+ time_t timestamp;
+ ret = gps_status_get_satellite(manager, &num_of_active, &num_of_inview, ×tamp);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
+}
+
+static void utc_location_gps_status_get_satellite_n(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ ret = gps_status_get_satellite(manager, NULL, NULL, NULL);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_gps_status_get_satellite_n_02(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ int num_of_active, num_of_inview;
+ time_t timestamp;
+ ret = gps_status_get_satellite(NULL, &num_of_active, &num_of_inview, ×tamp);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_gps_status_get_satellite_n_03(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ int num_of_active, num_of_inview;
+ time_t timestamp;
+ location_manager_h manager_02;
+ ret = gps_status_get_satellite(manager_02, &num_of_active, &num_of_inview, ×tamp);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_gps_status_get_satellite_n_04(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ int num_of_inview;
+ time_t timestamp;
+ ret = gps_status_get_satellite(manager, NULL, &num_of_inview, ×tamp);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_gps_status_get_satellite_n_05(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ int num_of_active;
+ time_t timestamp;
+ ret = gps_status_get_satellite(manager, &num_of_active, NULL, ×tamp);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_gps_status_get_satellite_n_06(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ int num_of_active, num_of_inview;
+ ret = gps_status_get_satellite(manager, &num_of_active, &num_of_inview, NULL);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static bool capi_gps_status_get_satellites_cb(unsigned int azimuth, unsigned int elevation, unsigned int prn, int snr,
+ bool is_in_use, void *user_data)
+{
+ return true;
+}
+
+static void utc_location_gps_status_foreach_satellites_in_view_p(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ ret = gps_status_foreach_satellites_in_view(manager, capi_gps_status_get_satellites_cb, NULL);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
+}
+
+static void utc_location_gps_status_foreach_satellites_in_view_n(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ ret = gps_status_foreach_satellites_in_view(manager, NULL, NULL);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_gps_status_foreach_satellites_in_view_n_02(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ ret = gps_status_foreach_satellites_in_view(NULL, capi_gps_status_get_satellites_cb, NULL);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_gps_status_foreach_satellites_in_view_n_03(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ location_manager_h manager_02;
+ ret = gps_status_foreach_satellites_in_view(manager_02, capi_gps_status_get_satellites_cb, NULL);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static bool capi_last_satellites_foreach_cb(unsigned int azimuth, unsigned int elevation, unsigned int prn, int snr, bool is_in_use,
+ void *user_data)
+{
+ printf("[Last Satellite information] azimuth : %d, elevation : %d, prn :%d, snr : %d, used: %d\n", azimuth, elevation,
+ prn, snr, is_in_use);
+ return true;
+}
+
+static void utc_location_gps_status_foreach_last_satellites_in_view_p(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ ret = gps_status_foreach_last_satellites_in_view(manager, capi_last_satellites_foreach_cb, NULL);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
+}
+
+static void utc_location_gps_status_foreach_last_satellites_in_view_n(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ ret = gps_status_foreach_last_satellites_in_view(manager, NULL, NULL);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_gps_status_foreach_last_satellites_in_view_n_02(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ ret = gps_status_foreach_last_satellites_in_view(NULL, capi_last_satellites_foreach_cb, NULL);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_gps_status_get_last_satellite_p(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ time_t timestamp;
+ int num_of_inview, num_of_active;
+ ret = gps_status_get_last_satellite(manager, &num_of_active, &num_of_inview, ×tamp);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
+}
+
+static void utc_location_gps_status_get_last_satellite_n(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ time_t timestamp;
+ int num_of_inview, num_of_active;
+ ret = gps_status_get_last_satellite(NULL, &num_of_active, &num_of_inview, ×tamp);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_gps_status_get_last_satellite_n_02(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ time_t timestamp;
+ int num_of_inview;
+ ret = gps_status_get_last_satellite(manager, NULL, &num_of_inview, ×tamp);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_gps_status_get_last_satellite_n_03(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ time_t timestamp;
+ int num_of_active;
+ ret = gps_status_get_last_satellite(manager, &num_of_active, NULL, ×tamp);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_gps_status_get_last_satellite_n_04(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ int num_of_inview, num_of_active;
+ ret = gps_status_get_last_satellite(manager, &num_of_active, &num_of_inview, NULL);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+
--- /dev/null
+/*
+* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#include <tet_api.h>
+#include <locations.h>
+#include <glib.h>
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_location_location_manager_create_p(void);
+static void utc_location_location_manager_create_p_02(void);
+static void utc_location_location_manager_create_p_03(void);
+static void utc_location_location_manager_create_p_04(void);
+static void utc_location_location_manager_create_p_05(void);
+static void utc_location_location_manager_create_n(void);
+static void utc_location_location_manager_create_n_02(void);
+static void utc_location_location_manager_create_n_03(void);
+static void utc_location_location_manager_create_n_04(void);
+static void utc_location_location_manager_create_n_05(void);
+static void utc_location_location_manager_create_n_06(void);
+static void utc_location_location_manager_add_boundary_p(void);
+static void utc_location_location_manager_add_boundary_n(void);
+static void utc_location_location_manager_add_boundary_n_02(void);
+static void utc_location_location_manager_add_boundary_n_03(void);
+static void utc_location_location_manager_add_boundary_n_04(void);
+static void utc_location_location_manager_foreach_boundary_p(void);
+static void utc_location_location_manager_foreach_boundary_n(void);
+static void utc_location_location_manager_foreach_boundary_n_02(void);
+static void utc_location_location_manager_foreach_boundary_n_03(void);
+static void utc_location_location_manager_foreach_boundary_n_04(void);
+static void utc_location_location_manager_remove_boundary_p(void);
+static void utc_location_location_manager_remove_boundary_n(void);
+static void utc_location_location_manager_remove_boundary_n_02(void);
+static void utc_location_location_manager_remove_boundary_n_03(void);
+static void utc_location_location_manager_remove_boundary_n_04(void);
+static void utc_location_location_manager_get_method_p(void);
+static void utc_location_location_manager_get_method_n(void);
+static void utc_location_location_manager_get_method_n_02(void);
+static void utc_location_location_manager_get_method_n_03(void);
+static void utc_location_location_manager_get_method_n_04(void);
+static void utc_location_location_manager_get_position_p(void);
+static void utc_location_location_manager_get_position_n(void);
+static void utc_location_location_manager_get_position_n_02(void);
+static void utc_location_location_manager_get_position_n_03(void);
+static void utc_location_location_manager_get_position_n_04(void);
+static void utc_location_location_manager_get_position_n_05(void);
+static void utc_location_location_manager_get_position_n_06(void);
+static void utc_location_location_manager_get_velocity_p(void);
+static void utc_location_location_manager_get_velocity_n(void);
+static void utc_location_location_manager_get_velocity_n_02(void);
+static void utc_location_location_manager_get_velocity_n_03(void);
+static void utc_location_location_manager_get_velocity_n_04(void);
+static void utc_location_location_manager_get_velocity_n_05(void);
+static void utc_location_location_manager_get_velocity_n_06(void);
+static void utc_location_location_manager_get_accuracy_p(void);
+static void utc_location_location_manager_get_accuracy_n(void);
+static void utc_location_location_manager_get_accuracy_n_02(void);
+static void utc_location_location_manager_get_accuracy_n_03(void);
+static void utc_location_location_manager_get_accuracy_n_04(void);
+static void utc_location_location_manager_get_accuracy_n_05(void);
+static void utc_location_location_manager_get_accuracy_n_06(void);
+static void utc_location_location_bounds_foreach_polygon_coords_p(void);
+static void utc_location_location_bounds_foreach_polygon_coords_n(void);
+static void utc_location_location_bounds_foreach_polygon_coords_n_02(void);
+static void utc_location_location_bounds_get_circle_coords_p(void);
+static void utc_location_location_bounds_get_circle_coords_n(void);
+static void utc_location_location_bounds_get_circle_coords_n_02(void);
+static void utc_location_location_bounds_get_circle_coords_n_03(void);
+static void utc_location_location_bounds_get_rect_coords_p(void);
+static void utc_location_location_bounds_get_rect_coords_n(void);
+static void utc_location_location_bounds_get_rect_coords_n_02(void);
+static void utc_location_location_bounds_get_rect_coords_n_03(void);
+static void utc_location_location_bounds_contains_coordinates_p(void);
+static void utc_location_location_bounds_contains_coordinates_p_02(void);
+static void utc_location_location_bounds_contains_coordinates_n(void);
+static void utc_location_location_bounds_contains_coordinates_n_02(void);
+static void utc_location_location_manager_get_last_accuracy_p(void);
+static void utc_location_location_manager_get_last_accuracy_n(void);
+static void utc_location_location_manager_get_last_accuracy_n_02(void);
+static void utc_location_location_manager_get_last_accuracy_n_03(void);
+static void utc_location_location_manager_get_last_accuracy_n_04(void);
+static void utc_location_location_manager_get_last_position_p(void);
+static void utc_location_location_manager_get_last_position_n(void);
+static void utc_location_location_manager_get_last_position_n_02(void);
+static void utc_location_location_manager_get_last_position_n_03(void);
+static void utc_location_location_manager_get_last_position_n_04(void);
+static void utc_location_location_manager_get_last_position_n_05(void);
+static void utc_location_location_manager_get_last_velocity_p(void);
+static void utc_location_location_manager_get_last_velocity_n(void);
+static void utc_location_location_manager_get_last_velocity_n_02(void);
+static void utc_location_location_manager_get_last_velocity_n_03(void);
+static void utc_location_location_manager_get_last_velocity_n_04(void);
+static void utc_location_location_manager_get_last_velocity_n_05(void);
+static void utc_location_location_manager_is_supported_method_p(void);
+static void utc_location_location_manager_is_supported_method_p_02(void);
+static void utc_location_location_manager_is_supported_method_p_03(void);
+static void utc_location_location_manager_is_supported_method_p_04(void);
+static void utc_location_location_manager_is_supported_method_n(void);
+static void utc_location_location_manager_is_supported_method_n_02(void);
+static void utc_location_location_manager_send_command_p(void);
+static void utc_location_location_manager_send_command_n(void);
+static void utc_location_location_manager_destroy_p(void);
+static void utc_location_location_manager_destroy_n(void);
+static void utc_location_location_manager_destroy_n_02(void);
+
+struct tet_testlist tet_testlist[] = {
+ {utc_location_location_manager_create_p, POSITIVE_TC_IDX},
+ {utc_location_location_manager_create_p_02, POSITIVE_TC_IDX},
+ {utc_location_location_manager_create_p_03, POSITIVE_TC_IDX},
+ { utc_location_location_manager_create_p_04, POSITIVE_TC_IDX },
+// { utc_location_location_manager_create_p_05, POSITIVE_TC_IDX }, // LOCATIONS_METHOD_NONE is a negative TC.
+ {utc_location_location_manager_create_n, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_create_n_02, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_create_n_03, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_create_n_04, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_create_n_05, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_create_n_06, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_add_boundary_p, POSITIVE_TC_IDX},
+ {utc_location_location_manager_add_boundary_n, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_add_boundary_n_02, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_add_boundary_n_03, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_add_boundary_n_04, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_foreach_boundary_p, POSITIVE_TC_IDX},
+ {utc_location_location_manager_foreach_boundary_n, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_foreach_boundary_n_02, NEGATIVE_TC_IDX},
+// { utc_location_location_manager_foreach_boundary_n_03, NEGATIVE_TC_IDX }, // Can't check created location_manager_h
+ {utc_location_location_manager_foreach_boundary_n_04, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_remove_boundary_p, POSITIVE_TC_IDX},
+ {utc_location_location_manager_remove_boundary_n, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_remove_boundary_n_02, NEGATIVE_TC_IDX},
+// { utc_location_location_manager_remove_boundary_n_03, NEGATIVE_TC_IDX }, // Can't check created location_manager_h
+ {utc_location_location_manager_remove_boundary_n_04, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_get_method_p, POSITIVE_TC_IDX},
+ {utc_location_location_manager_get_method_n, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_get_method_n_02, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_get_method_n_03, NEGATIVE_TC_IDX},
+// { utc_location_location_manager_get_method_n_04, NEGATIVE_TC_IDX }, // Can't check created location_manager_h
+ {utc_location_location_manager_get_position_p, POSITIVE_TC_IDX},
+ {utc_location_location_manager_get_position_n, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_get_position_n_02, NEGATIVE_TC_IDX},
+// { utc_location_location_manager_get_position_n_03, NEGATIVE_TC_IDX }, // Can't check created location_manager_h
+ {utc_location_location_manager_get_position_n_04, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_get_position_n_05, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_get_position_n_06, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_get_velocity_p, POSITIVE_TC_IDX},
+ {utc_location_location_manager_get_velocity_n, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_get_velocity_n_02, NEGATIVE_TC_IDX},
+// { utc_location_location_manager_get_velocity_n_03, NEGATIVE_TC_IDX }, // Can't check created location_manager_h
+ {utc_location_location_manager_get_velocity_n_04, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_get_velocity_n_05, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_get_velocity_n_06, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_get_accuracy_p, POSITIVE_TC_IDX},
+ {utc_location_location_manager_get_accuracy_n, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_get_accuracy_n_02, NEGATIVE_TC_IDX},
+// { utc_location_location_manager_get_accuracy_n_03, NEGATIVE_TC_IDX }, // Can't check created location_manager_h
+ {utc_location_location_manager_get_accuracy_n_04, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_get_accuracy_n_05, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_get_accuracy_n_06, NEGATIVE_TC_IDX},
+ {utc_location_location_bounds_foreach_polygon_coords_p, POSITIVE_TC_IDX},
+ {utc_location_location_bounds_foreach_polygon_coords_n, NEGATIVE_TC_IDX},
+ {utc_location_location_bounds_foreach_polygon_coords_n_02, NEGATIVE_TC_IDX},
+ {utc_location_location_bounds_get_circle_coords_p, POSITIVE_TC_IDX},
+ {utc_location_location_bounds_get_circle_coords_n, NEGATIVE_TC_IDX},
+ {utc_location_location_bounds_get_circle_coords_n_02, NEGATIVE_TC_IDX},
+ {utc_location_location_bounds_get_circle_coords_n_03, NEGATIVE_TC_IDX},
+ {utc_location_location_bounds_get_rect_coords_p, POSITIVE_TC_IDX},
+ {utc_location_location_bounds_get_rect_coords_n, NEGATIVE_TC_IDX},
+ {utc_location_location_bounds_get_rect_coords_n_02, NEGATIVE_TC_IDX},
+ {utc_location_location_bounds_get_rect_coords_n_03, NEGATIVE_TC_IDX},
+ {utc_location_location_bounds_contains_coordinates_p, POSITIVE_TC_IDX},
+ {utc_location_location_bounds_contains_coordinates_p_02, POSITIVE_TC_IDX},
+ {utc_location_location_bounds_contains_coordinates_n, NEGATIVE_TC_IDX},
+ {utc_location_location_bounds_contains_coordinates_n_02, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_get_last_accuracy_p, POSITIVE_TC_IDX},
+ {utc_location_location_manager_get_last_accuracy_n, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_get_last_accuracy_n_02, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_get_last_accuracy_n_03, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_get_last_accuracy_n_04, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_get_last_position_p, POSITIVE_TC_IDX},
+ {utc_location_location_manager_get_last_position_n, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_get_last_position_n_02, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_get_last_position_n_03, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_get_last_position_n_04, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_get_last_position_n_05, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_get_last_velocity_p, POSITIVE_TC_IDX},
+ {utc_location_location_manager_get_last_velocity_n, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_get_last_velocity_n_02, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_get_last_velocity_n_03, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_get_last_velocity_n_04, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_get_last_velocity_n_05, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_is_supported_method_p, POSITIVE_TC_IDX},
+ {utc_location_location_manager_is_supported_method_p_02, POSITIVE_TC_IDX},
+ {utc_location_location_manager_is_supported_method_p_03, POSITIVE_TC_IDX},
+ {utc_location_location_manager_is_supported_method_p_04, POSITIVE_TC_IDX},
+ {utc_location_location_manager_is_supported_method_n, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_is_supported_method_n_02, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_destroy_p, POSITIVE_TC_IDX},
+ {utc_location_location_manager_destroy_n, NEGATIVE_TC_IDX},
+// { utc_location_location_manager_destroy_n_02, NEGATIVE_TC_IDX }, // Can't check created location_manager_h
+ {NULL, 0},
+};
+
+static bool service_enabled = false;
+static bool touch_foreach_bounds = false;
+
+static GMainLoop *g_mainloop = NULL;
+static GThread *event_thread;
+
+gpointer GmainThread(gpointer data)
+{
+ g_mainloop = g_main_loop_new(NULL, 0);
+ g_main_loop_run(g_mainloop);
+ return NULL;
+}
+
+static void validate_and_next(char *api_name, int act_ret, int ext_ret, char *fail_msg)
+{
+ dts_message(api_name, "Actual Result : %d, Expected Result : %d", act_ret, ext_ret);
+ if (act_ret != ext_ret) {
+ dts_message(api_name, "Fail Message: %s", fail_msg);
+ dts_fail(api_name);
+ }
+}
+
+static void validate_eq(char *api_name, int act_ret, int ext_ret)
+{
+ dts_message(api_name, "Actual Result : %d, Expected Result : %d", act_ret, ext_ret);
+ if (act_ret == ext_ret) {
+ dts_pass(api_name);
+ } else {
+ dts_fail(api_name);
+ }
+}
+
+static void wait_for_service(char *api_name)
+{
+ int timeout = 0;
+ for (timeout; timeout < 60; timeout++) {
+ if (service_enabled) {
+ dts_message(api_name, "Location Service Enabled!!!!");
+ break;
+ } else {
+ dts_message(api_name, "Location Service Disabled!!!!");
+ sleep(1);
+ }
+ }
+}
+
+static void wait_for_bounds_foreach(char *api_name)
+{
+ int timeout = 0;
+ for (timeout; timeout < 30; timeout++) {
+ if (touch_foreach_bounds) {
+ dts_message(api_name, "bound foreach called!!!!");
+ break;
+ } else {
+ dts_message(api_name, "No bound foreach!!!!");
+ sleep(1);
+ }
+ }
+}
+
+static void __state_changed_cb(location_service_state_e state, void *user_data)
+{
+ switch (state) {
+ case LOCATIONS_SERVICE_ENABLED:
+ service_enabled = true;
+ break;
+ case LOCATIONS_SERVICE_DISABLED:
+ service_enabled = false;
+ break;
+ default:
+ break;
+ }
+}
+
+static bool __location_bounds_cb(location_bounds_h bounds, void *user_data)
+{
+ if (bounds == NULL)
+ printf("bounds ==NULL\n");
+ else {
+ location_bounds_type_e type;
+ location_bounds_get_type(bounds, &type);
+ dts_message(__func__, "__location_bounds_cb - type : %d!!!!", type);
+ touch_foreach_bounds = TRUE;
+ }
+ return TRUE;
+}
+
+static location_manager_h manager;
+static location_bounds_h bounds_rect;
+static location_bounds_h bounds_circle;
+static location_bounds_h bounds_poly;
+
+static void startup(void)
+{
+ g_setenv("PKG_NAME", "com.samsung.capi-location-manager-test", 1);
+ g_setenv("LOCATION_TEST_ENABLE", "1", 1);
+
+#if !GLIB_CHECK_VERSION (2, 31, 0)
+ if (!g_thread_supported()) {
+ g_thread_init(NULL);
+ }
+#endif
+
+ event_thread = g_thread_create(GmainThread, NULL, 1, NULL);
+}
+
+static void cleanup(void)
+{
+ if (manager) {
+ location_manager_unset_service_state_changed_cb(manager);
+ location_manager_stop(manager);
+ location_manager_destroy(manager);
+ manager = NULL;
+ }
+
+ service_enabled = false;
+ touch_foreach_bounds = false;
+ g_main_loop_quit(g_mainloop);
+ g_thread_join(event_thread);
+}
+
+static void utc_location_location_manager_create_p(void)
+{
+ int ret;
+
+ ret = location_manager_create(LOCATIONS_METHOD_HYBRID, &manager);
+ validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_manager_create() is failed");
+
+ ret = location_manager_set_service_state_changed_cb(manager, __state_changed_cb, NULL);
+ validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_manager_set_service_state_changed_cb() is failed");
+
+ ret = location_manager_start(manager);
+ validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_manager_start() is failed");
+
+ wait_for_service(__func__);
+
+ /*
+ location_manager_stop(manager); //If you call start() and then stop(), service_enabled always set false.
+ location_manager_unset_service_state_changed_cb(manager);
+ */
+
+ validate_eq(__func__, service_enabled, true);
+}
+
+static void utc_location_location_manager_create_p_02(void)
+{
+ int ret;
+ location_manager_h manager_02;
+
+ ret = location_manager_create(LOCATIONS_METHOD_GPS, &manager_02);
+
+ /* We don't need it
+ validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_manager_create() is failed");
+
+ ret = location_manager_set_service_state_changed_cb(manager_02, __state_changed_cb, NULL);
+ validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_manager_set_service_state_changed_cb() is failed");
+
+ ret = location_manager_start(manager_02);
+ validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_manager_start() is failed");
+
+ wait_for_service(__func__);
+
+ location_manager_stop(manager_02);
+ location_manager_unset_service_state_changed_cb(manager_02);
+ */
+
+ location_manager_destroy(manager_02);
+
+ validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
+}
+
+static void utc_location_location_manager_create_p_03(void)
+{
+ int ret;
+ location_manager_h manager_02;
+
+ ret = location_manager_create(LOCATIONS_METHOD_WPS, &manager_02);
+
+ /* We don't need it
+ validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_manager_create() is failed");
+
+ ret = location_manager_set_service_state_changed_cb(manager_02, __state_changed_cb, NULL);
+ validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_manager_set_service_state_changed_cb() is failed");
+
+ ret = location_manager_start(manager_02);
+ validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_manager_start() is failed");
+
+ wait_for_service(__func__);
+
+ location_manager_stop(manager_02);
+ location_manager_unset_service_state_changed_cb(manager_02);
+ */
+
+ location_manager_destroy(manager_02);
+
+ validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
+}
+
+static void utc_location_location_manager_create_p_04(void)
+{
+ int ret;
+ location_manager_h manager_02;
+
+ ret = location_manager_create(LOCATIONS_METHOD_CPS, &manager_02);
+ validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_manager_create() is failed");
+
+ ret = location_manager_set_service_state_changed_cb(manager_02, __state_changed_cb, NULL);
+ validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_manager_set_service_state_changed_cb() is failed");
+
+ ret = location_manager_start(manager_02);
+ validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_manager_start() is failed");
+
+ wait_for_service(__func__);
+
+ location_manager_stop(manager_02);
+ location_manager_unset_service_state_changed_cb(manager_02);
+ location_manager_destroy(manager_02);
+
+ validate_eq(__func__, service_enabled, TRUE);
+}
+
+static void utc_location_location_manager_create_p_05(void)
+{
+ int ret;
+ location_manager_h manager_02;
+
+ ret = location_manager_create(LOCATIONS_METHOD_NONE, &manager_02);
+ validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_manager_create() is failed");
+
+ ret = location_manager_set_service_state_changed_cb(manager_02, __state_changed_cb, NULL);
+ validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_manager_set_service_state_changed_cb() is failed");
+
+ ret = location_manager_start(manager_02);
+ validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_manager_start() is failed");
+
+ wait_for_service(__func__);
+
+ location_manager_stop(manager_02);
+ location_manager_unset_service_state_changed_cb(manager_02);
+ location_manager_destroy(manager_02);
+
+ validate_eq(__func__, service_enabled, TRUE);
+}
+
+static void utc_location_location_manager_create_n(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ ret = location_manager_create(LOCATIONS_METHOD_HYBRID, NULL);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+
+}
+
+static void utc_location_location_manager_create_n_02(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ ret = location_manager_create(LOCATIONS_METHOD_NONE, NULL);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+
+}
+
+static void utc_location_location_manager_create_n_03(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ ret = location_manager_create(LOCATIONS_METHOD_GPS, NULL);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+
+}
+
+static void utc_location_location_manager_create_n_04(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ ret = location_manager_create(LOCATIONS_METHOD_WPS, NULL);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+
+}
+
+static void utc_location_location_manager_create_n_05(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ ret = location_manager_create(LOCATIONS_METHOD_CPS, NULL);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+
+}
+
+static void utc_location_location_manager_create_n_06(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ location_manager_h manager_02;
+
+ ret = location_manager_create(LOCATIONS_METHOD_CPS + 1, &manager_02);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+
+}
+
+static void utc_location_location_manager_add_boundary_p(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ //Add the circle bounds
+ location_coords_s center;
+ center.latitude = 37.258;
+ center.longitude = 127.056;
+ double radius = 30;
+ ret = location_bounds_create_circle(center, radius, &bounds_circle);
+ validate_and_next(__func__, ret, LOCATION_BOUNDS_ERROR_NONE, "location_bounds_create_circle() is failed");
+
+ ret = location_manager_add_boundary(manager, bounds_circle);
+ validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_manager_add_boundary() is failed");
+
+ //Add the rect bounds
+ location_coords_s left_top;
+ left_top.latitude = 30;
+ left_top.longitude = 30;
+
+ location_coords_s right_bottom;
+ right_bottom.latitude = 10;
+ right_bottom.longitude = 50;
+
+ ret = location_bounds_create_rect(left_top, right_bottom, &bounds_rect);
+ validate_and_next(__func__, ret, LOCATION_BOUNDS_ERROR_NONE, "location_bounds_create_rect() is failed");
+
+ ret = location_manager_add_boundary(manager, bounds_rect);
+ validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_manager_add_boundary() is failed");
+
+ //Add the polygon bounds
+
+ int poly_size = 3;
+ location_coords_s coord_list[poly_size];
+
+ coord_list[0].latitude = 10;
+ coord_list[0].longitude = 10;
+ coord_list[1].latitude = 20;
+ coord_list[1].longitude = 20;
+ coord_list[2].latitude = 30;
+ coord_list[2].longitude = 30;
+
+ ret = location_bounds_create_polygon(coord_list, poly_size, &bounds_poly);
+ validate_and_next(__func__, ret, LOCATION_BOUNDS_ERROR_NONE, "location_bounds_create_polygon() is failed");
+
+ ret = location_manager_add_boundary(manager, bounds_poly);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
+}
+
+static void utc_location_location_manager_add_boundary_n(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ ret = location_manager_add_boundary(NULL, NULL);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_add_boundary_n_02(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ ret = location_manager_add_boundary(manager, NULL);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_add_boundary_n_03(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ //Add the circle bounds
+ location_coords_s center;
+ center.latitude = 37.258;
+ center.longitude = 127.056;
+ double radius = 30;
+ ret = location_bounds_create_circle(center, radius, &bounds_circle);
+ validate_and_next(__func__, ret, LOCATION_BOUNDS_ERROR_NONE, "location_bounds_create_circle() is failed");
+
+ ret = location_manager_add_boundary(NULL, bounds_circle);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_add_boundary_n_04(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ location_manager_h manager_02;
+
+ //Add the circle bounds
+ location_coords_s center;
+ center.latitude = 37.258;
+ center.longitude = 127.056;
+ double radius = 30;
+ ret = location_bounds_create_circle(center, radius, &bounds_circle);
+ validate_and_next(__func__, ret, LOCATION_BOUNDS_ERROR_NONE, "location_bounds_create_circle() is failed");
+
+ ret = location_manager_add_boundary(manager_02, bounds_circle);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_foreach_boundary_p(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ ret = location_manager_foreach_boundary(manager, __location_bounds_cb, (void *)manager);
+ validate_and_next(__func__, ret, LOCATION_BOUNDS_ERROR_NONE, "location_manager_foreach_boundary() is failed");
+ wait_for_bounds_foreach(__func__);
+ validate_eq(__func__, touch_foreach_bounds, TRUE);
+}
+
+static void utc_location_location_manager_foreach_boundary_n(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ ret = location_manager_foreach_boundary(NULL, NULL, NULL);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_foreach_boundary_n_02(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ ret = location_manager_foreach_boundary(NULL, __location_bounds_cb, (void *)manager);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_foreach_boundary_n_03(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ location_manager_h manager_02;
+ ret = location_manager_foreach_boundary(manager_02, __location_bounds_cb, (void *)manager);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_foreach_boundary_n_04(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ location_manager_h manager_02;
+ ret = location_manager_foreach_boundary(manager, NULL, NULL);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_remove_boundary_p(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ ret = location_manager_remove_boundary(manager, bounds_rect);
+ validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_manager_remove_boundary(rect) is failed");
+ ret = location_manager_remove_boundary(manager, bounds_circle);
+ validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_manager_remove_boundary(circle) is failed");
+ ret = location_manager_remove_boundary(manager, bounds_poly);
+ location_bounds_destroy(bounds_rect);
+ location_bounds_destroy(bounds_circle);
+ location_bounds_destroy(bounds_poly);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
+}
+
+static void utc_location_location_manager_remove_boundary_n(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ ret = location_manager_remove_boundary(NULL, NULL);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_remove_boundary_n_02(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ ret = location_manager_remove_boundary(NULL, bounds_rect);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_remove_boundary_n_03(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ location_manager_h manager_02;
+ ret = location_manager_remove_boundary(manager_02, bounds_rect);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_remove_boundary_n_04(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ ret = location_manager_remove_boundary(manager, NULL);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_get_method_p(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ location_method_e method;
+ ret = location_manager_get_method(manager, &method);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
+}
+
+static void utc_location_location_manager_get_method_n(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ ret = location_manager_get_method(NULL, NULL);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+
+}
+
+static void utc_location_location_manager_get_method_n_02(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ ret = location_manager_get_method(manager, NULL);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+
+}
+
+static void utc_location_location_manager_get_method_n_03(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ location_method_e method;
+ ret = location_manager_get_method(NULL, &method);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+
+}
+
+static void utc_location_location_manager_get_method_n_04(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ location_manager_h manager_02;
+ location_method_e method;
+ ret = location_manager_get_method(manager_02, &method);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+
+}
+
+static void utc_location_location_manager_get_position_p(void)
+{
+
+ int ret = LOCATIONS_ERROR_NONE;
+
+ double altitude;
+ double latitude;
+ double longitude;
+ time_t timestamp;
+
+ ret = location_manager_get_position(manager, &altitude, &latitude, &longitude, ×tamp);
+ dts_message(__func__, "altitude : %lf, latitude : %lf, longitude : %lf, timestamp:%d", latitude, latitude, longitude,
+ timestamp);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
+}
+
+static void utc_location_location_manager_get_position_n(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ double latitude;
+ double longitude;
+ time_t timestamp;
+
+ ret = location_manager_get_position(manager, NULL, &latitude, &longitude, ×tamp);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_get_position_n_02(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ double altitude;
+ double latitude;
+ double longitude;
+ time_t timestamp;
+
+ ret = location_manager_get_position(NULL, &altitude, &latitude, &longitude, ×tamp);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_get_position_n_03(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ double altitude;
+ double latitude;
+ double longitude;
+ time_t timestamp;
+ location_manager_h manager_02;
+
+ ret = location_manager_get_position(manager_02, &altitude, &latitude, &longitude, ×tamp);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_get_position_n_04(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ double altitude;
+ double longitude;
+ time_t timestamp;
+
+ ret = location_manager_get_position(manager, &altitude, NULL, &longitude, ×tamp);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_get_position_n_05(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ double altitude;
+ double latitude;
+ time_t timestamp;
+
+ ret = location_manager_get_position(manager, &altitude, &latitude, NULL, ×tamp);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_get_position_n_06(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ double altitude;
+ double latitude;
+ double longitude;
+
+ ret = location_manager_get_position(manager, &altitude, &latitude, &longitude, NULL);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_get_velocity_p(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ int climb;
+ int direction;
+ int speed;
+ time_t timestamp;
+
+ ret = location_manager_get_velocity(manager, &climb, &direction, &speed, ×tamp);
+ dts_message(__func__, "climb : %lf, direction : %lf, speed : %lf, timestamp:%d", climb, direction, speed, timestamp);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
+}
+
+static void utc_location_location_manager_get_velocity_n(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ int direction;
+ int speed;
+ time_t timestamp;
+
+ ret = location_manager_get_velocity(manager, NULL, &direction, &speed, ×tamp);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_get_velocity_n_02(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ int climb;
+ int direction;
+ int speed;
+ time_t timestamp;
+
+ ret = location_manager_get_velocity(NULL, &climb, &direction, &speed, ×tamp);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_get_velocity_n_03(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ int climb;
+ int direction;
+ int speed;
+ time_t timestamp;
+ location_manager_h manager_02;
+
+ ret = location_manager_get_velocity(manager_02, &climb, &direction, &speed, ×tamp);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_get_velocity_n_04(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ int climb;
+ int speed;
+ time_t timestamp;
+
+ ret = location_manager_get_velocity(manager, &climb, NULL, &speed, ×tamp);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_get_velocity_n_05(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ int climb;
+ int direction;
+ time_t timestamp;
+
+ ret = location_manager_get_velocity(manager, &climb, &direction, NULL, ×tamp);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_get_velocity_n_06(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ int climb;
+ int direction;
+ int speed;
+
+ ret = location_manager_get_velocity(manager, &climb, &direction, &speed, NULL);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_get_accuracy_p(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ location_accuracy_level_e level;
+ double horizontal;
+ double vertical;
+
+ ret = location_manager_get_accuracy(manager, &level, &horizontal, &vertical);
+ dts_message(__func__, "Level : %lf, horizontal : %lf, vertical : %lf", level, horizontal, vertical);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
+}
+
+static void utc_location_location_manager_get_accuracy_n(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ ret = location_manager_get_accuracy(manager, NULL, NULL, NULL);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_get_accuracy_n_02(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ location_accuracy_level_e level;
+ double horizontal;
+ double vertical;
+
+ ret = location_manager_get_accuracy(NULL, &level, &horizontal, &vertical);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_get_accuracy_n_03(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ location_accuracy_level_e level;
+ double horizontal;
+ double vertical;
+ location_manager_h manager_02;
+
+ ret = location_manager_get_accuracy(manager_02, &level, &horizontal, &vertical);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_get_accuracy_n_04(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ double horizontal;
+ double vertical;
+
+ ret = location_manager_get_accuracy(manager, NULL, &horizontal, &vertical);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_get_accuracy_n_05(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ location_accuracy_level_e level;
+ double vertical;
+
+ ret = location_manager_get_accuracy(manager, &level, NULL, &vertical);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_get_accuracy_n_06(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ location_accuracy_level_e level;
+ double horizontal;
+
+ ret = location_manager_get_accuracy(manager, &level, &horizontal, NULL);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static bool capi_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);
+ return TRUE;
+}
+
+static void utc_location_location_bounds_foreach_polygon_coords_p(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ //Add the polygon bounds
+ int poly_size = 3;
+ location_coords_s coord_list[poly_size];
+
+ coord_list[0].latitude = 10;
+ coord_list[0].longitude = 10;
+ coord_list[1].latitude = 20;
+ coord_list[1].longitude = 20;
+ coord_list[2].latitude = 30;
+ coord_list[2].longitude = 30;
+
+ location_bounds_h bounds_poly;
+ ret = location_bounds_create_polygon(coord_list, poly_size, &bounds_poly);
+ validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_bounds_create_polygon() is failed");
+
+ ret = location_bounds_foreach_polygon_coords(bounds_poly, capi_poly_coords_cb, NULL);
+
+ location_bounds_destroy(bounds_poly);
+
+ validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
+}
+
+static void utc_location_location_bounds_foreach_polygon_coords_n(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ ret = location_bounds_foreach_polygon_coords(NULL, capi_poly_coords_cb, NULL);
+
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_bounds_foreach_polygon_coords_n_02(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ //Add the polygon bounds
+ int poly_size = 3;
+ location_coords_s coord_list[poly_size];
+
+ coord_list[0].latitude = 10;
+ coord_list[0].longitude = 10;
+ coord_list[1].latitude = 20;
+ coord_list[1].longitude = 20;
+ coord_list[2].latitude = 30;
+ coord_list[2].longitude = 30;
+
+ location_bounds_h bounds_poly;
+ ret = location_bounds_create_polygon(coord_list, poly_size, &bounds_poly);
+ validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_bounds_create_polygon() is failed");
+
+ ret = location_bounds_foreach_polygon_coords(bounds_poly, NULL, NULL);
+
+ location_bounds_destroy(bounds_poly);
+
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_bounds_get_circle_coords_p(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ location_coords_s center;
+ center.latitude = 37.258;
+ center.longitude = 127.056;
+ double radius = 30;
+ location_bounds_h bounds_circle;
+ ret = location_bounds_create_circle(center, radius, &bounds_circle);
+ validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_bounds_create_circle() is failed");
+
+ location_coords_s center2;
+ double radius2;
+ ret = location_bounds_get_circle_coords(bounds_circle, ¢er2, &radius2);
+
+ location_bounds_destroy(bounds_circle);
+
+ validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
+}
+
+static void utc_location_location_bounds_get_circle_coords_n(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ location_coords_s center2;
+ double radius2;
+ ret = location_bounds_get_circle_coords(NULL, ¢er2, &radius2);
+
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_bounds_get_circle_coords_n_02(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ location_coords_s center;
+ center.latitude = 37.258;
+ center.longitude = 127.056;
+ double radius = 30;
+ location_bounds_h bounds_circle;
+ ret = location_bounds_create_circle(center, radius, &bounds_circle);
+ validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_bounds_create_circle() is failed");
+
+ double radius2;
+ ret = location_bounds_get_circle_coords(bounds_circle, NULL, &radius2);
+
+ location_bounds_destroy(bounds_circle);
+
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_bounds_get_circle_coords_n_03(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ location_coords_s center;
+ center.latitude = 37.258;
+ center.longitude = 127.056;
+ double radius = 30;
+ location_bounds_h bounds_circle;
+ ret = location_bounds_create_circle(center, radius, &bounds_circle);
+ validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_bounds_create_circle() is failed");
+
+ location_coords_s center2;
+ ret = location_bounds_get_circle_coords(bounds_circle, ¢er2, NULL);
+
+ location_bounds_destroy(bounds_circle);
+
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_bounds_get_rect_coords_p(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ //Add the rect bounds
+ location_coords_s left_top;
+ left_top.latitude = 30;
+ left_top.longitude = 30;
+
+ location_coords_s right_bottom;
+ right_bottom.latitude = 10;
+ right_bottom.longitude = 50;
+
+ location_bounds_h bounds_rect;
+ ret = location_bounds_create_rect(left_top, right_bottom, &bounds_rect);
+ validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_bounds_create_rect() is failed");
+
+ location_coords_s left_top2;
+ location_coords_s right_bottom2;
+ ret = location_bounds_get_rect_coords(bounds_rect, &left_top2, &right_bottom2);
+
+ location_bounds_destroy(bounds_rect);
+
+ validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
+}
+
+static void utc_location_location_bounds_get_rect_coords_n(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ location_coords_s left_top2;
+ location_coords_s right_bottom2;
+ ret = location_bounds_get_rect_coords(NULL, &left_top2, &right_bottom2);
+
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_bounds_get_rect_coords_n_02(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ //Add the rect bounds
+ location_coords_s left_top;
+ left_top.latitude = 30;
+ left_top.longitude = 30;
+
+ location_coords_s right_bottom;
+ right_bottom.latitude = 10;
+ right_bottom.longitude = 50;
+
+ location_bounds_h bounds_rect;
+ ret = location_bounds_create_rect(left_top, right_bottom, &bounds_rect);
+ validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_bounds_create_rect() is failed");
+
+ location_coords_s right_bottom2;
+ ret = location_bounds_get_rect_coords(bounds_rect, NULL, &right_bottom2);
+
+ location_bounds_destroy(bounds_rect);
+
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_bounds_get_rect_coords_n_03(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ //Add the rect bounds
+ location_coords_s left_top;
+ left_top.latitude = 30;
+ left_top.longitude = 30;
+
+ location_coords_s right_bottom;
+ right_bottom.latitude = 10;
+ right_bottom.longitude = 50;
+
+ location_bounds_h bounds_rect;
+ ret = location_bounds_create_rect(left_top, right_bottom, &bounds_rect);
+ validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_bounds_create_rect() is failed");
+
+ location_coords_s left_top2;
+ ret = location_bounds_get_rect_coords(bounds_rect, &left_top2, NULL);
+
+ location_bounds_destroy(bounds_rect);
+
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_bounds_contains_coordinates_p(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ //Add the polygon bounds
+ int poly_size = 3;
+ location_coords_s coord_list[poly_size];
+
+ coord_list[0].latitude = 10;
+ coord_list[0].longitude = 10;
+ coord_list[1].latitude = 20;
+ coord_list[1].longitude = 20;
+ coord_list[2].latitude = 30;
+ coord_list[2].longitude = 10;
+
+ location_bounds_h bounds_poly;
+ ret = location_bounds_create_polygon(coord_list, poly_size, &bounds_poly);
+ validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_bounds_create_polygon() is failed");
+
+ location_coords_s test_coords;
+ test_coords.latitude = 20;
+ test_coords.longitude = 12;
+ bool contained = FALSE;
+ contained = location_bounds_contains_coordinates(bounds_poly, test_coords);
+
+ location_bounds_destroy(bounds_poly);
+
+ validate_eq(__func__, contained, TRUE);
+}
+
+static void utc_location_location_bounds_contains_coordinates_p_02(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ //Add the polygon bounds
+ int poly_size = 3;
+ location_coords_s coord_list[poly_size];
+
+ coord_list[0].latitude = 10;
+ coord_list[0].longitude = 10;
+ coord_list[1].latitude = 20;
+ coord_list[1].longitude = 20;
+ coord_list[2].latitude = 30;
+ coord_list[2].longitude = 10;
+
+ location_bounds_h bounds_poly;
+ ret = location_bounds_create_polygon(coord_list, poly_size, &bounds_poly);
+ validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_bounds_create_polygon() is failed");
+
+ location_coords_s test_coords;
+ test_coords.latitude = 50;
+ test_coords.longitude = 50;
+ bool contained = FALSE;
+ contained = location_bounds_contains_coordinates(bounds_poly, test_coords);
+
+ location_bounds_destroy(bounds_poly);
+
+ validate_eq(__func__, contained, FALSE);
+}
+
+
+static void utc_location_location_bounds_contains_coordinates_n(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ location_coords_s test_coords;
+ test_coords.latitude = 12;
+ test_coords.longitude = 12;
+ ret = location_bounds_contains_coordinates(NULL, test_coords);
+
+ validate_eq(__func__, ret, FALSE);
+}
+
+static void utc_location_location_bounds_contains_coordinates_n_02(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ //Add the polygon bounds
+ int poly_size = 3;
+ location_coords_s coord_list[poly_size];
+
+ coord_list[0].latitude = 10;
+ coord_list[0].longitude = 10;
+ coord_list[1].latitude = 20;
+ coord_list[1].longitude = 20;
+ coord_list[2].latitude = 30;
+ coord_list[2].longitude = 10;
+
+ location_bounds_h bounds_poly;
+ ret = location_bounds_create_polygon(coord_list, poly_size, &bounds_poly);
+ validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_bounds_create_polygon() is failed");
+
+ location_coords_s coord_test;
+ coord_test.latitude = -91;
+ coord_test.longitude = 181;
+ ret = location_bounds_contains_coordinates(bounds_poly, coord_test);
+
+ location_bounds_destroy(bounds_poly);
+
+ validate_eq(__func__, ret, FALSE);
+}
+
+static void utc_location_location_manager_get_last_accuracy_p(void)
+{
+
+ int ret = LOCATIONS_ERROR_NONE;
+
+ double horizontal, vertical;
+ location_accuracy_level_e level;
+
+ ret = location_manager_get_last_accuracy(manager, &level, &horizontal, &vertical);
+ dts_message(__func__, "Level : %d, horizontal: %g, vertical : %g\n", level, horizontal, vertical);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
+}
+
+static void utc_location_location_manager_get_last_accuracy_n(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ double horizontal, vertical;
+ location_accuracy_level_e level;
+
+ ret = location_manager_get_last_accuracy(NULL, &level, &horizontal, &vertical);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_get_last_accuracy_n_02(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ double horizontal, vertical;
+
+ ret = location_manager_get_last_accuracy(manager, NULL, &horizontal, &vertical);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_get_last_accuracy_n_03(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ double vertical;
+ location_accuracy_level_e level;
+
+ ret = location_manager_get_last_accuracy(manager, &level, NULL, &vertical);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_get_last_accuracy_n_04(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ double horizontal;
+ location_accuracy_level_e level;
+
+ ret = location_manager_get_last_accuracy(manager, &level, &horizontal, NULL);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_get_last_position_p(void)
+{
+
+ int ret = LOCATIONS_ERROR_NONE;
+
+ double altitude;
+ double latitude;
+ double longitude;
+ time_t timestamp;
+
+ ret = location_manager_get_last_position(manager, &altitude, &latitude, &longitude, ×tamp);
+ dts_message(__func__, "altitude : %lf, latitude : %lf, longitude : %lf, timestamp:%d", latitude, latitude, longitude,
+ timestamp);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
+}
+
+static void utc_location_location_manager_get_last_position_n(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ double altitude;
+ double latitude;
+ double longitude;
+ time_t timestamp;
+
+ ret = location_manager_get_last_position(NULL, &altitude, &latitude, &longitude, ×tamp);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_get_last_position_n_02(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ double latitude;
+ double longitude;
+ time_t timestamp;
+
+ ret = location_manager_get_last_position(manager, NULL, &latitude, &longitude, ×tamp);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_get_last_position_n_03(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ double altitude;
+ double longitude;
+ time_t timestamp;
+
+ ret = location_manager_get_last_position(manager, &altitude, NULL, &longitude, ×tamp);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_get_last_position_n_04(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ double altitude;
+ double latitude;
+ time_t timestamp;
+
+ ret = location_manager_get_last_position(manager, &altitude, &latitude, NULL, ×tamp);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_get_last_position_n_05(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ double altitude;
+ double latitude;
+ double longitude;
+
+ ret = location_manager_get_last_position(manager, &altitude, &latitude, &longitude, NULL);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_get_last_velocity_p(void)
+{
+
+ int ret = LOCATIONS_ERROR_NONE;
+
+ int climb;
+ int direction;
+ int speed;
+ time_t timestamp;
+
+ ret = location_manager_get_last_velocity(manager, &climb, &direction, &speed, ×tamp);
+ dts_message(__func__, "climb : %lf, direction : %lf, speed : %lf, timestamp:%d", climb, direction, speed, timestamp);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
+}
+
+static void utc_location_location_manager_get_last_velocity_n(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ int climb;
+ int direction;
+ int speed;
+ time_t timestamp;
+
+ ret = location_manager_get_last_velocity(NULL, &climb, &direction, &speed, ×tamp);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_get_last_velocity_n_02(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ int direction;
+ int speed;
+ time_t timestamp;
+
+ ret = location_manager_get_last_velocity(manager, NULL, &direction, &speed, ×tamp);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_get_last_velocity_n_03(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ int climb;
+ int speed;
+ time_t timestamp;
+
+ ret = location_manager_get_last_velocity(manager, &climb, NULL, &speed, ×tamp);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_get_last_velocity_n_04(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ int climb;
+ int direction;
+ time_t timestamp;
+
+ ret = location_manager_get_last_velocity(manager, &climb, &direction, NULL, ×tamp);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_get_last_velocity_n_05(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ int climb;
+ int direction;
+ int speed;
+
+ ret = location_manager_get_last_velocity(manager, &climb, &direction, &speed, NULL);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_is_supported_method_p(void)
+{
+ bool supported = FALSE;
+ supported = location_manager_is_supported_method(LOCATIONS_METHOD_HYBRID);
+ validate_eq(__func__, supported, TRUE);
+}
+
+static void utc_location_location_manager_is_supported_method_p_02(void)
+{
+ bool supported = FALSE;
+ supported = location_manager_is_supported_method(LOCATIONS_METHOD_GPS);
+ validate_eq(__func__, supported, TRUE);
+}
+
+static void utc_location_location_manager_is_supported_method_p_03(void)
+{
+ bool supported = FALSE;
+ supported = location_manager_is_supported_method(LOCATIONS_METHOD_WPS);
+ validate_eq(__func__, supported, TRUE);
+}
+
+static void utc_location_location_manager_is_supported_method_p_04(void)
+{
+ bool supported = FALSE;
+ supported = location_manager_is_supported_method(LOCATIONS_METHOD_CPS);
+ validate_eq(__func__, supported, TRUE);
+}
+
+static void utc_location_location_manager_is_supported_method_n(void)
+{
+ bool supported = FALSE;
+ supported = location_manager_is_supported_method(LOCATIONS_METHOD_NONE);
+ validate_eq(__func__, supported, FALSE);
+}
+
+static void utc_location_location_manager_is_supported_method_n_02(void)
+{
+ bool supported = FALSE;
+ supported = location_manager_is_supported_method(LOCATIONS_METHOD_CPS + 1);
+ validate_eq(__func__, supported, FALSE);
+}
+
+static void utc_location_location_manager_send_command_p(void)
+{
+
+ int ret = LOCATIONS_ERROR_NONE;
+
+ const *str = "command";
+ ret = location_manager_send_command(str);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
+}
+
+static void utc_location_location_manager_send_command_n(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ ret = location_manager_send_command(NULL);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_destroy_p(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ ret = location_manager_destroy(manager);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
+
+}
+
+static void utc_location_location_manager_destroy_n(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ ret = location_manager_destroy(NULL);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+
+}
+
+static void utc_location_location_manager_destroy_n_02(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ location_manager_h manager_02;
+
+ ret = location_manager_destroy(manager_02);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+
+}
--- /dev/null
+/*
+* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#include <tet_api.h>
+#include <locations.h>
+#include <glib.h>
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_location_location_manager_start_p(void);
+static void utc_location_location_manager_start_n(void);
+static void utc_location_location_manager_start_n_02(void);
+static void utc_location_location_manager_set_position_updated_callback_p(void);
+static void utc_location_location_manager_set_position_updated_callback_n(void);
+static void utc_location_location_manager_set_position_updated_callback_n_02(void);
+static void utc_location_location_manager_set_position_updated_callback_n_03(void);
+static void utc_location_location_manager_set_position_updated_callback_n_04(void);
+static void utc_location_location_manager_set_position_updated_callback_n_05(void);
+static void utc_location_location_manager_unset_position_updated_callback_p(void);
+static void utc_location_location_manager_unset_position_updated_callback_n(void);
+static void utc_location_location_manager_set_velocity_updated_callback_p(void);
+static void utc_location_location_manager_set_velocity_updated_callback_n(void);
+static void utc_location_location_manager_set_velocity_updated_callback_n_02(void);
+static void utc_location_location_manager_set_velocity_updated_callback_n_03(void);
+static void utc_location_location_manager_unset_velocity_updated_callback_p(void);
+static void utc_location_location_manager_unset_velocity_updated_callback_n(void);
+static void utc_location_location_manager_set_service_state_changed_callback_p(void);
+static void utc_location_location_manager_set_service_state_changed_callback_n(void);
+static void utc_location_location_manager_set_service_state_changed_callback_n_02(void);
+static void utc_location_location_manager_set_service_state_changed_callback_n_03(void);
+static void utc_location_location_manager_unset_service_state_changed_callback_p(void);
+static void utc_location_location_manager_unset_service_state_changed_callback_n(void);
+static void utc_location_location_manager_set_zone_changed_callback_p(void);
+static void utc_location_location_manager_set_zone_changed_callback_n(void);
+static void utc_location_location_manager_set_zone_changed_callback_n_02(void);
+static void utc_location_location_manager_set_zone_changed_callback_n_03(void);
+static void utc_location_location_manager_unset_zone_changed_callback_p(void);
+static void utc_location_location_manager_unset_zone_changed_callback_n(void);
+static void utc_location_location_manager_stop_p(void);
+static void utc_location_location_manager_stop_n(void);
+static void utc_location_location_manager_stop_n_02(void);
+
+struct tet_testlist tet_testlist[] = {
+ {utc_location_location_manager_start_p, POSITIVE_TC_IDX},
+ {utc_location_location_manager_start_n, NEGATIVE_TC_IDX},
+// { utc_location_location_manager_start_n_02, NEGATIVE_TC_IDX }, //Can't check address of created location_manager_h
+ {utc_location_location_manager_set_position_updated_callback_p, POSITIVE_TC_IDX},
+ {utc_location_location_manager_set_position_updated_callback_n, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_unset_position_updated_callback_p, POSITIVE_TC_IDX},
+ {utc_location_location_manager_unset_position_updated_callback_n, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_set_velocity_updated_callback_p, POSITIVE_TC_IDX},
+ {utc_location_location_manager_set_velocity_updated_callback_n, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_set_velocity_updated_callback_n_02, NEGATIVE_TC_IDX},
+// { utc_location_location_manager_set_velocity_updated_callback_n_03, NEGATIVE_TC_IDX }, //Can't check address of created location_manager_h
+ {utc_location_location_manager_unset_velocity_updated_callback_p, POSITIVE_TC_IDX},
+ {utc_location_location_manager_unset_velocity_updated_callback_n, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_set_service_state_changed_callback_p, POSITIVE_TC_IDX},
+ {utc_location_location_manager_set_service_state_changed_callback_n, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_set_service_state_changed_callback_n_02, NEGATIVE_TC_IDX},
+// { utc_location_location_manager_set_service_state_changed_callback_n_03, NEGATIVE_TC_IDX }, // Can't check address of created location_manager_h
+ {utc_location_location_manager_unset_service_state_changed_callback_p, POSITIVE_TC_IDX},
+ {utc_location_location_manager_unset_service_state_changed_callback_n, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_set_zone_changed_callback_p, POSITIVE_TC_IDX},
+ {utc_location_location_manager_set_zone_changed_callback_n, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_set_zone_changed_callback_n_02, NEGATIVE_TC_IDX},
+// { utc_location_location_manager_set_zone_changed_callback_n_03, NEGATIVE_TC_IDX }, // Can't check address of created location_manager_h
+ {utc_location_location_manager_unset_zone_changed_callback_p, POSITIVE_TC_IDX},
+ {utc_location_location_manager_unset_zone_changed_callback_n, NEGATIVE_TC_IDX},
+ {utc_location_location_manager_stop_p, POSITIVE_TC_IDX},
+ {utc_location_location_manager_stop_n, NEGATIVE_TC_IDX},
+// { utc_location_location_manager_stop_n_02, NEGATIVE_TC_IDX }, //Can't check address of created location_manager_h
+ {NULL, 0},
+};
+
+static bool service_enabled = false;
+
+static void validate_and_next(char *api_name, int act_ret, int ext_ret, char *fail_msg)
+{
+ dts_message(api_name, "Actual Result : %d, Expected Result : %d", act_ret, ext_ret);
+ if (act_ret != ext_ret) {
+ dts_message(api_name, "Fail Message: %s", fail_msg);
+ dts_fail(api_name);
+ }
+}
+
+static void validate_eq(char *api_name, int act_ret, int ext_ret)
+{
+ dts_message(api_name, "Actual Result : %d, Expected Result : %d", act_ret, ext_ret);
+ if (act_ret == ext_ret) {
+ dts_pass(api_name);
+ } else {
+ dts_fail(api_name);
+ }
+}
+
+static void validate_neq(char *api_name, int act_ret, int ext_ret)
+{
+ dts_message(api_name, "Actual Result : %d, N-Expected Result : %d", act_ret, ext_ret);
+ if (act_ret != ext_ret) {
+ dts_pass(api_name);
+ } else {
+ dts_fail(api_name);
+ }
+}
+
+static void unprepare(location_manager_h manager)
+{
+ location_manager_unset_service_state_changed_cb(manager);
+ location_manager_destroy(manager);
+ service_enabled = false;
+}
+
+static void wait_for_service(char *api_name)
+{
+ int timeout = 0;
+ for (timeout; timeout < 30; timeout++) {
+ if (service_enabled) {
+ dts_message(api_name, "Location Service Enabled!!!!");
+ break;
+ } else {
+ dts_message(api_name, "Location Service Disabled!!!!");
+ sleep(1);
+ }
+ }
+}
+
+static void capi_state_changed_cb(location_service_state_e state, void *user_data)
+{
+ switch (state) {
+ case LOCATIONS_SERVICE_ENABLED:
+ service_enabled = true;
+ break;
+ case LOCATIONS_SERVICE_DISABLED:
+ service_enabled = false;
+ break;
+ default:
+ break;
+ }
+}
+
+static GMainLoop *g_mainloop = NULL;
+static GThread *event_thread;
+
+gpointer GmainThread(gpointer data)
+{
+ g_mainloop = g_main_loop_new(NULL, 0);
+ g_main_loop_run(g_mainloop);
+ return NULL;
+}
+
+static location_manager_h manager;
+
+static void startup(void)
+{
+ g_setenv("PKG_NAME", "com.samsung.capi-location-manager-callback-test", 1);
+ g_setenv("LOCATION_TEST_ENABLE", "1", 1);
+
+#if !GLIB_CHECK_VERSION (2, 31, 0)
+ if (!g_thread_supported()) {
+ g_thread_init(NULL);
+ }
+#endif
+
+ GError *gerr = NULL;
+ event_thread = g_thread_create(GmainThread, NULL, 1, &gerr);
+
+}
+
+static void cleanup(void)
+{
+ unprepare(manager);
+ g_main_loop_quit(g_mainloop);
+ g_thread_join(event_thread);
+}
+
+static void capi_position_updated_cb(double latitude, double longitude, double altitude, time_t timestamp, void *user_data)
+{
+}
+
+static void capi_zone_changed_cb(location_boundary_state_e state, double latitude, double longitude, double altitude,
+ time_t timestamp, void *user_data)
+{
+}
+
+static void capi_velocity_updated_cb(double speed, double direction, double climb, time_t timestamp, void *user_data)
+{
+}
+
+static bool capi_geocoder_get_position_cb(double latitude, double longitude, void *user_data)
+{
+ return true;
+}
+
+static void utc_location_location_manager_start_p(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ ret = location_manager_create(LOCATIONS_METHOD_HYBRID, &manager);
+ validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_manager_create() is failed");
+
+ ret = location_manager_set_service_state_changed_cb(manager, capi_state_changed_cb, NULL);
+ validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_manager_set_service_state_changed_cb() is failed");
+
+ ret = location_manager_start(manager);
+ validate_and_next(__func__, ret, LOCATIONS_ERROR_NONE, "location_manager_start() is failed");
+ wait_for_service(__func__);
+
+ validate_eq(__func__, service_enabled, true);
+
+}
+
+static void utc_location_location_manager_start_n(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ ret = location_manager_start(NULL);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_start_n_02(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ location_manager_h manager_02;
+
+ ret = location_manager_start(manager_02);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_set_position_updated_callback_p(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ ret = location_manager_set_position_updated_cb(manager, capi_position_updated_cb, 1, NULL);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
+}
+
+static void utc_location_location_manager_set_position_updated_callback_n(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ ret = location_manager_set_position_updated_cb(manager, NULL, 1, NULL);
+ validate_neq(__func__, ret, LOCATIONS_ERROR_NONE);
+}
+
+static void utc_location_location_manager_set_position_updated_callback_n_02(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ ret = location_manager_set_position_updated_cb(NULL, capi_position_updated_cb, 1, NULL);
+ validate_neq(__func__, ret, LOCATIONS_ERROR_NONE);
+}
+
+static void utc_location_location_manager_set_position_updated_callback_n_03(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ location_manager_h manager_02;
+ ret = location_manager_set_position_updated_cb(manager_02, capi_position_updated_cb, 1, NULL);
+ validate_neq(__func__, ret, LOCATIONS_ERROR_NONE);
+}
+
+static void utc_location_location_manager_set_position_updated_callback_n_04(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ ret = location_manager_set_position_updated_cb(manager, capi_position_updated_cb, 0, NULL);
+ validate_neq(__func__, ret, LOCATIONS_ERROR_NONE);
+}
+
+static void utc_location_location_manager_set_position_updated_callback_n_05(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ ret = location_manager_set_position_updated_cb(manager, capi_position_updated_cb, 121, NULL);
+ validate_neq(__func__, ret, LOCATIONS_ERROR_NONE);
+}
+
+static void utc_location_location_manager_unset_position_updated_callback_p(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ ret = location_manager_unset_position_updated_cb(manager);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
+}
+
+static void utc_location_location_manager_unset_position_updated_callback_n(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ ret = location_manager_unset_position_updated_cb(NULL);
+ validate_neq(__func__, ret, LOCATIONS_ERROR_NONE);
+}
+
+static void utc_location_location_manager_set_velocity_updated_callback_p(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ ret = location_manager_set_velocity_updated_cb(manager, capi_velocity_updated_cb, 1, NULL);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
+}
+
+static void utc_location_location_manager_set_velocity_updated_callback_n(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ ret = location_manager_set_velocity_updated_cb(manager, NULL, 1, NULL);
+ validate_neq(__func__, ret, LOCATIONS_ERROR_NONE);
+
+}
+
+static void utc_location_location_manager_set_velocity_updated_callback_n_02(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ ret = location_manager_set_velocity_updated_cb(NULL, capi_velocity_updated_cb, 1, NULL);
+ validate_neq(__func__, ret, LOCATIONS_ERROR_NONE);
+
+}
+
+static void utc_location_location_manager_set_velocity_updated_callback_n_03(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ location_manager_h manager_02;
+ ret = location_manager_set_velocity_updated_cb(manager_02, capi_velocity_updated_cb, 1, NULL);
+ validate_neq(__func__, ret, LOCATIONS_ERROR_NONE);
+
+}
+
+static void utc_location_location_manager_unset_velocity_updated_callback_p(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ ret = location_manager_unset_velocity_updated_cb(manager);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
+}
+
+static void utc_location_location_manager_unset_velocity_updated_callback_n(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ ret = location_manager_unset_velocity_updated_cb(NULL);
+ validate_neq(__func__, ret, LOCATIONS_ERROR_NONE);
+}
+
+static void utc_location_location_manager_set_service_state_changed_callback_p(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ ret = location_manager_set_service_state_changed_cb(manager, capi_state_changed_cb, NULL);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
+}
+
+static void utc_location_location_manager_set_service_state_changed_callback_n(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ ret = location_manager_set_service_state_changed_cb(manager, NULL, NULL);
+ validate_neq(__func__, ret, LOCATIONS_ERROR_NONE);
+}
+
+static void utc_location_location_manager_set_service_state_changed_callback_n_02(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ ret = location_manager_set_service_state_changed_cb(NULL, capi_state_changed_cb, NULL);
+ validate_neq(__func__, ret, LOCATIONS_ERROR_NONE);
+}
+
+static void utc_location_location_manager_set_service_state_changed_callback_n_03(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ location_manager_h manager_02;
+ ret = location_manager_set_service_state_changed_cb(manager_02, capi_state_changed_cb, NULL);
+ validate_neq(__func__, ret, LOCATIONS_ERROR_NONE);
+}
+
+static void utc_location_location_manager_unset_service_state_changed_callback_p(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ ret = location_manager_unset_service_state_changed_cb(manager);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
+}
+
+static void utc_location_location_manager_unset_service_state_changed_callback_n(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ ret = location_manager_unset_service_state_changed_cb(NULL);
+ validate_neq(__func__, ret, LOCATIONS_ERROR_NONE);
+
+}
+
+static void utc_location_location_manager_set_zone_changed_callback_p(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ ret = location_manager_set_zone_changed_cb(manager, capi_zone_changed_cb, NULL);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
+
+}
+
+static void utc_location_location_manager_set_zone_changed_callback_n(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ ret = location_manager_set_zone_changed_cb(manager, NULL, NULL);
+ validate_neq(__func__, ret, LOCATIONS_ERROR_NONE);
+}
+
+static void utc_location_location_manager_set_zone_changed_callback_n_02(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ ret = location_manager_set_zone_changed_cb(NULL, capi_zone_changed_cb, NULL);
+ validate_neq(__func__, ret, LOCATIONS_ERROR_NONE);
+}
+
+static void utc_location_location_manager_set_zone_changed_callback_n_03(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ location_manager_h manager_02;
+ ret = location_manager_set_zone_changed_cb(manager_02, capi_zone_changed_cb, NULL);
+ validate_neq(__func__, ret, LOCATIONS_ERROR_NONE);
+}
+
+static void utc_location_location_manager_unset_zone_changed_callback_p(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ ret = location_manager_unset_zone_changed_cb(manager);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
+}
+
+static void utc_location_location_manager_unset_zone_changed_callback_n(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ ret = location_manager_unset_zone_changed_cb(NULL);
+ validate_neq(__func__, ret, LOCATIONS_ERROR_NONE);
+}
+
+static void utc_location_location_manager_stop_p(void)
+{
+
+ int ret = LOCATIONS_ERROR_NONE;
+ ret = location_manager_stop(manager);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_NONE);
+}
+
+static void utc_location_location_manager_stop_n(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+
+ ret = location_manager_stop(NULL);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
+
+static void utc_location_location_manager_stop_n_02(void)
+{
+ int ret = LOCATIONS_ERROR_NONE;
+ location_manager_h manager_02;
+
+ ret = location_manager_stop(manager_02);
+ validate_eq(__func__, ret, LOCATIONS_ERROR_INVALID_PARAMETER);
+}
--- /dev/null
+/*
+* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#include <tet_api.h>
+#include <location_preference.h>
+#include <geocoder.h>
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_location_location_preference_foreach_available_property_keys_p(void);
+static void utc_location_location_preference_foreach_available_property_keys_n(void);
+static void utc_location_location_preference_foreach_available_property_values_p(void);
+static void utc_location_location_preference_foreach_available_property_values_n(void);
+static void utc_location_location_preference_foreach_available_languages_p(void);
+static void utc_location_location_preference_foreach_available_languages_n(void);
+static void utc_location_location_preference_foreach_properties_p(void);
+static void utc_location_location_preference_foreach_properties_n(void);
+static void utc_location_location_preference_set_p(void);
+static void utc_location_location_preference_set_n(void);
+static void utc_location_location_preference_get_p(void);
+static void utc_location_location_preference_get_n(void);
+static void utc_location_location_preference_get_provider_name_p(void);
+static void utc_location_location_preference_get_provider_name_n(void);
+static void utc_location_location_preference_get_distance_unit_p(void);
+static void utc_location_location_preference_get_distance_unit_n(void);
+static void utc_location_location_preference_set_distance_unit_p(void);
+static void utc_location_location_preference_set_distance_unit_n(void);
+static void utc_location_location_preference_get_language_p(void);
+static void utc_location_location_preference_get_language_n(void);
+static void utc_location_location_preference_set_language_p(void);
+static void utc_location_location_preference_set_language_n(void);
+
+struct tet_testlist tet_testlist[] = {
+// { utc_location_location_preference_foreach_available_property_keys_p, POSITIVE_TC_IDX },
+ {utc_location_location_preference_foreach_available_property_keys_n, NEGATIVE_TC_IDX},
+// { utc_location_location_preference_foreach_available_property_values_p, POSITIVE_TC_IDX },
+ {utc_location_location_preference_foreach_available_property_values_n, NEGATIVE_TC_IDX},
+ {utc_location_location_preference_foreach_available_languages_p, POSITIVE_TC_IDX},
+ {utc_location_location_preference_foreach_available_languages_n, NEGATIVE_TC_IDX},
+ {utc_location_location_preference_set_p, POSITIVE_TC_IDX},
+ {utc_location_location_preference_set_n, NEGATIVE_TC_IDX},
+ {utc_location_location_preference_foreach_properties_p, POSITIVE_TC_IDX},
+ {utc_location_location_preference_foreach_properties_n, NEGATIVE_TC_IDX},
+ {utc_location_location_preference_get_p, POSITIVE_TC_IDX},
+ {utc_location_location_preference_get_n, NEGATIVE_TC_IDX},
+ {utc_location_location_preference_get_provider_name_p, POSITIVE_TC_IDX},
+ {utc_location_location_preference_get_provider_name_n, NEGATIVE_TC_IDX},
+ {utc_location_location_preference_set_distance_unit_p, POSITIVE_TC_IDX},
+ {utc_location_location_preference_set_distance_unit_n, NEGATIVE_TC_IDX},
+ {utc_location_location_preference_get_distance_unit_p, POSITIVE_TC_IDX},
+ {utc_location_location_preference_get_distance_unit_n, NEGATIVE_TC_IDX},
+ {utc_location_location_preference_set_language_p, POSITIVE_TC_IDX},
+ {utc_location_location_preference_set_language_n, NEGATIVE_TC_IDX},
+ {utc_location_location_preference_get_language_p, POSITIVE_TC_IDX},
+ {utc_location_location_preference_get_language_n, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static geocoder_h geocoder;
+static char *available_language;
+static char *available_key;
+static char *available_value;
+
+static void startup(void)
+{
+ g_setenv("PKG_NAME", "com.samsung.capi-location-preference", 1);
+ g_setenv("LOCATION_TEST_ENABLE", "1", 1);
+
+ tet_printf("TC start");
+
+ int ret = geocoder_create(&geocoder);
+ available_language = NULL;
+ available_key = NULL;
+ available_value = NULL;
+ if (ret != GEOCODER_ERROR_NONE) {
+ tet_printf("Creating the handle of geocoder failed");
+ return;
+ } else {
+ tet_printf("Creating the handle of geocoder succeeded");
+ }
+}
+
+static void cleanup(void)
+{
+ geocoder_destroy(geocoder);
+}
+
+bool location_preference_available_property_key_cb_impl(const char *key, void *user_data)
+{
+ tet_printf("key : %s", key);
+ available_key = strdup(key);
+ return false;
+}
+
+bool location_preference_available_property_value_cb_impl(const char *value, void *user_data)
+{
+ tet_printf("value : %s", value);
+ available_value = strdup(value);
+ return false;
+}
+
+bool location_preference_available_language_cb_impl(const char *language, void *user_data)
+{
+ available_language = strdup(language);
+ tet_printf("available language : %s", available_language);
+ return false;
+}
+
+bool location_preference_property_cb_impl(const char *key, const char *value, void *user_data)
+{
+ tet_printf("key : %s", key);
+ tet_printf("value : %s", value);
+ return false;
+}
+
+static void utc_location_location_preference_foreach_available_property_keys_p(void)
+{
+ int ret = location_preference_foreach_available_property_keys(GET_LOCATION_SERVICE(geocoder),
+ location_preference_available_property_key_cb_impl, NULL);
+ if (ret == LOCATION_PREFERENCE_ERROR_NONE) {
+ dts_pass(__func__, "location_preference_foreach_available_property_keys passed");
+ } else {
+ dts_fail(__func__, "location_preference_foreach_available_property_keys failed");
+ }
+}
+
+static void utc_location_location_preference_foreach_available_property_keys_n(void)
+{
+ int ret = location_preference_foreach_available_property_keys(GET_LOCATION_SERVICE(geocoder), NULL, NULL);
+ dts_check_eq(__func__, ret, LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER,
+ "LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER was not returned.");
+}
+
+static void utc_location_location_preference_foreach_available_property_values_p(void)
+{
+ int ret = location_preference_foreach_available_property_values(GET_LOCATION_SERVICE(geocoder), available_key,
+ location_preference_available_property_value_cb_impl,
+ NULL);
+ if (ret == LOCATION_PREFERENCE_ERROR_NONE) {
+ dts_pass(__func__, "location_preference_foreach_available_property_values passed");
+ } else {
+ dts_fail(__func__, "location_preference_foreach_available_property_values failed");
+ }
+}
+
+static void utc_location_location_preference_foreach_available_property_values_n(void)
+{
+ int ret = location_preference_foreach_available_property_values(GET_LOCATION_SERVICE(geocoder), NULL, NULL, NULL);
+ dts_check_eq(__func__, ret, LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER,
+ "LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER was not returned.");
+}
+
+static void utc_location_location_preference_foreach_available_languages_p(void)
+{
+ int ret = location_preference_foreach_available_languages(GET_LOCATION_SERVICE(geocoder),
+ location_preference_available_language_cb_impl, NULL);
+ if (ret == LOCATION_PREFERENCE_ERROR_NONE) {
+ dts_pass(__func__, "location_preference_foreach_available_languages passed");
+ } else {
+ dts_fail(__func__, "location_preference_foreach_available_languages failed");
+ }
+}
+
+static void utc_location_location_preference_foreach_available_languages_n(void)
+{
+ int ret = location_preference_foreach_available_languages(GET_LOCATION_SERVICE(geocoder), NULL, NULL);
+ dts_check_eq(__func__, ret, LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER,
+ "LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER was not returned.");
+}
+
+static void utc_location_location_preference_foreach_properties_p(void)
+{
+ int ret =
+ location_preference_foreach_properties(GET_LOCATION_SERVICE(geocoder), location_preference_property_cb_impl, NULL);
+ dts_check_eq(__func__, ret, LOCATION_PREFERENCE_ERROR_NONE, "location_preference_foreach_properties failed.");
+}
+
+static void utc_location_location_preference_foreach_properties_n(void)
+{
+ int ret = location_preference_foreach_properties(GET_LOCATION_SERVICE(geocoder), NULL, NULL);
+ dts_check_eq(__func__, ret, LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER,
+ "LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER was not returned.");
+}
+
+static void utc_location_location_preference_set_p(void)
+{
+ if (available_key == NULL) {
+ available_key = strdup("test_key");
+ available_value = strdup("test_value");
+ }
+ int ret = location_preference_set(GET_LOCATION_SERVICE(geocoder), available_key, available_value);
+ dts_check_eq(__func__, ret, LOCATION_PREFERENCE_ERROR_NONE, "location_preference_set failed.");
+}
+
+static void utc_location_location_preference_set_n(void)
+{
+ int ret = location_preference_set(GET_LOCATION_SERVICE(geocoder), NULL, NULL);
+ dts_check_eq(__func__, ret, LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER,
+ "LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER was not returned.");
+}
+
+static void utc_location_location_preference_get_p(void)
+{
+ int ret = 0;
+ char *value = NULL;
+
+ ret = location_preference_get(GET_LOCATION_SERVICE(geocoder), available_key, &value);
+ if (value != NULL) {
+ tet_printf("value: %s", value);
+ }
+
+ dts_check_eq(__func__, ret, LOCATION_PREFERENCE_ERROR_NONE, "location_preference_get failed.");
+}
+
+static void utc_location_location_preference_get_n(void)
+{
+ int ret = location_preference_get(GET_LOCATION_SERVICE(geocoder), NULL, NULL);
+ dts_check_eq(__func__, ret, LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER,
+ "LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER was not returned.");
+}
+
+static void utc_location_location_preference_get_provider_name_p(void)
+{
+ int ret = 0;
+ char *name = NULL;
+
+ ret = location_preference_get_provider_name(GET_LOCATION_SERVICE(geocoder), &name);
+
+ if (ret == LOCATION_PREFERENCE_ERROR_NONE) {
+ if (name != NULL) {
+ tet_printf("provider name: %s", name);
+ }
+ dts_pass(__func__, "location_preference_get_provider_name passed");
+ } else
+ dts_fail(__func__, "location_preference_get_provider_name failed");
+}
+
+static void utc_location_location_preference_get_provider_name_n(void)
+{
+ int ret = location_preference_get_provider_name(GET_LOCATION_SERVICE(geocoder), NULL);
+ dts_check_eq(__func__, ret, LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER,
+ "LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER was not returned.");
+}
+
+static void utc_location_location_preference_set_distance_unit_p(void)
+{
+ int ret = location_preference_set_distance_unit(GET_LOCATION_SERVICE(geocoder), LOCATION_PREFERENCE_DISTANCE_UNIT_FT);
+ dts_check_eq(__func__, ret, LOCATION_PREFERENCE_ERROR_NONE, "location_preference_set_distance_unit failed.");
+}
+
+static void utc_location_location_preference_set_distance_unit_n(void)
+{
+ int ret = location_preference_set_distance_unit(GET_LOCATION_SERVICE(geocoder), -1);
+ dts_check_eq(__func__, ret, LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER,
+ "LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER was not returned.");
+}
+
+static void utc_location_location_preference_get_distance_unit_p(void)
+{
+ int ret = 0;
+ location_preference_distance_unit_e unit = LOCATION_PREFERENCE_DISTANCE_UNIT_FT;
+
+ ret = location_preference_get_distance_unit(GET_LOCATION_SERVICE(geocoder), &unit);
+ if (ret == LOCATION_PREFERENCE_ERROR_NONE) {
+ dts_pass(__func__, "location_preference_get_distance_unit passed");
+ } else {
+ dts_fail(__func__, "location_preference_get_distance_unit failed");
+ }
+}
+
+static void utc_location_location_preference_get_distance_unit_n(void)
+{
+ int ret = location_preference_get_distance_unit(GET_LOCATION_SERVICE(geocoder), NULL);
+ dts_check_eq(__func__, ret, LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER,
+ "LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER was not returned.");
+}
+
+static void utc_location_location_preference_set_language_p(void)
+{
+ if (available_language == NULL) {
+ available_language = strdup("KR");
+ }
+ int ret = location_preference_set_language(GET_LOCATION_SERVICE(geocoder), available_language);
+ dts_check_eq(__func__, ret, LOCATION_PREFERENCE_ERROR_NONE, "location_preference_set_language_unit failed.");
+}
+
+static void utc_location_location_preference_set_language_n(void)
+{
+ int ret = location_preference_set_language(GET_LOCATION_SERVICE(geocoder), NULL);
+ dts_check_eq(__func__, ret, LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER,
+ "LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER was not returned.");
+}
+
+static void utc_location_location_preference_get_language_p(void)
+{
+ int ret = 0;
+ char *language = NULL;
+
+ ret = location_preference_get_language(GET_LOCATION_SERVICE(geocoder), &language);
+ if (ret == LOCATION_PREFERENCE_ERROR_NONE) {
+ dts_pass(__func__, "location_preference_get_distance_unit passed");
+ } else {
+ dts_fail(__func__, "location_preference_get_distance_unit failed");
+ }
+}
+
+static void utc_location_location_preference_get_language_n(void)
+{
+ int ret = location_preference_get_language(GET_LOCATION_SERVICE(geocoder), NULL);
+ dts_check_eq(__func__, ret, LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER,
+ "LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER was not returned.");
+}
--- /dev/null
+all
+ ^TEST
+##### Scenarios for TEST #####
+
+# Test scenario
+TEST
+ :include:/testcase/tslist
--- /dev/null
+TET_OUTPUT_CAPTURE=True # capture option for build operation checking
+TET_BUILD_TOOL=make # build with using make command
+TET_BUILD_FILE=-f Makefile # execution file (Makefile) for build
+TET_API_COMPLIANT=True # use TET API in Test Case ?
+TET_PASS_TC_NAME=True # report passed TC name in Journal file?
--- /dev/null
+TET_OUTPUT_CAPTURE=True # capture option
+TET_CLEAN_TOOL= make clean # clean tool
+TET_CLEAN_FILE= Makefile # file for clean
+TET_API_COMPLIANT=True # TET API useage
+TET_PASS_TC_NAME=True # showing name , passed TC
--- /dev/null
+TET_OUTPUT_CAPTURE=True # capturing execution or not
+TET_EXEC_TOOL= # ex) exec : execution tool set up/ Optional
+TET_EXEC_FILE= # ex) exectool : execution file/ Optional
+TET_API_COMPLIANT=True # Test case or Tool usesTET API?
+TET_PASS_TC_NAME=True # showing Passed TC name ?
+capi-location-manager (0.1.2-1) unstable; urgency=low
+
+ * Add location_manager_get_distance, location_preference_get_country_code and location_preference_set_country_code
+ * Tag: capi-location-manager_0.1.2-1
+
+ -- Minjune Kim <sena06.kim@samsung.com> Mon, 20 Aug 2012 17:03:51 +0900
+
+capi-location-manager (0.1.1-2) unstable; urgency=low
+
+ * Change the type of a parameter in location_manager_get_velocity and location_manager_get_last_velocity from int to double.
+ * Tag: capi-location-manager_0.1.1-2
+
+ -- Minjune Kim <sena06.kim@samsung.com> Mon, 13 Aug 2012 16:42:03 +0900
+
+capi-location-manager (0.1.1-1) unstable; urgency=low
+
+ * Support to muliple provider
+ * Tag: capi-location-manager_0.1.1-1
+
+ -- Minjune Kim <sena06.kim@samsung.com> Wed, 01 Aug 2012 10:29:48 +0900
+
+capi-location-manager (0.1.0-26) unstable; urgency=low
+
+ * Seperate map service from location service
+ * Tag: capi-location-manager_0.1.0-26
+
+ -- Minjune Kim <sena06.kim@samsung.com> Fri, 27 Jul 2012 20:11:48 +0900
+
+capi-location-manager (0.1.0-25) unstable; urgency=low
+
+ * Support developer mode
+ * Tag: capi-location-manager_0.1.0-25
+
+ -- Minjune Kim <sena06.kim@samsung.com> Thu, 19 Jul 2012 19:58:47 +0900
+
+capi-location-manager (0.1.0-24) unstable; urgency=low
+
+ * Add the env variable, LOCATION_TEST_ENABLE
+ * Tag: capi-location-manager_0.1.0-24
+
+ -- Minjune Kim <sena06.kim@samsung.com> Fri, 13 Jul 2012 13:50:04 +0900
+
+capi-location-manager (0.1.0-23) unstable; urgency=low
+
+ * Apply to the grammar check for locatoin_bounds_contains_coordinates()
+ * Tag: capi-location-manager_0.1.0-23
+
+ -- Kangho Hur <kangho.hur@samsung.com> Tue, 26 Jun 2012 22:36:13 +0900
+
+capi-location-manager (0.1.0-22) unstable; urgency=low
+
+ * Support LOCATION_METHOD_CPS & Remove LOCATIONS_METHOD_SPS
+ * Tag: capi-location-manager_0.1.0-22
+
+ -- Minjune Kim <sena06.kim@samsung.com> Fri, 25 May 2012 20:21:07 +0900
+
+capi-location-manager (0.1.0-21) unstable; urgency=low
+
+ * Support the satellte information updates
+ * LOCATION_METHOD_SPS is not supported.
+ * Tag: capi-location-manager_0.1.0-21
+
+ -- Minjune Kim <sena06.kim@samsung.com> Wed, 16 May 2012 12:32:07 +0900
+
+capi-location-manager (0.1.0-20) unstable; urgency=low
+
+ * Fix a bug that getting satellite was failed when a method was hybrid.
+ * Tag: capi-location-manager_0.1.0-20
+
+ -- Minjune Kim <sena06.kim@samsung.com> Wed, 09 May 2012 10:06:03 +0900
+
+capi-location-manager (0.1.0-19) unstable; urgency=low
+
+ * Resolve Gcc 4.6 warning
+ * Tag: capi-location-manager_0.1.0-19
+
+ -- Kangho Hur <kangho.hur@samsung.com> Fri, 20 Apr 2012 17:54:51 +0900
+
capi-location-manager (0.1.0-18) unstable; urgency=low
* Fix return value for location_bounds_is_contains_coordinates()
- * Git: slp-source.sec.samsung.net:slp/api/location-manager
* Tag: capi-location-manager_0.1.0-18
-- Minjune Kim <sena06.kim@samsung.com> Tue, 03 Apr 2012 11:24:16 +0900
capi-location-manager (0.1.0-17) unstable; urgency=low
* fixed TC results
- * Git: slp-source.sec.samsung.net:slp/api/location-manager
* Tag: capi-location-manager_0.1.0-17
-- Genie Kim <daejins.kim@samsung.com> Thu, 22 Mar 2012 17:22:01 +0900
capi-location-manager (0.1.0-16) unstable; urgency=low
* Correct bugs in location preference
- * Git: slp-source.sec.samsung.net:slp/api/location-manager
* Tag: capi-location-manager_0.1.0-16
-- ByungWoo Lee <bw1212.lee@samsung.com> Tue, 20 Mar 2012 21:02:48 +0900
capi-location-manager (0.1.0-15) unstable; urgency=low
* Add location preference
- * Git: slp-source.sec.samsung.net:slp/api/location-manager
* Tag: capi-location-manager_0.1.0-15
-- ByungWoo Lee <bw1212.lee@samsung.com> Mon, 19 Mar 2012 19:37:00 +0900
capi-location-manager (0.1.0-14) unstable; urgency=low
* change gps_status_get_satellite functions
- * Git: slp-source.sec.samsung.net:slp/api/location-manager
* Tag: capi-location-manager_0.1.0-14
-- Genie Kim <daejins.kim@samsung.com> Wed, 14 Mar 2012 20:41:44 +0900
capi-location-manager (0.1.0-13) unstable; urgency=low
* Remove the unneccesary structure (location_bounds_s)
- * Git: slp-source.sec.samsung.net:slp/api/location-manager
* Tag: capi-location-manager_0.1.0-13
-- Kangho Hur <kangho.hur@samsung.com> Tue, 13 Mar 2012 16:03:12 +0900
capi-location-manager (0.1.0-12) unstable; urgency=low
* Add the last position, velocity, accuracy and satellite
- * Git: slp-source.sec.samsung.net:slp/api/location-manager
* Tag: capi-location-manager_0.1.0-12
-- Genie Kim <daejins.kim@samsung.com> Thu, 08 Mar 2012 14:56:28 +0900
capi-location-manager (0.1.0-11) unstable; urgency=low
* Support to multiple boundaries
- * Git: slp-source.sec.samsung.net:slp/api/location-manager
* Tag: capi-location-manager_0.1.0-11
-- Kangho Hur <kangho.hur@samsung.com> Tue, 06 Mar 2012 20:21:26 +0900
capi-location-manager (0.1.0-10) unstable; urgency=low
* Add the location_bounds.
- * Git: slp-source.sec.samsung.net:slp/api/location-manager
* Tag: capi-location-manager_0.1.0-10
-- Kangho Hur <kangho.hur@samsung.com> Fri, 02 Mar 2012 20:52:01 +0900
capi-location-manager (0.1.0-9) unstable; urgency=low
* Use 'static' to local function which is limited to the current source file.
- * Git: slp-source.sec.samsung.net:slp/api/location-manager
* Tag: capi-location-manager_0.1.0-9
-- Kangho Hur <kangho.hur@samsung.com> Tue, 21 Feb 2012 10:11:16 +0900
capi-location-manager (0.1.0-8) unstable; urgency=low
* Apply the SOVERSION
- * Git: slp-source.sec.samsung.net:slp/api/location-manager
* Tag: capi-location-manager_0.1.0-8
-- Kangho Hur <kangho.hur@samsung.com> Tue, 14 Feb 2012 17:53:09 +0900
capi-location-manager (0.1.0-7) unstable; urgency=low
* Add the location_manager_get_last_known_position(), location_manager_is_supported_method(), and interval setting.
- * Git: slp-source.sec.samsung.net:slp/api/location-manager
* Tag: capi-location-manager_0.1.0-7
-- Kangho Hur <kangho.hur@samsung.com> Thu, 26 Jan 2012 20:08:56 +0900
capi-location-manager (0.1.0-6) unstable; urgency=low
* Apply Location Boundary changes
- * Git: slp-source.sec.samsung.net:slp/api/location-manager
* Tag: capi-location-manager_0.1.0-6
-- Kangho Hur <kangho.hur@samsung.com> Wed, 07 Dec 2011 11:44:27 +0900
capi-location-manager (0.1.0-5) unstable; urgency=low
* Changes the value of ERROR_NONE
- * Git: slp-source.sec.samsung.net:slp/api/location-manager
* Tag: capi-location-manager_0.1.0-5
-- Kangho Hur <kangho.hur@samsung.com> Mon, 05 Dec 2011 11:18:34 +0900
capi-location-manager (0.1.0-4) unstable; urgency=low
* Apply the Tizen
- * Git: slp-source.sec.samsung.net:slp/api/location-manager
* Tag: capi-location-manager_0.1.0-4
-- Kangho Hur <kangho.hur@samsung.com> Wed, 23 Nov 2011 15:09:01 +0900
capi-location-manager (0.1.0-3) unstable; urgency=low
* Repackage for SDK
- * Git: slp-source.sec.samsung.net:slp/api/location-manager
* Tag: capi-location-manager_0.1.0-3
-- Kangho Hur <kangho.hur@samsung.com> Mon, 07 Nov 2011 21:40:30 +0900
capi-location-manager (0.1.0-2) unstable; urgency=low
* Apply the error messages
- * Git: slp-source.sec.samsung.net:slp/api/location-manager
* Tag: capi-location-manager_0.1.0-2
-- Kangho Hur <kangho.hur@samsung.com> Fri, 07 Oct 2011 13:28:33 +0900
capi-location-manager (0.1.0-1) unstable; urgency=low
* Alpha Release
- * Git: slp-source.sec.samsung.net:slp/api/location-manager
* Tag: capi-location-manager_0.1.0-1
-- Kangho Hur <kangho.hur@samsung.com> Tue, 27 Sep 2011 20:03:39 +0900
capi-location-manager (0.0.1-5) unstable; urgency=low
* Add the location_manager_is_boundary_contains_coordinate()
- * Git: slp-source.sec.samsung.net:slp/api/location-manager
* Tag: capi-location-manager_0.0.1-5
-- Kangho Hur <kangho.hur@samsung.com> Mon, 26 Sep 2011 19:41:49 +0900
capi-location-manager (0.0.1-4) unstable; urgency=low
* gps_status_get_used_satellite_count() API name changes.
- * Git: slp-source.sec.samsung.net:slp/api/location-manager
* Tag: capi-location-manager_0.0.1-4
-- Kangho Hur <kangho.hur@samsung.com> Fri, 09 Sep 2011 16:58:25 +0900
capi-location-manager (0.0.1-3) unstable; urgency=low
* Remove IPS, CPS location method type
- * Git: slp-source.sec.samsung.net:slp/api/location-manager
* Tag: capi-location-manager_0.0.1-3
-- Kangho Hur <kangho.hur@samsung.com> Mon, 05 Sep 2011 14:19:50 +0900
capi-location-manager (0.0.1-2) unstable; urgency=low
* Rename the callback prototype
- * Git: slp-source.sec.samsung.net:slp/api/location-manager
* Tag: capi-location-manager_0.0.1-2
-- Kangho Hur <kangho.hur@samsung.com> Mon, 08 Aug 2011 10:15:11 +0900
capi-location-manager (0.0.1-1) unstable; urgency=low
* Initial Upload
- * Git: slp-source.sec.samsung.net:slp/api/location-manager
* Tag: capi-location-manager_0.0.1-1
-- Kangho Hur <kangho.hur@samsung.com> Thu, 04 Aug 2011 16:51:02 +0900
* @see location_bounds_create_circle()
* @see location_bounds_create_polygon()
*/
-bool location_bounds_is_contains_coordinates(location_bounds_h bounds, location_coords_s coords);
+bool location_bounds_contains_coordinates(location_bounds_h bounds, location_coords_s coords);
/**
* @brief Get the type of location bounds.
typedef bool (*location_preference_property_cb)(const char* key, const char* value, void* user_data);
/**
+ * @brief Called repeatedly to get each supported providers.
+ * @param[in] provider The supported provider name
+ * @param[in] user_data The user data passed from the foreach function
+ * @return @c true to continue with the next iteration of the loop, \n @c false to break outsp of the loop.
+ * @pre location_preference_foreach_supported_provider() will invoke this callback.
+ * @see location_preference_foreach_supported_provider()
+ */
+typedef bool (*location_preference_supported_provider_cb)(const char* provider, void *user_data);
+
+/**
* @brief Retrieves the available property keys of location preference.
* @param[in] location_service The memory pointer of location service handle.
* It must be converted into location_service_h by GET_LOCATION_SERVICE().
*/
int location_preference_get(location_service_h service, const char* key, char** value);
+__attribute__ ((deprecated)) int location_preference_get_provider_name(location_service_h service, char** provider);
+
/**
- * @brief Gets the provider name of location service.
+ * @brief Sets the provider of location service.
+ * @param[in] location_service The memory pointer of location service handle.
+ * It must be converted into location_service_h by GET_LOCATION_SERVICE().
+ * @param[in] provider The provider name of location service
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #LOCATION_PREFERENCE_ERROR_NONE Successful
+ * @retval #LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see GET_LOCATION_SERVICE()
+ * @see location_preference_get_provider()
+ */
+int location_preference_set_provider(location_service_h service, char* provider);
+
+/**
+ * @brief Gets the provider of location service.
* @remarks The @a provider must be released with free() by you.
* @param[in] location_service The memory pointer of location service handle.
* It must be converted into location_service_h by GET_LOCATION_SERVICE().
* @return 0 on success, otherwise a negative error value.
* @retval #LOCATION_PREFERENCE_ERROR_NONE Successful
* @retval #LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see GET_LOCATION_SERVICE()
+ * @see location_preference_set_provider()
+ */
+int location_preference_get_provider(location_service_h service, char** provider);
+
+/**
+ * @brief Gets the default provider of location service.
+ * @remarks The @a provider must be released with free() by you.
+ * @param[in] location_service The memory pointer of location service handle.
+ * It must be converted into location_service_h by GET_LOCATION_SERVICE().
+ * @param[out] provider The default provider name of location service
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #LOCATION_PREFERENCE_ERROR_NONE Successful
+ * @retval #LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
* @see GET_LOCATION_SERVICE()
*/
-int location_preference_get_provider_name(location_service_h service, char** provider);
+int location_preference_get_default_provider(location_service_h service, char** provider);
+
+/**
+ * @brief Gets the provider of location service.
+ * @param[in] location_service The memory pointer of location service handle.
+ * It must be converted into location_service_h by GET_LOCATION_SERVICE().
+ * @param[in] callback The callback function to be invoked
+ * @param[in] user_data The user data passed to the callback function
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #LOCATION_PREFERENCE_ERROR_NONE Successful
+ * @retval #LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @post This function invokes location_preference_supported_provider_cb() to get all supported providers.
+ * @see GET_LOCATION_SERVICE()
+ * @see location_preference_set_provider()
+ */
+int location_preference_foreach_supported_provider(location_service_h service, location_preference_supported_provider_cb callback , void *user_data);
/**
* @brief Gets the distance unit of location service.
int location_preference_set_language(location_service_h service, const char* language);
/**
+ * @brief Sets the country code.
+ * @param[in] location_service The memory pointer of location service handle.
+ * It must be converted into location_service_h by GET_LOCATION_SERVICE().
+ * @param[in] country_code The country code
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #LOCATION_PREFERENCE_ERROR_NONE Successful
+ * @retval #LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see GET_LOCATION_SERVICE()
+ * @see location_preference_get_country_code()
+ */
+int location_preference_set_country_code(location_service_h service, const char* country_code);
+
+/**
+ * @brief Gets the country code.
+ * @param[in] location_service The memory pointer of location service handle.
+ * It must be converted into location_service_h by GET_LOCATION_SERVICE().
+ * @param[out] country_code The country code
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #LOCATION_PREFERENCE_ERROR_NONE Successful
+ * @retval #LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see GET_LOCATION_SERVICE()
+ * @see location_preference_set_country_code()
+ */
+int location_preference_get_country_code(location_service_h service, char** country_code);
+
+/**
* @}
*/
LOCATIONS_METHOD_HYBRID, /**< This method selects the best method available at the moment. */
LOCATIONS_METHOD_GPS, /**< This method uses Global Positioning System. */
LOCATIONS_METHOD_WPS, /**< This method uses Wifi Positioning System. */
- LOCATIONS_METHOD_SPS /**< This method uses sensor. */
+ LOCATIONS_METHOD_CPS /**< This method uses Cellular Positioning System. */
} location_method_e;
/**
* @{
*/
/**
- * @brief Called every 1 second with updated position information.
+ * @brief Called at defined interval with updated position information.
* @param[in] latitude The updated latitude [-90.0 ~ 90.0] (degrees)
* @param[in] longitude The updated longitude [-180.0 ~ 180.0] (degrees)
* @param[in] altitude The updated altitude (meters)
- * @param[in] timestamp The timestamp (time when measurement took place)
+ * @param[in] timestamp The timestamp (time when measurement took place or 0 if invalid)
* @param[in] user_data The user data passed from the call registration function
* @pre location_manager_start() will invoke this callback if you register this callback using location_manager_set_position_updated_cb()
* @see location_manager_start()
typedef void(*location_position_updated_cb)(double latitude, double longitude, double altitude, time_t timestamp, void *user_data);
/**
- * @brief Called every 1 second with updated velocity information.
+ * @brief Called at defined interval with updated velocity information.
* @param[in] speed The updated speed (km/h)
* @param[in] direction The updated direction (in degrees from the north)
* @param[in] climb The updated climb (km/h)
- * @param[in] timestamp The timestamp (time when measurement took place)
+ * @param[in] timestamp The timestamp (time when measurement took place or 0 if invalid)
* @param[in] user_data The user data passed from the callback registration function
* @pre location_manager_start() will invoke this callback if you register this callback using location_manager_set_velocity_updated_cb()
* @see location_manager_start()
* @param[in] latitude The updated latitude [-90.0 ~ 90.0] (degrees)
* @param[in] longitude The updated longitude [-180.0 ~ 180.0] (degrees)
* @param[in] altitude The updated altitude (meters)
- * @param[in] timestamp The timestamp (time when measurement took place)
+ * @param[in] timestamp The timestamp (time when measurement took place or 0 if invalid)
* @param[in] user_data The user data passed from the callback registration function
* @pre location_manager_start() will invoke this callback if you register this callback using location_manager_set_zone_changed_cb()
* @see #location_boundary_state_e
* @param[out] altitude The current altitude (meters)
* @param[out] latitude The current latitude [-90.0 ~ 90.0] (degrees)
* @param[out] longitude The current longitude [-180.0 ~ 180.0] (degrees)
- * @param[out] timestamp The timestamp (time when measurement took place)
+ * @param[out] timestamp The timestamp (time when measurement took place or 0 if valid)
* @return 0 on success, otherwise a negative error value.
* @retval #LOCATIONS_ERROR_NONE Successful
* @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
* @param[out] climb The climb (km/h)
* @param[out] direction The direction, degrees from the north
* @param[out] speed The speed (km/h)
- * @param[out] timestamp The timestamp (time when measurement took place)
+ * @param[out] timestamp The timestamp (time when measurement took place or 0 if invalid)
* @return 0 on success, otherwise a negative error value.
* @retval #LOCATIONS_ERROR_NONE Successful
* @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
* @retval #LOCATIONS_ERROR_GPS_SETTING_OFF GPS is not enabled
* @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start()
*/
-int location_manager_get_velocity(location_manager_h manager, int *climb, int *direction, int *speed, time_t *timestamp);
+int location_manager_get_velocity(location_manager_h manager, double *climb, double *direction, double *speed, time_t *timestamp);
/**
* @brief Gets the current accuracy information.
* @param[out] altitude The last altitude (meters)
* @param[out] latitude The last latitude [-90.0 ~ 90.0] (degrees)
* @param[out] longitude The last longitude [-180.0 ~ 180.0] (degrees)
- * @param[out] timestamp The timestamp (time when measurement took place)
+ * @param[out] timestamp The timestamp (time when measurement took place or 0 if invalid)
* @return 0 on success, otherwise a negative error value.
* @retval #LOCATIONS_ERROR_NONE Successful
* @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
* @param[out] climb The last climb (km/h)
* @param[out] direction The last direction, degrees from the north
* @param[out] speed The last speed (km/h)
- * @param[out] timestamp The timestamp (time when measurement took place)
+ * @param[out] timestamp The timestamp (time when measurement took place or 0 if invalid)
* @return 0 on success, otherwise a negative error value.
* @retval #LOCATIONS_ERROR_NONE Successful
* @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
* @pre The location manager handle must be created by location_manager_create()
*/
-int location_manager_get_last_velocity(location_manager_h manager, int *climb, int *direction, int *speed, time_t *timestamp);
+int location_manager_get_last_velocity(location_manager_h manager, double *climb, double *direction, double *speed, time_t *timestamp);
/**
* @brief Gets the last accuracy information which is recorded.
int location_manager_get_last_accuracy(location_manager_h manager, location_accuracy_level_e *level, double *horizontal, double *vertical);
/**
- * @brief Registers a callback function to be invoked every 1 second with updated position information.
+ * @brief Registers a callback function to be invoked at defined interval with updated position information.
*
* @param[in] manager The location manager handle
* @param[in] callback The callback function to register
* @see location_manager_unset_position_updated_cb()
* @see location_position_updated_cb()
*/
-int location_manager_set_position_updated_cb(location_manager_h manager, location_position_updated_cb callback, int interval, void *user_data);
+int location_manager_set_position_updated_cb(location_manager_h manager, location_position_updated_cb callback, int interval, void *user_data);
/**
* @brief Unregisters the callback function.
int location_manager_unset_position_updated_cb(location_manager_h manager);
/**
- * @brief Registers a callback function to be invoked every 1 second with updated velocity information.
+ * @brief Registers a callback function to be invoked at defined interval with updated velocity information.
*
* @param[in] manager The location manager handle
* @param[in] callback The callback function to register
+ * @param[in] interval The interval [1 ~ 120] (seconds)
* @param[in] user_data The user data to be passed to the callback function
* @return 0 on success, otherwise a negative error value.
* @retval #LOCATIONS_ERROR_NONE Successful
* @see location_manager_unset_velocity_updated_cb()
* @see location_velocity_updated_cb()
*/
-int location_manager_set_velocity_updated_cb(location_manager_h manager, location_velocity_updated_cb callback, void *user_data);
+int location_manager_set_velocity_updated_cb(location_manager_h manager, location_velocity_updated_cb callback, int interval, void *user_data);
/**
* @brief Unregisters the callback function.
int location_manager_unset_zone_changed_cb(location_manager_h manager);
/**
+ * @brief Gets the distance in meters between two locations.
+ * @param[in] start_latitude The starting latitude [-90.0 ~ 90.0] (degrees)
+ * @param[in] start_longitude The starting longitude [-180.0 ~ 180.0] (degrees)
+ * @param[in] end_latitude The ending latitude [-90.0 ~ 90.0] (degrees)
+ * @param[in] end_longitude The ending longitude [-180.0 ~ 180.0] (degrees)
+ * @param[out] distance The distance between two locations (meters)
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #LOCATIONS_ERROR_NONE Successful
+ * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
+ */
+int location_manager_get_distance(double start_latitude, double start_longitude, double end_latitude, double end_longitude, double *distance);
+
+/**
* @brief Sends command to the server.
* @param[in] cmd The command string to be sent
* @return 0 on success, otherwise a negative error value.
typedef bool(*gps_status_get_satellites_cb)(unsigned int azimuth, unsigned int elevation, unsigned int prn, int snr, bool is_active, void *user_data);
/**
+ * @brief Called at defined interval with updated satellite information.
+ * @param[out] num_of_active The last number of active satellites
+ * @param[out] num_of_inview The last number of satellites in view
+ * @param[out] timestamp The last timestamp (time when last measurement took place or 0 if invalid)
+ * @param[in] user_data The user data passed from the call registration function
+ * @pre location_manager_start() will invoke this callback if you register this callback using location_manager_set_position_updated_cb()
+ * @see location_manager_start()
+ * @see location_manager_set_position_updated_cb()
+ */
+typedef void(*gps_status_satellite_updated_cb)(int num_of_active, int num_of_inview, time_t timestamp, void *user_data);
+
+/**
* @brief Gets the GPS NMEA data.
* @remarks This call is valid only for location managers with #LOCATIONS_METHOD_GPS method.\n
* @a nmea must be released with @c free() by you.
* @param[in] manager The location manager handle
* @param[out] num_of_active The number of active satellites
* @param[out] num_of_inview The number of satellites in view
- * @param[out] timestamp The timestamp (time when measurement took place)
+ * @param[out] timestamp The timestamp (time when measurement took place or 0 if invalid)
* @return 0 on success, otherwise a negative error value.
* @retval #LOCATIONS_ERROR_NONE Successful
* @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
int gps_status_get_satellite(location_manager_h manager, int *num_of_active, int *num_of_inview, time_t *timestamp);
/**
+ * @brief Registers a callback function to be invoked at defined interval with updated satellite information.
+ *
+ * @param[in] manager The location manager handle
+ * @param[in] callback The callback function to register
+ * @param[in] interval The interval [1 ~ 120] (seconds)
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #LOCATIONS_ERROR_NONE Successful
+ * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @post gps_status_satellite_updated_cb() will be invoked
+ * @see gps_status_unset_satellite_updated_cb()
+ * @see gps_status_satellite_updated_cb()
+ */
+int gps_status_set_satellite_updated_cb(location_manager_h manager, gps_status_satellite_updated_cb callback, int interval, void *user_data);
+
+/**
+ * @brief Unregisters the callback function.
+ *
+ * @param[in] manager The location manager handle
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #LOCATIONS_ERROR_NONE Successful
+ * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see gps_status_set_satellite_updated_cb()
+ */
+int gps_status_unset_satellite_updated_cb(location_manager_h manager);
+
+/**
* @brief Invokes the callback function for each satellite.
* @remarks This function is valid only for location managers with the #LOCATIONS_METHOD_GPS method.
* @param[in] manager The location manager handle
* @param[in] manager The location manager handle
* @param[out] num_of_active The last number of active satellites
* @param[out] num_of_inview The last number of satellites in view
- * @param[out] timestamp The last timestamp (time when last measurement took place)
+ * @param[out] timestamp The last timestamp (time when last measurement took place or 0 if invalid)
* @return 0 on success, otherwise a negative error value.
* @retval #LOCATIONS_ERROR_NONE Successful
* @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
_LOCATIONS_EVENT_TYPE_POSITION,
_LOCATIONS_EVENT_TYPE_VELOCITY,
_LOCATIONS_EVENT_TYPE_BOUNDARY,
+ _LOCATIONS_EVENT_TYPE_SATELLITE,
_LOCATIONS_EVENT_TYPE_FOREACH_BOUNDS,
_LOCATIONS_EVENT_TYPE_NUM
}_location_event_e;
+#sbs-git:slp/api/location-manager capi-location-manager 0.1.0 d1ee09a32e8bc0e9ed48ece37c641a7393c086c5
Name: capi-location-manager
Summary: A Location Manager library in Tizen Native API
-Version: 0.1.0
-Release: 17
+Version: 0.1.2
+Release: 1
Group: TO_BE/FILLED_IN
-License: Apache-2.0
+License: TO BE FILLED IN
Source0: %{name}-%{version}.tar.gz
BuildRequires: cmake
BuildRequires: pkgconfig(dlog)
location_bounds_type_e ret;
switch(type)
{
- case LOCATION_BOUNDARY_NONE:
- case LOCATION_BOUNDARY_RECT:
- ret = LOCATION_BOUNDS_RECT;
- break;
case LOCATION_BOUNDARY_CIRCLE:
ret = LOCATION_BOUNDS_CIRCLE;
break;
case LOCATION_BOUNDARY_POLYGON:
ret = LOCATION_BOUNDS_POLYGON;
break;
+ case LOCATION_BOUNDARY_NONE:
+ case LOCATION_BOUNDARY_RECT:
+ default:
+ ret = LOCATION_BOUNDS_RECT;
+ break;
}
return ret;
}
return LOCATION_BOUNDS_ERROR_NONE;
}
-bool location_bounds_is_contains_coordinates(location_bounds_h bounds, location_coords_s coords)
+bool location_bounds_contains_coordinates(location_bounds_h bounds, location_coords_s coords)
{
if (!bounds)
return FALSE;
LocationPosition *pos = location_position_new(0, coords.latitude, coords.longitude, 0, LOCATION_STATUS_2D_FIX);
if (!pos)
return FALSE;
-
gboolean is_inside = location_boundary_if_inside((LocationBoundary*)bounds, pos);
location_position_free (pos);
bool result = is_inside?TRUE:FALSE;
#include <location_preference.h>
#include <dlog.h>
-#include <location.h>
+#include <location-map-service.h>
#include <stdlib.h>
#include <string.h>
#define LOCATION_PREFERENCE_PRINT_ERROR_CODE(error, msg) \
LOGE("[%s] %s(0x%08x)",__FUNCTION__, msg, error); return error;
-#define LOCATION_PREFERENCE_GET_LOCATION_OBJECT(service) *((LocationObject**)service)
+#define LOCATION_PREFERENCE_GET_LOCATION_OBJECT(service) *((LocationMapObject**)service)
/*
*/
int location_preference_foreach_available_property_keys(location_service_h service, location_preference_available_property_key_cb callback, void* user_data)
{
- LocationObject* object = NULL;
+ LocationMapObject* object = NULL;
GList* keys = NULL;
char* key = NULL;
int ret = 0;
LOCATION_PREFERENCE_NULL_ARG_CHECK(callback);
object = LOCATION_PREFERENCE_GET_LOCATION_OBJECT(service);
- ret = location_get_map_provider_capability_key(object, MAP_SERVICE_PREF_PROPERTY, &keys);
+ ret = location_map_get_provider_capability_key(object, MAP_SERVICE_PREF_PROPERTY, &keys);
if(ret != LOCATION_ERROR_NONE)
{
return __convert_error_code(ret, (char*)__FUNCTION__);
int location_preference_foreach_available_languages(location_service_h service, location_preference_available_language_cb callback, void* user_data)
{
- LocationObject* object = NULL;
+ LocationMapObject* object = NULL;
GList* keys = NULL;
char* key = NULL;
int ret = 0;
LOCATION_PREFERENCE_NULL_ARG_CHECK(callback);
object = LOCATION_PREFERENCE_GET_LOCATION_OBJECT(service);
- ret = location_get_map_provider_capability_key(object, MAP_SERVICE_PREF_LANGUAGE, &keys);
+ ret = location_map_get_provider_capability_key(object, MAP_SERVICE_PREF_LANGUAGE, &keys);
if(ret != LOCATION_ERROR_NONE)
{
return __convert_error_code(ret, (char*)__FUNCTION__);
int location_preference_foreach_properties(location_service_h service, location_preference_property_cb callback, void* user_data)
{
- LocationPreference* pref = NULL;
- LocationObject* object = NULL;
+ LocationMapPref* pref = NULL;
+ LocationMapObject* object = NULL;
GList* keys = NULL;
char* key = NULL;
char* value = NULL;
LOCATION_PREFERENCE_NULL_ARG_CHECK(callback);
object = LOCATION_PREFERENCE_GET_LOCATION_OBJECT(service);
- pref = location_get_map_service_pref(object);
+ pref = location_map_get_service_pref(object);
LOCATION_PREFERENCE_CHECK_CONDITION(pref != NULL, LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER, "LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER");
- keys = location_pref_get_property_key(pref);
+ keys = location_map_pref_get_property_key(pref);
while(keys) {
key = keys->data;
- value = (char*)location_pref_get_property(pref, key);
+ value = (char*)location_map_pref_get_property(pref, key);
if(!callback(key, value, user_data))
break;
keys = keys->next;
}
- location_pref_free(pref);
+ location_map_pref_free(pref);
return LOCATION_PREFERENCE_ERROR_NONE;
}
int location_preference_set(location_service_h service, const char* key, const char* value)
{
- LocationPreference* pref = NULL;
- LocationObject* object = NULL;
+ LocationMapPref* pref = NULL;
+ LocationMapObject* object = NULL;
LOCATION_PREFERENCE_NULL_ARG_CHECK(service);
LOCATION_PREFERENCE_NULL_ARG_CHECK(key);
LOCATION_PREFERENCE_NULL_ARG_CHECK(value);
object = LOCATION_PREFERENCE_GET_LOCATION_OBJECT(service);
- pref = location_get_map_service_pref(object);
+ pref = location_map_get_service_pref(object);
LOCATION_PREFERENCE_CHECK_CONDITION(pref != NULL, LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER, "LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER");
- location_pref_set_property(pref, (gconstpointer)key, (gconstpointer)value);
- location_set_map_service_pref(object, pref);
- location_pref_free(pref);
+ location_map_pref_set_property(pref, (gconstpointer)key, (gconstpointer)value);
+ location_map_set_service_pref(object, pref);
+ location_map_pref_free(pref);
return LOCATION_PREFERENCE_ERROR_NONE;
}
int location_preference_get(location_service_h service, const char* key, char** value)
{
- LocationPreference* pref = NULL;
- LocationObject* object = NULL;
+ LocationMapPref* pref = NULL;
+ LocationMapObject* object = NULL;
char* ret = NULL;
LOCATION_PREFERENCE_NULL_ARG_CHECK(service);
LOCATION_PREFERENCE_NULL_ARG_CHECK(value);
object = LOCATION_PREFERENCE_GET_LOCATION_OBJECT(service);
- pref = location_get_map_service_pref(object);
+ pref = location_map_get_service_pref(object);
LOCATION_PREFERENCE_CHECK_CONDITION(pref != NULL, LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER, "LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER");
- ret = (char*)location_pref_get_property(pref, (gconstpointer)key);
+ ret = (char*)location_map_pref_get_property(pref, (gconstpointer)key);
if(ret != NULL)
{
*value = strdup(ret);
- location_pref_free(pref);
- return LOCATION_PREFERENCE_ERROR_NONE;
+ location_map_pref_free(pref);
}
else
{
*value = NULL;
- location_pref_free(pref);
+ location_map_pref_free(pref);
LOCATION_PREFERENCE_PRINT_ERROR_CODE(LOCATION_PREFERENCE_ERROR_INVALID_KEY, "LOCATION_PREFERENCE_ERROR_INVALID_KEY");
}
+
+ return LOCATION_PREFERENCE_ERROR_NONE;
+}
+
+int location_preference_set_provider(location_service_h service, char* provider)
+{
+ LOCATION_PREFERENCE_NULL_ARG_CHECK(service);
+ LOCATION_PREFERENCE_NULL_ARG_CHECK(provider);
+
+ LocationMapObject *object = NULL;
+ LocationMapPref *pref = NULL;
+ gboolean ret = FALSE;
+
+ object = LOCATION_PREFERENCE_GET_LOCATION_OBJECT(service);
+ pref = location_map_get_service_pref(object);
+ LOCATION_PREFERENCE_CHECK_CONDITION(pref != NULL, LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER, "LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER");
+
+ ret = location_map_pref_set_provider_name(pref, provider);
+ if (!ret) {
+ location_map_pref_free(pref);
+ LOCATION_PREFERENCE_CHECK_CONDITION(pref != NULL, LOCATION_PREFERENCE_ERROR_INVALID_KEY, "LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER");
+ }
+ ret = location_map_set_service_pref(object, pref);
+ if (!ret) {
+ location_map_pref_free(pref);
+ LOCATION_PREFERENCE_CHECK_CONDITION(pref != NULL, LOCATION_PREFERENCE_ERROR_INVALID_KEY, "LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER");
+ }
+
+ location_map_pref_free(pref);
+ return LOCATION_PREFERENCE_ERROR_NONE;
+}
+
+int location_preference_get_provider(location_service_h service, char** provider)
+{
+ LOCATION_PREFERENCE_NULL_ARG_CHECK(service);
+ LOCATION_PREFERENCE_NULL_ARG_CHECK(provider);
+
+ LocationMapObject *object = NULL;
+ LocationMapPref *pref = NULL;
+ gchar* current_provider = NULL;
+
+ object = LOCATION_PREFERENCE_GET_LOCATION_OBJECT(service);
+ pref = location_map_get_service_pref(object);
+ LOCATION_PREFERENCE_CHECK_CONDITION(pref != NULL, LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER, "LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER");
+
+ current_provider = location_map_pref_get_provider_name(pref);
+ if (!current_provider) {
+ location_map_pref_free(pref);
+ LOCATION_PREFERENCE_CHECK_CONDITION(pref != NULL, LOCATION_PREFERENCE_ERROR_INVALID_KEY, "LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER");
+ }
+
+ *provider = g_strdup (current_provider);
+ location_map_pref_free(pref);
+
+ return LOCATION_PREFERENCE_ERROR_NONE;
+}
+
+int location_preference_get_default_provider(location_service_h service, char** provider)
+{
+ LOCATION_PREFERENCE_NULL_ARG_CHECK(service);
+ LOCATION_PREFERENCE_NULL_ARG_CHECK(provider);
+
+ LocationMapObject *object = NULL;
+ gchar *current_provider = NULL;
+ object = LOCATION_PREFERENCE_GET_LOCATION_OBJECT(service);
+ current_provider = location_map_get_default_provider(object);
+ LOCATION_PREFERENCE_CHECK_CONDITION(current_provider != NULL, LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER, "LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER");
+
+ *provider = g_strdup(current_provider);
+ g_free(current_provider);
+
+ return LOCATION_PREFERENCE_ERROR_NONE;
+}
+
+int location_preference_foreach_supported_provider(location_service_h service, location_preference_supported_provider_cb callback , void *user_data)
+{
+ LOCATION_PREFERENCE_NULL_ARG_CHECK(service);
+ LOCATION_PREFERENCE_NULL_ARG_CHECK(callback);
+
+ LocationMapObject *object = NULL;
+ GList *providers = NULL;
+ gchar *provider = NULL;
+
+ object = LOCATION_PREFERENCE_GET_LOCATION_OBJECT(service);
+ providers = location_map_get_supported_providers(object);
+ LOCATION_PREFERENCE_CHECK_CONDITION(providers != NULL, LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER, "LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER");
+ while(providers) {
+ provider = providers->data;
+ if(!callback(provider, user_data))
+ break;
+ providers = providers->next;
+ }
+
+ return LOCATION_PREFERENCE_ERROR_NONE;
}
int location_preference_get_provider_name(location_service_h service, char** provider)
{
- LocationPreference* pref = NULL;
- LocationObject* object = NULL;
+ LocationMapPref* pref = NULL;
+ LocationMapObject* object = NULL;
char* ret = NULL;
LOCATION_PREFERENCE_NULL_ARG_CHECK(service);
LOCATION_PREFERENCE_NULL_ARG_CHECK(provider);
object = LOCATION_PREFERENCE_GET_LOCATION_OBJECT(service);
- pref = location_get_map_service_pref(object);
+ pref = location_map_get_service_pref(object);
LOCATION_PREFERENCE_CHECK_CONDITION(pref != NULL, LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER, "LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER");
- ret = location_pref_get_provider_name(pref);
+ ret = location_map_pref_get_provider_name(pref);
if(ret != NULL)
*provider = strdup(ret);
else
*provider = NULL;
- location_pref_free(pref);
+ location_map_pref_free(pref);
return LOCATION_PREFERENCE_ERROR_NONE;
}
int location_preference_get_distance_unit(location_service_h service, location_preference_distance_unit_e* unit)
{
- LocationPreference* pref = NULL;
- LocationObject* object = NULL;
+ LocationMapPref* pref = NULL;
+ LocationMapObject* object = NULL;
char* ret = NULL;
LOCATION_PREFERENCE_NULL_ARG_CHECK(service);
LOCATION_PREFERENCE_NULL_ARG_CHECK(unit);
object = LOCATION_PREFERENCE_GET_LOCATION_OBJECT(service);
- pref = location_get_map_service_pref(object);
+ pref = location_map_get_service_pref(object);
LOCATION_PREFERENCE_CHECK_CONDITION(pref != NULL, LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER, "LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER");
- ret = location_pref_get_distance_unit(pref);
+ ret = location_map_pref_get_distance_unit(pref);
if(ret != NULL)
{
switch(ret[0]) {
*unit = LOCATION_PREFERENCE_DISTANCE_UNIT_M;
break;
}
- location_pref_free(pref);
+ location_map_pref_free(pref);
return LOCATION_PREFERENCE_ERROR_NONE;
}
else
{
- location_pref_free(pref);
+ location_map_pref_free(pref);
LOCATION_PREFERENCE_PRINT_ERROR_CODE(LOCATION_PREFERENCE_ERROR_RESULT_NOT_FOUND, "LOCATION_PREFERENCE_ERROR_RESULT_NOT_FOUND");
}
}
int location_preference_set_distance_unit(location_service_h service, location_preference_distance_unit_e unit)
{
- LocationPreference* pref = NULL;
- LocationObject* object = NULL;
+ LocationMapPref* pref = NULL;
+ LocationMapObject* object = NULL;
char* distance = NULL;
LOCATION_PREFERENCE_NULL_ARG_CHECK(service);
}
object = LOCATION_PREFERENCE_GET_LOCATION_OBJECT(service);
- pref = location_get_map_service_pref(object);
+ pref = location_map_get_service_pref(object);
LOCATION_PREFERENCE_CHECK_CONDITION(pref != NULL, LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER, "LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER");
- location_pref_set_distance_unit(pref, distance);
- location_set_map_service_pref(object, pref);
- location_pref_free(pref);
+ location_map_pref_set_distance_unit(pref, distance);
+ location_map_set_service_pref(object, pref);
+ location_map_pref_free(pref);
return LOCATION_PREFERENCE_ERROR_NONE;
}
int location_preference_get_language(location_service_h service, char** language)
{
- LocationPreference* pref = NULL;
- LocationObject* object = NULL;
+ LocationMapPref* pref = NULL;
+ LocationMapObject* object = NULL;
char* ret = NULL;
LOCATION_PREFERENCE_NULL_ARG_CHECK(service);
LOCATION_PREFERENCE_NULL_ARG_CHECK(language);
object = LOCATION_PREFERENCE_GET_LOCATION_OBJECT(service);
- pref = location_get_map_service_pref(object);
+ pref = location_map_get_service_pref(object);
LOCATION_PREFERENCE_CHECK_CONDITION(pref != NULL, LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER, "LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER");
- ret = location_pref_get_language(pref);
+ ret = location_map_pref_get_language(pref);
if(ret != NULL)
*language = strdup(ret);
else
*language = NULL;
- location_pref_free(pref);
+ location_map_pref_free(pref);
return LOCATION_PREFERENCE_ERROR_NONE;
}
int location_preference_set_language(location_service_h service, const char* language)
{
- LocationPreference* pref = NULL;
- LocationObject* object = NULL;
+ LocationMapPref* pref = NULL;
+ LocationMapObject* object = NULL;
LOCATION_PREFERENCE_NULL_ARG_CHECK(service);
LOCATION_PREFERENCE_NULL_ARG_CHECK(language);
object = LOCATION_PREFERENCE_GET_LOCATION_OBJECT(service);
- pref = location_get_map_service_pref(object);
+ pref = location_map_get_service_pref(object);
+ LOCATION_PREFERENCE_CHECK_CONDITION(pref != NULL, LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER, "LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER");
+
+ location_map_pref_set_language(pref, language);
+ location_map_set_service_pref(object, pref);
+ location_map_pref_free(pref);
+
+ return LOCATION_PREFERENCE_ERROR_NONE;
+}
+
+
+int location_preference_get_country_code(location_service_h service, char** country_code)
+{
+ LocationMapPref* pref = NULL;
+ LocationMapObject* object = NULL;
+ char* ret = NULL;
+
+ LOCATION_PREFERENCE_NULL_ARG_CHECK(service);
+ LOCATION_PREFERENCE_NULL_ARG_CHECK(country_code);
+
+ object = LOCATION_PREFERENCE_GET_LOCATION_OBJECT(service);
+ pref = location_map_get_service_pref(object);
LOCATION_PREFERENCE_CHECK_CONDITION(pref != NULL, LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER, "LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER");
- location_pref_set_language(pref, language);
- location_set_map_service_pref(object, pref);
- location_pref_free(pref);
+ ret = location_map_pref_get_country(pref);
+ if(ret != NULL)
+ *country_code = strdup(ret);
+ else
+ *country_code = NULL;
+ location_map_pref_free(pref);
return LOCATION_PREFERENCE_ERROR_NONE;
}
+int location_preference_set_country_code(location_service_h service, const char* country_code)
+{
+ LocationMapPref* pref = NULL;
+ LocationMapObject* object = NULL;
+
+ LOCATION_PREFERENCE_NULL_ARG_CHECK(service);
+ LOCATION_PREFERENCE_NULL_ARG_CHECK(country_code);
+ object = LOCATION_PREFERENCE_GET_LOCATION_OBJECT(service);
+ pref = location_map_get_service_pref(object);
+ LOCATION_PREFERENCE_CHECK_CONDITION(pref != NULL, LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER, "LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER");
+
+ location_map_pref_set_country(pref, country_code);
+ location_map_set_service_pref(object, pref);
+ location_map_pref_free(pref);
+
+ return LOCATION_PREFERENCE_ERROR_NONE;
+}
handle->user_data
[_LOCATIONS_EVENT_TYPE_VELOCITY]);
}
- if (type == POSITION_UPDATED && handle->user_cb[_LOCATIONS_EVENT_TYPE_POSITION]) {
+ else if (type == POSITION_UPDATED && handle->user_cb[_LOCATIONS_EVENT_TYPE_POSITION]) {
LocationPosition *pos = (LocationPosition *) data;
LOGI("[%s] Current position: timestamp : %d, latitude : %f, altitude: %f, longitude: %f", __FUNCTION__,
pos->timestamp, pos->latitude, pos->altitude, pos->longitude);
handle->user_data
[_LOCATIONS_EVENT_TYPE_POSITION]);
}
+ else if (type == SATELLITE_UPDATED && handle->user_cb[_LOCATIONS_EVENT_TYPE_SATELLITE]) {
+ LocationSatellite *sat = (LocationSatellite *)data;
+ LOGI("[%s] Current satellite information: timestamp : %d, number of active : %d, number of inview : %d", __FUNCTION__,
+ sat->timestamp, sat->num_of_sat_used, sat->num_of_sat_inview);
+ ((gps_status_satellite_updated_cb) handle->user_cb[_LOCATIONS_EVENT_TYPE_SATELLITE]) (sat->num_of_sat_used, sat->num_of_sat_inview,
+ sat->timestamp, handle->user_data[_LOCATIONS_EVENT_TYPE_SATELLITE]);
+ }
}
static void __cb_service_enabled(GObject * self, guint status, gpointer userdata)
case LOCATIONS_METHOD_WPS:
_method = LOCATION_METHOD_WPS;
break;
- case LOCATIONS_METHOD_SPS:
- _method = LOCATION_METHOD_SPS;
+ case LOCATIONS_METHOD_CPS:
+ _method = LOCATION_METHOD_CPS;
break;
default:
_method = LOCATION_METHOD_NONE;
LocationMethod _method = LOCATION_METHOD_NONE;
switch (method) {
- case LOCATIONS_METHOD_NONE:
- _method = LOCATION_METHOD_NONE;
- break;
case LOCATIONS_METHOD_HYBRID:
_method = LOCATION_METHOD_HYBRID;
break;
case LOCATIONS_METHOD_WPS:
_method = LOCATION_METHOD_WPS;
break;
- case LOCATIONS_METHOD_SPS:
- _method = LOCATION_METHOD_SPS;
+ case LOCATIONS_METHOD_CPS:
+ _method = LOCATION_METHOD_CPS;
break;
+ case LOCATIONS_METHOD_NONE:
+ return LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE;
default:
{
LOGE("[%s] LOCATIONS_ERROR_INVALID_PARAMETER(0x%08x) : Out of range (location_method_e) - method : %d ",
*method = LOCATIONS_METHOD_NONE;
break;
case LOCATION_METHOD_HYBRID:
- case LOCATION_METHOD_CPS:
- case LOCATION_METHOD_IPS:
*method = LOCATIONS_METHOD_HYBRID;
break;
case LOCATION_METHOD_GPS:
case LOCATION_METHOD_WPS:
*method = LOCATIONS_METHOD_WPS;
break;
- case LOCATION_METHOD_SPS:
- *method = LOCATIONS_METHOD_SPS;
+ case LOCATION_METHOD_CPS:
+ *method = LOCATIONS_METHOD_CPS;
break;
default:
{
return LOCATIONS_ERROR_NONE;
}
-int location_manager_get_velocity(location_manager_h manager, int *climb, int *direction, int *speed, time_t * timestamp)
+int location_manager_get_velocity(location_manager_h manager, double *climb, double *direction, double *speed, time_t * timestamp)
{
LOCATIONS_NULL_ARG_CHECK(manager);
LOCATIONS_NULL_ARG_CHECK(climb);
return LOCATIONS_ERROR_NONE;
}
-int location_manager_get_last_velocity(location_manager_h manager, int *climb, int *direction, int *speed, time_t * timestamp)
+int location_manager_get_last_velocity(location_manager_h manager, double *climb, double *direction, double *speed, time_t * timestamp)
{
LOCATIONS_NULL_ARG_CHECK(manager);
LOCATIONS_NULL_ARG_CHECK(climb);
return LOCATIONS_ERROR_NONE;
}
-int location_manager_set_position_updated_cb(location_manager_h manager, location_position_updated_cb callback, int interval,
- void *user_data)
+int location_manager_set_position_updated_cb(location_manager_h manager, location_position_updated_cb callback, int interval, void *user_data)
{
LOCATIONS_CHECK_CONDITION(interval >= 1
&& interval <= 120, LOCATIONS_ERROR_INVALID_PARAMETER, "LOCATIONS_ERROR_INVALID_PARAMETER");
LOCATIONS_NULL_ARG_CHECK(manager);
location_manager_s *handle = (location_manager_s *) manager;
- g_object_set(handle->object, "update-interval", interval, NULL);
+ g_object_set(handle->object, "pos-interval", interval, NULL);
return __set_callback(_LOCATIONS_EVENT_TYPE_POSITION, manager, callback, user_data);
}
return __unset_callback(_LOCATIONS_EVENT_TYPE_POSITION, manager);
}
-int location_manager_set_velocity_updated_cb(location_manager_h manager, location_velocity_updated_cb callback, void *user_data)
+int location_manager_set_velocity_updated_cb(location_manager_h manager, location_velocity_updated_cb callback, int interval, void *user_data)
{
+ LOCATIONS_CHECK_CONDITION(interval >= 1
+ && interval <= 120, LOCATIONS_ERROR_INVALID_PARAMETER, "LOCATIONS_ERROR_INVALID_PARAMETER");
+ LOCATIONS_NULL_ARG_CHECK(manager);
+ location_manager_s *handle = (location_manager_s *) manager;
+ g_object_set(handle->object, "vel-interval", interval, NULL);
return __set_callback(_LOCATIONS_EVENT_TYPE_VELOCITY, manager, callback, user_data);
}
return __unset_callback(_LOCATIONS_EVENT_TYPE_BOUNDARY, manager);
}
+int location_manager_get_distance(double start_latitude, double start_longitude, double end_latitude, double end_longitude, double *distance)
+{
+ LOCATIONS_NULL_ARG_CHECK(distance);
+ LOCATIONS_CHECK_CONDITION(start_latitude>=-90 && start_latitude<=90,LOCATION_BOUNDS_ERROR_INVALID_PARAMETER,"LOCATION_BOUNDS_ERROR_INVALID_PARAMETER");
+ LOCATIONS_CHECK_CONDITION(start_longitude>=-180 && start_longitude<=180,LOCATION_BOUNDS_ERROR_INVALID_PARAMETER, "LOCATION_BOUNDS_ERROR_INVALID_PARAMETER");
+ LOCATIONS_CHECK_CONDITION(end_latitude>=-90 && end_latitude<=90,LOCATION_BOUNDS_ERROR_INVALID_PARAMETER, "LOCATION_BOUNDS_ERROR_INVALID_PARAMETER");
+ LOCATIONS_CHECK_CONDITION(end_longitude>=-180 && end_longitude<=180,LOCATION_BOUNDS_ERROR_INVALID_PARAMETER, "LOCATION_BOUNDS_ERROR_INVALID_PARAMETER");
+
+ int ret = LOCATION_ERROR_NONE;
+ ulong u_distance;
+
+ LocationPosition *start = location_position_new (0, start_latitude, start_longitude, 0, LOCATION_STATUS_2D_FIX);
+ LocationPosition *end = location_position_new (0, end_latitude, end_longitude, 0, LOCATION_STATUS_2D_FIX);
+
+ ret = location_get_distance (start, end, &u_distance);
+ if (ret != LOCATION_ERROR_NONE) {
+ return __convert_error_code(ret, (char *)__FUNCTION__);
+ }
+
+ *distance = (double)u_distance;
+
+ return LOCATIONS_ERROR_NONE;
+}
+
int location_manager_send_command(const char *cmd)
{
LOCATIONS_NULL_ARG_CHECK(cmd);
LOCATIONS_NULL_ARG_CHECK(num_of_inview);
LOCATIONS_NULL_ARG_CHECK(timestamp);
location_manager_s *handle = (location_manager_s *) manager;
- if (handle->method == LOCATIONS_METHOD_HYBRID) {
- LocationMethod _method = LOCATION_METHOD_NONE;
- g_object_get(handle->object, "method", &_method, NULL);
- if (_method != LOCATION_METHOD_GPS) {
+ LocationSatellite *sat = NULL;
+ int ret = location_get_satellite (handle->object, &sat);
+ if (ret != LOCATION_ERROR_NONE || sat == NULL) {
+ if (ret == LOCATION_ERROR_NOT_SUPPORTED) {
LOGE("[%s] LOCATIONS_ERROR_INCORRECT_METHOD(0x%08x) : method - %d", __FUNCTION__,
LOCATIONS_ERROR_INCORRECT_METHOD, handle->method);
return LOCATIONS_ERROR_INCORRECT_METHOD;
}
- } else if (handle->method != LOCATIONS_METHOD_GPS) {
- LOGE("[%s] LOCATIONS_ERROR_INCORRECT_METHOD(0x%08x) : method - %d", __FUNCTION__,
- LOCATIONS_ERROR_INCORRECT_METHOD, handle->method);
- return LOCATIONS_ERROR_INCORRECT_METHOD;
- }
- LocationSatellite *sat = NULL;
- g_object_get(handle->object, "satellite", &sat, NULL);
- if (sat == NULL) {
LOGE("[%s] LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE(0x%08x) : satellite is NULL ", __FUNCTION__,
LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE);
return LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE;
return LOCATIONS_ERROR_NONE;
}
+int gps_status_set_satellite_updated_cb(location_manager_h manager, gps_status_satellite_updated_cb callback, int interval, void *user_data)
+{
+ LOCATIONS_CHECK_CONDITION(interval >= 1
+ && interval <= 120, LOCATIONS_ERROR_INVALID_PARAMETER, "LOCATIONS_ERROR_INVALID_PARAMETER");
+ LOCATIONS_NULL_ARG_CHECK(manager);
+ location_manager_s *handle = (location_manager_s *) manager;
+ g_object_set(handle->object, "sat-interval", interval, NULL);
+ return __set_callback(_LOCATIONS_EVENT_TYPE_SATELLITE, manager, callback, user_data);
+}
+
+int gps_status_unset_satellite_updated_cb(location_manager_h manager)
+{
+ return __unset_callback(_LOCATIONS_EVENT_TYPE_SATELLITE, manager);
+}
+
+
int gps_status_foreach_satellites_in_view(location_manager_h manager, gps_status_get_satellites_cb callback, void *user_data)
{
LOCATIONS_NULL_ARG_CHECK(manager);
LOCATIONS_NULL_ARG_CHECK(callback);
location_manager_s *handle = (location_manager_s *) manager;
- if (handle->method == LOCATIONS_METHOD_HYBRID) {
- LocationMethod _method = LOCATION_METHOD_NONE;
- g_object_get(handle->object, "method", &_method, NULL);
- if (_method != LOCATION_METHOD_GPS) {
+ LocationSatellite *sat = NULL;
+ int ret = location_get_satellite (handle->object, &sat);
+ if (ret != LOCATION_ERROR_NONE || sat == NULL) {
+ if (ret == LOCATION_ERROR_NOT_SUPPORTED) {
LOGE("[%s] LOCATIONS_ERROR_INCORRECT_METHOD(0x%08x) : method - %d", __FUNCTION__,
LOCATIONS_ERROR_INCORRECT_METHOD, handle->method);
return LOCATIONS_ERROR_INCORRECT_METHOD;
}
- } else if (handle->method != LOCATIONS_METHOD_GPS) {
- LOGE("[%s] LOCATIONS_ERROR_INCORRECT_METHOD(0x%08x) : method - %d", __FUNCTION__,
- LOCATIONS_ERROR_INCORRECT_METHOD, handle->method);
- return LOCATIONS_ERROR_INCORRECT_METHOD;
- }
- LocationSatellite *sat = NULL;
- g_object_get(handle->object, "satellite", &sat, NULL);
- if (sat == NULL) {
LOGE("[%s] LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE(0x%08x) : satellite is NULL ", __FUNCTION__,
LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE);
return LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE;
LOCATIONS_NULL_ARG_CHECK(num_of_inview);
LOCATIONS_NULL_ARG_CHECK(timestamp);
location_manager_s *handle = (location_manager_s *) manager;
- int ret;
- if (handle->method == LOCATIONS_METHOD_HYBRID) {
- LocationMethod _method = LOCATION_METHOD_NONE;
- g_object_get(handle->object, "method", &_method, NULL);
- if (_method != LOCATION_METHOD_GPS) {
+ int ret = LOCATION_ERROR_NONE;
+ LocationSatellite *last_sat = NULL;
+ ret = location_get_last_satellite(handle->object, &last_sat);
+ if (ret != LOCATION_ERROR_NONE || last_sat == NULL) {
+ if (ret == LOCATION_ERROR_NOT_SUPPORTED) {
LOGE("[%s] LOCATIONS_ERROR_INCORRECT_METHOD(0x%08x) : method - %d", __FUNCTION__,
LOCATIONS_ERROR_INCORRECT_METHOD, handle->method);
return LOCATIONS_ERROR_INCORRECT_METHOD;
}
- } else if (handle->method != LOCATIONS_METHOD_GPS) {
- LOGE("[%s] LOCATIONS_ERROR_INCORRECT_METHOD(0x%08x) : method - %d", __FUNCTION__,
- LOCATIONS_ERROR_INCORRECT_METHOD, handle->method);
- return LOCATIONS_ERROR_INCORRECT_METHOD;
- }
- LocationSatellite *last_sat = NULL;
- ret = location_get_last_satellite(handle->object, &last_sat);
- if (ret != LOCATION_ERROR_NONE) {
- return __convert_error_code(ret, (char *)__FUNCTION__);
+ LOGE("[%s] LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE(0x%08x) : satellite is NULL ", __FUNCTION__,
+ LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE);
+ return LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE;
}
*num_of_active = last_sat->num_of_sat_used;
LOCATIONS_NULL_ARG_CHECK(callback);
location_manager_s *handle = (location_manager_s *) manager;
int ret;
- if (handle->method == LOCATIONS_METHOD_HYBRID) {
- LocationMethod _method = LOCATION_METHOD_NONE;
- g_object_get(handle->object, "method", &_method, NULL);
- if (_method != LOCATION_METHOD_GPS) {
+ LocationSatellite *last_sat = NULL;
+ ret = location_get_last_satellite(handle->object, &last_sat);
+ if (ret != LOCATION_ERROR_NONE || last_sat == NULL) {
+ if (ret == LOCATION_ERROR_NOT_SUPPORTED) {
LOGE("[%s] LOCATIONS_ERROR_INCORRECT_METHOD(0x%08x) : method - %d", __FUNCTION__,
LOCATIONS_ERROR_INCORRECT_METHOD, handle->method);
return LOCATIONS_ERROR_INCORRECT_METHOD;
}
- } else if (handle->method != LOCATIONS_METHOD_GPS) {
- LOGE("[%s] LOCATIONS_ERROR_INCORRECT_METHOD(0x%08x) : method - %d", __FUNCTION__,
- LOCATIONS_ERROR_INCORRECT_METHOD, handle->method);
- return LOCATIONS_ERROR_INCORRECT_METHOD;
- }
- LocationSatellite *last_sat = NULL;
- ret = location_get_last_satellite(handle->object, &last_sat);
- if (ret != LOCATION_ERROR_NONE) {
- return __convert_error_code(ret, (char *)__FUNCTION__);
+ LOGE("[%s] LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE(0x%08x) : satellite is NULL ", __FUNCTION__,
+ LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE);
+ return LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE;
}
int i;
test_coords.latitude = 12;
test_coords.longitude = 12;
- if (location_bounds_is_contains_coordinates(bounds_poly, test_coords))
- printf("location_bounds_is_contains_coordinates() retrun TRUE \n");
+ if (location_bounds_contains_coordinates(bounds_poly, test_coords))
+ printf("location_bounds_contains_coordinates() retrun TRUE \n");
else
- printf("location_bounds_is_contains_coordinates() retrun FALSE \n");
+ printf("location_bounds_contains_coordinates() retrun FALSE \n");
//print current bounds
ret = location_manager_foreach_boundary(manager, __location_bounds_cb, (void *)manager);
{
int ret;
double altitude, latitude, longitude;
- int climb, direction, speed;
+ double climb, direction, speed;
double horizontal, vertical;
location_accuracy_level_e level;
time_t timestamp;
if (ret != LOCATIONS_ERROR_NONE) {
printf(" Fail : location_manager_get_last_velocity ---> %d \n", ret);
} else {
- printf("climb: %d, direction: %d, speed: %d\n", climb, direction, speed);
+ printf("climb: %f, direction: %f, speed: %f\n", climb, direction, speed);
}
ret = location_manager_get_last_accuracy(manager, &level, &horizontal, &vertical);