SET(PREFIX ${CMAKE_INSTALL_PREFIX})
SET(INC_DIR include)
+
INCLUDE_DIRECTORIES(${INC_DIR})
-SET(dependents "dlog location capi-base-common")
+INCLUDE(FindPkgConfig)
+pkg_check_modules(dependents REQUIRED dlog location capi-base-common capi-system-info)
+
SET(pc_dependents "capi-base-common")
-INCLUDE(FindPkgConfig)
-pkg_check_modules(${fw_name} REQUIRED ${dependents})
-FOREACH(flag ${${fw_name}_CFLAGS})
- SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+FOREACH(flag ${dependents_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
ENDFOREACH(flag)
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fvisibility=hidden -fPIC -Wall -Werror")
SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
IF("${ARCH}" STREQUAL "arm")
- ADD_DEFINITIONS("-DTARGET")
+ ADD_DEFINITIONS("-DTARGET")
ENDIF("${ARCH}" STREQUAL "arm")
ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+ADD_DEFINITIONS("-DEXPORT_API=__attribute__((visibility(\"default\")))")
ADD_DEFINITIONS("-DTIZEN_DEBUG")
SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib")
ADD_LIBRARY(${fw_name} SHARED ${SOURCES})
SET_TARGET_PROPERTIES(${fw_name}
- PROPERTIES
- VERSION ${FULLVER}
- SOVERSION ${MAJORVER}
- CLEAN_DIRECT_OUTPUT 1
+ PROPERTIES
+ VERSION ${FULLVER}
+ SOVERSION ${MAJORVER}
+ CLEAN_DIRECT_OUTPUT 1
)
-TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS})
+TARGET_LINK_LIBRARIES(${fw_name} ${dependents_LDFLAGS})
INSTALL(TARGETS ${fw_name} DESTINATION lib)
INSTALL(
- DIRECTORY ${INC_DIR}/ DESTINATION include/location
- FILES_MATCHING
- PATTERN "*_private.h" EXCLUDE
- PATTERN "${INC_DIR}/*.h"
- )
+ DIRECTORY ${INC_DIR}/ DESTINATION include/location
+ FILES_MATCHING
+ PATTERN "*_internal.h" EXCLUDE
+ PATTERN "${INC_DIR}/*.h"
+ )
SET(PC_NAME ${fw_name})
SET(PC_REQUIRED ${pc_dependents})
SET(PC_CFLAGS -I\${includedir}/location)
CONFIGURE_FILE(
- ${fw_name}.pc.in
- ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc
- @ONLY
+ ${fw_name}.pc.in
+ ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc
+ @ONLY
)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION lib/pkgconfig)
ADD_CUSTOM_TARGET (distclean @echo cleaning for source distribution)
ADD_CUSTOM_COMMAND(
- DEPENDS clean
- COMMENT "distribution clean"
- COMMAND find
- ARGS .
- -not -name config.cmake -and \(
- -name tester.c -or
- -name Testing -or
- -name CMakeFiles -or
- -name cmake.depends -or
- -name cmake.check_depends -or
- -name CMakeCache.txt -or
- -name cmake.check_cache -or
- -name *.cmake -or
- -name Makefile -or
- -name core -or
- -name core.* -or
- -name gmon.out -or
- -name install_manifest.txt -or
- -name *.pc -or
- -name *~ \)
- | grep -v TC | xargs rm -rf
- TARGET distclean
- VERBATIM
+ DEPENDS clean
+ COMMENT "distribution clean"
+ COMMAND find
+ ARGS .
+ -not -name config.cmake -and \(
+ -name tester.c -or
+ -name Testing -or
+ -name CMakeFiles -or
+ -name cmake.depends -or
+ -name cmake.check_depends -or
+ -name CMakeCache.txt -or
+ -name cmake.check_cache -or
+ -name *.cmake -or
+ -name Makefile -or
+ -name core -or
+ -name core.* -or
+ -name gmon.out -or
+ -name install_manifest.txt -or
+ -name *.pc -or
+ -name *~ \)
+ | grep -v TC | xargs rm -rf
+ TARGET distclean
+ VERBATIM
)
ENDIF(UNIX)
+++ /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 ?
+[Version] capi-location-manager_0.4.1
+[Date] 23 Mar 2015
+[Title] split header files into profiles of two.
+[Developer] Young-Ae Kang <youngae.kang@samsung.com>
+
+================================================================================
+
+[Version] capi-location-manager_0.4.0
+[Date] 17 Aug 2014
+[Title] Support multi profile build
+[New API] Internal batch API
+ Added error types
+
+[Developer] Kyoungjun Sung <kj7.sung@samsung.com>
+
+================================================================================
+
+[Version] capi-location-manager_0.3.1
+[date] 17 Aug 2014
+[Title] Added check condition of location-manager's method to avoid crash issue.(zone-in,zone-out signal)
+[Issue#] P140816-02326
+[Problem] NA
+[Cause] NA
+[Solution] check condition of location-manager's method.
+[Developer] Youngho Jeon <ykernel.jeon@samsung.com>
+
+================================================================================
+
+[Version] capi-location-manager_0.3.0
+[date] 12 Aug 2014
+[Title] add getter API of location setting
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Youngho Jeon <ykernel.jeon@samsung.com>
+
+================================================================================
+
+[Version] capi-location-manager_0.2.6
+[date] 17 Apr 2014
+[Title] Modify typo, location_preference_foreach_available_country_codes
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Minjune Kim <sena06.kim@samsung.com>
+
+================================================================================
+
+[Version] capi-location-manager_0.2.5
+[date] 16 Jan 2014
+[Title] Move geofence into libslp-location
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Kartika Sharma <s.kartika@samsung.com>
+
+================================================================================
+
+[Version] capi-location-manager_0.2.4
+[date] 30 Dec 2013
+[Title] Requirement: Add consent popup
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] API added to just show the consent popup
+[Developer] Kartika Sharma <s.kartika@samsung.com>
+
+================================================================================
+
+[Version] capi-location-manager_0.2.3
+[date] 9 Nov 2013
+[Title] Dont update satellite_cb to application before gps_status_satellite_cb is set
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Genie Kim <daejins.kim@samsung.com>
+
+================================================================================
+
+[Version] capi-location-manager_0.2.2-1
+[date] 26 Sep 2013
+[Title] Add description(reference guide) and TC for geofence service
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Genie Kim <daejins.kim@samsung.com>
+
+================================================================================
+
+[Version] capi-location-manager_0.2.1-1
+[date] 24 Sep 2013
+[Title] Add direction parameter of location_manager_get_location in location_product.h
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Genie Kim <daejins.kim@samsung.com>
+
+================================================================================
+
+[Version] capi-location-manager_0.2.0-1
+[date] 22 August 2013
+[Title] Support geofence
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Genie Kim <daejins.kim@samsung.com>
+
+================================================================================
+
+[Version] capi-location-manager_0.1.14-1
+[date] 1 July 2013
+[Title] add collectrion state callback in location_product.c
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Genie Kim <daejins.kim@samsung.com>
+
+================================================================================
+
+[Version] capi-location-manager_0.1.13-1
+[date] 27 June 2013
+[Title] Remove the duplicated signal connections/disconnections which make abort message.
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Minjune Kim <sena06.kim@samsung.com>
+
+================================================================================
+
+[Version] capi-location-manager_0.1.12-1
+[date] 31 May 2013
+[Title] Altitude can have nonpositive value
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Genie Kim <daejins.kim@samsung.com>
+
+================================================================================
+
+[Version] capi-location-manager_0.1.11-1
+[date] 17 Apr 2013
+[Title] Set an account key / Support Geofence method
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] Set an account key
+[Developer] Minjune Kim <sena06.kim@samsung.com>
+
+================================================================================
+
+[Version] capi-location-manager_0.1.10-1
+[date] 21 Feb 2013
+[Title] Add to get position_ext
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] Add to get position_ext
+[Developer] Minjune Kim <sena06.kim@samsung.com>
+
+================================================================================
+
+[Version] capi-location-manager_0.1.9-1
+[date] 6 Feb 2013
+[Title] add signal id of each g_signal & include time.h to fix build break
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Genie Kim <daejins.kim@samsung.com>
+
+================================================================================
+
+[Version] capi-location-manager_0.1.8-1
+[date] 24 Jan 2013
+[Title] change boilerplate
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] change boilerplate
+[Developer] Genie Kim <daejins.kim@samsung.com>
+
+================================================================================
+
+capi-location-manager (0.1.7-1) precise; urgency=low
+
+ * Change Dlog Format
+ * Tag: capi-location-manager_0.1.7-1
+
+ -- Ming Zhu <mingwu.zhu@samsung.com> Fri, 28 Dec 2012 19:10:57 +0900
+
+capi-location-manager (0.1.6-1) precise; urgency=low
+
+ * get accessibility from process not location manager handle
+ * Tag: capi-location-manager_0.1.-1
+
+ -- Genie Kim <daejins.kim@samsung.com> Wed, 26 Dec 2012 11:10:57 +0900
+
+capi-location-manager (0.1.5-1) unstable; urgency=low
+
+ * Support the boundary state changed callback
+ * Tag: capi-location-manager_0.1.5-1
+
+ -- Genie Kim <daejins.kim@samsung.com> Tue, 27 Nov 2012 22:37:13 +0900
+
+capi-location-manager (0.1.4-1) unstable; urgency=low
+
+ * 1. Extends error code 2. Support to check accessibility state 3. changes prototype of location_zone_changed_cb() 4. Add available country code APIs
+ * Tag: capi-location-manager_0.1.4-1
+
+ -- Minjune Kim <sena06.kim@samsung.com> Wed, 21 Nov 2012 11:02:55 +0900
+
+capi-location-manager (0.1.3-1) unstable; urgency=low
+
+ * Check NULL at location_manager_get_accuracy
+ * Tag: capi-location-manager_0.1.3-1
+
+ -- Minjune Kim <sena06.kim@samsung.com> Tue, 18 Sep 2012 22:22:46 +0900
+
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
--- /dev/null
+<manifest>
+ <request>
+ <domain name="_"/>
+ </request>
+</manifest>
Name: @PC_NAME@
Description: @PACKAGE_DESCRIPTION@
Version: @VERSION@
-Requires: @PC_REQUIRED@
+Requires: @PC_REQUIRED@
Libs: -L${libdir} @PC_LDFLAGS@
Cflags: -I${includedir}
+++ /dev/null
-/usr/include/*
-/usr/include/*/*
-/usr/lib/pkgconfig/*.pc
-
+++ /dev/null
-/usr/lib/lib*.so*
+++ /dev/null
-Source: capi-location-manager
-Section: libs
-Priority: extra
-Maintainer: Kangho Hur <kangho.hur@samsung.com>, ByungWoo Lee <bw1212.lee@samsung.com>, wYoungae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>, Genie Kim <daejins.kim@samsung.com>
-Build-Depends: debhelper (>= 5), dlog-dev, libslp-location-dev, capi-base-common-dev
-
-Package: capi-location-manager
-Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: A Location Manager library in Tizen Native API
-
-Package: capi-location-manager-dev
-Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, capi-location-manager (= ${Source-Version}), capi-base-common-dev
-Description: A Location Manager library in Tizen Native API (DEV)
-
-Package: capi-location-manager-dbg
-Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, capi-location-manager (= ${Source-Version})
-Description: A Location Manager library in Tizen Native API (DBG)
-
+++ /dev/null
-#!/usr/bin/make -f
-
-CFLAGS = -Wall -g
-
-FULLVER ?= $(shell dpkg-parsechangelog | grep Version: | cut -d ' ' -f 2 | cut -d '-' -f 1)
-MAJORVER ?= $(shell echo $(FULLVER) | cut -d '.' -f 1)
-
-ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
- CFLAGS += -O0
-else
- CFLAGS += -O2
-endif
-CMAKE_ROOT_DIR ?= $(CURDIR)
-CMAKE_BUILD_DIR ?= $(CURDIR)/cmake_build_tmp
-
-configure: configure-stamp
-configure-stamp:
- dh_testdir
- mkdir -p $(CMAKE_BUILD_DIR) && cd $(CMAKE_BUILD_DIR) && cmake .. -DFULLVER=${FULLVER} -DMAJORVER=${MAJORVER}
- touch configure-stamp
-
-
-build: build-stamp
-build-stamp: configure-stamp
- dh_testdir
- cd $(CMAKE_BUILD_DIR) && $(MAKE)
- touch $@
-
-clean:
- cd $(CMAKE_ROOT_DIR)
- dh_testdir
- dh_testroot
- rm -f build-stamp configure-stamp
- rm -f `find . -name *.pc`
- rm -rf $(CMAKE_BUILD_DIR)
- dh_clean
-
-install: build
- dh_testdir
- dh_testroot
- dh_clean -k
- dh_installdirs
-
- cd $(CMAKE_BUILD_DIR) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
-
-binary-indep: build install
-
-binary-arch: build install
- dh_testdir
- dh_testroot
- dh_installchangelogs
- dh_installdocs
- dh_installexamples
- dh_install --sourcedir=debian/tmp
- dh_installman
- dh_link
- dh_strip --dbg-package=capi-location-manager-dbg
- dh_fixperms
- dh_makeshlibs
- dh_installdeb
- dh_shlibdeps
- dh_gencontrol
- dh_md5sums
- dh_builddeb
-
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install configure
-
--- /dev/null
+/*
+ * Copyright (c) 2011-2013 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.
+ */
+
+
+#ifndef __TIZEN_LOCATION_LOCATION_MANAGER_DOC_H__
+#define __TIZEN_LOCATION_LOCATION_MANAGER_DOC_H__
+
+/**
+ * @ingroup CAPI_LOCATION_FRAMEWORK
+ * @defgroup CAPI_LOCATION_MANAGER_MODULE Location Manager
+ * @brief This Location Manager API provides functions for obtaining information related to geographical location.
+ * This API provides functions to acquire information related to the current position. Notifications on events like service becoming
+ * enabled or disabled, new position data being available and others can also be acquired.
+ *
+ * @section CAPI_LOCATION_MANAGER_MODULE_HEADER Required Header
+ * \#include <locations.h>
+ *
+ * @section CAPI_LOCATION_MANAGER_MODULE_OVERVIEW Overview
+ * The Location Manager API provides functions to acquire information about geographical location, including both as accurate a current position as possible,
+ * and receiving notification of changes in position, crossing boundary "fences", and velocity changes detected by the device.
+ *
+ * The related Geolocation API can be used to convert the location to a physical address.
+ *
+ * Notifications can be received about the following events:
+ * - Change in service status (enabled / disabled)
+ * - New position and velocity information becoming available
+ * - Given area being entered or left (geofencing)
+ *
+ * Information on GPS satellites is provided by the GPS Status & Satellite API.
+ *
+ * The main component of the Location Service is the location manager. A location manager serves as a gateway so the application does not have
+ * to manage the details of the back-end connection, which might be GPS, WiFi or others, although it may instruct the location manager
+ * as to a preference. The location manager also manages the callback functions which it invokes when a given event takes place.
+ *
+ * The location manager has the following properties:
+ * - Method
+ * - Boundary
+ * - 'Position updated' callback
+ * - 'Service state change' callback
+ * - 'Velocity updated' callback
+ * - 'Boundary event' callback
+ *
+ * The method property of a location manager (#location_method_e) determines the source of location information. It can be set only
+ * once - when the location manager is instantiated. The method can be one specific location method, or hybrid.
+ *
+ * A location manager set to the hybrid method will automatically choose
+ * the best method available at the moment, choosing between GPS, WPS
+ * and WPS. Note that the method may change any time, due to signals
+ * coming in/out of range, and so on. If more than one method is available,
+ * priorities are as follows:
+ *
+ * 1. GPS\n
+ * 2. WPS\n
+ *
+ * If no methods are available, the service state is changed to disabled
+ * and the appropriate callback is called. See location_manager_set_service_state_changed_cb() and location_service_state_changed_cb().
+ *
+ * The boundary property describes a border enclosing an area. The area
+ * can be circular - defined by its center in geographic coordinates a radius, or rectangular - defined by the geographic coordinates of its
+ * top left and bottom right corner.
+ * The location manager will use the selected method to track if the area has been entered or exited.
+ * The location manager will send asynchronous notifications by invoking
+ * previously registered callback functions on such change events.
+ *
+ * There may be multiple location managers. Callback functions to receive
+ * notifications are registered to a specific location manager, not to the location service as a whole.
+ * So it is, for example, possible to define several different geographic areas or fences, using different location methods,
+ * each being tracked by a different location manager and leading to distinct callbacks.
+ *
+ * Setting and unsetting callbacks for the manager can be done at any time, however before callbacks set for a given location manager can
+ * be invoked, the location service must be started for that location manager. This constraint holds for managers with GPS, WPS and
+ * Hybrid methods. See the Location manager life cycle section below. Note the start/stop functions apply only to
+ * the individual location manager and do not affect any other location managers that may be running.
+ *
+ * Only one callback can be set for a given event within the scope of a single location manager. Successive callback setting will result in
+ * the new callback replacing the old one. If an 'unset callback' function is called when there is no callback set, no error is returned.
+ * Callbacks can be set and unset any number of times.
+ *
+ * @subsection CAPI_LOCATION_MANAGER_MODULE_MANAGER_LIFECYCLE Location manager life cycle
+ *
+ * 1. Create location manager ( location_manager_create() )\n
+ * 2. Set callbacks and other required information\n
+ * 3. Start service with location_manager_start()\n
+ * 4. Wait until state change callback ( location_service_state_changed_cb() ) is called with #LOCATIONS_SERVICE_ENABLED as first argument\n
+ * 5. Other callbacks are working now, wait for events and process\n
+ * 6. Stop service with location_manager_stop()\n
+ * 7. Wait until state change callback ( location_service_state_changed_cb() ) is called with #LOCATIONS_SERVICE_DISABLED as first argument\n
+ * 8. Destroy location manager (location_manager_destroy())\n
+ *
+ * After stopping the location service for a given location manager,
+ * the location manager can still be used. So some functions can be called if they do not require a location service running on your device.
+ * The location service can be re-started later.
+ *
+ * If a location manager is no longer needed and is going to be destroyed, it is not mandatory to call location_manager_stop(),
+ * as location_manager_destroy() will call it automatically.
+ *
+ * Note that after a location manager has been destroyed, the handle (#location_manager_h) can be reused - location_manager_create() can
+ * be called again for this handle. In other words, the state before creation and after destruction can be treated as the same state.
+ *
+ * @section CAPI_LOCATION_MANAGER_MODULE_FEATURE Related Features
+ * This API is related with the following features:\n
+ * - http://tizen.org/feature/location\n
+ * - http://tizen.org/feature/location.gps\n
+ * - http://tizen.org/feature/location.wps\n
+ *
+ * It is recommended to design feature related codes in your application for reliability.\n
+ *
+ * You can check if a devrice supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n
+ *
+ * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
+ *
+ * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a>
+ *
+ */
+
+/**
+* @ingroup CAPI_LOCATION_MANAGER_MODULE
+* @defgroup CAPI_LOCATION_GPS_STATUS_MODULE GPS Status & Satellite
+* @brief The GPS Status & Satellite API provides functions to acquire information about GPS satellites in range and in use.
+*
+* @section CAPI_LOCATION_GPS_STATUS_MODULE_HEADER Required Header
+* \#include <locations.h>
+*
+* @section CAPI_LOCATION_GPS_STATUS_MODULE_OVERVIEW Overview
+* The GPS Status & Satellite API provides functions to acquire data on satellites that are currently visible to the device. Information
+* like azimuth and elevation of each satellite is available, along with number of satellites in range and in use.
+*
+* @par System Info note:
+* All of the functions require a started location manager with the #LOCATIONS_METHOD_GPS method set. See the Location Manager API for details.
+*
+* The gps_status_get_nmea() function gets NMEA data from the GPS system. NMEA 0183 (or NMEA for short) is a combined electrical and data
+* specification for communication between electronic devices. NMEA standard uses a simple ASCII, serial communications protocol that
+* defines how data is transmitted in a "sentence" from one "talker" to multiple "listeners" at a time. For more details, see <a href = "http://en.wikipedia.org/wiki/NMEA_0183">NMEA_0183</a>.
+*
+* The gps_status_get_satellite() method returns a count of satellites in view. The gps_status_foreach_satellites_in_view() method is an
+* iterator which will invoke a callback function for each satellite in view. The gps_status_get_satellite() method returns a count of
+* satellites in use.
+*
+ * @section CAPI_LOCATION_GPS_STATUS_MODULE_FEATURE Related Features
+ * This API is related with the following features:\n
+ * - http://tizen.org/feature/location\n
+ * - http://tizen.org/feature/location.gps\n
+ * - http://tizen.org/feature/location.gps.satellite\n
+ *
+ * It is recommended to design feature related codes in your application for reliability.\n
+ *
+ * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n
+ *
+ * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
+ *
+ * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a>
+ *
+*/
+
+/**
+ * @ingroup CAPI_LOCATION_MANAGER_MODULE
+ * @defgroup CAPI_LOCATION_BOUNDS_MODULE Location Bounds
+ * @brief The Location Bounds APIs provides functions related to geographic bounds information.
+ *
+ *
+ * @section CAPI_LOCATION_BOUNDS_MODULE_HEADER Required Header
+ * \#include <locations.h>
+ *
+ * @section CAPI_LOCATION_BOUNDS_MODULE_OVERVIEW Overview
+ *
+ * Boundary defines geographical boundary. It is same as geo-fence which is a virtual perimeter for a real-world geographic area.
+ * If you create a boundary, you can trigger some activities when a device enters(or exits) the boundaries defined by you.
+ *
+ * @section CAPI_LOCATION_BOUNDS_MODULE_FEATURE Related Features
+ * This API is related with the following features:\n
+ * - http://tizen.org/feature/location\n
+ * - http://tizen.org/feature/location.gps\n
+ * - http://tizen.org/feature/location.wps\n
+ *
+ * It is recommended to design feature related codes in your application for reliability.\n
+ *
+ * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n
+ *
+ * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
+ *
+ * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a>
+ *
+ */
+
+/**
+ * @internal
+ * @{
+ * @ingroup CAPI_LOCATION_FRAMEWORK
+ * @defgroup CAPI_LOCATION_PREF_MODULE Location Preference
+ * @brief The Location Preference APIs provides functions related to Maps
+ * Service.
+ *
+ *
+ * @section CAPI_LOCATION_PREF_MODULE_HEADER Required Header
+ * \#include <location_preference_product.h>
+ *
+ * @section CAPI_LOCATION_PREF_MODULE_OVERVIEW Overview
+ *
+ * You can set some options with Location Preference when you use Maps Service(geocoder, poi, and route) module.
+ *
+ * @section CAPI_LOCATION_PREF_MODULE_FEATURE Related Features
+ * This API is related with the following features:\n
+ * - http://tizen.org/feature/location\n
+ *
+ * It is recommended to design feature related codes in your application for reliability.\n
+ *
+ * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n
+ *
+ * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
+ *
+ * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a>
+ * @}
+ *
+ */
+
+#endif // __TIZEN_LOCATION_LOCATION_MANAGER_DOC_H__
--- /dev/null
+/*
+ * Copyright (c) 2011-2013 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.
+ */
+
+#ifndef __TIZEN_LOCATION_BATCH_H__
+#define __TIZEN_LOCATION_BATCH_H__
+
+#include <locations.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @internal
+ * @{
+ * @addtogroup CAPI_LOCATION_MANAGER_MODULE
+ * @{
+ */
+
+/**
+ * @brief Called when the batch interval is expired.
+ * @param[in] num_of_location The number of location batch data
+ * @param[in] user_data The user data passed from the callback registration function
+ */
+typedef void(*location_batch_cb)(int num_of_location, void *user_data);
+
+/**
+ * @brief Gets called iteratively to receive location batch data.
+ * @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] speed The updated speed (km/h)
+ * @param[in] direction The updated direction (in degrees from the north)
+ * @param[in] horizontal The horizontal accuracy (meters)
+ * @param[in] vertical The vertical accuracy (meters)
+ * @param[in] timestamp The timestamp (time when measurement took place or @c 0 if valid)
+ * @param[in] user_data The user data passed from the callback registration function
+ * @pre location_batch_get_location_cb() will invoke this callback if you register this callback using location_manager_foreach_location_batch()
+ */
+typedef bool(*location_batch_get_location_cb)(double latitude, double longitude, double altitude, double speed, double direction, double horizontal, double vertical, time_t timestamp, void *user_data);
+
+/**
+ * @brief Registers a callback function to be invoked when batch_period is expired.
+ * @param[in] manager The location manager handle
+ * @param[in] callback The callback function to register
+ * @param[in] batch_interval The batch smpling interval
+ * @param[in] batch_period The batch period
+ * @post location_batch_cb() will be invoked
+ */
+int location_manager_set_location_batch_cb(location_manager_h manager, location_batch_cb callback, int batch_interval, int batch_period, void *user_data);
+
+/**
+ * @brief Unregisters the callback function.
+ * @param[in] manager The location manager handle
+ */
+int location_manager_unset_location_batch_cb (location_manager_h manager);
+
+/**
+ * @brief Start the location batch mode.
+ * @param[in] manager The location manager handle
+ */
+int location_manager_start_batch (location_manager_h manager);
+
+/**
+ * @brief Stop the location batch mode.
+ * @param[in] manager The location manager handle
+ */
+int location_manager_stop_batch (location_manager_h manager);
+
+/**
+ * @brief Retrieves all location information by invoking a specific callback for each location data.
+ * @param[in] manager The location manager handle
+ * @param[in] callback The iteration callback function
+ * @param[in] user_data The user data passed from the callback registration function
+ * @post location_batch_get_location_cb() will be invoked
+ */
+int location_manager_foreach_location_batch(location_manager_h manager, location_batch_get_location_cb callback, void *user_data);
+
+/**
+ * @}
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIZEN_LOCATION_BATCH_H__ */
/*
-* 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.
-*/
+ * Copyright (c) 2011-2013 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.
+ */
#ifndef __TIZEN_LOCATION_BOUNDS_H__
#define __TIZEN_LOCATION_BOUNDS_H__
extern "C" {
#endif
-#define LOCATION_BOUNDS_ERROR_CLASS TIZEN_ERROR_LOCATION_CLASS | 0x20
+#define LOCATION_BOUNDS_ERROR_CLASS TIZEN_ERROR_LOCATION_MANAGER | 0x20
/**
* @addtogroup CAPI_LOCATION_BOUNDS_MODULE
*/
/**
- * @brief Represents a coordinates with latitude and longitude.
+ * @brief The structure type to represent coordinates with latitude and longitude.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef struct
{
} location_coords_s;
/**
- * @brief The location boundary handle.
+ * @brief Enumeration for error code for Location manager.
*/
- typedef void *location_bounds_h;
+typedef enum
+{
+ LOCATION_BOUNDS_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
+ LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
+ LOCATION_BOUNDS_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
+ LOCATION_BOUNDS_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported */
+ LOCATION_BOUNDS_ERROR_INCORRECT_TYPE = LOCATION_BOUNDS_ERROR_CLASS | 0x01, /**< Incorrect bounds type for a given call */
+ LOCATION_BOUNDS_ERROR_IS_ADDED = LOCATION_BOUNDS_ERROR_CLASS | 0x02, /**< Cannot remove bounds handle from location manager */
+} location_bound_error_e;
/**
- * @brief Enumerations of error code for Location manager.
+ * @brief Enumeration for Location boundary type.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum
{
- LOCATION_BOUNDS_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
- LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
- LOCATION_BOUNDS_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
- LOCATION_BOUNDS_ERROR_INCORRECT_TYPE = LOCATION_BOUNDS_ERROR_CLASS | 0x01, /**< Incorrect bounds type for a given call */
-} location_bound_error_e;
-
+ LOCATION_BOUNDS_RECT = 1, /**< Rectangular geographical area type. */
+ LOCATION_BOUNDS_CIRCLE, /**< Circle geographical area type.. */
+ LOCATION_BOUNDS_POLYGON, /**< Polygon geographical area type.. */
+} location_bounds_type_e;
/**
- * @brief Location boundary type.
+ * @brief Enumeration for the boundary state.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum
{
- LOCATION_BOUNDS_RECT=1, /**< Rectangular geographical area type. */
- LOCATION_BOUNDS_CIRCLE, /**< Circle geographical area type.. */
- LOCATION_BOUNDS_POLYGON, /**< Polygon geographical area type.. */
-} location_bounds_type_e;
+ LOCATIONS_BOUNDARY_IN, /**< Boundary In (Zone In) */
+ LOCATIONS_BOUNDARY_OUT /**< Boundary Out (Zone Out) */
+} location_boundary_state_e;
+
+/**
+ * @brief The location boundary handle.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+typedef struct location_bounds_s *location_bounds_h;
/**
- * @brief Gets called iteratively to notify you of coordinates of polygon.
- * @param[in] coords The coordinates
- * @param[in] user_data The user data passed from the foreach function
+ * @brief Gets called iteratively to notify you of coordinates of a polygon.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] coords The coordinates
+ * @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 out of the loop
* @pre location_bounds_foreach_polygon_coords() will invoke this callback.
- * @see location_bounds_foreach_polygon_coords()
+ * @see location_bounds_foreach_polygon_coords()
*/
typedef bool (*polygon_coords_cb)(location_coords_s coords, void *user_data);
+/**
+ * @brief Called when the given boundary is entered or exited.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] state The boundary state
+ * @pre location_manager_start() will invoke this callback if you register this callback using location_bounds_set_state_changed_cb()
+ * @see #location_boundary_state_e
+ * @see location_manager_start()
+ * @see location_bounds_set_state_changed_cb()
+ */
+typedef void (*location_bounds_state_changed_cb)(location_boundary_state_e state, void *user_data);
/**
* @brief Creates a rect type of new location bounds.
- * @remarks @a bounds must be released location_bounds_destroy() by you.
- * @param[in] top_left The top left position
- * @param[in] bottom_right The bottom right position
- * @param[out] bounds A location bounds handle to be newly created on success
- * @return 0 on success, otherwise a negative error value.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks You must release @a bounds using location_bounds_destroy().
+ * @param[in] top_left The top left position
+ * @param[in] bottom_right The bottom right position
+ * @param[out] bounds The location bounds handle that is newly created
+ * @return @c 0 on success, otherwise a negative error value.
* @retval #LOCATION_BOUNDS_ERROR_NONE Successful
* @retval #LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY Out of memory
* @retval #LOCATION_BOUNDS_ERROR_INVALID_PARAMETER Invalid parameter
- * @see location_bounds_get_rect_coords()
+ * @retval #LOCATION_BOUNDS_ERROR_NOT_SUPPORTED Not supported
+ * @see location_bounds_get_rect_coords()
* @see location_bounds_destroy()
*/
int location_bounds_create_rect(location_coords_s top_left, location_coords_s bottom_right, location_bounds_h* bounds);
/**
* @brief Creates a circle type of new location bounds.
- * @remarks @a bounds must be released location_bounds_destroy() by you.
- * @param[in] center The center position
- * @param[in] radius The radius of a circle (meters)
- * @param[out] bounds A location bounds handle to be newly created on success
- * @return 0 on success, otherwise a negative error value.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks You must release @a bounds using location_bounds_destroy().
+ * @param[in] center The center position
+ * @param[in] radius The radius of a circle (meters)
+ * @param[out] bounds The location bounds handle that is newly created
+ * @return @c 0 on success, otherwise a negative error value
* @retval #LOCATION_BOUNDS_ERROR_NONE Successful
* @retval #LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY Out of memory
* @retval #LOCATION_BOUNDS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #LOCATION_BOUNDS_ERROR_NOT_SUPPORTED Not supported
* @see location_bounds_get_circle_coords()
* @see location_bounds_destroy()
*/
/**
* @brief Creates a polygon type of new location bounds.
- * @remarks @a bounds must be released location_bounds_destroy() by you.
- * @remarks @a length sholud be over than 3 to represent polygon.
- * @param[in] coords_list The list of coordinates
- * @param[in] length The length of the coordinates list
- * @param[out] bounds A location bounds handle to be newly created on success
- * @return 0 on success, otherwise a negative error value.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks You must release @a bounds using location_bounds_destroy().
+ * @remarks @a length should be more than @c 3 to represent polygon.
+ * @param[in] coords_list The list of coordinates
+ * @param[in] length The length of the coordinates list
+ * @param[out] bounds The location bounds handle that is newly created on success
+ * @return @c 0 on success, otherwise a negative error value
* @retval #LOCATION_BOUNDS_ERROR_NONE Successful
* @retval #LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY Out of memory
* @retval #LOCATION_BOUNDS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #LOCATION_BOUNDS_ERROR_NOT_SUPPORTED Not supported
* @see location_bounds_foreach_polygon_coords()
* @see location_bounds_destroy()
*/
int location_bounds_create_polygon(location_coords_s* coords_list, int length, location_bounds_h* bounds);
/**
- * @brief Check if the bounds contains the specified coordinates.
- * @param[in] bounds The location bounds handle
- * @param[in] coords The coordinates
- * @param[out] contained The result indicating whether the boundary contains the specified coordinate (@c true = contained, @c false = not contained )
- * @return @c true if the bouns contains the specified coordinates. \n else @c false
+ * @brief Checks whether the bounds contains the specified coordinates.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remark The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
+ * @param[in] bounds The location bounds handle
+ * @param[in] coords The coordinates
+ * @return @c true if the bounds contains the specified coordinates, otherwise else @c false
+ * @exception #LOCATION_BOUNDS_ERROR_NONE Successful
+ * @exception #LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY Out of memory
+ * @exception #LOCATION_BOUNDS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @exception #LOCATION_BOUNDS_ERROR_NOT_SUPPORTED Not supported
* @see location_bounds_create_rect()
* @see location_bounds_create_circle()
* @see location_bounds_create_polygon()
bool location_bounds_contains_coordinates(location_bounds_h bounds, location_coords_s coords);
/**
- * @brief Get the type of location bounds.
- * @param[in] bounds The location bounds handle
- * @param[out] type The type of location bounds
- * @return 0 on success, otherwise a negative error value.
+ * @brief Gets the type of location bounds.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] bounds The location bounds handle
+ * @param[out] type The type of location bounds
+ * @return @c 0 on success, otherwise a negative error value.
* @retval #LOCATION_BOUNDS_ERROR_NONE Successful
* @retval #LOCATION_BOUNDS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #LOCATION_BOUNDS_ERROR_NOT_SUPPORTED Not supported
* @see location_bounds_create_rect()
* @see location_bounds_create_circle()
* @see location_bounds_create_polygon()
int location_bounds_get_type(location_bounds_h bounds, location_bounds_type_e *type);
/**
- * @brief Get the center position and radius of circle bounds.
- * @param[in] bounds The location bounds handle
- * @param[out] top_left The top left position
- * @param[out] bottom_right The bottom right position
- * @return 0 on success, otherwise a negative error value.
+ * @brief Gets the center position and radius of circle bounds.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] bounds The location bounds handle
+ * @param[out] top_left The top left position
+ * @param[out] bottom_right The bottom right position
+ * @return @c 0 on success, otherwise a negative error value.
* @retval #LOCATION_BOUNDS_ERROR_NONE Successful
* @retval #LOCATION_BOUNDS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #LOCATION_BOUNDS_ERROR_NOT_SUPPORTED Not supported
* @retval #LOCATION_BOUNDS_ERROR_INCORRECT_TYPE Incorrect bounds type
* @see location_bounds_create_rect()
*/
-int location_bounds_get_rect_coords(location_bounds_h bounds, location_coords_s *top_left, location_coords_s *bottom_right);
+int location_bounds_get_rect_coords(location_bounds_h bounds, location_coords_s *top_left, location_coords_s *bottom_right);
/**
- * @brief Get the center position and radius of circle bounds.
- * @param[in] bounds The location bounds handle
- * @param[out] center The center position of circle
- * @param[radius] center The radius of circle
- * @return 0 on success, otherwise a negative error value.
+ * @brief Gets the center position and radius of circle bounds.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] bounds The location bounds handle
+ * @param[out] center The center position of the circle
+ * @param[out] radius The radius of the circle
+ * @return @c 0 on success, otherwise a negative error value.
* @retval #LOCATION_BOUNDS_ERROR_NONE Successful
* @retval #LOCATION_BOUNDS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #LOCATION_BOUNDS_ERROR_NOT_SUPPORTED Not supported
* @retval #LOCATION_BOUNDS_ERROR_INCORRECT_TYPE Incorrect bounds type
* @see location_bounds_create_circle()
*/
-int location_bounds_get_circle_coords(location_bounds_h bounds, location_coords_s *center, double *radius);
+int location_bounds_get_circle_coords(location_bounds_h bounds, location_coords_s *center, double *radius);
/**
- * @brief Get the coordinates of polygon.
- * @param[in] bounds The location bounds handle
- * @param[in] callback The geocoder get positions callback function
- * @param[in] user_data The user data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value.
+ * @brief Get the coordinates of a polygon.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] bounds The location bounds handle
+ * @param[in] callback The geocoder get position callback function
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return @c 0 on success, otherwise a negative error value.
* @retval #LOCATION_BOUNDS_ERROR_NONE Successful
* @retval #LOCATION_BOUNDS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #LOCATION_BOUNDS_ERROR_NOT_SUPPORTED Not supported
* @retval #LOCATION_BOUNDS_ERROR_INCORRECT_TYPE Incorrect bounds type
* @post It invokes polygon_coords_cb() to get coordinates of polygon.
* @see polygon_coords_cb()
/**
* @brief Releases the location bounds.
- * @param[in] bounds The location bounds handle
- * @return 0 on success, otherwise a negative error value.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] bounds The location bounds handle
+ * @return @c 0 on success, otherwise a negative error value.
* @retval #LOCATION_BOUNDS_ERROR_NONE Successful
* @retval #LOCATION_BOUNDS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #LOCATION_BOUNDS_ERROR_NOT_SUPPORTED Not supported
* @see location_bounds_create_rect()
* @see location_bounds_create_circle()
* @see location_bounds_create_polygon()
int location_bounds_destroy(location_bounds_h bounds);
/**
+ * @brief Registers a callback function to be invoked when the boundary area is entered or exited.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] bounds The location bounds handle
+ * @param[in] callback The callback function to register
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return @c 0 on success, otherwise a negative error value.
+ * @retval #LOCATION_BOUNDS_ERROR_NONE Successful
+ * @retval #LOCATION_BOUNDS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #LOCATION_BOUNDS_ERROR_NOT_SUPPORTED Not supported
+ * @post location_bounds_state_changed_cb() will be invoked
+ * @see location_bounds_unset_state_changed_cb()
+ * @see location_bounds_state_changed_cb()
+ */
+int location_bounds_set_state_changed_cb(location_bounds_h bounds, location_bounds_state_changed_cb callback, void* user_data);
+
+/**
+ * @brief Unregisters the callback function.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] bounds The location bounds handle
+ * @return @c 0 on success, otherwise a negative error value.
+ * @retval #LOCATION_BOUNDS_ERROR_NONE Successful
+ * @retval #LOCATION_BOUNDS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #LOCATION_BOUNDS_ERROR_NOT_SUPPORTED Not supported
+ * @see location_bounds_set_state_changed_cb()
+ */
+int location_bounds_unset_state_changed_cb(location_bounds_h bounds);
+
+/**
* @}
*/
#ifdef __cplusplus
--- /dev/null
+/*
+ * Copyright (c) 2011-2013 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.
+ */
+
+#ifndef __TIZEN_LOCATION_INTERNAL_H__
+#define __TIZEN_LOCATION_INTERNAL_H__
+
+#include <location.h>
+#include <locations.h>
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "CAPI_LOCATION_MANAGER"
+
+/*
+* Internal Macros
+*/
+
+#define LOCATIONS_LOGD(fmt,args...) LOGD(fmt, ##args)
+#define LOCATIONS_LOGW(fmt,args...) LOGW(fmt, ##args)
+#define LOCATIONS_LOGI(fmt,args...) LOGI(fmt, ##args)
+#define LOCATIONS_LOGE(fmt,args...) LOGE(fmt, ##args)
+
+#define LOCATIONS_CHECK_CONDITION(condition, error, msg) \
+ do { \
+ if (condition) { \
+ } else { \
+ LOCATIONS_LOGE("%s(0x%08x)", msg, error); \
+ return error; \
+ } \
+ } while (0)
+
+
+#define LOCATIONS_PRINT_ERROR_CODE(error, msg) \
+ do { \
+ LOCATIONS_LOGE("%s(0x%08x)", msg, error); \
+ return error; \
+ } while (0)
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum {
+ _LOCATIONS_EVENT_TYPE_SERVICE_STATE,
+ _LOCATIONS_EVENT_TYPE_POSITION,
+ _LOCATIONS_EVENT_TYPE_VELOCITY,
+ _LOCATIONS_EVENT_TYPE_BOUNDARY,
+ _LOCATIONS_EVENT_TYPE_SATELLITE,
+ _LOCATIONS_EVENT_TYPE_FOREACH_BOUNDS,
+ _LOCATIONS_EVENT_TYPE_COLLECTION_STATE,
+ _LOCATIONS_EVENT_TYPE_LOCATION,
+ _LOCATIONS_EVENT_TYPE_BATCH,
+ _LOCATIONS_EVENT_TYPE_NUM
+} _location_event_e;
+
+typedef enum {
+ _LOCATION_SIGNAL_SERVICE_ENABLED,
+ _LOCATION_SIGNAL_SERVICE_DISABLED,
+ _LOCATION_SIGNAL_SERVICE_UPDATED,
+ _LOCATION_SIGNAL_ZONE_IN,
+ _LOCATION_SIGNAL_ZONE_OUT,
+ _LOCATION_SIGNAL_LOCATION_UPDATED,
+ _LOCATION_SIGNAL_BATCH_UPDATED,
+ _LOCATION_SIGNAL_ERROR_EMITTED,
+ _LOCATION_SIGNAL_NUM
+} _location_signal_e;
+
+typedef struct _location_manager_s {
+ LocationObject* object;
+ const void* user_cb[_LOCATIONS_EVENT_TYPE_NUM];
+ void* user_data[_LOCATIONS_EVENT_TYPE_NUM];
+ location_method_e method;
+ bool is_continue_foreach_bounds;
+ int collection_state;
+ GList *bounds_list;
+ guint timeout;
+ gulong sig_id[_LOCATION_SIGNAL_NUM];
+} location_manager_s;
+
+typedef struct _location_bounds_s {
+ LocationBoundary* boundary;
+ const void* user_cb;
+ void* user_data;
+ bool is_added;
+} location_bounds_s;
+
+typedef struct _location_setting_changed_s {
+ location_setting_changed_cb callback;
+ void *user_data;
+} location_setting_changed_s;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIZEN_LOCATION_INTERNAL_H__ */
+++ /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.
-*/
-
-#ifndef __TIZEN_LOCATION_LOCATION_PREFERENCE_H__
-#define __TIZEN_LOCATION_LOCATION_PREFERENCE_H__
-
-#include <tizen_type.h>
-#include <tizen_error.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/**
- * @addtogroup CAPI_LOCATION_PREF_MODULE
- * @{
- */
-
-/**
- * @brief The handle of location service
- */
-typedef void* location_service_h;
-
-
-/**
- * @brief Gets a handle of location service from x
- */
-#define GET_LOCATION_SERVICE(x) (location_service_h)(x)
-
-
-/**
- * @brief Enumerations of error code for Location Preference
- */
-typedef enum
-{
- LOCATION_PREFERENCE_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
- LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
- LOCATION_PREFERENCE_ERROR_RESULT_NOT_FOUND = TIZEN_ERROR_LOCATION_CLASS|0x0101, /**< Result not found */
- LOCATION_PREFERENCE_ERROR_NETWORK_FAILED = TIZEN_ERROR_LOCATION_CLASS|0x0102, /**< Network unavailable */
- LOCATION_PREFERENCE_ERROR_INVALID_KEY = TIZEN_ERROR_LOCATION_CLASS | 0x0103, /**< Invalid key */
-} location_preference_error_e;
-
-/**
- * @brief Enumerations of distance unit
- */
-typedef enum
-{
- LOCATION_PREFERENCE_DISTANCE_UNIT_M = 0, /**< Meter */
- LOCATION_PREFERENCE_DISTANCE_UNIT_KM = 1, /**< Kilometer */
- LOCATION_PREFERENCE_DISTANCE_UNIT_FT = 2, /**< Feet */
- LOCATION_PREFERENCE_DISTANCE_UNIT_YD = 3, /**< Mile */
- LOCATION_PREFERENCE_DISTANCE_UNIT_MI = 4, /**< Mile */
-} location_preference_distance_unit_e;
-
-/**
- * @brief Called repeatedly when you get the available property keys.
- * @param[in] key The property key of location preference
- * @param[in] user_data The user data passed from foreach function
- * @pre location_preference_foreach_available_property_keys() will invoke this callback.
- * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop
- * @see location_preference_foreach_available_property_keys()
- */
-typedef bool (*location_preference_available_property_key_cb)(const char* key, void* user_data);
-
-/**
- * @brief Called repeatedly when you get the available property values.
- * @param[in] value The property value of location preference
- * @param[in] user_data The user data passed from foreach function
- * @pre location_preference_foreach_available_property_values() will invoke this callback.
- * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop
- * @see location_preference_foreach_available_property_values()
- */
-typedef bool (*location_preference_available_property_value_cb)(const char* value, void* user_data);
-
-/**
- * @brief Called repeatedly when you get the available languages.
- * @param[in] language The language of location preference
- * @param[in] user_data The user data passed from foreach function
- * @pre location_preference_foreach_available_languages() will invoke this callback.
- * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop
- * @see location_preference_foreach_available_languages()
- */
-typedef bool (*location_preference_available_language_cb)(const char* language, void* user_data);
-
-/**
- * @brief Called repeatedly when you get the properties that was set in location preference.
- * @param[in] key The property key of location preference
- * @param[in] value The property value of location preference
- * @param[in] user_data The user data passed from foreach function
- * @pre location_preference_foreach_properties() will invoke this callback.
- * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop
- * @see location_preference_foreach_properties()
- */
-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().
- * @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
- * @retval #LOCATION_PREFERENCE_ERROR_NETWORK_FAILED Network unavailable
- * @retval #LOCATION_PREFERENCE_ERROR_RESULT_NOT_FOUND Result not found
- * @post location_preference_available_property_key_cb() will be invoked.
- * @see GET_LOCATION_SERVICE()
- * @see location_preference_available_property_key_cb()
- * @see location_preference_foreach_available_property_values()
- */
-int location_preference_foreach_available_property_keys(location_service_h service, location_preference_available_property_key_cb callback, void* user_data);
-
-/**
- * @brief Retrieves the available property values 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().
- * @param[in] key The property of location preference
- * @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
- * @retval #LOCATION_PREFERENCE_ERROR_INVALID_KEY Invalid key
- * @retval #LOCATION_PREFERENCE_ERROR_RESULT_NOT_FOUND Result not found
- * @post location_preference_available_property_value_cb() will be invoked.
- * @see GET_LOCATION_SERVICE()
- * @see location_preference_available_property_value_cb()
- * @see location_preference_foreach_available_property_keys()
- */
-int location_preference_foreach_available_property_values(location_service_h service, const char* key, location_preference_available_property_value_cb callback, void* user_data);
-
-/**
- * @brief Retrieves the available languages 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().
- * @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
- * @retval #LOCATION_PREFERENCE_ERROR_NETWORK_FAILED Network unavailable
- * @retval #LOCATION_PREFERENCE_ERROR_RESULT_NOT_FOUND Result not found
- * @post location_preference_available_language_cb() will be invoked.
- * @see GET_LOCATION_SERVICE()
- * @see location_preference_available_language_cb()
- */
-int location_preference_foreach_available_languages(location_service_h service, location_preference_available_language_cb callback, void* user_data);
-
-/**
- * @brief Gets the location preference that was set in 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().
- * @param[in] key The property of location preference
- * @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
- * @see GET_LOCATION_SERVICE()
- */
-int location_preference_foreach_properties(location_service_h service, location_preference_property_cb callback, void* user_data);
-
-/**
- * @brief Sets the location preference value.
- * @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] property The property of location preference
- * @param[in] value The value of location preference
- * @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_foreach_available_property_keys()
- * @see location_preference_foreach_available_property_values()
- * @see location_preference_get()
- */
-int location_preference_set(location_service_h service, const char* key, const char* value);
-
-/**
- * @brief Gets the location preference value.
- * @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] property The property of location preference
- * @param[out] value The value of location preference
- * @return 0 on success, otherwise a negative error value.
- * @retval #LOCATION_PREFERENCE_ERROR_NONE Successful
- * @retval #LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #LOCATION_PREFERENCE_ERROR_INVALID_KEY Invalid key
- * @see GET_LOCATION_SERVICE()
- * @see location_preference_foreach_available_property_keys()
- * @see location_preference_set()
- */
-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 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().
- * @param[out] 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_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_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.
- * @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] unit The distance unit
- * @return 0 on success, otherwise a negative error value.
- * @retval #LOCATION_PREFERENCE_ERROR_NONE Successful
- * @retval #LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #LOCATION_PREFERENCE_ERROR_RESULT_NOT_FOUND Result not found
- * @see GET_LOCATION_SERVICE()
- * @see location_preference_set_distance_unit()
- */
-int location_preference_get_distance_unit(location_service_h service, location_preference_distance_unit_e* unit);
-
-/**
- * @brief Sets the distance unit 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] unit The distance unit
- * @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_distance_unit()
- */
-int location_preference_set_distance_unit(location_service_h service, location_preference_distance_unit_e unit);
-
-/**
- * @brief Gets the language 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[out] language The language
- * @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_language()
- */
-int location_preference_get_language(location_service_h service, char** language);
-
-/**
- * @brief Sets the language 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] language The language
- * @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_language()
- */
-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);
-
-/**
- * @}
- */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __TIZEN_LOCATION_LOCATION_PREFERENCE_H__ */
/*
-* 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.
-*/
+ * Copyright (c) 2011-2013 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.
+ */
#ifndef __TIZEN_LOCATION_LOCATIONS_H__
#define __TIZEN_LOCATION_LOCATIONS_H__
#include <tizen_type.h>
#include <tizen_error.h>
+#include <time.h>
#include <location_bounds.h>
#ifdef __cplusplus
*/
/**
- * @brief Enumerations of error code for Location manager.
+ * @brief Enumeration for error code for Location manager.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum
{
- LOCATIONS_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
- LOCATIONS_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
- LOCATIONS_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
- LOCATIONS_ERROR_INCORRECT_METHOD = TIZEN_ERROR_LOCATION_CLASS | 0x01, /**< Location manager contains incorrect method for a given call */
- LOCATIONS_ERROR_NETWORK_FAILED = TIZEN_ERROR_LOCATION_CLASS | 0x02, /**< Network unavailable */
- LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE = TIZEN_ERROR_LOCATION_CLASS | 0x03, /**< Service unavailable */
- LOCATIONS_ERROR_GPS_SETTING_OFF = TIZEN_ERROR_LOCATION_CLASS | 0x04, /**< GPS is not enabled */
+ LOCATIONS_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
+ LOCATIONS_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
+ LOCATIONS_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
+ LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
+ LOCATIONS_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported */
+ LOCATIONS_ERROR_INCORRECT_METHOD = TIZEN_ERROR_LOCATION_MANAGER | 0x01, /**< Location manager contains incorrect method for a given call */
+ LOCATIONS_ERROR_NETWORK_FAILED = TIZEN_ERROR_LOCATION_MANAGER | 0x02, /**< Network unavailable */
+ LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE = TIZEN_ERROR_LOCATION_MANAGER | 0x03, /**< Location service is not available */
+ LOCATIONS_ERROR_GPS_SETTING_OFF = TIZEN_ERROR_LOCATION_MANAGER | 0x04, /**< GPS/WPS setting is not enabled */
+ LOCATIONS_ERROR_SECURITY_RESTRICTED = TIZEN_ERROR_LOCATION_MANAGER | 0x05, /**< Restricted by security system policy */
} location_error_e;
-
-
/**
- * @brief Location method type.
+ * @brief Enumeration for Location method type.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum
{
- LOCATIONS_METHOD_NONE=-1, /**< Undefined method. */
- 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_CPS /**< This method uses Cellular Positioning System. */
+ LOCATIONS_METHOD_NONE=-1, /**< Undefined method. */
+ 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. */
} location_method_e;
/**
- * @brief Approximate accuracy level of given information.
+ * @brief Enumeration for Approximate accuracy level of given information.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum
{
- LOCATIONS_ACCURACY_NONE=0, /**< Invalid data. */
- LOCATIONS_ACCURACY_COUNTRY, /**< Country accuracy level. */
- LOCATIONS_ACCURACY_REGION, /**< Regional accuracy level. */
- LOCATIONS_ACCURACY_LOCALITY, /**< Local accuracy level. */
- LOCATIONS_ACCURACY_POSTALCODE, /**< Postal accuracy level. */
- LOCATIONS_ACCURACY_STREET, /**< Street accuracy level. */
- LOCATIONS_ACCURACY_DETAILED, /**< Detailed accuracy level. */
+ LOCATIONS_ACCURACY_NONE=0, /**< Invalid data */
+ LOCATIONS_ACCURACY_COUNTRY, /**< Country accuracy level */
+ LOCATIONS_ACCURACY_REGION, /**< Regional accuracy level */
+ LOCATIONS_ACCURACY_LOCALITY, /**< Local accuracy level */
+ LOCATIONS_ACCURACY_POSTALCODE, /**< Postal accuracy level */
+ LOCATIONS_ACCURACY_STREET, /**< Street accuracy level */
+ LOCATIONS_ACCURACY_DETAILED, /**< Detailed accuracy level */
} location_accuracy_level_e;
/**
- * @brief Enumerations of the state of the location service.
+ * @brief Enumeration for the state of the location service.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum
{
- LOCATIONS_SERVICE_DISABLED, /**< Service is disabled */
- LOCATIONS_SERVICE_ENABLED /**< Service is enabled */
+ LOCATIONS_SERVICE_DISABLED, /**< Service is disabled */
+ LOCATIONS_SERVICE_ENABLED, /**< Service is enabled */
} location_service_state_e;
/**
- * @brief Enumerations of the boundary state.
+ * @brief Enumeration for the location service accessibility state.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum
{
- LOCATIONS_BOUNDARY_IN, /**< Boundary In (Zone In) */
- LOCATIONS_BOUNDARY_OUT /**< Boundary Out (Zone Out) */
-} location_boundary_state_e;
+ LOCATIONS_ACCESS_STATE_NONE, /**< Access state is not determined */
+ LOCATIONS_ACCESS_STATE_DENIED, /**< Access denied */
+ LOCATIONS_ACCESS_STATE_ALLOWED, /**< Access authorized */
+} location_accessibility_state_e;
/**
* @brief The location manager handle.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
- typedef struct location_manager_s *location_manager_h;
+typedef struct location_manager_s *location_manager_h;
/**
* @}
*/
/**
* @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 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()
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @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 or @c 0 if valid)
+ * @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()
*/
/**
* @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 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()
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @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 or @c 0 if valid)
+ * @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()
* @see location_manager_set_velocity_updated_cb()
*/
typedef void(*location_velocity_updated_cb)(double speed, double direction, double climb, time_t timestamp, void *user_data);
/**
+ * @brief Called at defined interval with updated location information.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] error #LOCATIONS_ERROR_NONE Successful
+ * @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 or @c 0 if valid)
+ * @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] user_data The user data passed from the callback registration function
+ * @pre location_manager_request_single_location() will invoke this callback.
+ * @see location_manager_request_single_location()
+ */
+typedef void(*location_updated_cb)(location_error_e error, double latitude, double longitude, double altitude, time_t timestamp, double speed, double direction, double climb, void *user_data);
+
+/**
* @brief Called when the state of location service is changed from enabled to disabled or vice versa.
- * @param[in] state The service state
- * @param[in] user_data The user data passed from the callback registration function
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] state The service state
+ * @param[in] user_data The user data passed from the callback registration function
* @pre Either location_manager_start() or location_manager_stop() will invoke this callback if you register this callback using location_manager_set_service_state_changed_cb()
* @see location_manager_start()
* @see location_manager_stop()
/**
* @brief Called when the user defined zones are entered or exited.
- * @param[in] state The boundary state
- * @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 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()
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] state The boundary state
+ * @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 or @c 0 if valid)
+ * @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
* @see location_manager_start()
* @see location_manager_set_zone_changed_cb()
typedef void(*location_zone_changed_cb)(location_boundary_state_e state, double latitude, double longitude, double altitude, time_t timestamp, void *user_data);
/**
+ * @brief Called when the state of location method is changed.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] method The method changed on setting
+ * @param[in] enable The setting value changed
+ * @param[in] user_data The user data passed from the callback registration function
+ * @pre location_setting_changed_cb() will invoke this callback if you register this callback using location_manager_set_setting_changed_cb()
+ * @see location_manager_set_setting_changed_cb()
+ * @see location_manager_unset_setting_changed_cb()
+ */
+typedef void(*location_setting_changed_cb)(location_method_e method, bool enable, void *user_data);
+
+/**
* @brief Gets called iteratively to notify you of location bounds.
- * @param[in] bounds The location bounds handle
- * @param[in] user_data The user data passed from the callback registration function
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] bounds The location bounds handle
+ * @param[in] user_data The user data passed from the callback registration function
* @pre location_manager_foreach_boundary() will invoke this callback.
* @see location_manager_foreach_boundary()
*/
typedef bool(*location_bounds_cb)(location_bounds_h bounds, void *user_data);
/**
- * @brief Checks whether the given location method is avaliable or not.
+ * @brief Checks whether the given location method is available.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remark The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
* @param[in] method The location method to be checked
- * @return @c true if the specified location method is supported, \n else @c false
+ * @return @c true if the specified location method is supported, otherwise @c false if it is not available
+ * @exception #LOCATIONS_ERROR_NONE Successful
+ * @exception #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
+ * @exception #LOCATIONS_ERROR_INCORRECT_METHOD Incorrect method
* @see location_manager_create()
* @see location_manager_get_method()
*/
bool location_manager_is_supported_method(location_method_e method);
+/**
+ * @brief Checks whether the given location method is enabled or not on setting.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] method The location method to be checked
+ * @param[out] enable The result value of checking the given location method
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #LOCATIONS_ERROR_NONE Successful
+ * @retval #LOCATIONS_ERROR_INCORRECT_METHOD Incorrect method
+ * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
+ * @see location_manager_create()
+ * @see location_manager_set_setting_changed_cb()
+ * @see location_manager_unset_setting_changed_cb()
+ */
+int location_manager_is_enabled_method(location_method_e method, bool *enable);
/**
- * @brief Creates a new location manager.
- * @remarks @a manager must be released location_manager_destroy() by you.
- * @param[in] method The location method
- * @param[out] manager A location manager handle to be newly created on success
+ * @platform
+ * @brief Enable the given location method.
+ * @since_tizen 2.3.1
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/location.enable
+ * @param[in] method The location method to be checked
+ * @param[in] enable The value to set
* @return 0 on success, otherwise a negative error value.
* @retval #LOCATIONS_ERROR_NONE Successful
- * @retval #LOCATIONS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #LOCATIONS_ERROR_INCORRECT_METHOD Incorrect method
+ * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED Permission denied
+ * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
+ * @see location_manager_is_enabled_method()
+ * @see location_manager_create()
+ */
+int location_manager_enable_method(const location_method_e method, const bool enable);
+
+/**
+ * @brief Creates a new location manager.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks You must release @a manager using location_manager_destroy().
+ * @param[in] method The location method
+ * @param[out] manager The location manager handle that is newly created
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #LOCATIONS_ERROR_NONE Successful
+ * @retval #LOCATIONS_ERROR_OUT_OF_MEMORY Out of memory
* @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
* @see location_manager_destroy()
*/
int location_manager_create(location_method_e method, location_manager_h* manager);
/**
* @brief Releases the location manager.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] manager The location manager handle
- * @return 0 on success, otherwise a negative error value.
- * @retval #LOCATIONS_ERROR_NONE Successful
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #LOCATIONS_ERROR_NONE Successful
* @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
* @see location_manager_create()
*/
int location_manager_destroy(location_manager_h manager);
/**
+ * @brief Request to update current location once.
+ * @remarks Do not request to start the location service using the same manager handler
+ * Calling this function invokes a location service event. When the location service is updated, location_updated_cb
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/location
+ * @param[in] manager The location manager handle
+ * @param[in] timeout Timeout to stop requesting single location after
+ * @param[in] callback The location callback function to register
+ * @param[in] user_data The user data to be passed to the callback function
+ * @retval #LOCATIONS_ERROR_NONE Successful
+ * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ * @retval #LOCATIONS_ERROR_NETWORK_FAILED Network failed
+ * @retval #LOCATIONS_ERROR_GPS_SETTING_OFF GPS is not enabled
+ * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
+ * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
+ * @post It invokes location_updated_cb().
+ */
+int location_manager_request_single_location(location_manager_h manager, int timeout, location_updated_cb callback, void *user_data);
+
+/**
* @brief Starts the location service.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/location
*
* @remarks There is no limit on number of location managers for which this function was called.
*
- * Calling this function invokes a location service event. When the location service is enabled, the service state change callback
- * (set using #location_manager_set_service_state_changed_cb()) notifies the user with #LOCATIONS_SERVICE_ENABLED as
- * the first argument, and the service starts. \n
-
- * Started service is a requirement for calling these functions:
+ * @remarks Calling this function invokes a location service event. When the location service is enabled, the service state change callback
+ * (set using location_manager_set_service_state_changed_cb()) notifies the user with #LOCATIONS_SERVICE_ENABLED as
+ * the first argument, and the service starts.
*
- * location_manager_get_position(), location_manager_get_velocity(), location_manager_get_accuracy(),
- * gps_status_get_nmea(), gps_status_get_satellite_count_in_view(), gps_status_foreach_satellites_in_view(), gps_status_get_active_satellite_count().
+ * @remarks The started service is a requirement for calling these functions:
+ * location_manager_get_position(), location_manager_get_velocity(), location_manager_get_accuracy(),
+ * gps_status_get_nmea(), gps_status_get_satellite(), gps_status_foreach_satellites_in_view().
*
- * Once you stop the service, using #location_manager_stop(), you can no longer call the functions listed above.
+ * @remarks Once you stop the service using location_manager_stop(), you can no longer call the functions listed above.
*
- * Starting and stopping the service is in the scope of the given location manager only (if there's more than one manager,
- * starting and stopping should be executed for each of them separately).
+ * @remarks Starting and stopping the service is in the scope of the given location manager only (if there is more than one manager,
+ * starting and stopping should be executed for each of them separately).
*
- * @param[in] manager The location manager handle
+ * @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
- * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
- * @retval #LOCATIONS_ERROR_NETWORK_FAILED Network failed
- * @retval #LOCATIONS_ERROR_GPS_SETTING_OFF GPS is not enabled
+ * @retval #LOCATIONS_ERROR_NONE Successful
+ * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ * @retval #LOCATIONS_ERROR_NETWORK_FAILED Network failed
+ * @retval #LOCATIONS_ERROR_GPS_SETTING_OFF GPS is not enabled
+ * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
+ * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
* @post It invokes location_position_updated_cb(), location_velocity_updated_cb(), location_zone_changed_cb(), and location_service_state_changed_cb().
* @see location_manager_stop()
* @see location_manager_get_position()
/**
* @brief Stops the location service.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks This function initiates the process of stopping the service. When the process is finished, callback set using
* #location_manager_set_service_state_changed_cb() will be called, with #LOCATIONS_SERVICE_DISABLED as first argument.
* When that happens, the service is stopped and the user is notified.
*
* You can stop and start the location manager as needed.
*
- * @param[in] manager The location manager handle
+ * @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
- * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
- * @retval #LOCATIONS_ERROR_NETWORK_FAILED Network failed
+ * @retval #LOCATIONS_ERROR_NONE Successful
+ * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ * @retval #LOCATIONS_ERROR_NETWORK_FAILED Network failed
+ * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
* @see location_manager_start()
* @see location_manager_set_service_state_changed_cb()
* @see location_service_state_changed_cb()
/**
* @brief Adds a bounds for a given location manager.
- * @param[in] manager The location manager handle
- * @param[in] bounds The location bounds handle
- * @return 0 on success, otherwise a negative error value.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] manager The location manager handle
+ * @param[in] bounds The location bounds handle
+ * @return @c 0 on success, otherwise a negative error value
* @retval #LOCATIONS_ERROR_NONE Successful
- * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #LOCATIONS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #LOCATIONS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
* @post It invokes location_manager_set_zone_changed_cb() when a boundary is entered or exited, if you set a callback with location_manager_set_zone_changed_cb().
* @see location_manager_remove_boundary()
* @see location_manager_set_zone_changed_cb()
- * @see location_manager_is_boundary_contains_coordinate()
*/
int location_manager_add_boundary(location_manager_h manager, const location_bounds_h bounds);
/**
* @brief Deletes a bounds for a given location manager.
- * @param[in] manager The location manager handle
- * @param[in] bounds The location bounds handle
- * @return 0 on success, otherwise a negative error value.
- * @retval #LOCATIONS_ERROR_NONE Successful
- * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #LOCATIONS_ERROR_OUT_OF_MEMORY Out of memory
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] manager The location manager handle
+ * @param[in] bounds The location bounds handle
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #LOCATIONS_ERROR_NONE Successful
+ * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #LOCATIONS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
* @see location_manager_add_boundary()
*/
int location_manager_remove_boundary(location_manager_h manager, const location_bounds_h bounds);
/**
- * @brief Retrieves all location bounds by invoking a specific callback for each locatoin bounds
- * @param[in] manager The location manager handle
- * @param[in] callback The iteration callback
- * @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 location_bounds_cb() will be invoked
+ * @brief Retrieves all location bounds by invoking a specific callback for each location bounds
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] manager The location manager handle
+ * @param[in] callback The iteration callback
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return @c 0 on success, otherwise a negative error value.
+ * @retval #LOCATIONS_ERROR_NONE Successful
+ * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
+ * @post location_bounds_cb() will be invoked
* @see location_manager_add_boundary()
* @see location_manager_remove_boundary()
* @see location_bounds_cb()
*/
-int location_manager_foreach_boundary(location_manager_h manager, location_bounds_cb callback, void *user_data);
+int location_manager_foreach_boundary(location_manager_h manager, location_bounds_cb callback, void *user_data);
/**
* @brief Gets the given location manager's method.
- *
- * @param[in] manager The location manager handle
- * @param[out] method The location method
- * @return 0 on success, otherwise a negative error value.
- * @retval #LOCATIONS_ERROR_NONE Successful
- * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] manager The location manager handle
+ * @param[out] method The location method
+ * @return @c 0 on success, otherwise a negative error value.
+ * @retval #LOCATIONS_ERROR_NONE Successful
+ * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
* @see location_manager_create()
*/
int location_manager_get_method(location_manager_h manager, location_method_e *method);
/**
* @brief Gets the current position information.
- * @details
- * The result is current altitude, latitude, and longitude, with a measurement timestamp.
+ * @details The result contains the current altitude, latitude, and longitude, with a measurement timestamp.
*
- * If @a altitude is negative, only altitude and latitude are available (fix status is 2D).
- * If @a altitude is positive, fix status is 3D and returned altitude value is the result of measurement.
- *
- * @param[in] manager The location manager handle
- * @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 or 0 if valid)
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/location
+ * @param[in] manager The location manager handle
+ * @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 or @c 0 if valid)
* @return 0 on success, otherwise a negative error value.
- * @retval #LOCATIONS_ERROR_NONE Successful
- * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
- * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
- * @retval #LOCATIONS_ERROR_GPS_SETTING_OFF GPS is not enabled
+ * @retval #LOCATIONS_ERROR_NONE Successful
+ * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
+ * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ * @retval #LOCATIONS_ERROR_GPS_SETTING_OFF GPS is not enabled
+ * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
+ * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
* @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start()
*/
int location_manager_get_position(location_manager_h manager, double *altitude, double *latitude, double *longitude, time_t *timestamp);
/**
- * @brief Gets the current velocity information.
- * @details
- * The result is current climb, direction, and speed, with a measurement timestamp.
+ * @brief Gets the current position information.
+ * @details The result contains the current altitude, latitude, longitude, climb, direction, speed, level, horizontal and vertical with a measurement timestamp.
*
- * @param[in] manager The location manager handle
- * @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 or 0 if invalid)
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/location
+ * @param[in] manager The location manager handle
+ * @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] climb The climb (km/h)
+ * @param[out] direction The direction, degrees from the north
+ * @param[out] speed The speed (km/h)
+ * @param[out] level The accuracy level
+ * @param[out] horizontal The horizontal accuracy (meters)
+ * @param[out] vertical The vertical accuracy (meters)
+ * @param[out] timestamp The timestamp (time when measurement took place or @c 0 if valid)
* @return 0 on success, otherwise a negative error value.
- * @retval #LOCATIONS_ERROR_NONE Successful
- * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
- * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
- * @retval #LOCATIONS_ERROR_GPS_SETTING_OFF GPS is not enabled
+ * @retval #LOCATIONS_ERROR_NONE Successful
+ * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
+ * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ * @retval #LOCATIONS_ERROR_GPS_SETTING_OFF GPS is not enabled
+ * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
+ * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
+ * @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start()
+ */
+int location_manager_get_location(location_manager_h manager, double *altitude, double *latitude, double *longitude, double *climb, double *direction, double *speed, location_accuracy_level_e *level, double *horizontal, double *vertical, time_t *timestamp);
+
+/**
+ * @brief Gets the current velocity information.
+ * @details The result contains the current climb, direction, and speed, with a measurement timestamp.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/location
+ * @param[in] manager The location manager handle
+ * @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 or @c 0 if valid)
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #LOCATIONS_ERROR_NONE Successful
+ * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
+ * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ * @retval #LOCATIONS_ERROR_GPS_SETTING_OFF GPS is not enabled
+ * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
+ * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
* @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start()
*/
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[in] manager The location manager handle
- * @param[out] level The accuracy level
- * @param[out] horizontal The horizontal accuracy (meters)
- * @param[out] vertical The vertical accuracy (meters)
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/location
+ * @param[in] manager The location manager handle
+ * @param[out] level The accuracy level
+ * @param[out] horizontal The horizontal accuracy (meters)
+ * @param[out] vertical The vertical accuracy (meters)
* @return 0 on success, otherwise a negative error value.
- * @retval #LOCATIONS_ERROR_NONE Successful
- * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
- * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
- * @retval #LOCATIONS_ERROR_GPS_SETTING_OFF GPS is not enabled
+ * @retval #LOCATIONS_ERROR_NONE Successful
+ * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
+ * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ * @retval #LOCATIONS_ERROR_GPS_SETTING_OFF GPS is not enabled
+ * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
+ * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
* @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start()
*/
int location_manager_get_accuracy(location_manager_h manager, location_accuracy_level_e *level, double *horizontal, double *vertical);
/**
* @brief Gets the last position information which is recorded.
* @details The @a altitude, @a latitude, @a longitude, and @c timestamp values should be 0, if there is no record of any previous position information.
- * @details If @a altitude is negative, only altitude and latitude are available (fix status is 2D).
- * @details If @a altitude is positive, fix status is 3D and returned altitude value is the result of measurement.
- * @param[in] manager The location manager handle
- * @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 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
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/location
+ * @param[in] manager The location manager handle
+ * @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 or @c 0 if valid)
+ * @return @c 0 on success, otherwise a negative error value.
+ * @retval #LOCATIONS_ERROR_NONE Successful
+ * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
+ * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
+ * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
* @pre The location manager handle must be created by location_manager_create()
*/
int location_manager_get_last_position(location_manager_h manager, double *altitude, double *latitude, double *longitude, time_t *timestamp);
/**
+ * @brief Gets the last location information.
+ * @details The @a altitude, @a latitude, @a longitude, @a climb, @a direction, @a speed and @c timestamp values should be 0, if there is no record of any previous position information.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/location
+ * @param[in] manager The location manager handle
+ * @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] climb The climb (km/h)
+ * @param[out] direction The direction, degrees from the north
+ * @param[out] speed The speed (km/h)
+ * @param[out] level The accuracy level
+ * @param[out] horizontal The horizontal accuracy (meters)
+ * @param[out] vertical The vertical accuracy (meters)
+ * @param[out] timestamp The timestamp (time when measurement took place or @c 0 if valid)
+ * @return @c 0 on success, otherwise a negative error value.
+ * @retval #LOCATIONS_ERROR_NONE Successful
+ * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
+ * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
+ * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
+ * @pre The location manager handle must be created by location_manager_create()
+ */
+int location_manager_get_last_location(location_manager_h manager, double *altitude, double *latitude, double *longitude, double *climb, double *direction, double *speed, location_accuracy_level_e *level, double *horizontal, double *vertical, time_t *timestamp);
+
+
+/**
* @brief Gets the last velocity information which is recorded.
- * @details
- * The @a climb, @a direction and @a speed values should be 0, if there is no record of any previous velocity information.
+ * @details The @a climb, @a direction and @a speed values should be @c 0, if there is no record of any previous velocity information.
*
- * @param[in] manager The location manager handle
- * @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 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
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/location
+ * @param[in] manager The location manager handle
+ * @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 or @c 0 if valid)
+ * @return @c 0 on success, otherwise a negative error value.
+ * @retval #LOCATIONS_ERROR_NONE Successful
+ * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
+ * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
+ * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
* @pre The location manager handle must be created by location_manager_create()
*/
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.
- * @param[in] manager The location manager handle
- * @param[out] level The last accuracy level
- * @param[out] horizontal The last horizontal accuracy (meters)
- * @param[out] vertical The last vertical accuracy (meters)
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/location
+ * @param[in] manager The location manager handle
+ * @param[out] level The last accuracy level
+ * @param[out] horizontal The last horizontal accuracy (meters)
+ * @param[out] vertical The last vertical accuracy (meters)
* @return 0 on success, otherwise a negative error value.
- * @retval #LOCATIONS_ERROR_NONE Successful
- * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
+ * @retval #LOCATIONS_ERROR_NONE Successful
+ * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
+ * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
+ * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
* @pre The location manager handle must be created by location_manager_create()
*/
int location_manager_get_last_accuracy(location_manager_h manager, location_accuracy_level_e *level, double *horizontal, double *vertical);
/**
+ * @brief Gets the current application's location accessibility status.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[out] state The current location service accessibility status.
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #LOCATIONS_ERROR_NONE Successful
+ * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
+ * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
+ */
+int location_manager_get_accessibility_state(location_accessibility_state_e* state);
+
+/**
* @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
- * @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 location_position_updated_cb() will be invoked
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @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 @c 0 on success, otherwise a negative error value.
+ * @retval #LOCATIONS_ERROR_NONE Successful
+ * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
+ * @post location_position_updated_cb() will be invoked
* @see location_manager_unset_position_updated_cb()
* @see location_position_updated_cb()
*/
/**
* @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
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] manager The location manager handle
+ * @return @c 0 on success, otherwise a negative error value.
+ * @retval #LOCATIONS_ERROR_NONE Successful
+ * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
* @see location_manager_set_position_updated_cb()
*/
int location_manager_unset_position_updated_cb(location_manager_h manager);
/**
* @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
- * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
- * @post location_velocity_updated_cb() will be invoked
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @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 @c 0 on success, otherwise a negative error value.
+ * @retval #LOCATIONS_ERROR_NONE Successful
+ * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
+ * @post location_velocity_updated_cb() will be invoked
* @see location_manager_unset_velocity_updated_cb()
* @see location_velocity_updated_cb()
*/
/**
* @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
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] manager The location manager handle
+ * @return @c 0 on success, otherwise a negative error value.
+ * @retval #LOCATIONS_ERROR_NONE Successful
+ * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
* @see location_manager_set_velocity_updated_cb()
*/
int location_manager_unset_velocity_updated_cb(location_manager_h manager);
/**
- * @brief Registers a callback function to be invoked when the location service state is changed.
- *
- * @param[in] manager The location manager handle
- * @param[in] callback The callback function to register
- * @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 location_service_state_changed_cb() will be invoked
+ * @brief Registers a callback function to be invoked when the location service state is changed.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] manager The location manager handle
+ * @param[in] callback The callback function to register
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return @c 0 on success, otherwise a negative error value.
+ * @retval #LOCATIONS_ERROR_NONE Successful
+ * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
+ * @post location_service_state_changed_cb() will be invoked
* @see location_manager_unset_service_state_changed_cb()
* @see location_service_state_changed_cb()
* @see location_manager_start()
/**
* @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
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] manager The location manager handle
+ * @return @c 0 on success, otherwise a negative error value.
+ * @retval #LOCATIONS_ERROR_NONE Successful
+ * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
* @see location_manager_set_service_state_changed_cb()
*/
int location_manager_unset_service_state_changed_cb(location_manager_h manager);
/**
* @brief Registers a callback function to be invoked when the previously set boundary area is entered or left.
*
- * @param[in] manager The location manager handle
- * @param[in] callback The callback function to register
- * @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
- * @pre Either location_manager_set_boundary_rect() or location_manager_set_boundary_circle() is called before.
- * @post location_zone_changed_cb() will be invoked
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] manager The location manager handle
+ * @param[in] callback The callback function to register
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return @c 0 on success, otherwise a negative error value.
+ * @retval #LOCATIONS_ERROR_NONE Successful
+ * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
+ * @pre location_manager_add_boundary() is called before.
+ * @post location_zone_changed_cb() will be invoked
* @see location_manager_unset_zone_changed_cb()
* @see location_zone_changed_cb()
*/
/**
* @brief Unregisters the callback function.
- * @param[in] manager The location manager handle
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @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
+ * @retval #LOCATIONS_ERROR_NONE Successful
+ * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
* @see location_manager_set_zone_changed_cb()
*/
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)
+ * @brief Registers a callback function to be invoked when the location setting is changed.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] method The method to observe
+ * @param[in] callback The callback function to register
+ * @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 argument
+ * @retval #LOCATIONS_ERROR_NONE Successful
+ * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
+ * @post location_setting_changed_cb() will be invoked
+ * @see location_manager_unset_setting_changed_cb()
+ * @see location_setting_changed_cb()
*/
-int location_manager_get_distance(double start_latitude, double start_longitude, double end_latitude, double end_longitude, double *distance);
+int location_manager_set_setting_changed_cb(location_method_e method, location_setting_changed_cb callback, void *user_data);
/**
- * @brief Sends command to the server.
- * @param[in] cmd The command string to be sent
+ * @brief Unregisters the callback function.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] method The method to observe
* @return 0 on success, otherwise a negative error value.
- * @retval #LOCATIONS_ERROR_NONE Successful
- * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #LOCATIONS_ERROR_NONE Successful
+ * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
+ * @see location_manager_set_setting_changed_cb()
*/
-int location_manager_send_command(const char *cmd);
+int location_manager_unset_setting_changed_cb(location_method_e method);
+
+/**
+ * @brief Gets the distance in meters between two locations.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @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
+ * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
+ */
+int location_manager_get_distance(double start_latitude, double start_longitude, double end_latitude, double end_longitude, double *distance);
/**
* @}
*/
/**
- * @brief Called once for each satellite in range.
- * @param[in] azimuth The azimuth of the satellite (degrees)
- * @param[in] elevation The elevation of the satellite (meters)
- * @param[in] prn The PRN of the satellite
- * @param[in] snr The SNR of the satellite [dB]
- * @param[in] is_active The flag signaling if satellite is in use
- * @param[in] user_data The user data passed from the foreach function
+ * @brief Called once for each satellite in range.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] azimuth The azimuth of the satellite (degrees)
+ * @param[in] elevation The elevation of the satellite (meters)
+ * @param[in] prn The PRN of the satellite
+ * @param[in] snr The SNR of the satellite [dB]
+ * @param[in] is_active The flag signaling if satellite is in use
+ * @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 out of the loop
* @pre gps_status_foreach_satellites_in_view() will invoke this callback.
* @pre gps_status_foreach_last_satellites_in_view() will invoke this callback.
/**
* @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
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @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 measurement took place or @c 0 if valid)
+ * @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);
+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] nmea The NMEA data
- * @return 0 on success, otherwise a negative error value.
- * @retval #LOCATIONS_ERROR_NONE Successful
- * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
- * @retval #LOCATIONS_ERROR_INCORRECT_METHOD Incorrect method
- * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
- * @retval #LOCATIONS_ERROR_OUT_OF_MEMORY Out of memory
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks This call is valid only for location managers with #LOCATIONS_METHOD_GPS method.
+ * You must release @a nmea using @c free().
+ * @param[in] manager The location manager handle
+ * @param[out] nmea The NMEA data
+ * @return @c 0 on success, otherwise a negative error value.
+ * @retval #LOCATIONS_ERROR_NONE Successful
+ * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
+ * @retval #LOCATIONS_ERROR_INCORRECT_METHOD Incorrect method
+ * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ * @retval #LOCATIONS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
* @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start()
* @see location_manager_start()
*/
/**
* @brief Gets the information of satellites.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/location
* @remarks This call is valid only for location managers with #LOCATIONS_METHOD_GPS method.
- * @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 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_INCORRECT_METHOD Incorrect method
- * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ * @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 or @c 0 if valid)
+ * @return @c 0 on success, otherwise a negative error value.
+ * @retval #LOCATIONS_ERROR_NONE Successful
+ * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
+ * @retval #LOCATIONS_ERROR_INCORRECT_METHOD Incorrect method
+ * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
+ * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
* @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start()
- * @see gps_status_foreach_satellites_in_view()
+ * @pre The gps_status_satellite_updated_cb must be set with gps_status_set_satellite_updated_cb()
+ * @see gps_status_foreach_satellites_in_view()
*/
-int gps_status_get_satellite(location_manager_h manager, int *num_of_active, int *num_of_inview, time_t *timestamp);
+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
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/location
+ * @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
+ * @retval #LOCATIONS_ERROR_NONE Successful
+ * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
+ * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
+ * @post gps_status_satellite_updated_cb() will be invoked
* @see gps_status_unset_satellite_updated_cb()
* @see gps_status_satellite_updated_cb()
+ * @see gps_status_get_satellite()
+ * @see gps_status_foreach_satellites_in_view()
+ * @see gps_status_get_last_satellite()
+ * @see gps_status_foreach_last_satellites_in_view()
*/
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
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/location
+ * @param[in] manager The location manager handle
+ * @return @c 0 on success, otherwise a negative error value.
+ * @retval #LOCATIONS_ERROR_NONE Successful
+ * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
+ * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
* @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.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/location
* @remarks This function is valid only for location managers with the #LOCATIONS_METHOD_GPS method.
- * @param[in] manager The location manager handle
- * @param[in] callback The iteration callback function
- * @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 argument
- * @retval #LOCATIONS_ERROR_INCORRECT_METHOD Incorrect method
- * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ * @param[in] manager The location manager handle
+ * @param[in] callback The iteration callback function
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return @c 0 on success, otherwise a negative error value.
+ * @retval #LOCATIONS_ERROR_NONE Successful
+ * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
+ * @retval #LOCATIONS_ERROR_INCORRECT_METHOD Incorrect method
+ * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
+ * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
* @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start()
- * @post It invokes gps_status_get_satellites_cb().
- * @see gps_status_get_satellite()
- * @see gps_status_get_satellites_cb()
+ * @pre The gps_status_satellite_updated_cb must be set with gps_status_set_satellite_updated_cb()
+ * @post It invokes gps_status_get_satellites_cb().
+ * @see gps_status_get_satellite()
+ * @see gps_status_get_satellites_cb()
*/
-int gps_status_foreach_satellites_in_view (location_manager_h manager, gps_status_get_satellites_cb callback, void *user_data);
+int gps_status_foreach_satellites_in_view (location_manager_h manager, gps_status_get_satellites_cb callback, void *user_data);
/**
* @brief Gets the last information of satellites.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/location
* @remarks This call is valid only for location managers with #LOCATIONS_METHOD_GPS method.
- * @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 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_INCORRECT_METHOD Incorrect method
- * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ * @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 or @c 0 if valid)
+ * @return @c 0 on success, otherwise a negative error value.
+ * @retval #LOCATIONS_ERROR_NONE Successful
+ * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
+ * @retval #LOCATIONS_ERROR_INCORRECT_METHOD Incorrect method
+ * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
+ * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
* @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start()
- * @see gps_status_foreach_satellites_in_view()
+ * @pre The gps_status_satellite_updated_cb must be set with gps_status_set_satellite_updated_cb()
+ * @see gps_status_foreach_satellites_in_view()
*/
int gps_status_get_last_satellite(location_manager_h manager, int *num_of_active, int *num_of_inview, time_t *timestamp);
/**
* @brief Invokes the callback function for each last satellite which is recorded.
- * @remarks This function is valid only for location managers with the #LOCATIONS_METHOD_GPS method.
- * @param[in] manager The location manager handle
- * @param[in] callback The iteration callback function
- * @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 argument
- * @retval #LOCATIONS_ERROR_INCORRECT_METHOD Incorrect method
- * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/location
+ * @remarks This function is valid only for location managers with the #LOCATIONS_METHOD_GPS method.
+ * @param[in] manager The location manager handle
+ * @param[in] callback The iteration callback function
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return @c 0 on success, otherwise a negative error value.
+ * @retval #LOCATIONS_ERROR_NONE Successful
+ * @retval #LOCATIONS_ERROR_INVALID_PARAMETER Invalid argument
+ * @retval #LOCATIONS_ERROR_INCORRECT_METHOD Incorrect method
+ * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ * @retval #LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED The application does not have the privilege to call this method
+ * @retval #LOCATIONS_ERROR_NOT_SUPPORTED Not supported
* @pre The location service state must be #LOCATIONS_SERVICE_ENABLED with location_manager_start()
- * @post It invokes gps_status_get_satellites_cb().
- * @see gps_status_get_last_satellite()
- * @see gps_status_get_satellites_cb()
+ * @pre The gps_status_satellite_updated_cb must be set with gps_status_set_satellite_updated_cb()
+ * @post It invokes gps_status_get_satellites_cb().
+ * @see gps_status_get_last_satellite()
+ * @see gps_status_get_satellites_cb()
*/
int gps_status_foreach_last_satellites_in_view(location_manager_h manager, gps_status_get_satellites_cb callback, void *user_data);
+++ /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.
-*/
-
-#ifndef __TIZEN_LOCATION_LOCATIONS_PRIVATE_H__
-#define __TIZEN_LOCATION_LOCATIONS_PRIVATE_H__
-
-#include <location/location.h>
-#include <locations.h>
-#include <location_bounds.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
- _LOCATIONS_EVENT_TYPE_SERVICE_STATE,
- _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;
-
-typedef struct _location_manager_s{
- LocationObject* object;
- const void* user_cb[_LOCATIONS_EVENT_TYPE_NUM];
- void* user_data[_LOCATIONS_EVENT_TYPE_NUM];
- location_method_e method;
- bool is_continue_foreach_bounds;
-} location_manager_s;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //__TIZEN_LOCATION_LOCATIONS_PRIVATE_H__
#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.2
-Release: 1
-Group: TO_BE/FILLED_IN
-License: TO BE FILLED IN
-Source0: %{name}-%{version}.tar.gz
+Name: capi-location-manager
+Summary: A Location Manager library in Tizen Native API
+Version: 0.4.7
+Release: 1
+Group: Framework/Location
+License: Apache-2.0
+Source0: %{name}-%{version}.tar.gz
BuildRequires: cmake
BuildRequires: pkgconfig(dlog)
BuildRequires: pkgconfig(location)
BuildRequires: pkgconfig(capi-base-common)
-Requires(post): /sbin/ldconfig
+BuildRequires: pkgconfig(capi-system-info)
+BuildRequires: pkgconfig(vconf)
+Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
%description
%package devel
-Summary: A Location Manager library in Tizen Native API (Development)
-Group: TO_BE/FILLED_IN
+Summary: A Location Manager library in Tizen Native API (Development)
+Group: TO_BE/FILLED_IN
Requires: %{name} = %{version}-%{release}
-%description devel
+%description devel
%prep
%build
+export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
+export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
+export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
-
make %{?jobs:-j%jobs}
+
%install
rm -rf %{buildroot}
%make_install
+mkdir -p %{buildroot}/usr/share/license
+cp LICENSE %{buildroot}/usr/share/license/%{name}
%post -p /sbin/ldconfig
+
%postun -p /sbin/ldconfig
%files
+%manifest capi-location-manager.manifest
%{_libdir}/libcapi-location-manager.so.*
+/usr/share/license/%{name}
+
%files devel
%{_includedir}/location/*.h
%{_libdir}/pkgconfig/*.pc
%{_libdir}/libcapi-location-manager.so
-
-
/*
-* 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.
-*/
+ * Copyright (c) 2011-2013 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 <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <locations_private.h>
-#include <dlog.h>
+#include <system_info.h>
+#include "location_bounds.h"
+#include "location_internal.h"
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-#define LOG_TAG "TIZEN_N_LOCATION_MANAGER"
-
-/*
-* Internal Macros
-*/
-#define LOCATIONS_CHECK_CONDITION(condition,error,msg) \
- if(condition) {} else \
- { LOGE("[%s] %s(0x%08x)",__FUNCTION__, msg,error); return error;}; \
#define LOCATIONS_NULL_ARG_CHECK(arg) \
- LOCATIONS_CHECK_CONDITION(arg != NULL,LOCATION_BOUNDS_ERROR_INVALID_PARAMETER,"LOCATION_BOUNDS_ERROR_INVALID_PARAMETER") \
+ LOCATIONS_CHECK_CONDITION((arg != NULL),LOCATION_BOUNDS_ERROR_INVALID_PARAMETER,"LOCATION_BOUNDS_ERROR_INVALID_PARAMETER") \
+
+#define LOCATIONS_NOT_SUPPORTED_CHECK(arg) \
+ LOCATIONS_CHECK_CONDITION((arg == LOCATIONS_ERROR_NONE),LOCATIONS_ERROR_NOT_SUPPORTED,"LOCATIONS_ERROR_NOT_SUPPORTED") \
static void __free_position_list(gpointer data)
{
- if (data == NULL) return;
+ if (data == NULL)
+ return;
- LocationPosition *position = (LocationPosition*) data;
+ LocationPosition *position = (LocationPosition *) data;
location_position_free(position);
}
+static int __is_location_supported(void)
+{
+ bool is_gps_supported = false;
+ bool is_wps_supported = false;
+ int retval = 0;
+
+ retval = system_info_get_platform_bool("http://tizen.org/feature/location.gps", &is_gps_supported);
+ if (retval != SYSTEM_INFO_ERROR_NONE) {
+ LOCATIONS_LOGW("system_info_get_platform_bool failed: retval = %d", retval);
+ }
+
+ retval = system_info_get_platform_bool("http://tizen.org/feature/location.wps", &is_wps_supported);
+ if (retval != SYSTEM_INFO_ERROR_NONE) {
+ LOCATIONS_LOGW("system_info_get_platform_bool failed: retval = %d", retval);
+ }
+
+ if (is_gps_supported || is_wps_supported) {
+ return LOCATIONS_ERROR_NONE;
+ }
+
+ return LOCATIONS_ERROR_NOT_SUPPORTED;
+}
+
static location_bounds_type_e __convert_bounds_type(LocationBoundaryType type)
{
location_bounds_type_e ret;
- switch(type)
- {
+ switch (type) {
case LOCATION_BOUNDARY_CIRCLE:
ret = LOCATION_BOUNDS_CIRCLE;
break;
return ret;
}
-int location_bounds_create_rect(location_coords_s top_left, location_coords_s bottom_right, location_bounds_h* bounds)
+EXPORT_API int location_bounds_create_rect(location_coords_s top_left, location_coords_s bottom_right, location_bounds_h * bounds)
{
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
LOCATIONS_NULL_ARG_CHECK(bounds);
LOCATIONS_CHECK_CONDITION(top_left.latitude>=-90 && top_left.latitude<=90,LOCATION_BOUNDS_ERROR_INVALID_PARAMETER,"LOCATION_BOUNDS_ERROR_INVALID_PARAMETER");
LOCATIONS_CHECK_CONDITION(top_left.longitude>=-180 && top_left.longitude<=180,LOCATION_BOUNDS_ERROR_INVALID_PARAMETER, "LOCATION_BOUNDS_ERROR_INVALID_PARAMETER");
LOCATIONS_CHECK_CONDITION(bottom_right.longitude>=-180 && bottom_right.longitude<=180,LOCATION_BOUNDS_ERROR_INVALID_PARAMETER, "LOCATION_BOUNDS_ERROR_INVALID_PARAMETER");
LocationPosition *lt = location_position_new(0, top_left.latitude, top_left.longitude, 0, LOCATION_STATUS_2D_FIX);
- if (lt ==NULL)
- {
- LOGE("[%s] LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY(0x%08x) : fail to location_position_new", __FUNCTION__, LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY);
+ if (lt == NULL) {
+ LOCATIONS_LOGE("LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY(0x%08x) : fail to location_position_new", LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY);
return LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY;
}
LocationPosition *rb = location_position_new(0, bottom_right.latitude, bottom_right.longitude, 0, LOCATION_STATUS_2D_FIX);
- if (rb ==NULL)
- {
- LOGE("[%s] LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY(0x%08x) : fail to location_position_new", __FUNCTION__, LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY);
- location_position_free (lt);
+ if (rb == NULL) {
+ LOCATIONS_LOGE("LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY(0x%08x) : fail to location_position_new", LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY);
+ location_position_free(lt);
return LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY;
}
- LocationBoundary *boundary = location_boundary_new_for_rect(lt, rb);
- location_position_free (rb);
- location_position_free (lt);
-
- if(!boundary)
- {
- LOGE("[%s] LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY(0x%08x) : fail to location_boundary_new_for_rect", __FUNCTION__, LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY);
+ location_bounds_s *handle = (location_bounds_s *) malloc(sizeof(location_bounds_s));
+ if (handle == NULL) {
+ LOCATIONS_LOGE("OUT_OF_MEMORY(0x%08x)", LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY);
+ location_position_free(rb);
+ location_position_free(lt);
+ return LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY;
+ }
+ memset(handle, 0, sizeof(location_bounds_s));
+
+ handle->is_added = FALSE;
+ handle->boundary = location_boundary_new_for_rect(lt, rb);
+ location_position_free(rb);
+ location_position_free(lt);
+ if (handle->boundary == NULL) {
+ LOCATIONS_LOGE("LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY(0x%08x) : fail to location_boundary_new_for_rect", LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY);
+ free(handle);
return LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY;
}
+ handle->user_cb = NULL;
+ handle->user_data = NULL;
- *bounds = (location_bounds_h)boundary;
+ *bounds = (location_bounds_h) handle;
return LOCATION_BOUNDS_ERROR_NONE;
}
-int location_bounds_create_circle(location_coords_s center, double radius, location_bounds_h* bounds)
+EXPORT_API int location_bounds_create_circle(location_coords_s center, double radius, location_bounds_h * bounds)
{
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
LOCATIONS_NULL_ARG_CHECK(bounds);
LOCATIONS_CHECK_CONDITION(radius>=0,LOCATION_BOUNDS_ERROR_INVALID_PARAMETER,"LOCATION_BOUNDS_ERROR_INVALID_PARAMETER");
LOCATIONS_CHECK_CONDITION(center.latitude>=-90 && center.latitude<=90,LOCATION_BOUNDS_ERROR_INVALID_PARAMETER,"LOCATION_BOUNDS_ERROR_INVALID_PARAMETER");
LOCATIONS_CHECK_CONDITION(center.longitude>=-180 && center.longitude<=180,LOCATION_BOUNDS_ERROR_INVALID_PARAMETER, "LOCATION_BOUNDS_ERROR_INVALID_PARAMETER");
LocationPosition *ct = location_position_new(0, center.latitude, center.longitude, 0, LOCATION_STATUS_2D_FIX);
- if (ct ==NULL)
- {
- LOGE("[%s] LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY(0x%08x) : fail to location_position_new", __FUNCTION__, LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY);
+ if (ct == NULL) {
+ LOCATIONS_LOGE("LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY(0x%08x) : fail to location_position_new", LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY);
return LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY;
}
- LocationBoundary *boundary = location_boundary_new_for_circle(ct,radius);
- location_position_free (ct);
-
- if(!boundary)
- {
- LOGE("[%s] LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY(0x%08x) : fail to location_boundary_new_for_circle", __FUNCTION__, LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY);
+ location_bounds_s *handle = (location_bounds_s *) malloc(sizeof(location_bounds_s));
+ if (handle == NULL) {
+ LOCATIONS_LOGE("OUT_OF_MEMORY(0x%08x)", LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY);
+ location_position_free(ct);
return LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY;
}
+ memset(handle, 0, sizeof(location_bounds_s));
+
+ handle->is_added = FALSE;
+ handle->boundary = location_boundary_new_for_circle(ct, radius);
+ location_position_free(ct);
+ if (handle->boundary == NULL) {
+ int ret = get_last_result();
+ free(handle);
+ if (ret == LOCATION_ERROR_PARAMETER) {
+ LOCATIONS_LOGE("LOCATION_BOUNDS_ERROR_INVALID_PARAMETER(0x%08x) fail to location_boundary_new_for_circle", LOCATION_BOUNDS_ERROR_INVALID_PARAMETER);
+ return LOCATION_BOUNDS_ERROR_INVALID_PARAMETER;
+ } else {
+ LOCATIONS_LOGE("LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY(0x%08x) : fail to location_boundary_new_for_circle", LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY);
+ return LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY;
+ }
+ }
+ handle->user_cb = NULL;
+ handle->user_data = NULL;
- *bounds = (location_bounds_h)boundary;
+ *bounds = (location_bounds_h) handle;
return LOCATION_BOUNDS_ERROR_NONE;
}
-int location_bounds_create_polygon(location_coords_s* coords_list, int length, location_bounds_h* bounds)
+EXPORT_API int location_bounds_create_polygon(location_coords_s * coords_list, int length, location_bounds_h * bounds)
{
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
LOCATIONS_NULL_ARG_CHECK(coords_list);
LOCATIONS_NULL_ARG_CHECK(bounds);
- LOCATIONS_CHECK_CONDITION(length>=3,LOCATION_BOUNDS_ERROR_INVALID_PARAMETER,"LOCATION_BOUNDS_ERROR_INVALID_PARAMETER");
+ LOCATIONS_CHECK_CONDITION(length>=3, LOCATION_BOUNDS_ERROR_INVALID_PARAMETER, "LOCATION_BOUNDS_ERROR_INVALID_PARAMETER");
int i;
- GList* position_list = NULL;
+ GList *position_list = NULL;
LocationPosition *position = NULL;
bool isValid;
-
- for(i=0;i<length;i++)
- {
- if(coords_list[i].latitude < -90 || coords_list[i].latitude > 90 || coords_list[i].longitude < -180 || coords_list[i].longitude > 180)
- {
- LOGE("[%s] LOCATION_BOUNDS_ERROR_INVALID_PARAMETER(0x%08x)", __FUNCTION__, LOCATION_BOUNDS_ERROR_INVALID_PARAMETER);
+
+ for (i = 0; i < length; i++) {
+ if (coords_list[i].latitude < -90 || coords_list[i].latitude > 90 || coords_list[i].longitude < -180 || coords_list[i].longitude > 180) {
+ LOCATIONS_LOGE("LOCATION_BOUNDS_ERROR_INVALID_PARAMETER(0x%08x)", LOCATION_BOUNDS_ERROR_INVALID_PARAMETER);
isValid = FALSE;
break;
- }
-
+ }
position = location_position_new(0, coords_list[i].latitude, coords_list[i].longitude, 0.0, LOCATION_STATUS_2D_FIX);
- position_list = g_list_append(position_list,position);
+ position_list = g_list_append(position_list, position);
location_position_free(position);
isValid = TRUE;
}
- if(!isValid)
- {
- g_list_free_full(position_list, (GDestroyNotify)__free_position_list);
+ if (!isValid) {
+ g_list_free_full(position_list, (GDestroyNotify) __free_position_list);
return LOCATION_BOUNDS_ERROR_INVALID_PARAMETER;
}
-
- if (position_list ==NULL)
- {
- LOGE("[%s] LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY(0x%08x) : fail to location_position_new", __FUNCTION__, LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY);
+
+ if (position_list == NULL) {
+ LOCATIONS_LOGE("LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY(0x%08x) : fail to location_position_new", LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY);
+ g_list_free_full(position_list, (GDestroyNotify) __free_position_list);
return LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY;
}
- LocationBoundary *boundary = location_boundary_new_for_polygon(position_list);
-
- if(!boundary)
- {
- LOGE("[%s] LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY(0x%08x) : fail to location_boundary_new_for_rect", __FUNCTION__, LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY);
+ location_bounds_s *handle = (location_bounds_s *) malloc(sizeof(location_bounds_s));
+ if (handle == NULL) {
+ LOCATIONS_LOGE("OUT_OF_MEMORY(0x%08x)", LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY);
return LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY;
}
+ memset(handle, 0, sizeof(location_bounds_s));
+
+ handle->is_added = FALSE;
+ handle->boundary = location_boundary_new_for_polygon(position_list);
+ if (handle->boundary == NULL) {
+ int ret = get_last_result();
+ free(handle);
+ if (ret == LOCATION_ERROR_PARAMETER) {
+ LOCATIONS_LOGE("LOCATION_BOUNDS_ERROR_INVALID_PARAMETER(0x%08x) fail to location_boundary_new_for_polygon", LOCATION_BOUNDS_ERROR_INVALID_PARAMETER);
+ return LOCATION_BOUNDS_ERROR_INVALID_PARAMETER;
+ } else {
+ LOCATIONS_LOGE("LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY(0x%08x) : fail to location_boundary_new_for_polygon", LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY);
+ return LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY;
+ }
+ }
+ handle->user_cb = NULL;
+ handle->user_data = NULL;
- *bounds = (location_bounds_h)boundary;
+ *bounds = (location_bounds_h) handle;
return LOCATION_BOUNDS_ERROR_NONE;
}
-bool location_bounds_contains_coordinates(location_bounds_h bounds, location_coords_s coords)
+EXPORT_API bool location_bounds_contains_coordinates(location_bounds_h bounds, location_coords_s coords)
{
- if (!bounds)
+ if (__is_location_supported() == LOCATIONS_ERROR_NOT_SUPPORTED) {
+ set_last_result(LOCATIONS_ERROR_NOT_SUPPORTED);
return FALSE;
+ }
- if (coords.latitude < -90 || coords.latitude > 90 || coords.longitude < -180 || coords.longitude > 180)
+ if (!bounds) {
+ set_last_result(LOCATION_BOUNDS_ERROR_INVALID_PARAMETER);
return FALSE;
+ }
+
+ if (coords.latitude < -90 || coords.latitude > 90 || coords.longitude < -180 || coords.longitude > 180) {
+ set_last_result(LOCATION_BOUNDS_ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
LocationPosition *pos = location_position_new(0, coords.latitude, coords.longitude, 0, LOCATION_STATUS_2D_FIX);
- if (!pos)
+ if (pos == NULL) {
+ LOCATIONS_LOGE("LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY(0x%08x) : fail to location_position_new", LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY);
+ set_last_result(LOCATION_BOUNDS_ERROR_OUT_OF_MEMORY);
return FALSE;
- gboolean is_inside = location_boundary_if_inside((LocationBoundary*)bounds, pos);
- location_position_free (pos);
- bool result = is_inside?TRUE:FALSE;
+ }
+ location_bounds_s *handle = (location_bounds_s *) bounds;
+ gboolean is_inside = location_boundary_if_inside(handle->boundary, pos);
+ location_position_free(pos);
+ bool result = is_inside ? TRUE : FALSE;
+
+ set_last_result(LOCATION_BOUNDS_ERROR_NONE);
return result;
}
-int location_bounds_get_type(location_bounds_h bounds, location_bounds_type_e *type)
+EXPORT_API int location_bounds_get_type(location_bounds_h bounds, location_bounds_type_e *type)
{
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
LOCATIONS_NULL_ARG_CHECK(bounds);
- LOCATIONS_NULL_ARG_CHECK(type);
- *type = __convert_bounds_type(((LocationBoundary*)bounds)->type);
+ LOCATIONS_NULL_ARG_CHECK(type);
+
+ location_bounds_s *handle = (location_bounds_s *) bounds;
+ *type = __convert_bounds_type(handle->boundary->type);
return LOCATION_BOUNDS_ERROR_NONE;
}
-int location_bounds_get_rect_coords(location_bounds_h bounds, location_coords_s *top_left, location_coords_s *bottom_right)
+EXPORT_API int location_bounds_get_rect_coords(location_bounds_h bounds, location_coords_s *top_left, location_coords_s *bottom_right)
{
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
LOCATIONS_NULL_ARG_CHECK(bounds);
LOCATIONS_NULL_ARG_CHECK(top_left);
LOCATIONS_NULL_ARG_CHECK(bottom_right);
- if( __convert_bounds_type(((LocationBoundary*)bounds)->type) != LOCATION_BOUNDS_RECT)
- {
- LOGE("[%s] LOCATION_BOUNDS_ERROR_INCORRECT_TYPE(0x%08x)", __FUNCTION__, LOCATION_BOUNDS_ERROR_INCORRECT_TYPE);
+
+ location_bounds_s *handle = (location_bounds_s *) bounds;
+ if (__convert_bounds_type(handle->boundary->type) != LOCATION_BOUNDS_RECT) {
+ LOCATIONS_LOGE("LOCATION_BOUNDS_ERROR_INCORRECT_TYPE(0x%08x)", LOCATION_BOUNDS_ERROR_INCORRECT_TYPE);
+ return LOCATION_BOUNDS_ERROR_INCORRECT_TYPE;
}
- top_left->latitude = ((LocationBoundary*)bounds)->rect.left_top->latitude;
- top_left->longitude = ((LocationBoundary*)bounds)->rect.left_top->longitude;
- bottom_right->latitude =((LocationBoundary*)bounds)->rect.right_bottom->latitude;
- bottom_right->longitude = ((LocationBoundary*)bounds)->rect.right_bottom->longitude;
+ top_left->latitude = handle->boundary->rect.left_top->latitude;
+ top_left->longitude = handle->boundary->rect.left_top->longitude;
+ bottom_right->latitude = handle->boundary->rect.right_bottom->latitude;
+ bottom_right->longitude = handle->boundary->rect.right_bottom->longitude;
return LOCATION_BOUNDS_ERROR_NONE;
}
-int location_bounds_get_circle_coords(location_bounds_h bounds, location_coords_s *center, double *radius)
+EXPORT_API int location_bounds_get_circle_coords(location_bounds_h bounds, location_coords_s *center, double *radius)
{
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
LOCATIONS_NULL_ARG_CHECK(bounds);
LOCATIONS_NULL_ARG_CHECK(center);
LOCATIONS_NULL_ARG_CHECK(radius);
- if( __convert_bounds_type(((LocationBoundary*)bounds)->type) != LOCATION_BOUNDS_CIRCLE)
- {
- LOGE("[%s] LOCATION_BOUNDS_ERROR_INCORRECT_TYPE(0x%08x)", __FUNCTION__, LOCATION_BOUNDS_ERROR_INCORRECT_TYPE);
+
+ location_bounds_s *handle = (location_bounds_s *) bounds;
+ if (__convert_bounds_type(handle->boundary->type) != LOCATION_BOUNDS_CIRCLE) {
+ LOCATIONS_LOGE("LOCATION_BOUNDS_ERROR_INCORRECT_TYPE(0x%08x)", LOCATION_BOUNDS_ERROR_INCORRECT_TYPE);
+ return LOCATION_BOUNDS_ERROR_INCORRECT_TYPE;
}
- center->latitude = ((LocationBoundary*)bounds)->circle.center->latitude;
- center->longitude =((LocationBoundary*)bounds)->circle.center->longitude;
- *radius = ((LocationBoundary*)bounds)->circle.radius;
+ center->latitude = handle->boundary->circle.center->latitude;
+ center->longitude = handle->boundary->circle.center->longitude;
+ *radius = handle->boundary->circle.radius;
return LOCATION_BOUNDS_ERROR_NONE;
}
-int location_bounds_foreach_polygon_coords(location_bounds_h bounds, polygon_coords_cb callback, void *user_data)
+EXPORT_API int location_bounds_foreach_polygon_coords(location_bounds_h bounds, polygon_coords_cb callback, void *user_data)
{
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
LOCATIONS_NULL_ARG_CHECK(bounds);
- LOCATIONS_NULL_ARG_CHECK(callback);
- if( __convert_bounds_type(((LocationBoundary*)bounds)->type) != LOCATION_BOUNDS_POLYGON)
- {
- LOGE("[%s] LOCATION_BOUNDS_ERROR_INCORRECT_TYPE(0x%08x)", __FUNCTION__, LOCATION_BOUNDS_ERROR_INCORRECT_TYPE);
+ LOCATIONS_NULL_ARG_CHECK(callback);
+
+ location_bounds_s *handle = (location_bounds_s *) bounds;
+ if (__convert_bounds_type(handle->boundary->type) != LOCATION_BOUNDS_POLYGON) {
+ LOCATIONS_LOGE("LOCATION_BOUNDS_ERROR_INCORRECT_TYPE(0x%08x)", LOCATION_BOUNDS_ERROR_INCORRECT_TYPE);
+ return LOCATION_BOUNDS_ERROR_INCORRECT_TYPE;
}
- GList *list = ((LocationBoundary*)bounds)->polygon.position_list;
- while(list)
- {
+ GList *list = handle->boundary->polygon.position_list;
+ while (list) {
LocationPosition *pos = list->data;
location_coords_s coords;
coords.latitude = pos->latitude;
coords.longitude = pos->longitude;
-
- if ( callback(coords, user_data) != TRUE )
- {
- LOGI("[%s] User quit the loop ", __FUNCTION__);
+
+ if (callback(coords, user_data) != TRUE) {
+ LOCATIONS_LOGI("User quit the loop ");
break;
}
list = g_list_next(list);
return LOCATION_BOUNDS_ERROR_NONE;
}
-int location_bounds_destroy(location_bounds_h bounds)
+EXPORT_API int location_bounds_destroy(location_bounds_h bounds)
{
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
LOCATIONS_NULL_ARG_CHECK(bounds);
- location_boundary_free((LocationBoundary*)bounds);
+
+ location_bounds_s *handle = (location_bounds_s *) bounds;
+ if (handle->is_added) {
+ LOCATIONS_LOGE("LOCATION_BOUNDS_ERROR_IS_ADDED(0x%08x)", LOCATION_BOUNDS_ERROR_IS_ADDED);
+ return LOCATION_BOUNDS_ERROR_IS_ADDED;
+ }
+ location_boundary_free(handle->boundary);
+ handle->user_cb = NULL;
+ handle->user_data = NULL;
+ free(handle);
+ LOCATIONS_LOGE("");
+ return LOCATION_BOUNDS_ERROR_NONE;
+}
+
+EXPORT_API int location_bounds_set_state_changed_cb(location_bounds_h bounds, location_bounds_state_changed_cb callback, void *user_data)
+{
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
+ LOCATIONS_NULL_ARG_CHECK(bounds);
+ LOCATIONS_NULL_ARG_CHECK(callback);
+
+ location_bounds_s *handle = (location_bounds_s *) bounds;
+ handle->user_cb = callback;
+ handle->user_data = user_data;
return LOCATION_BOUNDS_ERROR_NONE;
}
+EXPORT_API int location_bounds_unset_state_changed_cb(location_bounds_h bounds)
+{
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
+ LOCATIONS_NULL_ARG_CHECK(bounds);
+
+ location_bounds_s *handle = (location_bounds_s *) bounds;
+ handle->user_cb = NULL;
+ handle->user_data = NULL;
+ return LOCATION_BOUNDS_ERROR_NONE;
+}
+++ /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 <location_preference.h>
-#include <dlog.h>
-#include <location-map-service.h>
-#include <stdlib.h>
-#include <string.h>
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-#define LOG_TAG "TIZEN_N_LOCATION_PREFERENCE"
-
-/*
-* Internal Macros
-*/
-#define LOCATION_PREFERENCE_CHECK_CONDITION(condition, error, msg) \
- if(condition) {} else \
- { LOGE("[%s] %s(0x%08x)", __FUNCTION__, msg, error); return error; };
-
-#define LOCATION_PREFERENCE_NULL_ARG_CHECK(arg) \
- LOCATION_PREFERENCE_CHECK_CONDITION(arg != NULL, LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER, "LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER")
-
-#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) *((LocationMapObject**)service)
-
-
-/*
-* Internal Implementation
-*/
-
-static int __convert_error_code(int code, char* func_name)
-{
- int ret = LOCATION_PREFERENCE_ERROR_NONE;
- char* msg = "LOCATION_PREFERENCE_ERROR_NONE";
- switch(code)
- {
- case LOCATION_ERROR_NONE:
- ret = LOCATION_PREFERENCE_ERROR_NONE;
- msg = "LOCATION_PREFERENCE_ERROR_NONE";
- break;
- case LOCATION_ERROR_NETWORK_NOT_CONNECTED:
- ret = LOCATION_PREFERENCE_ERROR_NETWORK_FAILED;
- msg = "LOCATION_PREFERENCE_ERROR_NETWORK_FAILED";
- break;
- case LOCATION_ERROR_PARAMETER:
- ret = LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER;
- msg = "LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER";
- break;
- case LOCATION_ERROR_NOT_AVAILABLE:
- msg = "LOCATION_PREFERENCE_ERROR_RESULT_NOT_FOUND";
- ret = LOCATION_PREFERENCE_ERROR_RESULT_NOT_FOUND;
- }
- LOGE("[%s] %s(0x%08x)", func_name, msg, ret);
- return ret;
-}
-
-
-/*
-* Public Implementation
-*/
-int location_preference_foreach_available_property_keys(location_service_h service, location_preference_available_property_key_cb callback, void* user_data)
-{
- LocationMapObject* object = NULL;
- GList* keys = NULL;
- char* key = NULL;
- int ret = 0;
-
- LOCATION_PREFERENCE_NULL_ARG_CHECK(service);
- LOCATION_PREFERENCE_NULL_ARG_CHECK(callback);
-
- object = LOCATION_PREFERENCE_GET_LOCATION_OBJECT(service);
- 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__);
- }
- else
- {
- while(keys) {
- key = keys->data;
- if(!callback(key, user_data))
- break;
- keys = keys->next;
- }
-
- return LOCATION_PREFERENCE_ERROR_NONE;
- }
-}
-
-int location_preference_foreach_available_property_values(location_service_h service, const char* key, location_preference_available_property_value_cb callback, void* user_data)
-{
- LOCATION_PREFERENCE_NULL_ARG_CHECK(service);
- LOCATION_PREFERENCE_NULL_ARG_CHECK(key);
- LOCATION_PREFERENCE_NULL_ARG_CHECK(callback);
- return LOCATION_PREFERENCE_ERROR_RESULT_NOT_FOUND;
-}
-
-int location_preference_foreach_available_languages(location_service_h service, location_preference_available_language_cb callback, void* user_data)
-{
- LocationMapObject* object = NULL;
- GList* keys = NULL;
- char* key = NULL;
- int ret = 0;
-
- LOCATION_PREFERENCE_NULL_ARG_CHECK(service);
- LOCATION_PREFERENCE_NULL_ARG_CHECK(callback);
-
- object = LOCATION_PREFERENCE_GET_LOCATION_OBJECT(service);
- 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__);
- }
- else
- {
- while(keys) {
- key = keys->data;
- if(!callback(key, user_data))
- break;
- keys = keys->next;
- }
-
- return LOCATION_PREFERENCE_ERROR_NONE;
- }
-}
-
-
-int location_preference_foreach_properties(location_service_h service, location_preference_property_cb callback, void* user_data)
-{
- LocationMapPref* pref = NULL;
- LocationMapObject* object = NULL;
- GList* keys = NULL;
- char* key = NULL;
- char* value = NULL;
-
- LOCATION_PREFERENCE_NULL_ARG_CHECK(service);
- LOCATION_PREFERENCE_NULL_ARG_CHECK(callback);
-
- 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");
-
- keys = location_map_pref_get_property_key(pref);
- while(keys) {
- key = keys->data;
- value = (char*)location_map_pref_get_property(pref, key);
- if(!callback(key, value, user_data))
- break;
- keys = keys->next;
- }
-
- location_map_pref_free(pref);
- return LOCATION_PREFERENCE_ERROR_NONE;
-}
-
-int location_preference_set(location_service_h service, const char* key, const char* value)
-{
- 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_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_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)
-{
- LocationMapPref* pref = NULL;
- LocationMapObject* object = NULL;
- char* ret = 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_map_get_service_pref(object);
- LOCATION_PREFERENCE_CHECK_CONDITION(pref != NULL, LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER, "LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER");
-
- ret = (char*)location_map_pref_get_property(pref, (gconstpointer)key);
- if(ret != NULL)
- {
- *value = strdup(ret);
- location_map_pref_free(pref);
- }
- else
- {
- *value = NULL;
- 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)
-{
- 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_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_get_provider_name(pref);
- if(ret != NULL)
- *provider = strdup(ret);
- else
- *provider = NULL;
-
- 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)
-{
- 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_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_get_distance_unit(pref);
- if(ret != NULL)
- {
- switch(ret[0]) {
- case 'F' :
- *unit = LOCATION_PREFERENCE_DISTANCE_UNIT_FT;
- break;
- case 'K' :
- *unit = LOCATION_PREFERENCE_DISTANCE_UNIT_KM;
- break;
- case 'Y' :
- *unit = LOCATION_PREFERENCE_DISTANCE_UNIT_YD;
- break;
- case 'M' :
- if(ret[1] == 'I')
- *unit = LOCATION_PREFERENCE_DISTANCE_UNIT_MI;
- else
- *unit = LOCATION_PREFERENCE_DISTANCE_UNIT_M;
- break;
- }
- location_map_pref_free(pref);
- return LOCATION_PREFERENCE_ERROR_NONE;
- }
- else
- {
- 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)
-{
- LocationMapPref* pref = NULL;
- LocationMapObject* object = NULL;
- char* distance = NULL;
-
- LOCATION_PREFERENCE_NULL_ARG_CHECK(service);
- switch(unit) {
- case LOCATION_PREFERENCE_DISTANCE_UNIT_FT :
- distance = "FT";
- break;
- case LOCATION_PREFERENCE_DISTANCE_UNIT_KM :
- distance = "KM";
- break;
- case LOCATION_PREFERENCE_DISTANCE_UNIT_YD :
- distance = "YD";
- break;
- case LOCATION_PREFERENCE_DISTANCE_UNIT_MI :
- distance = "MI";
- break;
- case LOCATION_PREFERENCE_DISTANCE_UNIT_M :
- distance = "M";
- break;
- default :
- LOCATION_PREFERENCE_PRINT_ERROR_CODE(LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER, "LOCATION_PREFERENCE_ERROR_INVALID_PARAMETER");
- }
-
- 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_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)
-{
- 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_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_get_language(pref);
- if(ret != NULL)
- *language = strdup(ret);
- else
- *language = NULL;
-
- location_map_pref_free(pref);
- return LOCATION_PREFERENCE_ERROR_NONE;
-}
-
-int location_preference_set_language(location_service_h service, const char* language)
-{
- 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_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");
-
- 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;
-}
/*
-* 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.
-*/
+ * Copyright (c) 2011-2013 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 <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <locations_private.h>
-#include <dlog.h>
+#include <system_info.h>
+#include "location_internal.h"
+#include "location_bounds.h"
+#include "location_batch.h"
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-#define LOG_TAG "TIZEN_N_LOCATION_MANAGER"
-
-/*
-* Internal Macros
-*/
-#define LOCATIONS_CHECK_CONDITION(condition,error,msg) \
- if(condition) {} else \
- { LOGE("[%s] %s(0x%08x)",__FUNCTION__, msg,error); return error;}; \
#define LOCATIONS_NULL_ARG_CHECK(arg) \
- LOCATIONS_CHECK_CONDITION(arg != NULL,LOCATIONS_ERROR_INVALID_PARAMETER,"LOCATIONS_ERROR_INVALID_PARAMETER") \
+ LOCATIONS_CHECK_CONDITION((arg != NULL),LOCATIONS_ERROR_INVALID_PARAMETER,"LOCATIONS_ERROR_INVALID_PARAMETER") \
+
+#define LOCATIONS_NOT_SUPPORTED_CHECK(arg) \
+ LOCATIONS_CHECK_CONDITION((arg == LOCATIONS_ERROR_NONE),LOCATIONS_ERROR_NOT_SUPPORTED,"LOCATIONS_ERROR_NOT_SUPPORTED") \
+
/*
* Internal Implementation
*/
-static int __convert_error_code(int code, char *func_name)
+static location_setting_changed_s g_location_setting[LOCATIONS_METHOD_WPS+1];
+
+static int __convert_error_code(int code)
{
int ret;
char *msg = "LOCATIONS_ERROR_NONE";
msg = "LOCATIONS_ERROR_NETWORK_FAILED";
break;
case LOCATION_ERROR_NOT_ALLOWED:
+ ret = LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED;
+ msg = "LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED";
+ break;
+ case LOCATION_ERROR_SETTING_OFF:
ret = LOCATIONS_ERROR_GPS_SETTING_OFF;
msg = "LOCATIONS_ERROR_GPS_SETTING_OFF";
break;
+ case LOCATION_ERROR_SECURITY_DENIED:
+ ret = LOCATIONS_ERROR_SECURITY_RESTRICTED;
+ msg = "LOCATIONS_ERROR_SECURITY_RESTRICTED";
+ break;
case LOCATION_ERROR_NOT_AVAILABLE:
case LOCATION_ERROR_CONFIGURATION:
case LOCATION_ERROR_PARAMETER:
msg = "LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE";
ret = LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE;
}
- LOGE("[%s] %s(0x%08x) : core fw error(0x%x)", func_name, msg, ret, code);
+ if (ret != LOCATIONS_ERROR_NONE)
+ LOCATIONS_LOGE("%s(0x%08x) : core fw error(0x%x)", msg, ret, code);
return ret;
}
+static location_method_e __convert_location_method_e(LocationMethod method)
+{
+ location_method_e _method = LOCATIONS_METHOD_NONE;
+ switch(method) {
+ case LOCATION_METHOD_HYBRID:
+ _method = LOCATIONS_METHOD_HYBRID;
+ break;
+ case LOCATION_METHOD_GPS:
+ _method = LOCATIONS_METHOD_GPS;
+ break;
+ case LOCATION_METHOD_WPS:
+ _method = LOCATIONS_METHOD_WPS;
+ break;
+ case LOCATION_METHOD_NONE:
+ default:
+ break;
+ }
+ return _method;
+}
+
+static LocationMethod __convert_LocationMethod(location_method_e method)
+{
+ LocationMethod _method = LOCATION_METHOD_NONE;
+ switch (method) {
+ case LOCATIONS_METHOD_HYBRID:
+ _method = LOCATION_METHOD_HYBRID;
+ break;
+ case LOCATIONS_METHOD_GPS:
+ _method = LOCATION_METHOD_GPS;
+ break;
+ case LOCATIONS_METHOD_WPS:
+ _method = LOCATION_METHOD_WPS;
+ break;
+ case LOCATIONS_METHOD_NONE:
+ default:
+ _method = LOCATION_METHOD_NONE;
+ break;
+ }
+ return _method;
+}
+
+static int __is_gps_supported(void)
+{
+ bool is_supported = false;
+ int retval = 0;
+
+ retval = system_info_get_platform_bool("http://tizen.org/feature/location.gps", &is_supported);
+ if (retval != SYSTEM_INFO_ERROR_NONE) {
+ LOCATIONS_LOGW("system_info_get_platform_bool failed: retval = %d", retval);
+ }
+ if (is_supported == false) {
+ return LOCATIONS_ERROR_NOT_SUPPORTED;
+ }
+ return LOCATIONS_ERROR_NONE;
+}
+
+static int __is_gps_satellite_supported(void)
+{
+ bool is_supported = false;
+ int retval = 0;
+
+ retval = system_info_get_platform_bool("http://tizen.org/feature/location.gps.satellite", &is_supported);
+ if (retval != SYSTEM_INFO_ERROR_NONE) {
+ LOCATIONS_LOGW("system_info_get_platform_bool failed: retval = %d", retval);
+ }
+ if (is_supported == false) {
+ return LOCATIONS_ERROR_NOT_SUPPORTED;
+ }
+ return LOCATIONS_ERROR_NONE;
+}
+
+
+static int __is_wps_supported(void)
+{
+ bool is_supported = false;
+ int retval = 0;
+
+ retval = system_info_get_platform_bool("http://tizen.org/feature/location.wps", &is_supported);
+ if (retval != SYSTEM_INFO_ERROR_NONE) {
+ LOCATIONS_LOGW("system_info_get_platform_bool failed: retval = %d", retval);
+ }
+ if (is_supported == false) {
+ return LOCATIONS_ERROR_NOT_SUPPORTED;
+ }
+ return LOCATIONS_ERROR_NONE;
+}
+
+static int __is_location_supported(void)
+{
+ if (__is_gps_supported() == LOCATIONS_ERROR_NOT_SUPPORTED) {
+ if (__is_wps_supported() == LOCATIONS_ERROR_NOT_SUPPORTED) {
+ return LOCATIONS_ERROR_NOT_SUPPORTED;
+ } else {
+ return LOCATIONS_ERROR_NONE;
+ }
+ }
+
+ return LOCATIONS_ERROR_NONE;
+}
+
static void __cb_service_updated(GObject * self, guint type, gpointer data, gpointer accuracy, gpointer userdata)
{
- LOGI("[%s] Callback function has been invoked. ", __FUNCTION__);
+ LOCATIONS_LOGD("Callback function has been invoked. ");
location_manager_s *handle = (location_manager_s *) userdata;
if (type == VELOCITY_UPDATED && handle->user_cb[_LOCATIONS_EVENT_TYPE_VELOCITY]) {
LocationVelocity *vel = (LocationVelocity *) data;
- LOGI("[%s] Current velocity: timestamp : %d, speed: %f, direction : %f, climb : %f", __FUNCTION__,
- vel->timestamp, vel->speed, vel->direction, vel->climb);
+ LOCATIONS_LOGD("Current velocity: timestamp : %d", vel->timestamp);
((location_velocity_updated_cb) handle->user_cb[_LOCATIONS_EVENT_TYPE_VELOCITY]) (vel->speed, vel->direction,
- vel->climb, vel->timestamp,
- handle->user_data
- [_LOCATIONS_EVENT_TYPE_VELOCITY]);
+ vel->climb, vel->timestamp,
+ handle->user_data
+ [_LOCATIONS_EVENT_TYPE_VELOCITY]);
}
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);
+ LOCATIONS_LOGD("Current position: timestamp : %d", pos->timestamp);
((location_position_updated_cb) handle->user_cb[_LOCATIONS_EVENT_TYPE_POSITION]) (pos->latitude, pos->longitude,
- pos->altitude, pos->timestamp,
- handle->user_data
- [_LOCATIONS_EVENT_TYPE_POSITION]);
+ pos->altitude, pos->timestamp,
+ 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);
+ LOCATIONS_LOGD("Current satellite information: timestamp : %d, number of active : %d, number of inview : %d",
+ 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_location_updated(GObject * self, int error, gpointer position, gpointer velocity, gpointer accuracy, gpointer userdata)
+{
+ LOCATIONS_LOGD("Callback function has been invoked. ");
+ int converted_err = __convert_error_code(error);
+ location_manager_s *handle = (location_manager_s *) userdata;
+ LocationPosition *pos = (LocationPosition*) position;
+ LocationVelocity *vel = (LocationVelocity*) velocity;
+
+ LOCATIONS_LOGD("Current position: timestamp : %d", pos->timestamp);
+ if (handle->user_cb[_LOCATIONS_EVENT_TYPE_LOCATION]) {
+ ((location_updated_cb) handle->user_cb[_LOCATIONS_EVENT_TYPE_LOCATION]) (converted_err, pos->latitude, pos->longitude, pos->altitude,
+ pos->timestamp, vel->speed, vel->climb, vel->direction, handle->user_data[_LOCATIONS_EVENT_TYPE_LOCATION]);
+ }
+}
+
+#if 0
+static gboolean __cb_single_service_stop(gpointer user_data)
+{
+ location_manager_s *handle = (location_manager_s *) user_data;
+
+ if (handle->timeout) {
+ g_source_remove(handle->timeout);
+ handle->timeout = 0;
+ }
+
+ location_stop(handle->object);
+
+ return FALSE;
+}
+#endif
+
static void __cb_service_enabled(GObject * self, guint status, gpointer userdata)
{
- LOGI("[%s] Callback function has been invoked. ", __FUNCTION__);
+ LOCATIONS_LOGD("Callback function has been invoked. ");
location_manager_s *handle = (location_manager_s *) userdata;
if (handle->user_cb[_LOCATIONS_EVENT_TYPE_SERVICE_STATE]) {
((location_service_state_changed_cb)
static void __cb_service_disabled(GObject * self, guint status, gpointer userdata)
{
- LOGI("[%s] Callback function has been invoked. ", __FUNCTION__);
+ LOCATIONS_LOGD("Callback function has been invoked. ");
location_manager_s *handle = (location_manager_s *) userdata;
if (handle->user_cb[_LOCATIONS_EVENT_TYPE_SERVICE_STATE])
((location_service_state_changed_cb)
handle->user_data[_LOCATIONS_EVENT_TYPE_SERVICE_STATE]);
}
-static void __cb_zone_in(GObject * self, guint type, gpointer position, gpointer accuracy, gpointer userdata)
+static int __compare_position (gconstpointer a, gconstpointer b)
+{
+ if(location_position_equal((LocationPosition*) a, (LocationPosition *)b) == TRUE) {
+ return 0;
+ }
+
+ return -1;
+}
+
+static int __boundary_compare(LocationBoundary * bound1, LocationBoundary * bound2)
{
+ int ret = -1;
+
+ if (bound1->type == bound2->type) {
+ switch (bound1->type) {
+ case LOCATION_BOUNDARY_CIRCLE:
+ if (location_position_equal(bound1->circle.center, bound2->circle.center) && bound1->circle.radius == bound2->circle.radius) {
+ ret = 0;
+ }
+ break;
+ case LOCATION_BOUNDARY_RECT:
+ if (location_position_equal(bound1->rect.left_top, bound2->rect.left_top) && location_position_equal(bound1->rect.right_bottom, bound2->rect.right_bottom)) {
+ ret = 0;
+ }
+ break;
+ case LOCATION_BOUNDARY_POLYGON: {
+ GList *boundary1_next = NULL;
+ GList *boundary2_start = NULL, *boundary2_prev = NULL, *boundary2_next = NULL;
+ if (g_list_length(bound1->polygon.position_list) != g_list_length(bound2->polygon.position_list)) {
+ return -1;
+ }
+
+ boundary2_start = g_list_find_custom(bound2->polygon.position_list, g_list_nth_data(bound1->polygon.position_list, 0), (GCompareFunc) __compare_position);
+ if (boundary2_start == NULL) return -1;
+
+ boundary2_prev = g_list_previous(boundary2_start);
+ boundary2_next = g_list_next(boundary2_start);
+
+ if (boundary2_prev == NULL) boundary2_prev = g_list_last(bound2->polygon.position_list);
+ if (boundary2_next == NULL) boundary2_next = g_list_first(bound2->polygon.position_list);
+
+ boundary1_next = g_list_next(bound1->polygon.position_list);
+ if (boundary1_next != NULL && boundary2_prev != NULL &&
+ location_position_equal((LocationPosition*)boundary1_next->data, (LocationPosition*)boundary2_prev->data) == TRUE) {
+ boundary1_next = g_list_next(boundary1_next);
+ while (boundary1_next) {
+ boundary2_prev = g_list_previous(boundary2_prev);
+ if (boundary2_prev == NULL) boundary2_prev = g_list_last(bound2->polygon.position_list);
+ if (location_position_equal((LocationPosition*)boundary1_next->data, (LocationPosition*) boundary2_prev->data) == FALSE) {
+ return -1;
+ }
+ boundary1_next = g_list_next(boundary1_next);
+ }
+ ret = 0;
+ } else if (boundary1_next != NULL && boundary2_next != NULL &&
+ location_position_equal((LocationPosition*)boundary1_next->data, (LocationPosition*)boundary2_next->data) == TRUE) {
+ boundary1_next = g_list_next(boundary1_next);
+ while(boundary1_next) {
+ boundary2_next = g_list_next(boundary2_next);
+ if (boundary2_next == NULL) boundary2_next = g_list_first(bound2->polygon.position_list);
+ if (location_position_equal((LocationPosition*)boundary1_next->data, (LocationPosition*) boundary2_next->data) == FALSE) {
+ return -1;
+ }
+ boundary1_next = g_list_next(boundary1_next);
+ }
+ ret = 0;
+ } else {
+ return -1;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ return ret;
+}
+
+static void __cb_zone_in(GObject * self, gpointer boundary, gpointer position, gpointer accuracy, gpointer userdata)
+{
+ LOCATIONS_LOGD("ENTER >>>");
location_manager_s *handle = (location_manager_s *) userdata;
if (handle->user_cb[_LOCATIONS_EVENT_TYPE_BOUNDARY]) {
LocationPosition *pos = (LocationPosition *) position;
((location_zone_changed_cb) handle->user_cb[_LOCATIONS_EVENT_TYPE_BOUNDARY]) (LOCATIONS_BOUNDARY_IN,
- pos->latitude, pos->longitude,
- pos->altitude, pos->timestamp,
- handle->user_data
- [_LOCATIONS_EVENT_TYPE_BOUNDARY]);
+ pos->latitude, pos->longitude,
+ pos->altitude, pos->timestamp,
+ handle->user_data
+ [_LOCATIONS_EVENT_TYPE_BOUNDARY]);
}
+
+ location_bounds_s *bounds;
+ GList *bounds_list = g_list_first(handle->bounds_list);
+ while (bounds_list) {
+ bounds = (location_bounds_s *)bounds_list->data;
+ if (__boundary_compare(boundary, bounds->boundary) == 0) {
+ LOCATIONS_LOGD("Find zone in boundary");
+ if (bounds->user_cb) {
+ ((location_bounds_state_changed_cb) bounds->user_cb) (LOCATIONS_BOUNDARY_IN, bounds->user_data);
+ }
+ break;
+ }
+ bounds_list = g_list_next(bounds_list);
+ }
+ LOCATIONS_LOGD("EXIT <<<");
}
-static void __cb_zone_out(GObject * self, guint type, gpointer position, gpointer accuracy, gpointer userdata)
+static void __cb_zone_out(GObject * self, gpointer boundary, gpointer position, gpointer accuracy, gpointer userdata)
{
+ LOCATIONS_LOGD("ENTER >>>");
location_manager_s *handle = (location_manager_s *) userdata;
if (handle->user_cb[_LOCATIONS_EVENT_TYPE_BOUNDARY]) {
LocationPosition *pos = (LocationPosition *) position;
((location_zone_changed_cb) handle->user_cb[_LOCATIONS_EVENT_TYPE_BOUNDARY]) (LOCATIONS_BOUNDARY_OUT,
- pos->latitude, pos->longitude,
- pos->altitude, pos->timestamp,
- handle->user_data
- [_LOCATIONS_EVENT_TYPE_BOUNDARY]);
+ pos->latitude, pos->longitude,
+ pos->altitude, pos->timestamp,
+ handle->user_data
+ [_LOCATIONS_EVENT_TYPE_BOUNDARY]);
+ }
+
+ location_bounds_s *bounds;
+ GList *bounds_list = g_list_first(handle->bounds_list);
+ while (bounds_list) {
+ bounds = (location_bounds_s *)bounds_list->data;
+ if (__boundary_compare(boundary, bounds->boundary) == 0) {
+ LOCATIONS_LOGD("Find zone out boundary");
+ if (bounds->user_cb) {
+ ((location_bounds_state_changed_cb) bounds->user_cb) (LOCATIONS_BOUNDARY_OUT, bounds->user_data);
+ }
+ break;
+ }
+ bounds_list = g_list_next(bounds_list);
}
+ LOCATIONS_LOGD("EXIT <<<");
}
static int __set_callback(_location_event_e type, location_manager_h manager, void *callback, void *user_data)
location_manager_s *handle = (location_manager_s *) manager;
handle->user_cb[type] = callback;
handle->user_data[type] = user_data;
- LOGI("[%s] event type : %d. ", __FUNCTION__, type);
+ LOCATIONS_LOGD("event type : %d", type);
return LOCATIONS_ERROR_NONE;
}
location_manager_s *handle = (location_manager_s *) manager;
handle->user_cb[type] = NULL;
handle->user_data[type] = NULL;
- LOGI("[%s] event type : %d. ", __FUNCTION__, type);
+ LOCATIONS_LOGD("event type : %d. ", type);
return LOCATIONS_ERROR_NONE;
}
ret = location_bounds_create_polygon(coords, size, &bounds);
}
} else {
- LOGI("[%s] Invalid boundary type : %d", __FUNCTION__, boundary->type);
+ LOCATIONS_LOGI("Invalid boundary type : %d", boundary->type);
}
if (ret != LOCATIONS_ERROR_NONE) {
- LOGI("[%s] Failed to create location_bounds : (0x%08x) ", __FUNCTION__, ret);
+ LOCATIONS_LOGI("Failed to create location_bounds : (0x%08x) ", ret);
} else {
if (handle->is_continue_foreach_bounds) {
handle->is_continue_foreach_bounds =
- ((location_bounds_cb) handle->user_cb[_LOCATIONS_EVENT_TYPE_FOREACH_BOUNDS]) (bounds,
- handle->
- user_data
- [_LOCATIONS_EVENT_TYPE_FOREACH_BOUNDS]);
+ ((location_bounds_cb) handle->user_cb[_LOCATIONS_EVENT_TYPE_FOREACH_BOUNDS]) (bounds,
+ handle->
+ user_data
+ [_LOCATIONS_EVENT_TYPE_FOREACH_BOUNDS]);
}
location_bounds_destroy(bounds);
}
} else {
- LOGI("[%s] __foreach_boundary() has been failed", __FUNCTION__);
+ LOCATIONS_LOGD("__foreach_boundary() has been failed");
+ }
+}
+
+static void __setting_changed_cb(LocationMethod method, gboolean enable, void *user_data)
+{
+ LOCATIONS_LOGD("__setting_changed_cb method [%d]", method);
+ location_method_e _method = __convert_location_method_e(method);
+ location_setting_changed_s *_setting_changed = (location_setting_changed_s *)user_data;
+ if (_setting_changed == NULL) {
+ LOCATIONS_LOGE("Invaild userdata\n");
+ return;
+ }
+
+ if (_setting_changed[_method].callback != NULL) {
+ _setting_changed[_method].callback(_method, enable, _setting_changed[_method].user_data);
+ }
+}
+
+static void __cb_batch_updated(GObject * self, guint num_of_location, gpointer userdata)
+{
+ LOCATIONS_LOGD("Batch callback function has been invoked.");
+ location_manager_s *handle = (location_manager_s *) userdata;
+
+ if (handle->user_cb[_LOCATIONS_EVENT_TYPE_BATCH]) {
+ ((location_batch_cb) handle->user_cb[_LOCATIONS_EVENT_TYPE_BATCH]) (num_of_location, handle->user_data[_LOCATIONS_EVENT_TYPE_BATCH]);
}
}
// Location Manager
////////////////////////////////////////
+EXPORT_API int location_manager_set_location_batch_cb(location_manager_h manager, location_batch_cb callback, int batch_interval, int batch_period, void *user_data)
+{
+ LOCATIONS_LOGD("location_manager_set_location_batch_cb");
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
+
+ LOCATIONS_CHECK_CONDITION(batch_interval >= 1 && batch_interval <= 120, LOCATIONS_ERROR_INVALID_PARAMETER, "LOCATIONS_ERROR_INVALID_PARAMETER");
+ LOCATIONS_CHECK_CONDITION(batch_period >= 120 && batch_period <= 600, LOCATIONS_ERROR_INVALID_PARAMETER, "LOCATIONS_ERROR_INVALID_PARAMETER");
+ LOCATIONS_NULL_ARG_CHECK(manager);
+ LOCATIONS_NULL_ARG_CHECK(callback);
+ location_manager_s *handle = (location_manager_s *) manager;
+ g_object_set(handle->object, "batch-period", batch_period, NULL);
+ g_object_set(handle->object, "batch-interval", batch_interval, NULL);
+ return __set_callback(_LOCATIONS_EVENT_TYPE_BATCH, manager, callback, user_data);
+}
+
+EXPORT_API int location_manager_unset_location_batch_cb (location_manager_h manager)
+{
+ LOCATIONS_LOGD("location_manager_unset_location_batch_cb");
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
+ return __unset_callback(_LOCATIONS_EVENT_TYPE_BATCH, manager);
+}
+
+EXPORT_API int location_manager_start_batch(location_manager_h manager)
+{
+ LOCATIONS_LOGD("location_manager_start_batch");
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
+ LOCATIONS_NULL_ARG_CHECK(manager);
+ location_manager_s *handle = (location_manager_s *) manager;
+
+ if (LOCATIONS_METHOD_GPS == handle->method)
+ {
+ if (!handle->sig_id[_LOCATION_SIGNAL_BATCH_UPDATED]) {
+ handle->sig_id[_LOCATION_SIGNAL_BATCH_UPDATED] = g_signal_connect(handle->object, "batch-updated", G_CALLBACK(__cb_batch_updated), handle);
+ }
+ } else {
+ LOCATIONS_LOGE("method is not GPS");
+ }
+
+ if (handle->user_cb[_LOCATIONS_EVENT_TYPE_BATCH] != NULL) {
+ LOCATIONS_LOGI("batch status set : Start");
+ }
+
+ int ret = location_start_batch(handle->object);
+ if (ret != LOCATION_ERROR_NONE) {
+ return __convert_error_code(ret);
+ }
+
+ return LOCATIONS_ERROR_NONE;
+}
+
+EXPORT_API int location_manager_stop_batch(location_manager_h manager)
+{
+ LOCATIONS_LOGD("location_manager_stop_batch");
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
+ LOCATIONS_NULL_ARG_CHECK(manager);
+ location_manager_s *handle = (location_manager_s *) manager;
+
+ if (LOCATIONS_METHOD_GPS == handle->method)
+ {
+ if (handle->sig_id[_LOCATION_SIGNAL_BATCH_UPDATED]) {
+ g_signal_handler_disconnect(handle->object, handle->sig_id[_LOCATION_SIGNAL_BATCH_UPDATED]);
+ handle->sig_id[_LOCATION_SIGNAL_BATCH_UPDATED] = 0;
+ }
+ } else {
+ LOCATIONS_LOGE("method is not GPS");
+ }
+
+ int ret = location_stop_batch(handle->object);
+ if (ret != LOCATION_ERROR_NONE) {
+ return __convert_error_code(ret);
+ }
+
+ return LOCATIONS_ERROR_NONE;
+}
+
+EXPORT_API int location_manager_foreach_location_batch(location_manager_h manager, location_batch_get_location_cb callback, void *user_data)
+{
+ LOCATIONS_LOGD("location_manager_foreach_location_batch");
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
+ LOCATIONS_NULL_ARG_CHECK(manager);
+ LOCATIONS_NULL_ARG_CHECK(callback);
+ location_manager_s *handle = (location_manager_s *) manager;
+ LocationBatch *batch = NULL;
+
+ int ret = location_get_batch (handle->object, &batch);
+ if (ret != LOCATION_ERROR_NONE || batch == NULL) {
+ if (ret == LOCATION_ERROR_NOT_SUPPORTED) {
+ LOCATIONS_LOGE("LOCATIONS_ERROR_INCORRECT_METHOD(0x%08x) : method - %d", LOCATIONS_ERROR_INCORRECT_METHOD, handle->method);
+ return LOCATIONS_ERROR_INCORRECT_METHOD;
+ } else if (ret == LOCATION_ERROR_NOT_ALLOWED) {
+ LOCATIONS_LOGE("LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED");
+ return LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED;
+ }
+
+ LOCATIONS_LOGE("LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE(0x%08x) : batch is NULL ",
+ LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE);
+ return LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE;
+ }
+
+ int i;
+ for (i = 0; i < batch->num_of_location; i++) {
+ gdouble latitude;
+ gdouble longitude;
+ gdouble altitude;
+ gdouble speed;
+ gdouble direction;
+ gdouble h_accuracy;
+ gdouble v_accuracy;
+ guint timestamp;
+
+ location_get_batch_details(batch, i, &latitude, &longitude, &altitude, &speed, &direction, &h_accuracy, &v_accuracy, ×tamp);
+ if (callback(latitude, longitude, altitude, speed, direction, h_accuracy, v_accuracy, timestamp, user_data) != TRUE) {
+ break;
+ }
+ }
+ location_batch_free(batch);
+ batch = NULL;
+ return LOCATIONS_ERROR_NONE;
+}
+
/*
* Public Implementation
*/
-bool location_manager_is_supported_method(location_method_e method)
+EXPORT_API bool location_manager_is_supported_method(location_method_e method)
{
- LocationMethod _method = LOCATION_METHOD_NONE;
- switch (method) {
- case LOCATIONS_METHOD_HYBRID:
- _method = LOCATION_METHOD_HYBRID;
- break;
- case LOCATIONS_METHOD_GPS:
- _method = LOCATION_METHOD_GPS;
- break;
- case LOCATIONS_METHOD_WPS:
- _method = LOCATION_METHOD_WPS;
- break;
- case LOCATIONS_METHOD_CPS:
- _method = LOCATION_METHOD_CPS;
- break;
- default:
- _method = LOCATION_METHOD_NONE;
- break;
+ LOCATIONS_LOGD("location_manager_is_supported_method %d", method);
+ if (__is_location_supported() == LOCATIONS_ERROR_NOT_SUPPORTED) {
+ set_last_result(LOCATIONS_ERROR_NOT_SUPPORTED);
+ return false;
+ }
+
+ LocationMethod _method = __convert_LocationMethod(method);
+ if (_method == LOCATION_METHOD_NONE) {
+ LOCATIONS_LOGE("Not supported method [%d]", method);
+ set_last_result(LOCATIONS_ERROR_INCORRECT_METHOD);
+ return false;
}
+
+ set_last_result(LOCATIONS_ERROR_NONE);
return location_is_supported_method(_method);
}
-int location_manager_create(location_method_e method, location_manager_h * manager)
+EXPORT_API int location_manager_is_enabled_method(location_method_e method, bool *enable)
+{
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
+ if (LOCATIONS_METHOD_HYBRID > method || LOCATIONS_METHOD_WPS < method) {
+ LOCATIONS_LOGE("Not supported method [%d]", method);
+ return LOCATIONS_ERROR_INCORRECT_METHOD;
+ }
+
+ LOCATIONS_LOGD("location_manager_is_enabled_method %d", method);
+ LOCATIONS_NULL_ARG_CHECK(enable);
+
+ int is_enabled_val = -1;
+ LocationMethod _method = __convert_LocationMethod(method);
+ int ret = location_is_enabled_method(_method, &is_enabled_val);
+ if (ret != LOCATION_ERROR_NONE) {
+ if (ret == LOCATION_ERROR_NOT_SUPPORTED)
+ return LOCATIONS_ERROR_INCORRECT_METHOD;
+ return __convert_error_code(ret);
+ }
+ if (is_enabled_val == -1)
+ return TIZEN_ERROR_PERMISSION_DENIED;
+
+ *enable = (is_enabled_val == 0)?FALSE:TRUE;
+ return LOCATIONS_ERROR_NONE;
+}
+
+EXPORT_API int location_manager_enable_method(const location_method_e method, const bool enable)
+{
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
+ if (LOCATIONS_METHOD_HYBRID > method || LOCATIONS_METHOD_WPS < method) {
+ LOCATIONS_LOGE("Not supported method [%d]", method);
+ return LOCATIONS_ERROR_INCORRECT_METHOD;
+ }
+ LOCATIONS_LOGD("method: %d, enable: %d", method, enable);
+
+ LocationMethod _method = __convert_LocationMethod(method);
+
+ int ret = location_enable_method(_method, enable);
+ return __convert_error_code(ret);
+}
+
+
+EXPORT_API int location_manager_create(location_method_e method, location_manager_h * manager)
{
+ LOCATIONS_LOGD("location_manager_create (method : %d)", method);
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
+
+ LocationMethod _method = __convert_LocationMethod(method);
+ if (_method == LOCATION_METHOD_NONE) {
+ LOCATIONS_LOGE("LOCATIONS_ERROR_NOT_SUPPORTED(0x%08x) : fail to location_init", LOCATIONS_ERROR_NOT_SUPPORTED);
+ return LOCATIONS_ERROR_NOT_SUPPORTED;
+ }
+ if (!location_is_supported_method(_method)) {
+ LOCATIONS_LOGE("LOCATIONS_ERROR_NOT_SUPPORTED(0x%08x) : fail to location_is_supported_method", LOCATIONS_ERROR_NOT_SUPPORTED);
+ return LOCATIONS_ERROR_NOT_SUPPORTED;
+ }
+
+ //It is moved here becasue of TCS.
LOCATIONS_NULL_ARG_CHECK(manager);
- if (location_init() != LOCATION_ERROR_NONE)
- return LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE;
- LocationMethod _method = LOCATION_METHOD_NONE;
- switch (method) {
- case LOCATIONS_METHOD_HYBRID:
- _method = LOCATION_METHOD_HYBRID;
- break;
- case LOCATIONS_METHOD_GPS:
- _method = LOCATION_METHOD_GPS;
- break;
- case LOCATIONS_METHOD_WPS:
- _method = LOCATION_METHOD_WPS;
- break;
- case LOCATIONS_METHOD_CPS:
- _method = LOCATION_METHOD_CPS;
- break;
- case LOCATIONS_METHOD_NONE:
+ if (location_init() != LOCATION_ERROR_NONE) {
+ LOCATIONS_LOGE("LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE(0x%08x) : fail to location_init", LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE);
return LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE;
- default:
- {
- LOGE("[%s] LOCATIONS_ERROR_INVALID_PARAMETER(0x%08x) : Out of range (location_method_e) - method : %d ",
- __FUNCTION__, LOCATIONS_ERROR_INVALID_PARAMETER, method);
- return LOCATIONS_ERROR_INVALID_PARAMETER;
- }
}
location_manager_s *handle = (location_manager_s *) malloc(sizeof(location_manager_s));
if (handle == NULL) {
- LOGE("[%s] OUT_OF_MEMORY(0x%08x)", __FUNCTION__, LOCATIONS_ERROR_OUT_OF_MEMORY);
+ LOCATIONS_LOGE("OUT_OF_MEMORY(0x%08x)", LOCATIONS_ERROR_OUT_OF_MEMORY);
return LOCATIONS_ERROR_OUT_OF_MEMORY;
}
handle->object = location_new(_method);
if (handle->object == NULL) {
- LOGE("[%s] LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE(0x%08x) : fail to location_new", __FUNCTION__,
- LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE);
+ LOCATIONS_LOGE("LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE(0x%08x) : fail to location_new", LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE);
free(handle);
return LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE;
}
handle->method = method;
handle->is_continue_foreach_bounds = TRUE;
+ handle->bounds_list = NULL;
+
+ if (!handle->sig_id[_LOCATION_SIGNAL_SERVICE_ENABLED])
+ handle->sig_id[_LOCATION_SIGNAL_SERVICE_ENABLED] = g_signal_connect(handle->object, "service-enabled", G_CALLBACK(__cb_service_enabled), handle);
+
+ if (!handle->sig_id[_LOCATION_SIGNAL_SERVICE_DISABLED])
+ handle->sig_id[_LOCATION_SIGNAL_SERVICE_DISABLED] = g_signal_connect(handle->object, "service-disabled", G_CALLBACK(__cb_service_disabled), handle);
+
*manager = (location_manager_h) handle;
return LOCATIONS_ERROR_NONE;
}
-int location_manager_destroy(location_manager_h manager)
+EXPORT_API int location_manager_destroy(location_manager_h manager)
{
+ LOCATIONS_LOGD("location_manager_destroy");
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
LOCATIONS_NULL_ARG_CHECK(manager);
location_manager_s *handle = (location_manager_s *) manager;
+ if (handle->sig_id[_LOCATION_SIGNAL_SERVICE_ENABLED]) {
+ g_signal_handler_disconnect(handle->object, handle->sig_id[_LOCATION_SIGNAL_SERVICE_ENABLED]);
+ handle->sig_id[_LOCATION_SIGNAL_SERVICE_ENABLED] = 0;
+ }
+
+ if (handle->sig_id[_LOCATION_SIGNAL_SERVICE_DISABLED]) {
+ g_signal_handler_disconnect(handle->object, handle->sig_id[_LOCATION_SIGNAL_SERVICE_DISABLED]);
+ handle->sig_id[_LOCATION_SIGNAL_SERVICE_DISABLED] = 0;
+ }
+
int ret = location_free(handle->object);
if (ret != LOCATIONS_ERROR_NONE) {
- return __convert_error_code(ret, (char *)__FUNCTION__);
+ return __convert_error_code(ret);
}
free(handle);
return LOCATIONS_ERROR_NONE;
}
-int location_manager_start(location_manager_h manager)
+EXPORT_API int location_manager_start(location_manager_h manager)
{
+ LOCATIONS_LOGD("location_manager_start");
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
LOCATIONS_NULL_ARG_CHECK(manager);
location_manager_s *handle = (location_manager_s *) manager;
- g_signal_connect(handle->object, "service-enabled", G_CALLBACK(__cb_service_enabled), handle);
- g_signal_connect(handle->object, "service-disabled", G_CALLBACK(__cb_service_disabled), handle);
- g_signal_connect(handle->object, "service-updated", G_CALLBACK(__cb_service_updated), handle);
- g_signal_connect(handle->object, "zone-in", G_CALLBACK(__cb_zone_in), handle);
- g_signal_connect(handle->object, "zone-out", G_CALLBACK(__cb_zone_out), handle);
+ if (!handle->sig_id[_LOCATION_SIGNAL_SERVICE_UPDATED])
+ handle->sig_id[_LOCATION_SIGNAL_SERVICE_UPDATED] = g_signal_connect(handle->object, "service-updated", G_CALLBACK(__cb_service_updated), handle);
+
+ if (LOCATIONS_METHOD_HYBRID <= handle->method && LOCATIONS_METHOD_WPS >= handle->method)
+ {
+ if (!handle->sig_id[_LOCATION_SIGNAL_ZONE_IN])
+ handle->sig_id[_LOCATION_SIGNAL_ZONE_IN] = g_signal_connect(handle->object, "zone-in", G_CALLBACK(__cb_zone_in), handle);
+
+ if (!handle->sig_id[_LOCATION_SIGNAL_ZONE_OUT])
+ handle->sig_id[_LOCATION_SIGNAL_ZONE_OUT] = g_signal_connect(handle->object, "zone-out", G_CALLBACK(__cb_zone_out), handle);
+ } else {
+ LOCATIONS_LOGI("This method [%d] is not supported zone-in, zone-out signal.", handle->method);
+ }
+
+ if (handle->user_cb[_LOCATIONS_EVENT_TYPE_SATELLITE] != NULL) {
+ LOCATIONS_LOGI("Satellite update_cb is set");
+ location_set_option(handle->object, "USE_SV");
+ }
int ret = location_start(handle->object);
if (ret != LOCATION_ERROR_NONE) {
- return __convert_error_code(ret, (char *)__FUNCTION__);
+ return __convert_error_code(ret);
}
return LOCATIONS_ERROR_NONE;
}
-int location_manager_stop(location_manager_h manager)
+EXPORT_API int location_manager_request_single_location(location_manager_h manager, int timeout, location_updated_cb callback, void *user_data)
{
+ LOCATIONS_LOGD("location_manager_request_single_location");
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
LOCATIONS_NULL_ARG_CHECK(manager);
+ LOCATIONS_NULL_ARG_CHECK(callback);
+ if (timeout <= 0 || timeout > 120) {
+ LOCATIONS_LOGE("timeout scope is incorrect(1~120) [%d]", timeout);
+ return LOCATIONS_ERROR_INVALID_PARAMETER;
+ }
+
location_manager_s *handle = (location_manager_s *) manager;
+ int ret = LOCATIONS_ERROR_NONE;
- int ret = location_stop(handle->object);
+ if (!handle->sig_id[_LOCATION_SIGNAL_LOCATION_UPDATED])
+ handle->sig_id[_LOCATION_SIGNAL_LOCATION_UPDATED] = g_signal_connect(handle->object, "location-updated", G_CALLBACK(__cb_location_updated), handle);
+
+ ret = __set_callback(_LOCATIONS_EVENT_TYPE_LOCATION, manager, callback, user_data);
+ if (ret != LOCATIONS_ERROR_NONE) {
+ return ret;
+ }
+
+ ret = location_request_single_location(handle->object, timeout);
if (ret != LOCATION_ERROR_NONE) {
- return __convert_error_code(ret, (char *)__FUNCTION__);
+ return __convert_error_code(ret);
}
return LOCATIONS_ERROR_NONE;
}
-int location_manager_add_boundary(location_manager_h manager, const location_bounds_h bounds)
+EXPORT_API int location_manager_stop(location_manager_h manager)
{
+ LOCATIONS_LOGD("location_manager_stop");
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
LOCATIONS_NULL_ARG_CHECK(manager);
- LOCATIONS_NULL_ARG_CHECK(bounds);
location_manager_s *handle = (location_manager_s *) manager;
- int ret = location_boundary_add(handle->object,(LocationBoundary*)bounds);
+ if (handle->sig_id[_LOCATION_SIGNAL_SERVICE_UPDATED]) {
+ g_signal_handler_disconnect(handle->object, handle->sig_id[_LOCATION_SIGNAL_SERVICE_UPDATED]);
+ handle->sig_id[_LOCATION_SIGNAL_SERVICE_UPDATED] = 0;
+ }
+
+ if (LOCATIONS_METHOD_HYBRID <= handle->method && LOCATIONS_METHOD_WPS >= handle->method)
+ {
+ if (handle->sig_id[_LOCATION_SIGNAL_ZONE_IN]) {
+ g_signal_handler_disconnect(handle->object, handle->sig_id[_LOCATION_SIGNAL_ZONE_IN]);
+ handle->sig_id[_LOCATION_SIGNAL_ZONE_IN] = 0;
+ }
+
+ if (handle->sig_id[_LOCATION_SIGNAL_ZONE_OUT]) {
+ g_signal_handler_disconnect(handle->object, handle->sig_id[_LOCATION_SIGNAL_ZONE_OUT]);
+ handle->sig_id[_LOCATION_SIGNAL_ZONE_OUT] = 0;
+ }
+ }
+
+ int ret = location_stop(handle->object);
if (ret != LOCATION_ERROR_NONE) {
- return __convert_error_code(ret, (char *)__FUNCTION__);
+ return __convert_error_code(ret);
}
return LOCATIONS_ERROR_NONE;
}
-int location_manager_remove_boundary(location_manager_h manager, const location_bounds_h bounds)
+EXPORT_API int location_manager_add_boundary(location_manager_h manager, location_bounds_h bounds)
{
+ LOCATIONS_LOGD("location_manager_add_boundary");
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
LOCATIONS_NULL_ARG_CHECK(manager);
LOCATIONS_NULL_ARG_CHECK(bounds);
location_manager_s *handle = (location_manager_s *) manager;
- int ret = location_boundary_remove(handle->object, (LocationBoundary*)bounds);
+ location_bounds_s *bound_handle = (location_bounds_s *) bounds;
+ int ret = location_boundary_add(handle->object, bound_handle->boundary);
+ if (ret != LOCATION_ERROR_NONE) {
+ return __convert_error_code(ret);
+ }
+ bound_handle->is_added = TRUE;
+ handle->bounds_list = g_list_append(handle->bounds_list, bound_handle);
+ return LOCATIONS_ERROR_NONE;
+}
+EXPORT_API int location_manager_remove_boundary(location_manager_h manager, location_bounds_h bounds)
+{
+ LOCATIONS_LOGD("location_manager_remove_boundary");
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
+ LOCATIONS_NULL_ARG_CHECK(manager);
+ LOCATIONS_NULL_ARG_CHECK(bounds);
+
+ location_manager_s *handle = (location_manager_s *) manager;
+ location_bounds_s *bound_handle = (location_bounds_s *) bounds;
+ int ret = location_boundary_remove(handle->object, bound_handle->boundary);
if (ret != LOCATION_ERROR_NONE) {
- return __convert_error_code(ret, (char *)__FUNCTION__);
+ return __convert_error_code(ret);
}
+ handle->bounds_list = g_list_remove(handle->bounds_list, bound_handle);
+ bound_handle->is_added = FALSE;
return LOCATIONS_ERROR_NONE;
}
-int location_manager_foreach_boundary(location_manager_h manager, location_bounds_cb callback, void *user_data)
+EXPORT_API int location_manager_foreach_boundary(location_manager_h manager, location_bounds_cb callback, void *user_data)
{
+ LOCATIONS_LOGD("location_manager_foreach_boundary");
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
LOCATIONS_NULL_ARG_CHECK(manager);
LOCATIONS_NULL_ARG_CHECK(callback);
handle->is_continue_foreach_bounds = TRUE;
int ret = location_boundary_foreach(handle->object, __foreach_boundary, handle);
if (ret != LOCATION_ERROR_NONE) {
- return __convert_error_code(ret, (char *)__FUNCTION__);
+ return __convert_error_code(ret);
}
return LOCATIONS_ERROR_NONE;
}
-int location_manager_get_method(location_manager_h manager, location_method_e * method)
+EXPORT_API int location_manager_get_method(location_manager_h manager, location_method_e * method)
{
+ LOCATIONS_LOGD("location_manager_get_method %d", method);
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
LOCATIONS_NULL_ARG_CHECK(manager);
LOCATIONS_NULL_ARG_CHECK(method);
+
location_manager_s *handle = (location_manager_s *) manager;
LocationMethod _method = LOCATION_METHOD_NONE;
g_object_get(handle->object, "method", &_method, NULL);
case LOCATION_METHOD_WPS:
*method = LOCATIONS_METHOD_WPS;
break;
- case LOCATION_METHOD_CPS:
- *method = LOCATIONS_METHOD_CPS;
- break;
default:
{
- LOGE("[%s] LOCATIONS_ERROR_INVALID_PARAMETER(0x%08x) : Out of range (location_method_e) - method : %d ",
- __FUNCTION__, LOCATIONS_ERROR_INVALID_PARAMETER, method);
+ LOCATIONS_LOGE("LOCATIONS_ERROR_INVALID_PARAMETER(0x%08x) : Out of range (location_method_e) - method : %d ",
+ LOCATIONS_ERROR_INVALID_PARAMETER, method);
return LOCATIONS_ERROR_INVALID_PARAMETER;
}
}
return LOCATIONS_ERROR_NONE;
}
-int location_manager_get_position(location_manager_h manager, double *altitude, double *latitude, double *longitude,
- time_t * timestamp)
+EXPORT_API int location_manager_get_position(location_manager_h manager, double *altitude, double *latitude, double *longitude,
+ time_t * timestamp)
{
+ LOCATIONS_LOGD("location_manager_get_position");
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
LOCATIONS_NULL_ARG_CHECK(manager);
LOCATIONS_NULL_ARG_CHECK(altitude);
LOCATIONS_NULL_ARG_CHECK(latitude);
LocationAccuracy *acc = NULL;
ret = location_get_position(handle->object, &pos, &acc);
if (ret != LOCATION_ERROR_NONE) {
- return __convert_error_code(ret, (char *)__FUNCTION__);
+ return __convert_error_code(ret);
}
if (pos->status == LOCATION_STATUS_NO_FIX) {
- *altitude = -1;
- *latitude = -1;
- *longitude = -1;
+ return LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE;
} else {
- if (pos->status == LOCATION_STATUS_3D_FIX) {
- *altitude = pos->altitude;
- } else {
- *altitude = -1;
- }
*latitude = pos->latitude;
*longitude = pos->longitude;
+ *altitude = pos->altitude;
}
*timestamp = pos->timestamp;
location_position_free(pos);
return LOCATIONS_ERROR_NONE;
}
-int location_manager_get_velocity(location_manager_h manager, double *climb, double *direction, double *speed, time_t * timestamp)
+EXPORT_API int location_manager_get_location(location_manager_h manager, double *altitude, double *latitude, double *longitude, double *climb, double *direction, double *speed, location_accuracy_level_e *level, double *horizontal, double *vertical, time_t *timestamp)
{
+ LOCATIONS_LOGD("location_manager_get_location");
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
LOCATIONS_NULL_ARG_CHECK(manager);
+ LOCATIONS_NULL_ARG_CHECK(altitude);
+ LOCATIONS_NULL_ARG_CHECK(latitude);
+ LOCATIONS_NULL_ARG_CHECK(longitude);
LOCATIONS_NULL_ARG_CHECK(climb);
LOCATIONS_NULL_ARG_CHECK(direction);
LOCATIONS_NULL_ARG_CHECK(speed);
+ LOCATIONS_NULL_ARG_CHECK(level);
+ LOCATIONS_NULL_ARG_CHECK(horizontal);
+ LOCATIONS_NULL_ARG_CHECK(vertical);
LOCATIONS_NULL_ARG_CHECK(timestamp);
+ int ret;
location_manager_s *handle = (location_manager_s *) manager;
+ LocationPosition *pos = NULL;
+ LocationVelocity *vel = NULL;
+ LocationAccuracy *acc = NULL;
+ ret = location_get_position_ext(handle->object, &pos, &vel, &acc);
+ if (ret != LOCATION_ERROR_NONE) {
+ return __convert_error_code(ret);
+ }
+
+ if (pos->status == LOCATION_STATUS_NO_FIX) {
+ return __convert_error_code(LOCATION_ERROR_NOT_AVAILABLE);
+ } else {
+ *latitude = pos->latitude;
+ *longitude = pos->longitude;
+ *altitude = pos->altitude;
+ }
+ *timestamp = pos->timestamp;
+ *climb = vel->climb;
+ *direction = vel->direction;
+ *speed = vel->speed;
+ *level = acc->level;
+ *horizontal = acc->horizontal_accuracy;
+ *vertical = acc->vertical_accuracy;
+
+ location_position_free(pos);
+ location_velocity_free(vel);
+ location_accuracy_free(acc);
+ return LOCATIONS_ERROR_NONE;
+}
+
+EXPORT_API int location_manager_get_velocity(location_manager_h manager, double *climb, double *direction, double *speed, time_t * timestamp)
+{
+ LOCATIONS_LOGD("location_manager_get_velocity");
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
+ LOCATIONS_NULL_ARG_CHECK(manager);
+ LOCATIONS_NULL_ARG_CHECK(climb);
+ LOCATIONS_NULL_ARG_CHECK(direction);
+ LOCATIONS_NULL_ARG_CHECK(speed);
+ LOCATIONS_NULL_ARG_CHECK(timestamp);
+
int ret;
+ location_manager_s *handle = (location_manager_s *) manager;
LocationVelocity *vel = NULL;
LocationAccuracy *acc = NULL;
ret = location_get_velocity(handle->object, &vel, &acc);
if (ret != LOCATION_ERROR_NONE) {
- return __convert_error_code(ret, (char *)__FUNCTION__);
+ return __convert_error_code(ret);
}
*climb = vel->climb;
return LOCATIONS_ERROR_NONE;
}
-int location_manager_get_accuracy(location_manager_h manager, location_accuracy_level_e * level, double *horizontal,
- double *vertical)
+EXPORT_API int location_manager_get_accuracy(location_manager_h manager, location_accuracy_level_e * level, double *horizontal,
+ double *vertical)
{
+ LOCATIONS_LOGD("location_manager_get_accuracy");
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
LOCATIONS_NULL_ARG_CHECK(manager);
LOCATIONS_NULL_ARG_CHECK(level);
LOCATIONS_NULL_ARG_CHECK(horizontal);
LOCATIONS_NULL_ARG_CHECK(vertical);
- location_manager_s *handle = (location_manager_s *) manager;
int ret;
+ location_manager_s *handle = (location_manager_s *) manager;
LocationPosition *pos = NULL;
LocationAccuracy *acc = NULL;
ret = location_get_position(handle->object, &pos, &acc);
if (ret != LOCATION_ERROR_NONE) {
- return __convert_error_code(ret, (char *)__FUNCTION__);
+ return __convert_error_code(ret);
+ }
+
+ if (acc == NULL) {
+ return __convert_error_code(LOCATION_ERROR_NOT_AVAILABLE);
}
*level = acc->level;
return LOCATIONS_ERROR_NONE;
}
-int location_manager_get_last_position(location_manager_h manager, double *altitude, double *latitude, double *longitude,
- time_t * timestamp)
+EXPORT_API int location_manager_get_last_position(location_manager_h manager, double *altitude, double *latitude, double *longitude,
+ time_t * timestamp)
{
+ LOCATIONS_LOGD("location_manager_get_last_position");
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
LOCATIONS_NULL_ARG_CHECK(manager);
LOCATIONS_NULL_ARG_CHECK(altitude);
LOCATIONS_NULL_ARG_CHECK(latitude);
LOCATIONS_NULL_ARG_CHECK(longitude);
LOCATIONS_NULL_ARG_CHECK(timestamp);
- location_manager_s *handle = (location_manager_s *) manager;
-
int ret;
+ location_manager_s *handle = (location_manager_s *) manager;
LocationPosition *last_pos = NULL;
LocationAccuracy *last_acc = NULL;
ret = location_get_last_position(handle->object, &last_pos, &last_acc);
if (ret != LOCATION_ERROR_NONE) {
- return __convert_error_code(ret, (char *)__FUNCTION__);
+ return __convert_error_code(ret);
}
if (last_pos->status == LOCATION_STATUS_NO_FIX) {
- *altitude = -1;
- *latitude = -1;
- *longitude = -1;
+ return LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE;
} else {
- if (last_pos->status == LOCATION_STATUS_3D_FIX) {
- *altitude = last_pos->altitude;
- } else {
- *altitude = -1;
- }
*latitude = last_pos->latitude;
*longitude = last_pos->longitude;
+ *altitude = last_pos->altitude;
}
*timestamp = last_pos->timestamp;
location_position_free(last_pos);
return LOCATIONS_ERROR_NONE;
}
-int location_manager_get_last_velocity(location_manager_h manager, double *climb, double *direction, double *speed, time_t * timestamp)
+EXPORT_API int location_manager_get_last_location(location_manager_h manager, double *altitude, double *latitude, double *longitude, double *climb, double *direction, double *speed, location_accuracy_level_e * level, double *horizontal, double *vertical, time_t * timestamp)
{
+ LOCATIONS_LOGD("location_manager_get_last_location");
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
LOCATIONS_NULL_ARG_CHECK(manager);
+ LOCATIONS_NULL_ARG_CHECK(altitude);
+ LOCATIONS_NULL_ARG_CHECK(latitude);
+ LOCATIONS_NULL_ARG_CHECK(longitude);
LOCATIONS_NULL_ARG_CHECK(climb);
LOCATIONS_NULL_ARG_CHECK(direction);
LOCATIONS_NULL_ARG_CHECK(speed);
+ LOCATIONS_NULL_ARG_CHECK(level);
+ LOCATIONS_NULL_ARG_CHECK(horizontal);
+ LOCATIONS_NULL_ARG_CHECK(vertical);
LOCATIONS_NULL_ARG_CHECK(timestamp);
+ int ret;
location_manager_s *handle = (location_manager_s *) manager;
+ LocationPosition *last_pos = NULL;
+ LocationVelocity *last_vel = NULL;
+ LocationAccuracy *last_acc = NULL;
+ ret = location_get_last_position_ext(handle->object, &last_pos, &last_vel, &last_acc);
+ if (ret != LOCATION_ERROR_NONE) {
+ return __convert_error_code(ret);
+ }
+
+ if (last_pos->status == LOCATION_STATUS_NO_FIX) {
+ return LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE;
+ } else {
+ *latitude = last_pos->latitude;
+ *longitude = last_pos->longitude;
+ *altitude = last_pos->altitude;
+ }
+ *timestamp = last_pos->timestamp;
+ *climb = last_vel->climb;
+ *direction = last_vel->direction;
+ *speed = last_vel->speed;
+ *level = last_acc->level;
+ *horizontal = last_acc->horizontal_accuracy;
+ *vertical = last_acc->vertical_accuracy;
+ location_position_free(last_pos);
+ location_velocity_free(last_vel);
+ location_accuracy_free(last_acc);
+ return LOCATIONS_ERROR_NONE;
+}
+
+EXPORT_API int location_manager_get_last_velocity(location_manager_h manager, double *climb, double *direction, double *speed, time_t * timestamp)
+{
+ LOCATIONS_LOGD("location_manager_get_last_velocity");
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
+ LOCATIONS_NULL_ARG_CHECK(manager);
+ LOCATIONS_NULL_ARG_CHECK(climb);
+ LOCATIONS_NULL_ARG_CHECK(direction);
+ LOCATIONS_NULL_ARG_CHECK(speed);
+ LOCATIONS_NULL_ARG_CHECK(timestamp);
int ret;
+ location_manager_s *handle = (location_manager_s *) manager;
LocationVelocity *last_vel = NULL;
LocationAccuracy *last_acc = NULL;
ret = location_get_last_velocity(handle->object, &last_vel, &last_acc);
if (ret != LOCATION_ERROR_NONE) {
- return __convert_error_code(ret, (char *)__FUNCTION__);
+ return __convert_error_code(ret);
}
*climb = last_vel->climb;
return LOCATIONS_ERROR_NONE;
}
-int location_manager_get_last_accuracy(location_manager_h manager, location_accuracy_level_e * level, double *horizontal,
- double *vertical)
+EXPORT_API int location_manager_get_last_accuracy(location_manager_h manager, location_accuracy_level_e * level, double *horizontal,
+ double *vertical)
{
+ LOCATIONS_LOGD("location_manager_get_last_accuracy");
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
LOCATIONS_NULL_ARG_CHECK(manager);
LOCATIONS_NULL_ARG_CHECK(level);
LOCATIONS_NULL_ARG_CHECK(horizontal);
LOCATIONS_NULL_ARG_CHECK(vertical);
- location_manager_s *handle = (location_manager_s *) manager;
int ret;
+ location_manager_s *handle = (location_manager_s *) manager;
LocationPosition *last_pos = NULL;
LocationAccuracy *last_acc = NULL;
ret = location_get_last_position(handle->object, &last_pos, &last_acc);
if (ret != LOCATION_ERROR_NONE) {
- return __convert_error_code(ret, (char *)__FUNCTION__);
+ return __convert_error_code(ret);
}
*level = last_acc->level;
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)
+EXPORT_API int location_manager_get_accessibility_state(location_accessibility_state_e* state)
{
- LOCATIONS_CHECK_CONDITION(interval >= 1
- && interval <= 120, LOCATIONS_ERROR_INVALID_PARAMETER, "LOCATIONS_ERROR_INVALID_PARAMETER");
+ LOCATIONS_LOGD("location_manager_get_accessibility_state");
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
+ LOCATIONS_NULL_ARG_CHECK(state);
+
+ int ret = LOCATION_ERROR_NONE;
+ LocationAccessState auth = LOCATION_ACCESS_NONE;
+ ret = location_get_accessibility_state (&auth);
+ if (ret != LOCATION_ERROR_NONE) {
+ *state = LOCATIONS_ACCESS_STATE_NONE;
+ return __convert_error_code(ret);
+ }
+
+ switch (auth) {
+ case LOCATION_ACCESS_DENIED:
+ *state = LOCATIONS_ACCESS_STATE_DENIED;
+ break;
+ case LOCATION_ACCESS_ALLOWED:
+ *state = LOCATIONS_ACCESS_STATE_ALLOWED;
+ break;
+ case LOCATION_ACCESS_NONE:
+ default:
+ *state = LOCATIONS_ACCESS_STATE_NONE;
+ break;
+ }
+
+ return LOCATIONS_ERROR_NONE;
+}
+
+EXPORT_API int location_manager_set_position_updated_cb(location_manager_h manager, location_position_updated_cb callback, int interval, void *user_data)
+{
+ LOCATIONS_LOGD("location_manager_set_position_updated_cb");
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
+ 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, "pos-interval", interval, NULL);
return __set_callback(_LOCATIONS_EVENT_TYPE_POSITION, manager, callback, user_data);
}
-int location_manager_unset_position_updated_cb(location_manager_h manager)
+EXPORT_API int location_manager_unset_position_updated_cb(location_manager_h manager)
{
+ LOCATIONS_LOGD("location_manager_unset_position_updated_cb");
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
+
return __unset_callback(_LOCATIONS_EVENT_TYPE_POSITION, manager);
}
-int location_manager_set_velocity_updated_cb(location_manager_h manager, location_velocity_updated_cb callback, int interval, void *user_data)
+EXPORT_API 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_LOGD("location_manager_set_velocity_updated_cb");
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
+ 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);
}
-int location_manager_unset_velocity_updated_cb(location_manager_h manager)
+EXPORT_API int location_manager_unset_velocity_updated_cb(location_manager_h manager)
{
+ LOCATIONS_LOGD("location_manager_unset_velocity_updated_cb");
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
return __unset_callback(_LOCATIONS_EVENT_TYPE_VELOCITY, manager);
}
-int location_manager_set_service_state_changed_cb(location_manager_h manager, location_service_state_changed_cb callback,
- void *user_data)
+EXPORT_API int location_manager_set_service_state_changed_cb(location_manager_h manager, location_service_state_changed_cb callback,
+ void *user_data)
{
+ LOCATIONS_LOGD("location_manager_set_service_state_changed_cb");
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
return __set_callback(_LOCATIONS_EVENT_TYPE_SERVICE_STATE, manager, callback, user_data);
}
-int location_manager_unset_service_state_changed_cb(location_manager_h manager)
+EXPORT_API int location_manager_unset_service_state_changed_cb(location_manager_h manager)
{
+ LOCATIONS_LOGD("location_manager_unset_service_state_changed_cb");
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
return __unset_callback(_LOCATIONS_EVENT_TYPE_SERVICE_STATE, manager);
}
-int location_manager_set_zone_changed_cb(location_manager_h manager, location_zone_changed_cb callback, void *user_data)
+EXPORT_API int location_manager_set_zone_changed_cb(location_manager_h manager, location_zone_changed_cb callback, void *user_data)
{
+ LOCATIONS_LOGD("location_manager_set_zone_changed_cb");
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
return __set_callback(_LOCATIONS_EVENT_TYPE_BOUNDARY, manager, callback, user_data);
}
-int location_manager_unset_zone_changed_cb(location_manager_h manager)
+EXPORT_API int location_manager_unset_zone_changed_cb(location_manager_h manager)
{
+ LOCATIONS_LOGD("location_manager_unset_zone_changed_cb");
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
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)
+EXPORT_API int location_manager_set_setting_changed_cb(location_method_e method, location_setting_changed_cb callback, void *user_data)
{
- 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");
+ LOCATIONS_LOGD("location_manager_set_setting_changed_cb");
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
+ LOCATIONS_NULL_ARG_CHECK(callback);
+ LocationMethod _method = __convert_LocationMethod(method);
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);
+ if (_method == LOCATION_METHOD_NONE) {
+ return LOCATIONS_ERROR_INVALID_PARAMETER;
+ }
- ret = location_get_distance (start, end, &u_distance);
+ g_location_setting[_method].callback = callback;
+ g_location_setting[_method].user_data = user_data;
+
+ ret = location_add_setting_notify(_method, __setting_changed_cb, &g_location_setting);
+ return __convert_error_code(ret);
+}
+
+EXPORT_API int location_manager_unset_setting_changed_cb(location_method_e method /*, location_setting_changed_cb callback */)
+{
+ LOCATIONS_LOGD("location_manager_unset_setting_changed_cb");
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
+ LocationMethod _method = __convert_LocationMethod(method);
+ int ret = LOCATION_ERROR_NONE;
+
+ if (_method == LOCATION_METHOD_NONE) {
+ return LOCATIONS_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = location_ignore_setting_notify(_method, __setting_changed_cb);
if (ret != LOCATION_ERROR_NONE) {
- return __convert_error_code(ret, (char *)__FUNCTION__);
+ LOCATIONS_LOGE("Fail to ignore notify. Error[%d]", ret);
+ ret = __convert_error_code(ret);
}
- *distance = (double)u_distance;
+ g_location_setting[method].callback = NULL;
+ g_location_setting[method].user_data = NULL;
return LOCATIONS_ERROR_NONE;
}
-int location_manager_send_command(const char *cmd)
+EXPORT_API int location_manager_get_distance(double start_latitude, double start_longitude, double end_latitude, double end_longitude, double *distance)
{
- LOCATIONS_NULL_ARG_CHECK(cmd);
+ LOCATIONS_LOGD("location_manager_get_distance");
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
+ LOCATIONS_NULL_ARG_CHECK(distance);
+ LOCATIONS_CHECK_CONDITION(start_latitude>=-90 && start_latitude<=90,LOCATIONS_ERROR_INVALID_PARAMETER,"LOCATIONS_ERROR_INVALID_PARAMETER");
+ LOCATIONS_CHECK_CONDITION(start_longitude>=-180 && start_longitude<=180,LOCATIONS_ERROR_INVALID_PARAMETER, "LOCATIONS_ERROR_INVALID_PARAMETER");
+ LOCATIONS_CHECK_CONDITION(end_latitude>=-90 && end_latitude<=90,LOCATIONS_ERROR_INVALID_PARAMETER, "LOCATIONS_ERROR_INVALID_PARAMETER");
+ LOCATIONS_CHECK_CONDITION(end_longitude>=-180 && end_longitude<=180,LOCATIONS_ERROR_INVALID_PARAMETER, "LOCATIONS_ERROR_INVALID_PARAMETER");
- int ret;
- ret = location_send_command(cmd);
+ 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__);
+ return __convert_error_code(ret);
}
+ *distance = (double)u_distance;
+
return LOCATIONS_ERROR_NONE;
}
// GPS Status & Satellites
////////////////////////////////////////
-int gps_status_get_nmea(location_manager_h manager, char **nmea)
+EXPORT_API int gps_status_get_nmea(location_manager_h manager, char **nmea)
{
+ LOCATIONS_LOGD("gps_status_get_nmea");
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_gps_satellite_supported());
LOCATIONS_NULL_ARG_CHECK(manager);
LOCATIONS_NULL_ARG_CHECK(nmea);
- location_manager_s *handle = (location_manager_s *) manager;
+ 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) {
- LOGE("[%s] LOCATIONS_ERROR_INCORRECT_METHOD(0x%08x) : method - %d", __FUNCTION__,
- LOCATIONS_ERROR_INCORRECT_METHOD, handle->method);
+ LOCATIONS_LOGE("LOCATIONS_ERROR_INCORRECT_METHOD(0x%08x) : method - %d",
+ 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);
+ LOCATIONS_LOGE("LOCATIONS_ERROR_INCORRECT_METHOD(0x%08x) : method - %d",
+ LOCATIONS_ERROR_INCORRECT_METHOD, handle->method);
return LOCATIONS_ERROR_INCORRECT_METHOD;
}
gchar *nmea_data = NULL;
g_object_get(handle->object, "nmea", &nmea_data, NULL);
if (nmea_data == NULL) {
- LOGE("[%s] LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE(0x%08x) : nmea data is NULL ", __FUNCTION__,
- LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE);
+ LOCATIONS_LOGE("LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE(0x%08x) : nmea data is NULL ",
+ LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE);
return LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE;
}
*nmea = NULL;
*nmea = strdup(nmea_data);
if (*nmea == NULL) {
- LOGE("[%s] LOCATIONS_ERROR_OUT_OF_MEMORY(0x%08x) : fail to strdup ", __FUNCTION__,
- LOCATIONS_ERROR_OUT_OF_MEMORY);
+ LOCATIONS_LOGE("LOCATIONS_ERROR_OUT_OF_MEMORY(0x%08x) : fail to strdup ",
+ LOCATIONS_ERROR_OUT_OF_MEMORY);
return LOCATIONS_ERROR_OUT_OF_MEMORY;
}
g_free(nmea_data);
return LOCATIONS_ERROR_NONE;
}
-int gps_status_get_satellite(location_manager_h manager, int *num_of_active, int *num_of_inview, time_t *timestamp)
+EXPORT_API int gps_status_get_satellite(location_manager_h manager, int *num_of_active, int *num_of_inview, time_t *timestamp)
{
+ LOCATIONS_LOGD("gps_status_get_satellite");
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_gps_satellite_supported());
LOCATIONS_NULL_ARG_CHECK(manager);
LOCATIONS_NULL_ARG_CHECK(num_of_active);
LOCATIONS_NULL_ARG_CHECK(num_of_inview);
LOCATIONS_NULL_ARG_CHECK(timestamp);
+
location_manager_s *handle = (location_manager_s *) manager;
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);
+ LOCATIONS_LOGE("LOCATIONS_ERROR_INCORRECT_METHOD(0x%08x) : method - %d",
+ LOCATIONS_ERROR_INCORRECT_METHOD, handle->method);
return LOCATIONS_ERROR_INCORRECT_METHOD;
+ } else if (ret == LOCATION_ERROR_NOT_ALLOWED) {
+ LOCATIONS_LOGE("LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED");
+ return LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED;
}
- LOGE("[%s] LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE(0x%08x) : satellite is NULL ", __FUNCTION__,
- LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE);
+ LOCATIONS_LOGE("LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE(0x%08x) : satellite is NULL ",
+ 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)
+EXPORT_API 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_LOGD("gps_status_set_satellite_updated_cb");
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_gps_satellite_supported());
+ LOCATIONS_CHECK_CONDITION(interval >= 1 && interval <= 120, LOCATIONS_ERROR_INVALID_PARAMETER, "LOCATIONS_ERROR_INVALID_PARAMETER");
LOCATIONS_NULL_ARG_CHECK(manager);
+ LOCATIONS_NULL_ARG_CHECK(callback);
+
location_manager_s *handle = (location_manager_s *) manager;
+ location_set_option(handle->object, "USE_SV");
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)
+EXPORT_API int gps_status_unset_satellite_updated_cb(location_manager_h manager)
{
+ LOCATIONS_LOGD("gps_status_unset_satellite_updated_cb");
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_gps_satellite_supported());
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)
+EXPORT_API int gps_status_foreach_satellites_in_view(location_manager_h manager, gps_status_get_satellites_cb callback, void *user_data)
{
+ LOCATIONS_LOGD("gps_status_foreach_satellites_in_view");
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_gps_satellite_supported());
LOCATIONS_NULL_ARG_CHECK(manager);
LOCATIONS_NULL_ARG_CHECK(callback);
+
location_manager_s *handle = (location_manager_s *) manager;
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);
+ LOCATIONS_LOGE("LOCATIONS_ERROR_INCORRECT_METHOD(0x%08x) : method - %d",
+ LOCATIONS_ERROR_INCORRECT_METHOD, handle->method);
return LOCATIONS_ERROR_INCORRECT_METHOD;
+ } else if (ret == LOCATION_ERROR_NOT_ALLOWED) {
+ LOCATIONS_LOGE("LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED");
+ return LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED;
}
- LOGE("[%s] LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE(0x%08x) : satellite is NULL ", __FUNCTION__,
- LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE);
+ LOCATIONS_LOGE("LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE(0x%08x) : satellite is NULL ",
+ LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE);
return LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE;
}
return LOCATIONS_ERROR_NONE;
}
-int gps_status_get_last_satellite(location_manager_h manager, int *num_of_active, int *num_of_inview, time_t *timestamp)
+EXPORT_API int gps_status_get_last_satellite(location_manager_h manager, int *num_of_active, int *num_of_inview, time_t *timestamp)
{
+ LOCATIONS_LOGD("gps_status_get_last_satellite");
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_gps_satellite_supported());
LOCATIONS_NULL_ARG_CHECK(manager);
LOCATIONS_NULL_ARG_CHECK(num_of_active);
LOCATIONS_NULL_ARG_CHECK(num_of_inview);
LOCATIONS_NULL_ARG_CHECK(timestamp);
+
location_manager_s *handle = (location_manager_s *) manager;
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);
+ LOCATIONS_LOGE("LOCATIONS_ERROR_INCORRECT_METHOD(0x%08x) : method - %d",
+ LOCATIONS_ERROR_INCORRECT_METHOD, handle->method);
return LOCATIONS_ERROR_INCORRECT_METHOD;
+ } else if (ret == LOCATION_ERROR_NOT_ALLOWED) {
+ LOCATIONS_LOGE("LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED");
+ return LOCATIONS_ERROR_ACCESSIBILITY_NOT_ALLOWED;
}
- LOGE("[%s] LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE(0x%08x) : satellite is NULL ", __FUNCTION__,
- LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE);
+ LOCATIONS_LOGE("LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE(0x%08x) : satellite is NULL ",
+ LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE);
return LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE;
}
return LOCATIONS_ERROR_NONE;
}
-int gps_status_foreach_last_satellites_in_view(location_manager_h manager, gps_status_get_satellites_cb callback,
- void *user_data)
+EXPORT_API int gps_status_foreach_last_satellites_in_view(location_manager_h manager, gps_status_get_satellites_cb callback,
+ void *user_data)
{
+ LOCATIONS_LOGD("gps_status_foreach_last_satellites_in_view");
+ LOCATIONS_NOT_SUPPORTED_CHECK(__is_gps_satellite_supported());
LOCATIONS_NULL_ARG_CHECK(manager);
LOCATIONS_NULL_ARG_CHECK(callback);
+
location_manager_s *handle = (location_manager_s *) manager;
int ret;
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);
+ LOCATIONS_LOGE("LOCATIONS_ERROR_INCORRECT_METHOD(0x%08x) : method - %d",
+ LOCATIONS_ERROR_INCORRECT_METHOD, handle->method);
return LOCATIONS_ERROR_INCORRECT_METHOD;
}
- LOGE("[%s] LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE(0x%08x) : satellite is NULL ", __FUNCTION__,
- LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE);
+ LOCATIONS_LOGE("LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE(0x%08x) : satellite is NULL ",
+ LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE);
return LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE;
}
INCLUDE(FindPkgConfig)
pkg_check_modules(${fw_test} REQUIRED )
FOREACH(flag ${${fw_test}_CFLAGS})
- SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
ENDFOREACH(flag)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -Werror")
aux_source_directory(. sources)
FOREACH(src ${sources})
- GET_FILENAME_COMPONENT(src_name ${src} NAME_WE)
- MESSAGE("${src_name}")
- ADD_EXECUTABLE(${src_name} ${src})
- TARGET_LINK_LIBRARIES(${src_name} ${fw_name} ${${fw_test}_LDFLAGS})
+ GET_FILENAME_COMPONENT(src_name ${src} NAME_WE)
+ MESSAGE("${src_name}")
+ ADD_EXECUTABLE(${src_name} ${src})
+ TARGET_LINK_LIBRARIES(${src_name} ${fw_name} ${${fw_test}_LDFLAGS})
ENDFOREACH()
/*
-* 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.
-*/
+ * Copyright (c) 2011-2013 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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <locations.h>
+#include <location_bounds.h>
+
+//#define COMPANION_TEST
location_manager_h manager;
+#if 0
void zone_event_cb(location_boundary_state_e state, double latitude, double longitude, double altitude, time_t timestamp,
- void *user_data)
+ void *user_data)
{
if (state == LOCATIONS_BOUNDARY_IN) {
printf("Entering zone\n");
}
static bool satellites_foreach_cb(unsigned int azimuth, unsigned int elevation, unsigned int prn, int snr, bool is_in_use,
- void *user_data)
+ void *user_data)
{
- printf("[Satellite information] azimuth : %d, elevation : %d, prn :%d, snr : %d, used: %d\n", azimuth, elevation, prn,
- snr, is_in_use);
+ printf("[Satellite information] azimuth : %d, elevation : %d, prn :%d, snr : %d, used: %d\n", azimuth, elevation, prn,
+ snr, is_in_use);
return true;
}
static bool last_satellites_foreach_cb(unsigned int azimuth, unsigned int elevation, unsigned int prn, int snr, bool is_in_use,
- void *user_data)
+ 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);
+ printf("[Last Satellite information] azimuth : %d, elevation : %d, prn :%d, snr : %d, used: %d\n", azimuth, elevation,
+ prn, snr, is_in_use);
return true;
}
double radius;
location_bounds_get_circle_coords(bounds, ¢er, &radius);
printf("location_bounds_get_circle_coords(center : %lf, %lf, radius : %lf) \n", center.latitude,
- center.longitude, radius);
+ center.longitude, radius);
} else if (type == LOCATION_BOUNDS_RECT) {
location_coords_s left_top;
location_coords_s right_bottom;
location_bounds_get_rect_coords(bounds, &left_top, &right_bottom);
printf("location_bounds_get_rect_coords(left_top : %lf, %lf - right_bottom : %lf, %lf) \n",
- left_top.latitude, left_top.longitude, right_bottom.latitude, right_bottom.longitude);
+ left_top.latitude, left_top.longitude, right_bottom.latitude, right_bottom.longitude);
} else if (type == LOCATION_BOUNDS_POLYGON) {
location_bounds_foreach_polygon_coords(bounds, __poly_coords_cb, NULL);
}
printf("location_bounds_get_circle_coords() failed\n");
} else
printf("location_bounds_get_circle_coords(center : %lf, %lf, radius : %lf) \n", center2.latitude,
- center2.longitude, radius2);
+ center2.longitude, radius2);
//Add the rect bounds
location_coords_s left_top;
printf("location_bounds_get_rect_coords() failed\n");
} else
printf("location_bounds_get_rect_coords(left_top : %lf, %lf - right_bottom : %lf, %lf) \n", left_top2.latitude,
- left_top2.longitude, right_bottom2.latitude, right_bottom2.longitude);
+ left_top2.longitude, right_bottom2.latitude, right_bottom2.longitude);
//Add the polygon bounds
printf(" Fail : gps_status_foreach_last_satellites_in_view ---> %d \n", ret);
}
}
+#endif
+
+#ifdef COMPANION_TEST
+static void select_menu(char* buf)
+{
+ int len = 0;
+ char *str = NULL;
+ str = fgets(buf, 255, stdin);
+ if (NULL == str) {
+ printf("fgets return NULL. \n");
+ }
+ len = g_utf8_strlen(buf, -1);
+ buf[len-1] = '\0';
+}
+
+void print_menu()
+{
+ printf("==== companion gps/wps test ======\n");
+ printf("[1] LOCATIONS_METHOD_COMPANION_WPS, request_single_location\n");
+ printf("[2] LOCATIONS_METHOD_COMPANION_GPS, request_single_location\n");
+}
+#endif
+
+void location_cb(int error, double latitude, double longitude, double altitude, time_t timestamp, double speed, double climb, double direction, void *user_data)
+{
+ printf("error[%d]\n", error);
+ printf("location_cb : lat[%f] lon[%f] alt[%f]\n", latitude, longitude, altitude);
+ printf("speed[%f] climb[%f] direction[%f]\n", speed, climb, direction);
+}
+
+static void __setting_cb(location_method_e method, bool enable, void *user_data)
+{
+ printf("method[%d], enable[%d]\n", method, enable);
+}
int location_test()
{
- int ret;
- ret = location_manager_create(LOCATIONS_METHOD_GPS, &manager);
- printf("create : %d\n", ret);
+// char menu[255];
+ /*
+ while(1) {
+ print_menu();
+ printf("Select menu :");
+ select_menu(menu);
+ if (strcmp(menu, "1") == 0) {
+ int ret;
+ ret = location_manager_create(LOCATIONS_METHOD_COMPANION_WPS, &manager);
+ printf("LOCATIONS_METHOD_COMPANION_WPS create : %d\n", ret);
+ ret = location_manager_request_single_location(manager, 30, location_cb, manager);
+ printf("request single : %d\n", ret);
+ return 0;
+ } else if (strcmp(menu, "2") == 0) {
+ int ret;
+ ret = location_manager_create(LOCATIONS_METHOD_COMPANION_GPS, &manager);
+ printf("LOCATIONS_METHOD_COMPANION_GPS create : %d\n", ret);
+ ret = location_manager_request_single_location(manager, 30, location_cb, manager);
+ printf("request single : %d\n", ret);
+ return 0 ;
+ }
+ }
+ */
+// location_bounds_test();
+// location_get_last_information_test();
+ printf("location_manager_is_enabled_method TEST\n");
+ bool is_enabled = FALSE;
+ location_manager_is_enabled_method(LOCATIONS_METHOD_HYBRID, &is_enabled);
+ printf("hybrid : %d\n", is_enabled);
+
+ location_manager_is_enabled_method(LOCATIONS_METHOD_GPS, &is_enabled);
+ printf("gps : %d\n", is_enabled);
+
+ location_manager_is_enabled_method(LOCATIONS_METHOD_WPS, &is_enabled);
+ printf("wps : %d\n", is_enabled);
+
+ location_manager_set_setting_changed_cb(LOCATIONS_METHOD_GPS, __setting_cb, NULL);
+ location_manager_set_setting_changed_cb(LOCATIONS_METHOD_WPS, __setting_cb, NULL);
- location_bounds_test();
- location_get_last_information_test();
//set zone changed callback
- ret = location_manager_set_zone_changed_cb(manager, zone_event_cb, (void *)manager);
- printf("set zone callback : %d\n", ret);
+// ret = location_manager_set_zone_changed_cb(manager, zone_event_cb, (void *)manager);
+// printf("set zone callback : %d\n", ret);
+
+// ret = location_manager_set_service_state_changed_cb(manager, _state_change_cb, (void *)manager);
+// printf("set state callback : %d\n", ret);
+
+// ret = location_manager_start(manager);
+// printf("start : %d\n", ret);
+
- ret = location_manager_set_service_state_changed_cb(manager, _state_change_cb, (void *)manager);
- printf("set state callback : %d\n", ret);
- ret = location_manager_start(manager);
- printf("start : %d\n", ret);
return 1;
}
printf("manager == NULL \n");
} else {
int ret = location_manager_stop(manager);
- printf("stop : %d\n", ret);
+ printf("stop : %d\n", ret);
ret = location_manager_destroy(manager);
- printf("destroy : %d\n", ret);
+ printf("destroy : %d\n", ret);
}
g_main_loop_quit(g_mainloop);
printf("Quit g_main_loop\n");
+ location_manager_unset_setting_changed_cb(LOCATIONS_METHOD_GPS);
+ location_manager_unset_setting_changed_cb(LOCATIONS_METHOD_WPS);
return FALSE;
}