--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(lbs-location C)
+
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(EXEC_PREFIX "\${prefix}")
+#SET(LIBDIR "\${prefix}/lib")
+#SET(INCLUDEDIR "\${prefix}/include")
+
+# Set required packages
+INCLUDE(FindPkgConfig)
+pkg_check_modules(pkgs REQUIRED glib-2.0 gthread-2.0 gobject-2.0 gmodule-2.0
+ capi-appfw-app-manager capi-appfw-package-manager pkgmgr-info
+ privacy-manager-client dlog vconf json-glib-1.0 lbs-dbus bundle eventsystem)
+
+FOREACH(flag ${pkgs_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Wl,-zdefs -fvisibility=hidden ")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Wextra -fvisibility=hidden -fPIC")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-parameter -Wno-missing-field-initializers -Wno-missing-declarations -Wall -Wcast-align -Wno-sign-compare")
+
+ADD_DEFINITIONS("-DFEATURE_DLOG_DEBUG")
+ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+ADD_DEFINITIONS(" -DEXPORT_API=\"__attribute__((visibility(\\\"default\\\")))\" ")
+
+MESSAGE(${CMAKE_C_FLAGS})
+MESSAGE(${CMAKE_EXE_LINKER_FLAGS})
+
+# pkgconfig file
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+
+CONFIGURE_FILE(lbs-location.pc.in lbs-location.pc @ONLY)
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/lbs-location.pc DESTINATION ${LIBDIR}/pkgconfig)
+
+#INSTALL(FILES ${CMAKE_SOURCE_DIR}/LICENSE DESTINATION /usr/share/license RENAME liblbs-dbus)
+
+ADD_SUBDIRECTORY(location)
+#ADD_SUBDIRECTORY(tests)
+++ /dev/null
-ACLOCAL_AMFLAGS=-I m4
-
-SUBDIRS=location
-
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = location.pc
+++ /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
-TET_INSTALL_HOST_PATH=/home/june/SBS2/work/tetware/TETware
-TET_INSTALL_TARGET_PATH=/mnt/nfs/SBS2/work/tetware/TETware
+++ /dev/null
-. ./_export_target_env.sh # setting environment variables
-
-echo PATH=$PATH
-echo LD_LIBRARY_PATH=$LD_LIBRARY_PATH
-echo TET_ROOT=$TET_ROOT
-echo TET_SUITE_ROOT=$TET_SUITE_ROOT
-echo ARCH=$ARCH
-
-RESULT_DIR=results-$ARCH
-HTML_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.html
-JOURNAL_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.journal
-
-mkdir $RESULT_DIR
-
-tcc -e -j $JOURNAL_RESULT -p ./ # executing tcc, with –e option
-grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT # reporting the result
+++ /dev/null
-#!/usr/bin/python
-
-#############################################
-# tet_scen auto generator
-#
-# ** argv[1] = TC root
-#############################################
-
-import sys,string,os
-
-
-write_file = open("tet_scen", 'w')
-
-#
-# making new tet_scen
-#
-def making_tet_scen (filename):
- #tmp_list = filename.strip().split('/')
- n_filename = filename.replace(' ', '\\ ')
- #print n_filename
- #new_path = "/"+ sys.argv[1] +"/"+n_filename[2:-6]
- new_path = "/"+n_filename[:-6]
- #print new_path
- file = open(filename, 'r')
- lines = file.readlines()
- for line in lines:
- if len(line.strip()) > 1:
- list = line.strip().split('/')
- #print new_path + list[-1]
- write_file.write("\t"+new_path+list[-1]+"\n")
-
-#
-# usage()
-#
-def usage():
- print(" ")
- print("./making_new_tet_scen.py tc_root")
- print("Put the Test Case's root directory.")
- print("Do not include '/' at the end")
- print(" ")
-
-#
-# main()
-#
-def main():
- if len(sys.argv) < 2:
- usage()
- sys.exit(0)
-
- os.system('find '+ sys.argv[1] +' -name "tslist" > tslist.txt')
-
- #write_file = open("tetscen", w)
- write_file.write("# auto generated tet_scen\n")
- write_file.write("all\n")
- write_file.write("\t\"Starting Full Test Suite\"\n")
-
- for file in open("tslist.txt", 'r'):
- #print file.strip()
- making_tet_scen(file.strip())
-
- write_file.write("\t\"Completed Full Test Suite\"\n")
- write_file.write("# EOF\n")
- write_file.close()
- print(" ")
- print("==============================")
- print("New tet_scen file is made~~~~")
- print("==============================")
- print(" ")
-main()
+++ /dev/null
-# auto generated tet_scen
-all
- "Starting Full Test Suite"
- /unit/stc_gps_nmea
- /unit/stc_gps_position
- /unit/stc_gps_satellite
- /unit/stc_gps_velocity
- /unit/stc_gps_zone
- /unit/utc_location_free
- /unit/utc_location_get_address
- /unit/utc_location_get_last_known_position
- /unit/utc_location_get_address_from_position
- /unit/utc_location_get_position_from_address
- /unit/utc_location_get_position_from_freeformed_address
- /unit/utc_location_get_position
- /unit/utc_location_get_last_position
- /unit/utc_location_get_velocity
- /unit/utc_location_get_last_velocity
- /unit/utc_location_get_satellite
- /unit/utc_location_get_last_satellite
- /unit/utc_location_search_poi
- /unit/utc_location_init
- /unit/utc_location_new
- /unit/utc_location_start
- /unit/utc_location_stop
- /unit/utc_properties_method
- /unit/utc_signals_service_disabled
- /unit/utc_signals_service_enabled
- /unit/utc_signals_service_updated
- /unit/utc_signals_zone_in
- /unit/utc_signals_zone_out
- "Completed Full Test Suite"
-# EOF
+++ /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 ?
+++ /dev/null
-###################################################
-# add your TestCase List Here
-#
-# e.g.,
-# TC1 = utc_frameworkName_apiName_func
-# TC2 = utc_ApplicationLib_recurGetDayOfWeek_func
-TC1 = stc_gps_position
-TC2 = stc_gps_velocity
-TC3 = stc_gps_satellite
-TC4 = stc_gps_nmea
-TC5 = stc_gps_zone
-TC6 = utc_location_init
-TC7 = utc_location_new
-TC8 = utc_location_start
-TC9 = utc_location_stop
-TC10 = utc_location_free
-TC11 = utc_location_get_position
-TC12 = utc_location_get_last_position
-TC13 = utc_location_get_last_known_position
-TC14 = utc_location_get_velocity
-TC15 = utc_location_get_last_velocity
-TC16 = utc_location_get_satellite
-TC17 = utc_location_get_last_satellite
-TC18 = utc_properties_method
-TC19 = utc_signals_service_disabled
-TC20 = utc_signals_service_enabled
-TC21 = utc_signals_service_updated
-TC22 = utc_signals_zone_in
-TC23 = utc_signals_zone_out
-TC24 = utc_location_get_address
-TC25 = utc_location_get_address_from_position
-TC26 = utc_location_get_position_from_address
-TC27 = utc_location_get_position_from_freeformed_address
-TC28 = utc_location_search_poi
-
-#
-# add your Package Config Info Here
-#
-# e.g.,
-# PKGS=calendar
-PKGS= gconf-2.0 network vconf location
-
-LDLIBS = $(TET_ROOT)/lib/tet3/tcm_s.o
-LDLIBS += -L$(TET_ROOT)/lib/tet3 -ltcm_s
-LDLIBS += -L$(TET_ROOT)/lib/tet3 -lapi_s
-LDLIBS += `pkg-config --libs $(PKGS)`
-
-TTLIBS = $(TET_ROOT)/lib/tet3/tcm_s.o
-TTLIBS += -L$(TET_ROOT)/lib/tet3 -ltcm_s
-TTLIBS += -L$(TET_ROOT)/lib/tet3 -lapi_s
-TTLIBS += `pkg-config --libs $(PKGS)`
-
-CC = gcc
-INCS = -I$(TET_ROOT)/inc/tet3
-INCS += -I.`pkg-config --cflags $(PKGS)`
-CFLAGS = -Wall -D_TETWARE_MODE
-CFLAGS += $(INCS)
-
-###################################################
-# Modify here
-# depending on the Test Case you want to build
-#
-# e.g.,
-#
-TCLIST = $(TC1) $(TC2) $(TC3) $(TC4) $(TC5) $(TC6) $(TC7) $(TC8) $(TC9) $(TC10) $(TC11) $(TC12) $(TC13) $(TC14) $(TC16) $(TC17) $(TC18) $(TC19) $(TC20) $(TC21) $(TC22) $(TC23) $(TC24) $(TC25) $(TC26) $(TC27) $(TC28)
-
-all: $(TCLIST)
- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
-
-clean:
- rm -f $(TCLIST)
- rm -f *.o
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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 <glib.h>
-#include <location.h>
-
-static void startup(), cleanup();
-void (*tet_startup) () = startup;
-void (*tet_cleanup) () = cleanup;
-
-static void utc_location_init();
-static void utc_location_new();
-static void utc_location_start();
-static void utc_get_method();
-static void utc_get_devname();
-static void utc_location_get_nmea();
-static void utc_location_svc_disabled();
-static void utc_location_free();
-
-
-struct tet_testlist tet_testlist[] = {
- {utc_location_init,1},
- {utc_location_new,1},
- {utc_location_start,1},
- {utc_get_method,1},
- {utc_get_devname,1},
- {utc_location_get_nmea,1},
- {utc_location_svc_disabled,1},
- {utc_location_free,1},
- {NULL,0},
-};
-
-static GMainLoop *loop = NULL;
-int ret;
-LocationObject* loc;
-
-gboolean
-exit_loop (gpointer data)
-{
- g_main_loop_quit (loop);
- tet_result(TET_FAIL);
- return FALSE;
-}
-
-
-static void startup()
-{
- tet_printf("\n TC startup");
-}
-
-static void cleanup()
-{
- tet_printf("\n TC End");
-}
-
-static void
-utc_location_init()
-{
- ret = location_init();
- if(ret == LOCATION_ERROR_NONE) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
-static void
-utc_location_new()
-{
- loc = location_new(LOCATION_METHOD_GPS);
- if (loc) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
-static void
-utc_location_start()
-{
- ret = location_start(loc);
- if(ret == LOCATION_ERROR_NONE) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
-static void
-utc_get_method()
-{
- LocationMethod method;
- g_object_get(loc, "method", &method, NULL);
- if (LOCATION_METHOD_HYBRID <= method && method<= LOCATION_METHOD_WPS) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
-static void
-utc_get_devname()
-{
- char* devname = NULL;
- g_object_get(loc, "dev-name", &devname, NULL);
- if(devname){
- tet_result(TET_PASS);
- g_free(devname);
- } else tet_result(TET_FAIL);
-}
-
-static void
-_get_nmea (GObject *self,
- guint _status,
- gpointer userdata)
-{
- char* nmea_data;
- g_object_get(loc, "nmea", &nmea_data, NULL);
- if (nmea_data) {
- tet_result(TET_PASS);
- g_free(nmea_data);
- } else tet_result(TET_FAIL);
- g_main_loop_quit (loop);
-}
-
-static void
-utc_location_get_nmea()
-{
- loop = g_main_loop_new (NULL, TRUE);
- g_signal_connect (loc, "service-updated", G_CALLBACK(_get_nmea), loc);
- g_timeout_add_seconds(60, exit_loop, NULL);
- g_main_loop_run (loop);
-}
-
-static void
-_cb_disabled (GObject *self,
- guint _status,
- gpointer userdata)
-{
- if( LOCATION_STATUS_NO_FIX <= _status && _status <= LOCATION_STATUS_3D_FIX) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
- g_main_loop_quit (loop);
-}
-
-gboolean
-_stop_location()
-{
- location_stop(loc);
- return FALSE;
-}
-
-static void
-utc_location_svc_disabled()
-{
- g_signal_connect (loc, "service-disabled", G_CALLBACK(_cb_disabled), loc);
- g_timeout_add_seconds(1, _stop_location, NULL);
- g_timeout_add_seconds(60, exit_loop, NULL);
- g_main_loop_run (loop);
-
-}
-
-static void
-utc_location_free()
-{
- ret = location_free(loc);
- if(ret == LOCATION_ERROR_NONE) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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 <glib.h>
-#include <location.h>
-
-static void startup(), cleanup();
-void (*tet_startup) () = startup;
-void (*tet_cleanup) () = cleanup;
-
-static void utc_location_init();
-static void utc_location_new();
-static void utc_location_start();
-static void utc_get_method();
-static void utc_get_devname();
-static void utc_location_get_position();
-static void utc_location_svc_updated();
-static void utc_location_stop();
-static void utc_get_lastpostion();
-static void utc_location_free();
-
-
-struct tet_testlist tet_testlist[] = {
- {utc_location_init,1},
- {utc_location_new,1},
- {utc_location_start,1},
- {utc_get_method,1},
- {utc_get_devname,1},
- {utc_location_get_position,1},
- {utc_location_svc_updated,1},
- {utc_location_stop,1},
- {utc_get_lastpostion,1},
- {utc_location_free,1},
- {NULL,0},
-};
-
-static GMainLoop *loop = NULL;
-int ret;
-LocationObject* loc;
-
-static gboolean
-exit_loop (gpointer data)
-{
- g_main_loop_quit (loop);
- tet_result(TET_FAIL);
- return FALSE;
-}
-
-
-static void startup()
-{
- tet_printf("\n TC startup");
- loop = g_main_loop_new (NULL, TRUE);
-}
-
-static void cleanup()
-{
- tet_printf("\n TC End");
-}
-
-static void
-utc_location_init()
-{
- ret = location_init();
- if(ret == LOCATION_ERROR_NONE) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
-static void
-utc_location_new()
-{
- loc = location_new(LOCATION_METHOD_GPS);
- if (loc) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
-static void
-utc_location_start()
-{
- ret = location_start(loc);
- if (ret == LOCATION_ERROR_NONE) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
-static void
-utc_get_method()
-{
- LocationMethod method;
- g_object_get(loc, "method", &method, NULL);
-
- if(LOCATION_METHOD_HYBRID <= method && method<= LOCATION_METHOD_WPS) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
-static void
-utc_get_devname()
-{
- char* devname = NULL;
- g_object_get(loc, "dev-name", &devname, NULL);
-
- if (devname) {
- tet_result(TET_PASS);
- g_free(devname);
- } else tet_result(TET_FAIL);
-}
-
-static void
-utc_get_lastpostion()
-{
- LocationPosition *pos = NULL;
- g_object_get(loc, "last-position", &pos, NULL);
-
- if (pos) {
- tet_result(TET_PASS);
- location_position_free (pos);
- } else tet_result(TET_FAIL);
-}
-
-static void
-_get_position (GObject *self,
- guint _status,
- gpointer userdata)
-{
- LocationAccuracy *acc = NULL;
- LocationPosition *pos = NULL;
- LocationObject *loc = (LocationObject*)userdata;
-
- ret = location_get_position (loc, &pos, &acc);
- if (ret == LOCATION_ERROR_NONE) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-
- g_main_loop_quit (loop);
-}
-
-static void
-utc_location_get_position()
-{
- g_signal_connect (loc, "service-enabled", G_CALLBACK(_get_position), loc);
- g_timeout_add_seconds(60, exit_loop, NULL);
- g_main_loop_run (loop);
-}
-
-static void
-utc_location_stop()
-{
- ret = location_stop(loc);
-
- if(ret == LOCATION_ERROR_NONE) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
-static void
-_cb_updated (GObject *self,
- guint type,
- gpointer data,
- gpointer accuracy,
- gpointer userdata)
-{
- if ( POSITION_UPDATED <= type && type <= REVERSEGEOCODE_UPDATED) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
- g_main_loop_quit (loop);
-}
-
-static void
-utc_location_svc_updated()
-{
- g_signal_connect (loc, "service-updated", G_CALLBACK(_cb_updated), loc);
- g_timeout_add_seconds(60, exit_loop, NULL);
- g_main_loop_run (loop);
-}
-
-static void
-utc_location_free()
-{
- ret = location_free(loc);
- if (ret == LOCATION_ERROR_NONE) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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 <glib.h>
-#include <location.h>
-
-static void startup(), cleanup();
-void (*tet_startup) () = startup;
-void (*tet_cleanup) () = cleanup;
-
-static void utc_location_init();
-static void utc_location_new();
-static void utc_location_start();
-static void utc_get_method();
-static void utc_get_devname();
-static void utc_location_get_satellite();
-static void utc_location_svc_disabled();
-static void utc_location_free();
-
-
-struct tet_testlist tet_testlist[] = {
- {utc_location_init,1},
- {utc_location_new,1},
- {utc_location_start,1},
- {utc_get_method,1},
- {utc_get_devname,1},
- {utc_location_get_satellite,1},
- {utc_location_svc_disabled,1},
- {utc_location_free,1},
- {NULL,0},
-};
-
-
-
-static GMainLoop *loop = NULL;
-int ret;
-LocationObject* loc;
-
-gboolean
-exit_loop (gpointer data)
-{
- g_main_loop_quit (loop);
- tet_result(TET_FAIL);
- return FALSE;
-}
-
-static void startup()
-{
- tet_printf("\n TC startup");
-}
-
-static void cleanup()
-{
- tet_printf("\n TC End");
-}
-
-static void
-utc_location_init()
-{
- ret = location_init();
- if(ret == LOCATION_ERROR_NONE) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
-static void
-utc_location_new()
-{
- loc = location_new(LOCATION_METHOD_GPS);
- if(loc) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
-static void
-utc_location_start()
-{
- ret = location_start(loc);
- if(ret == LOCATION_ERROR_NONE) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
-static void
-utc_get_method()
-{
- LocationMethod method;
- g_object_get(loc, "method", &method, NULL);
- if (LOCATION_METHOD_HYBRID <= method && method<= LOCATION_METHOD_WPS) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
-static void
-utc_get_devname()
-{
- char* devname = NULL;
- g_object_get(loc, "dev-name", &devname, NULL);
- if (devname) {
- tet_result(TET_PASS);
- g_free(devname);
- } else tet_result(TET_FAIL);
-}
-
-static void
-_get_satellite (GObject *self,
- guint _status,
- gpointer userdata)
-{
- LocationSatellite *sat = NULL;
- int ret = 0;
-
- ret = location_get_satellite (loc, &sat);
- if (ret == LOCATION_ERROR_NONE) {
- tet_result(TET_PASS);
- location_satellite_free (sat);
- } else tet_result(TET_FAIL);
- g_main_loop_quit (loop);
-}
-
-static void
-utc_location_get_satellite()
-{
- loop = g_main_loop_new (NULL, TRUE);
- g_signal_connect (loc, "service-enabled", G_CALLBACK(_get_satellite), loc);
- g_timeout_add_seconds(60, exit_loop, NULL);
- g_main_loop_run (loop);
-}
-
-static void
-_cb_disabled (GObject *self,
- guint _status,
- gpointer userdata)
-{
- if( LOCATION_STATUS_NO_FIX <= _status && _status <= LOCATION_STATUS_3D_FIX) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
- g_main_loop_quit (loop);
-}
-
-gboolean
-_stop_location()
-{
- location_stop(loc);
- return FALSE;
-}
-
-static void
-utc_location_svc_disabled()
-{
- g_signal_connect (loc, "service-disabled", G_CALLBACK(_cb_disabled), loc);
- g_timeout_add_seconds(1, _stop_location, NULL);
- g_timeout_add_seconds(60, exit_loop, NULL);
- g_main_loop_run (loop);
-}
-
-static void
-utc_location_free()
-{
- ret = location_free(loc);
- if(ret == LOCATION_ERROR_NONE) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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 <glib.h>
-#include <location.h>
-
-static void startup(), cleanup();
-void (*tet_startup) () = startup;
-void (*tet_cleanup) () = cleanup;
-
-static void utc_location_init();
-static void utc_location_new();
-static void utc_location_start();
-static void utc_get_method();
-static void utc_get_devname();
-static void utc_location_get_velocity();
-static void utc_location_stop();
-static void utc_location_svc_updated();
-static void utc_location_free();
-
-struct tet_testlist tet_testlist[] = {
- {utc_location_init,1},
- {utc_location_new,1},
- {utc_location_start,1},
- {utc_get_method,1},
- {utc_get_devname,1},
- {utc_location_get_velocity,1},
- {utc_location_svc_updated,1},
- {utc_location_stop,1},
- {utc_location_free,1},
- {NULL,0},
-};
-
-static GMainLoop *loop = NULL;
-int ret;
-LocationObject* loc;
-
-static gboolean
-exit_loop (gpointer data)
-{
- g_main_loop_quit (loop);
- tet_result(TET_FAIL);
- return FALSE;
-}
-
-static void startup()
-{
- tet_printf("\n TC startup");
-}
-
-static void cleanup()
-{
- tet_printf("\n TC End");
-}
-
-static void
-utc_location_init()
-{
- ret = location_init();
- if (ret == LOCATION_ERROR_NONE) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
-static void
-utc_location_new()
-{
- loc = location_new(LOCATION_METHOD_GPS);
- if (loc) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
-static void
-utc_location_start()
-{
- ret = location_start(loc);
-
- if (ret == LOCATION_ERROR_NONE) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
-static void
-utc_get_method()
-{
- LocationMethod method;
- g_object_get(loc, "method", &method, NULL);
-
- if (LOCATION_METHOD_HYBRID <= method && method<= LOCATION_METHOD_WPS) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
-static void
-utc_get_devname()
-{
- char* devname = NULL;
- g_object_get(loc, "dev-name", &devname, NULL);
-
- if(devname){
- tet_result(TET_PASS);
- g_free(devname);
- } else tet_result(TET_FAIL);
-}
-
-static void
-_get_velocity (GObject *self,
- guint _status,
- gpointer userdata)
-{
- LocationVelocity *vel = NULL;
- LocationAccuracy *acc = NULL;
- LocationObject *loc = (LocationObject*)userdata;
-
- ret = location_get_velocity (loc, &vel, &acc);
- if (ret == LOCATION_ERROR_NONE) {
- location_velocity_free (vel);
- location_accuracy_free (acc);
- tet_result(TET_PASS);
- }
- else tet_result(TET_FAIL);
- g_main_loop_quit (loop);
-}
-
-static void
-utc_location_get_velocity()
-{
- loop = g_main_loop_new (NULL, TRUE);
-
- g_signal_connect (loc, "service-enabled", G_CALLBACK(_get_velocity), loc);
- g_timeout_add_seconds(60, exit_loop, NULL);
- g_main_loop_run (loop);
-}
-
-static void
-utc_location_stop()
-{
- ret = location_stop(loc);
-
- if (ret == LOCATION_ERROR_NONE) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
-static void
-_cb_updated (GObject *self,
- guint type,
- gpointer data,
- gpointer accuracy,
- gpointer userdata)
-{
- if ( POSITION_UPDATED <= type && type <= REVERSEGEOCODE_UPDATED) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
- g_main_loop_quit (loop);
-}
-
-static void
-utc_location_svc_updated()
-{
- g_signal_connect (loc, "service-updated", G_CALLBACK(_cb_updated), loc);
- g_timeout_add_seconds(60, exit_loop, NULL);
- g_main_loop_run (loop);
-}
-
-static void
-utc_location_free()
-{
- ret = location_free(loc);
- if (ret == LOCATION_ERROR_NONE) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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 <glib.h>
-#include <location.h>
-
-static gboolean g_is_found = FALSE;
-
-static void startup(), cleanup();
-void (*tet_startup) () = startup;
-void (*tet_cleanup) () = cleanup;
-
-static void utc_location_init();
-static void utc_location_new();
-static void utc_location_start();
-static void utc_get_method();
-static void utc_get_devname();
-static void utc_location_svc_enabled();
-static void utc_set_boundary_in_suwonHQ();
-static void utc_get_boundary_in_suwonHQ();
-static void utc_zone_in();
-static void utc_set_boundary_in_Santorini();
-static void utc_get_boundary_in_Santorini();
-static void utc_zone_out();
-static void utc_location_stop();
-static void utc_location_free();
-
-
-struct tet_testlist tet_testlist[] = {
- {utc_location_init,1},
- {utc_location_new,1},
- {utc_location_start,1},
- {utc_get_method,1},
- {utc_get_devname,1},
- {utc_location_svc_enabled,1},
- {utc_set_boundary_in_suwonHQ,1},
- {utc_get_boundary_in_suwonHQ,1},
- {utc_zone_in,1},
- {utc_set_boundary_in_Santorini,1},
- {utc_get_boundary_in_Santorini,1},
- {utc_zone_out,1},
- {utc_location_stop,1},
- {utc_location_free,1},
- {NULL,0},
-};
-
-
-static GMainLoop *loop = NULL;
-int ret;
-LocationObject* loc;
-
-static void comp_boundary(LocationBoundary *bound, gpointer user_data)
-{
- LocationBoundary *check_bound = (LocationBoundary *) user_data;
-
- if(bound && bound->type == check_bound->type) {
- switch(bound->type) {
- case LOCATION_BOUNDARY_RECT:
- if(bound->rect.right_bottom->latitude == check_bound->rect.right_bottom->latitude &&
- bound->rect.right_bottom->longitude == check_bound->rect.right_bottom->longitude &&
- bound->rect.left_top->latitude == check_bound->rect.left_top->latitude &&
- bound->rect.left_top->longitude == check_bound->rect.left_top->longitude ){
- g_is_found = TRUE;
- }
- break;
- default:
- break;
- }
- }
-}
-
-
-static gboolean
-exit_loop (gpointer data)
-{
- g_main_loop_quit (loop);
- tet_result(TET_FAIL);
- return FALSE;
-}
-
-static void startup()
-{
- tet_printf("\n TC startup");
- loop = g_main_loop_new (NULL, TRUE);
-}
-
-static void cleanup()
-{
- tet_printf("\n TC End");
-}
-
-static void
-utc_location_init()
-{
- ret = location_init();
- if(ret == LOCATION_ERROR_NONE) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
-static void
-utc_location_new()
-{
- loc = location_new(LOCATION_METHOD_GPS);
- if(loc) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
-static void
-utc_location_start()
-{
- ret = location_start(loc);
-
- if (ret == LOCATION_ERROR_NONE) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
-static void
-utc_get_method()
-{
- LocationMethod method;
- g_object_get(loc, "method", &method, NULL);
-
- if(LOCATION_METHOD_HYBRID <= method && method<= LOCATION_METHOD_WPS) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
-static void
-utc_get_devname()
-{
- char* devname = NULL;
- g_object_get(loc, "dev-name", &devname, NULL);
-
- if(devname){
- tet_result(TET_PASS);
- g_free(devname);
- } else tet_result(TET_FAIL);
-}
-
-static void
-_cb_svc_enabled (GObject *self,
- guint _status,
- gpointer userdata)
-{
- if(LOCATION_STATUS_NO_FIX <= _status && _status <= LOCATION_STATUS_3D_FIX) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
- g_main_loop_quit(loop);
-}
-
-
-static void
-utc_location_svc_enabled()
-{
- g_signal_connect (loc, "service-enabled", G_CALLBACK(_cb_svc_enabled), loc);
- g_timeout_add_seconds(60, exit_loop, NULL);
- g_main_loop_run (loop);
-}
-
-static void
-utc_set_boundary_in_suwonHQ()
-{
- int ret = 0;
- LocationPosition *rb = location_position_new(0, 37.253, 127.058, 0, LOCATION_STATUS_2D_FIX);
- LocationPosition *lt = location_position_new(0, 37.261, 127.052, 0, LOCATION_STATUS_2D_FIX);
- LocationBoundary *bound = location_boundary_new_for_rect(lt, rb);
- location_position_free (rb);
- location_position_free (lt);
- ret = location_boundary_add(loc, bound);
- if (!ret) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-
- location_boundary_free (bound);
-}
-
-static void
-utc_get_boundary_in_suwonHQ()
-{
- LocationPosition *rb = location_position_new(0, 37.253, 127.058, 0, LOCATION_STATUS_2D_FIX);
- LocationPosition *lt = location_position_new(0, 37.261, 127.052, 0, LOCATION_STATUS_2D_FIX);
- LocationBoundary *bound = location_boundary_new_for_rect(lt, rb);
- location_position_free (rb);
- location_position_free (lt);
-
- g_is_found = FALSE;
- location_boundary_foreach(loc, comp_boundary, bound);
- if(g_is_found) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-
- location_boundary_free (bound);
-}
-
-static void
-_cb_zone_in(LocationObject *self,
- guint type,
- gpointer position,
- gpointer accuracy)
-{
- LocationPosition *pos = (LocationPosition*) position;
- if( (37.253 <= pos->latitude && pos->latitude <= 37.261) &&
- (127.052 <= pos->longitude && pos->longitude <= 127.058) ) {
- tet_result(TET_PASS); // I am in Suwon HQ
- } else tet_result(TET_FAIL);
-
- g_main_loop_quit(loop);
-}
-
-static void
-utc_zone_in()
-{
- g_signal_connect (loc, "zone-in", G_CALLBACK(_cb_zone_in), loc);
- g_timeout_add_seconds(60, exit_loop, NULL);
- g_main_loop_run (loop);
-}
-
-static void
-utc_set_boundary_in_Santorini()
-{
- int ret = 0;
- LocationPosition *rb = location_position_new(0, 36.395, 25.41, 0, LOCATION_STATUS_2D_FIX);
- LocationPosition *lt = location_position_new(0, 36.413, 25.388, 0, LOCATION_STATUS_2D_FIX);
- LocationBoundary* bound = location_boundary_new_for_rect(lt, rb);
- location_position_free (rb);
- location_position_free (lt);
-
- ret = location_boundary_add(loc, bound);
- if (!ret) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-
- location_boundary_free (bound);
-}
-
-static void
-utc_get_boundary_in_Santorini()
-{
- LocationPosition *rb = location_position_new(0, 36.395, 25.41, 0, LOCATION_STATUS_2D_FIX);
- LocationPosition *lt = location_position_new(0, 36.413, 25.388, 0, LOCATION_STATUS_2D_FIX);
- LocationBoundary* bound = location_boundary_new_for_rect(lt, rb);
- location_position_free (rb);
- location_position_free (lt);
-
- g_is_found = FALSE;
- location_boundary_foreach(loc, comp_boundary, bound);
- if(g_is_found) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-
- location_boundary_free (bound);
-}
-
-static void
-_cb_zone_out(LocationObject *self,
- guint type,
- gpointer position,
- gpointer accuracy)
-{
- LocationPosition *pos = (LocationPosition*) position;
-
- if( (37.253 <= pos->latitude && pos->latitude <= 37.261) &&
- (27.052 <= pos->longitude && pos->longitude <= 127.058) ) {
- tet_result(TET_PASS); // I am in Suwon HQ
- } else tet_result(TET_FAIL);
- g_main_loop_quit(loop);
-}
-
-
-static void
-utc_zone_out()
-{
- g_signal_connect (loc, "zone-out", G_CALLBACK(_cb_zone_out), loc);
- g_timeout_add_seconds(60, exit_loop, NULL);
- g_main_loop_run (loop);
-}
-
-static void
-utc_location_stop()
-{
- ret = location_stop(loc);
-
- if(ret == LOCATION_ERROR_NONE) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
-static void
-utc_location_free()
-{
- ret = location_free(loc);
- if(ret == LOCATION_ERROR_NONE) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
+++ /dev/null
-stc_gps_nmea
-stc_gps_position
-stc_gps_satellite
-stc_gps_velocity
-stc_gps_zone
-utc_location_free
-utc_location_get_address
-utc_location_get_last_known_position
-utc_location_get_address_from_position
-utc_location_get_position_from_address
-utc_location_get_position_from_freeformed_address
-utc_location_get_position
-utc_location_get_last_position
-utc_location_get_velocity
-utc_location_get_last_velocity
-utc_location_get_satellite
-utc_location_get_last_satellite
-utc_location_search_poi
-utc_location_init
-utc_location_new
-utc_location_start
-utc_location_stop
-utc_properties_method
-utc_signals_service_disabled
-utc_signals_service_enabled
-utc_signals_service_updated
-utc_signals_zone_in
-utc_signals_zone_out
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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 <glib.h>
-#include <location.h>
-
-static void startup(), cleanup();
-void (*tet_startup) () = startup;
-void (*tet_cleanup) () = cleanup;
-
-static void utc_location_free_01();
-static void utc_location_free_02();
-
-struct tet_testlist tet_testlist[] = {
- {utc_location_free_01,1},
- {utc_location_free_02,2},
- {NULL,0},
-};
-
-int ret;
-LocationObject* loc;
-
-static void startup()
-{
- ret = location_init();
- loc = location_new(LOCATION_METHOD_GPS);
- tet_printf("\n TC startup");
-}
-
-static void cleanup()
-{
- if(loc)
- location_free(loc);
-
- tet_printf("\n TC End");
-}
-
-static void
-utc_location_free_01()
-{
- ret = location_free(loc);
-
- tet_printf("Returned value: %d", ret);
- if(ret == LOCATION_ERROR_NONE){
- tet_result(TET_PASS);
- loc = NULL;
- }
- else{
- tet_result(TET_FAIL);
- }
-}
-
-static void
-utc_location_free_02()
-{
- ret = location_free(NULL);
-
- tet_printf("Returned value: %d", ret);
- if(ret == LOCATION_ERROR_PARAMETER){
- tet_result(TET_PASS);
- }
- else{
- tet_result(TET_FAIL);
- }
-}
-
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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 <glib.h>
-#include <location.h>
-
-static void startup(), cleanup();
-void (*tet_startup) () = startup;
-void (*tet_cleanup) () = cleanup;
-
-static void utc_location_get_address_01();
-static void utc_location_get_address_02();
-static void utc_location_get_address_03();
-
-struct tet_testlist tet_testlist[] = {
- {utc_location_get_address_01,1},
- {utc_location_get_address_02,2},
- {utc_location_get_address_03,3},
- {NULL,0},
-};
-
-static GMainLoop *loop = NULL;
-LocationObject* loc = NULL;
-int ret = LOCATION_ERROR_NONE;
-int isNetStarted = 0;
-
-static gboolean
-exit_loop_fail (gpointer data)
-{
- g_main_loop_quit (loop);
- tet_result(TET_FAIL);
- return FALSE;
-}
-
-static void startup()
-{
- location_init();
- loc = location_new(LOCATION_METHOD_GPS);
-
- loop = g_main_loop_new(NULL,FALSE);
-
- tet_printf("\n TC startup");
-}
-
-static void cleanup()
-{
- location_stop(loc);
- location_free(loc);
- tet_printf("\n TC End");
-}
-
-static void
-_get_address (GObject *self,
- guint _status,
- gpointer userdata)
-{
- LocationAccuracy *acc = NULL;
- LocationAddress *addr = NULL;
-
- ret = location_get_address(loc, &addr, &acc);
- tet_printf("Returned value: %d", ret);
- if (ret == LOCATION_ERROR_NONE ||
- ret == LOCATION_ERROR_CONFIGURATION) {
- location_address_free(addr);
- location_accuracy_free(acc);
- tet_result(TET_PASS);
- } else tet_result(TET_FAIL);
- g_main_loop_quit (loop);
-}
-
-static void
-utc_location_get_address_01()
-{
- g_signal_connect (loc, "service-enabled", G_CALLBACK(_get_address), loc);
- location_start(loc);
- g_timeout_add_seconds(60, exit_loop_fail, loop);
- g_main_loop_run (loop);
-}
-
-static void
-utc_location_get_address_02()
-{
- LocationAccuracy *acc = NULL;
- LocationAddress *addr = NULL;
-
- ret = location_get_address(NULL, &addr, &acc);
- tet_printf("Returned value: %d", ret);
- if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
-static void
-utc_location_get_address_03()
-{
- LocationAccuracy *acc = NULL;
- ret = location_get_address(loc, NULL, &acc);
- tet_printf("Returned value: %d", ret);
- if(ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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 <glib.h>
-#include <location.h>
-
-static void startup(), cleanup();
-void (*tet_startup) () = startup;
-void (*tet_cleanup) () = cleanup;
-
-static void utc_location_get_address_from_position_01();
-static void utc_location_get_address_from_position_02();
-static void utc_location_get_address_from_position_03();
-static void utc_location_get_address_from_position_04();
-
-struct tet_testlist tet_testlist[] = {
- {utc_location_get_address_from_position_01,1},
- {utc_location_get_address_from_position_02,2},
- {utc_location_get_address_from_position_03,3},
- {utc_location_get_address_from_position_04,4},
- {NULL,0},
-};
-
-static GMainLoop *loop = NULL;
-LocationObject* loc;
-int ret;
-int isNetStarted = 0;
-int g_state = 0;
-
-static gboolean
-exit_loop (gpointer data)
-{
- g_main_loop_quit (loop);
- return FALSE;
-}
-
-static void startup()
-{
- location_init();
- loc = location_new(LOCATION_METHOD_GPS);
-
- loop = g_main_loop_new(NULL,FALSE);
- tet_printf("\n TC startup");
-}
-
-static void cleanup()
-{
- location_free(loc);
- tet_printf("\n TC End");
-}
-
-static void
-utc_location_get_address_from_position_01()
-{
- LocationPosition *pos = location_position_new(0, 37.257809, 127.056383, 0, LOCATION_STATUS_2D_FIX);
- LocationAccuracy *acc = NULL;
- LocationAddress *addr = NULL;
- ret = location_get_address_from_position(loc, pos, &addr, &acc);
- location_position_free(pos);
- tet_printf("Returned value: %d", ret);
- if (ret == LOCATION_ERROR_NONE ||
- ret == LOCATION_ERROR_CONFIGURATION) {
- location_address_free(addr);
- location_accuracy_free(acc);
- tet_result(TET_PASS);
- } else tet_result(TET_FAIL);
-}
-
-static void
-utc_location_get_address_from_position_02()
-{
- LocationPosition *pos = location_position_new(0, 37.257809, 127.056383, 0, LOCATION_STATUS_2D_FIX);
- LocationAccuracy *acc = NULL;
- LocationAddress *addr = NULL;
-
- ret = location_get_address_from_position(NULL, pos, &addr, &acc);
- location_position_free(pos);
- location_address_free(addr);
- location_accuracy_free(acc);
- tet_printf("Returned value: %d", ret);
- if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
- static void
-utc_location_get_address_from_position_03()
-{
- LocationAccuracy *acc = NULL;
- LocationAddress *addr = NULL;
- ret = location_get_address_from_position(loc, NULL, &addr, &acc);
- tet_printf("Returned value: %d", ret);
- if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
- static void
-utc_location_get_address_from_position_04()
-{
- LocationAccuracy *acc = NULL;
- LocationPosition *pos = location_position_new(0, 37.257809, 127.056383, 0, LOCATION_STATUS_2D_FIX);
-
- ret = location_get_address_from_position(loc, pos, NULL, &acc);
- location_position_free(pos);
- tet_printf("Returned value: %d", ret);
- if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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 <glib.h>
-#include <location.h>
-
-static void startup(), cleanup();
-void (*tet_startup) () = startup;
-void (*tet_cleanup) () = cleanup;
-
-static void utc_location_get_last_known_position_01();
-static void utc_location_get_last_known_position_02();
-
-struct tet_testlist tet_testlist[] = {
- {utc_location_get_last_known_position_01,1},
- {utc_location_get_last_known_position_02,2},
- {NULL,0},
-};
-
-int ret;
-LocationObject* loc;
-
-static void startup()
-{
- ret = location_init();
- loc = location_new(LOCATION_METHOD_GPS);
- tet_printf("\n TC startup");
-}
-
-static void cleanup()
-{
- if( loc )
- location_free(loc);
- tet_printf("\n TC End");
-}
-
-static void
-utc_location_get_last_known_position_01()
-{
- int ret = 0;
- LocationLastPosition last_known_position = {0, };
-
- ret = location_get_last_known_position(loc, LOCATION_METHOD_HYBRID, &last_known_position);
- if (ret == LOCATION_ERROR_NONE) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
-static void
-utc_location_get_last_known_position_02()
-{
- int ret = 0;
- LocationLastPosition last_known_position = {0, };
- ret = location_get_last_known_position(NULL, LOCATION_METHOD_HYBRID, &last_known_position);
- if (ret == LOCATION_ERROR_NONE) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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 <glib.h>
-#include <location.h>
-
-static void startup(), cleanup();
-void (*tet_startup) () = startup;
-void (*tet_cleanup) () = cleanup;
-
-static void utc_location_get_last_position_01();
-static void utc_location_get_last_position_02();
-static void utc_location_get_last_position_03();
-static void utc_location_get_last_position_04();
-
-struct tet_testlist tet_testlist[] = {
- {utc_location_get_last_position_01,1},
- {utc_location_get_last_position_02,2},
- {utc_location_get_last_position_03,3},
- {utc_location_get_last_position_04,4},
- {NULL,0},
-};
-
-int ret;
-LocationObject* loc;
-
-static void startup()
-{
- location_init();
- loc = location_new(LOCATION_METHOD_GPS);
- tet_printf("\n TC startup");
-}
-
-static void cleanup()
-{
- location_free(loc);
- tet_printf("\n TC End");
-}
-
-static void
-utc_location_get_last_position_01()
-{
- LocationPosition *last_pos = NULL;
- LocationAccuracy *last_acc = NULL;
-
- ret = location_get_last_position (loc, LOCATION_METHOD_GPS, &last_pos, &last_acc);
- if (ret == LOCATION_ERROR_NONE) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
-static void
-utc_location_get_last_position_02()
-{
- LocationAccuracy *last_acc = NULL;
- LocationPosition *last_pos = NULL;
-
- ret = location_get_last_position (NULL, LOCATION_METHOD_HYBRID, &last_pos, &last_acc);
- tet_printf("Returned value: %d", ret);
- if (ret == LOCATION_ERROR_NONE) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
-static void
-utc_location_get_last_position_03()
-{
- LocationAccuracy *last_acc = NULL;
- ret = location_get_last_position (loc, LOCATION_METHOD_GPS, NULL, &last_acc);
- tet_printf("Returned value: %d", ret);
- if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
-static void
-utc_location_get_last_position_04()
-{
- LocationPosition *last_pos = NULL;
- ret = location_get_last_position (loc, LOCATION_METHOD_GPS, &last_pos, NULL);
- tet_printf("Returned value: %d", ret);
- if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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 <glib.h>
-#include <location.h>
-
-static void startup(), cleanup();
-void (*tet_startup) () = startup;
-void (*tet_cleanup) () = cleanup;
-
-static void utc_location_get_last_satellite_01();
-static void utc_location_get_last_satellite_02();
-static void utc_location_get_last_satellite_03();
-
-struct tet_testlist tet_testlist[] = {
- {utc_location_get_last_satellite_01,1},
- {utc_location_get_last_satellite_02,2},
- {utc_location_get_last_satellite_03,3},
- {NULL,0},
-};
-
-int ret;
-LocationObject* loc;
-
-static void startup()
-{
- location_init();
- loc = location_new(LOCATION_METHOD_GPS);
- tet_printf("\n TC startup");
-}
-
-static void cleanup()
-{
- location_free(loc);
- tet_printf("\n TC End");
-}
-
-static void
-utc_location_get_last_satellite_01()
-{
- int ret = 0;
- LocationSatellite *last_sat = NULL;
-
- ret = location_get_last_satellite (loc, &last_sat);
- tet_printf("Returned value: %d", ret);
- if (ret == LOCATION_ERROR_NONE) {
- location_satellite_free(last_sat);
- tet_result(TET_PASS);
- } else tet_result(TET_FAIL);
-
-}
-
-static void
-utc_location_get_last_satellite_02()
-{
- LocationSatellite *last_sat = NULL;
- ret = location_get_last_satellite (NULL, &last_sat);
- tet_printf("Returned value: %d", ret);
- if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
-static void
-utc_location_get_last_satellite_03()
-{
- ret = location_get_last_satellite (loc, NULL);
- tet_printf("Returned value: %d", ret);
- if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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 <glib.h>
-#include <location.h>
-
-static void startup(), cleanup();
-void (*tet_startup) () = startup;
-void (*tet_cleanup) () = cleanup;
-
-static void utc_location_get_last_velocity_01();
-static void utc_location_get_last_velocity_02();
-static void utc_location_get_last_velocity_03();
-static void utc_location_get_last_velocity_04();
-
-struct tet_testlist tet_testlist[] = {
- {utc_location_get_last_velocity_01,1},
- {utc_location_get_last_velocity_02,2},
- {utc_location_get_last_velocity_03,3},
- {utc_location_get_last_velocity_04,4},
- {NULL,0},
-};
-
-int ret;
-LocationObject* loc;
-
-static void startup()
-{
- location_init();
- loc = location_new(LOCATION_METHOD_GPS);
- tet_printf("\n TC startup");
-}
-
-static void cleanup()
-{
- location_free(loc);
- tet_printf("\n TC End");
-}
-
-
-static void
-utc_location_get_last_velocity_01()
-{
- LocationVelocity *last_vel = NULL;
- LocationAccuracy *last_acc = NULL;
- ret = location_get_last_velocity (loc, &last_vel, &last_acc);
- tet_printf("Returned value: %d", ret);
- if (ret == LOCATION_ERROR_NONE) {
- location_velocity_free (last_vel);
- location_accuracy_free (last_acc);
- tet_result(TET_PASS);
- } else tet_result(TET_FAIL);
-
-}
-
-
-static void
-utc_location_get_last_velocity_02()
-{
- LocationVelocity *last_vel = NULL;
- LocationAccuracy *last_acc = NULL;
- ret = location_get_last_velocity (NULL, &last_vel, &last_acc);
- tet_printf("Returned value: %d", ret);
- if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
-static void
-utc_location_get_last_velocity_03()
-{
- LocationAccuracy *last_acc = NULL;
- ret = location_get_velocity (loc, NULL, &last_acc);
- tet_printf("Returned value: %d", ret);
- if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
-static void
-utc_location_get_last_velocity_04()
-{
- LocationVelocity *last_vel = NULL;
- ret = location_get_velocity (loc, &last_vel, NULL);
- tet_printf("Returned value: %d", ret);
- if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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 <glib.h>
-#include <location.h>
-
-static void startup(), cleanup();
-void (*tet_startup) () = startup;
-void (*tet_cleanup) () = cleanup;
-
-static void utc_location_get_position_01();
-static void utc_location_get_position_02();
-static void utc_location_get_position_03();
-static void utc_location_get_position_04();
-
-struct tet_testlist tet_testlist[] = {
- {utc_location_get_position_01,1},
- {utc_location_get_position_02,2},
- {utc_location_get_position_03,3},
- {utc_location_get_position_04,4},
- {NULL,0},
-};
-
-static GMainLoop *loop = NULL;
-int ret;
-LocationObject* loc;
-
-static gboolean
-exit_loop (gpointer data)
-{
- g_main_loop_quit (loop);
- tet_result(TET_FAIL);
- return FALSE;
-}
-
-static void startup()
-{
- location_init();
- loc = location_new(LOCATION_METHOD_GPS);
- location_start(loc);
- loop = g_main_loop_new(NULL,FALSE);
- tet_printf("\n TC startup");
-}
-
-static void cleanup()
-{
- location_stop(loc);
- location_free(loc);
- tet_printf("\n TC End");
-}
-
-static void
-_get_position (GObject *self,
- guint _status,
- gpointer userdata)
-{
- LocationAccuracy *acc = NULL;
- LocationPosition *pos = NULL;
- LocationObject *loc = (LocationObject*)userdata;
-
- ret = location_get_position (loc, &pos, &acc);
- tet_printf("Returned value: %d", ret);
- if (ret == LOCATION_ERROR_NONE) {
- location_position_free (pos);
- location_accuracy_free (acc);
- tet_result(TET_PASS);
- } else tet_result(TET_FAIL);
- g_main_loop_quit (loop);
-}
-
-static void
-utc_location_get_position_01()
-{
- g_signal_connect (loc, "service-enabled", G_CALLBACK(_get_position), loc);
- g_timeout_add_seconds(60, exit_loop, NULL);
- g_main_loop_run (loop);
-}
-
-static void
-utc_location_get_position_02()
-{
- LocationAccuracy *acc = NULL;
- LocationPosition *pos = NULL;
-
- ret = location_get_position (NULL, &pos, &acc);
- tet_printf("Returned value: %d", ret);
- if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
-static void
-utc_location_get_position_03()
-{
- LocationAccuracy *acc = NULL;
- ret = location_get_position (loc, NULL, &acc);
- tet_printf("Returned value: %d", ret);
- if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
-static void
-utc_location_get_position_04()
-{
- LocationPosition *pos = NULL;
- ret = location_get_position (loc, &pos, NULL);
- tet_printf("Returned value: %d", ret);
- if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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 <glib.h>
-#include <gconf/gconf-client.h>
-#include <location.h>
-
-static void startup(), cleanup();
-void (*tet_startup) () = startup;
-void (*tet_cleanup) () = cleanup;
-
-static void utc_location_get_position_from_address_01();
-static void utc_location_get_position_from_address_02();
-static void utc_location_get_position_from_address_03();
-static void utc_location_get_position_from_address_04();
-
-struct tet_testlist tet_testlist[] = {
- {utc_location_get_position_from_address_01,1},
- {utc_location_get_position_from_address_02,2},
- {utc_location_get_position_from_address_03,3},
- {utc_location_get_position_from_address_04,4},
- {NULL,0},
-};
-
-static GMainLoop *loop = NULL;
-LocationObject* loc;
-int ret;
-int isNetStarted = 0;
-int g_state = 0;
-gboolean is_found = FALSE;
-
-static gboolean
-exit_loop (gpointer data)
-{
- g_main_loop_quit (loop);
- return FALSE;
-}
-
-static void startup()
-{
- location_init();
- loc = location_new(LOCATION_METHOD_GPS);
-
- loop = g_main_loop_new(NULL,FALSE);
-
- tet_printf("\n TC startup");
-}
-
-static void cleanup()
-{
- location_free(loc);
- tet_printf("\n TC End");
-}
-
-static void comp_position (gpointer data, gpointer user_data)
-{
- if (!data) return;
-
- LocationPosition *pos = (LocationPosition *)data;
-
- if (pos) {
- if (37.325276 <= pos->latitude && pos->latitude <= 37.345276 &&
- -121.900059 <= pos->longitude && pos->longitude<= -121.880059) {
- is_found = TRUE;
- }
-
- location_position_free(pos);
- }
-}
-
-static void free_accuracy (gpointer data, gpointer user_data)
-{
- if (!data) return;
-
- LocationAccuracy *acc = (LocationAccuracy *)data;
-
- if (acc) location_accuracy_free(acc);
-}
-
-static void
-utc_location_get_position_from_address_01()
-{
- GList *pos_list = NULL;
- GList *acc_list = NULL;
- LocationAddress *addr = location_address_new ("1", "Post Street", NULL, "san jose", "ca", NULL, "95113",NULL,NULL,NULL);
- ret = location_get_position_from_address (loc, addr, &pos_list, &acc_list);
- location_address_free(addr);
- tet_printf("Returned value: %d", ret);
- if (ret == LOCATION_ERROR_NONE) {
- is_found = FALSE;
- g_list_foreach (pos_list, comp_position, NULL);
- g_list_foreach (acc_list, free_accuracy, NULL);
- if (is_found)
- tet_result(TET_PASS);
- else
- tet_result(TET_FAIL);
- } else tet_result(TET_FAIL);
-}
-
-static void
-utc_location_get_position_from_address_02()
-{
- GList *pos_list = NULL;
- GList *acc_list = NULL;
- LocationAddress *addr = location_address_new ("1", "Post Street", NULL, "san jose", "ca", NULL, "95113",NULL,NULL,NULL);
- ret = location_get_position_from_address (NULL, addr, &pos_list, &acc_list);
- location_address_free(addr);
- tet_printf("Returned value: %d", ret);
- if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
-static void
-utc_location_get_position_from_address_03()
-{
- GList *pos_list = NULL;
- GList *acc_list = NULL;
- ret = location_get_position_from_address(loc, NULL, &pos_list, &acc_list);
- tet_printf("Returned value: %d", ret);
- if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
-static void
-utc_location_get_position_from_address_04()
-{
- LocationAddress *addr = location_address_new ("1", "Post Street", NULL, "san jose", "ca", NULL, "95113",NULL,NULL,NULL);
- GList *acc_list = NULL;
- ret = location_get_position_from_address(loc, addr, NULL, &acc_list);
- location_address_free (addr);
- tet_printf("Returned value: %d", ret);
- if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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 <glib.h>
-#include <location.h>
-
-static void startup(), cleanup();
-void (*tet_startup) () = startup;
-void (*tet_cleanup) () = cleanup;
-
-static void utc_location_get_position_from_freeformed_address_01();
-static void utc_location_get_position_from_freeformed_address_02();
-static void utc_location_get_position_from_freeformed_address_03();
-static void utc_location_get_position_from_freeformed_address_04();
-
-struct tet_testlist tet_testlist[] = {
- {utc_location_get_position_from_freeformed_address_01,1},
- {utc_location_get_position_from_freeformed_address_02,2},
- {utc_location_get_position_from_freeformed_address_03,3},
- {utc_location_get_position_from_freeformed_address_04,4},
- {NULL,0},
-};
-
-static GMainLoop *loop = NULL;
-LocationObject* loc;
-int ret;
-int isNetStarted = 0;
-gboolean is_found = FALSE;
-
-static gboolean
-exit_loop (gpointer data)
-{
- g_main_loop_quit (loop);
- return FALSE;
-}
-
-static void startup()
-{
- location_init();
- loc = location_new(LOCATION_METHOD_GPS);
-
- loop = g_main_loop_new(NULL,FALSE);
- tet_printf("\n TC startup");
-}
-
-static void cleanup()
-{
- location_free(loc);
- tet_printf("\n TC End");
-}
-
-static void comp_position (gpointer data, gpointer user_data)
-{
- if (!data) return;
- LocationPosition *pos = (LocationPosition *)data;
- if (pos) {
- if (37.325276 <= pos->latitude && pos->latitude <= 37.345276 &&
- -121.900059 <= pos->longitude && pos->longitude<= -121.880059) {
- is_found = TRUE;
- }
- location_position_free (pos);
- }
-}
-
-static void free_accuracy (gpointer data, gpointer user_data)
-{
- if (!data) return;
-
- LocationAccuracy *acc = (LocationAccuracy *)data;
- if (acc) location_accuracy_free(acc);
-}
-
-static void
-utc_location_get_position_from_freeformed_address_01()
-{
- GList *pos_list = NULL;
- GList *acc_list = NULL;
- char* addr_str = g_strdup("4 N 2nd Street 95113");
- ret = location_get_position_from_freeformed_address(loc, addr_str, &pos_list, &acc_list);
- g_free(addr_str);
- tet_printf("Returned value: %d", ret);
- if (ret == LOCATION_ERROR_NONE ) {
- g_list_foreach (pos_list, comp_position, NULL);
- g_list_foreach (acc_list, free_accuracy, NULL);
- if (is_found == TRUE)
- tet_result(TET_PASS);
- else
- tet_result(TET_FAIL);
- }
- else
- tet_result(TET_FAIL);
-}
-
-static void
-utc_location_get_position_from_freeformed_address_02()
-{
- GList *pos_list = NULL;
- GList *acc_list = NULL;
- char* addr_str = g_strdup("4 N 2nd Street 95113");
- ret = location_get_position_from_freeformed_address(NULL, addr_str, &pos_list, &acc_list);
- g_free(addr_str);
- tet_printf("Returned value: %d", ret);
- if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
-static void
-utc_location_get_position_from_freeformed_address_03()
-{
- GList *pos_list = NULL;
- GList *acc_list = NULL;
- ret = location_get_position_from_freeformed_address(loc, NULL, &pos_list, &acc_list);
- tet_printf("Returned value: %d", ret);
- if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
-static void
-utc_location_get_position_from_freeformed_address_04()
-{
- GList *acc_list = NULL;
- char* addr_str = g_strdup("4 N 2nd Street 95113");
- ret = location_get_position_from_freeformed_address(loc, addr_str, NULL, &acc_list);
- g_free (addr_str);
- tet_printf("Returned value: %d", ret);
- if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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 <glib.h>
-#include <location.h>
-
-static void startup(), cleanup();
-void (*tet_startup) () = startup;
-void (*tet_cleanup) () = cleanup;
-
-static void utc_location_get_satellite_01();
-static void utc_location_get_satellite_02();
-static void utc_location_get_satellite_03();
-
-struct tet_testlist tet_testlist[] = {
- {utc_location_get_satellite_01,1},
- {utc_location_get_satellite_02,2},
- {utc_location_get_satellite_03,3},
- {NULL,0},
-};
-
-static GMainLoop *loop = NULL;
-int ret;
-LocationObject* loc;
-
-static gboolean
-exit_loop (gpointer data)
-{
- g_main_loop_quit (loop);
- tet_result(TET_FAIL);
- return FALSE;
-}
-
-static void startup()
-{
- location_init();
- loc = location_new(LOCATION_METHOD_GPS);
- location_start(loc);
- loop = g_main_loop_new(NULL,FALSE);
- tet_printf("\n TC startup");
-}
-
-static void cleanup()
-{
- location_stop(loc);
- location_free(loc);
- tet_printf("\n TC End");
-}
-
-static void
-_get_satellite (GObject *self,
- guint _status,
- gpointer userdata)
-{
- LocationSatellite *sat = NULL;
- LocationObject *loc = (LocationObject*)userdata;
-
- ret = location_get_satellite (loc, &sat);
- tet_printf("Returned value: %d", ret);
- if (ret == LOCATION_ERROR_NONE) {
- location_satellite_free(sat);
- tet_result(TET_PASS);
- } else tet_result(TET_FAIL);
- g_main_loop_quit (loop);
-}
-
-static void
-utc_location_get_satellite_01()
-{
- g_signal_connect (loc, "service-enabled", G_CALLBACK(_get_satellite), loc);
- g_timeout_add_seconds(60, exit_loop, loop);
- g_main_loop_run (loop);
-}
-
-static void
-utc_location_get_satellite_02()
-{
- LocationSatellite *sat = NULL;
- ret = location_get_satellite (NULL, &sat);
- tet_printf("Returned value: %d", ret);
- if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
-static void
-utc_location_get_satellite_03()
-{
- LocationSatellite *sat = NULL;
- ret = location_get_satellite (loc, NULL);
- tet_printf("Returned value: %d", ret);
- if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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 <glib.h>
-#include <location.h>
-
-static void startup(), cleanup();
-void (*tet_startup) () = startup;
-void (*tet_cleanup) () = cleanup;
-
-static void utc_location_get_velocity_01();
-static void utc_location_get_velocity_02();
-static void utc_location_get_velocity_03();
-static void utc_location_get_velocity_04();
-
-struct tet_testlist tet_testlist[] = {
- {utc_location_get_velocity_01,1},
- {utc_location_get_velocity_02,2},
- {utc_location_get_velocity_03,3},
- {utc_location_get_velocity_04,4},
- {NULL,0},
-};
-
-static GMainLoop *loop = NULL;
-int ret;
-LocationObject* loc;
-
-static gboolean
-exit_loop (gpointer data)
-{
- g_main_loop_quit (loop);
- tet_result(TET_FAIL);
- return FALSE;
-}
-
-static void startup()
-{
- location_init();
- loc = location_new(LOCATION_METHOD_GPS);
- location_start(loc);
- loop = g_main_loop_new(NULL,FALSE);
- tet_printf("\n TC startup");
-}
-
-static void cleanup()
-{
- location_stop(loc);
- location_free(loc);
- tet_printf("\n TC End");
-}
-
-
-static void
-_get_velocity (GObject *self,
- guint _status,
- gpointer userdata)
-{
- LocationVelocity *vel = NULL;
- LocationAccuracy *acc = NULL;
- LocationObject *loc = (LocationObject*)userdata;
- ret = location_get_velocity (loc, &vel, &acc);
- tet_printf("Returned value: %d", ret);
- if (ret == LOCATION_ERROR_NONE) {
- location_velocity_free (vel);
- location_accuracy_free (acc);
- tet_result(TET_PASS);
- } else tet_result(TET_FAIL);
- g_main_loop_quit (loop);
-}
-
-static void
-utc_location_get_velocity_01()
-{
- g_signal_connect (loc, "service-enabled", G_CALLBACK(_get_velocity), loc);
- g_timeout_add_seconds(60, exit_loop, NULL);
- g_main_loop_run (loop);
-}
-
-
-static void
-utc_location_get_velocity_02()
-{
- LocationVelocity *vel = NULL;
- LocationAccuracy *acc = NULL;
- ret = location_get_velocity (NULL, &vel, &acc);
- tet_printf("Returned value: %d", ret);
- if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
-static void
-utc_location_get_velocity_03()
-{
- LocationAccuracy *acc = NULL;
- ret = location_get_velocity (loc, NULL, &acc);
- tet_printf("Returned value: %d", ret);
- if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
-static void
-utc_location_get_velocity_04()
-{
- LocationVelocity *vel = NULL;
- ret = location_get_velocity (loc, &vel, NULL);
- tet_printf("Returned value: %d", ret);
- if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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 <glib.h>
-#include <location.h>
-
-static void startup(), cleanup();
-void (*tet_startup) () = startup;
-void (*tet_cleanup) () = cleanup;
-
-static void utc_location_init();
-
-struct tet_testlist tet_testlist[] = {
- {utc_location_init,1},
- {NULL,0},
-};
-
-int ret;
-
-static void startup()
-{
- tet_printf("\n TC startup");
-}
-
-static void cleanup()
-{
- tet_printf("\n TC End");
-}
-
-static void
-utc_location_init()
-{
- ret = location_init();
- if (ret == LOCATION_ERROR_NONE) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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 <glib.h>
-#include <location.h>
-
-static void startup(), cleanup();
-void (*tet_startup) () = startup;
-void (*tet_cleanup) () = cleanup;
-
-static void utc_location_new_01();
-static void utc_location_new_02();
-
-struct tet_testlist tet_testlist[] = {
- {utc_location_new_01,1},
- {utc_location_new_02,1},
- {NULL,0},
-};
-
-int ret;
-LocationObject* loc;
-
-static void startup()
-{
- ret = location_init();
- tet_printf("\n TC startup");
-}
-
-static void cleanup()
-{
- if (loc) location_free(loc);
- tet_printf("\n TC End");
-}
-
-static void
-utc_location_new_01()
-{
- loc = location_new(LOCATION_METHOD_GPS);
- if (loc) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
- location_free(loc);
-}
-
-static void
-utc_location_new_02()
-{
- loc = location_new(-1);
- if (!loc) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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 <glib.h>
-#include <location.h>
-#include <location-map-service.h>
-#include <location-landmark-ext.h>
-
-static void startup(), cleanup();
-void (*tet_startup) () = startup;
-void (*tet_cleanup) () = cleanup;
-
-static void utc_location_search_poi_01();
-static void utc_location_search_poi_02();
-static void utc_location_search_poi_03();
-static void utc_location_search_poi_04();
-static void utc_location_search_poi_05();
-static void utc_location_search_poi_06();
-static void utc_location_search_poi_07();
-static void utc_location_search_poi_08();
-static void utc_location_search_poi_09();
-static void utc_location_search_poi_10();
-
-struct tet_testlist tet_testlist[] = {
- {utc_location_search_poi_01,1},
- {utc_location_search_poi_02,2},
- {utc_location_search_poi_03,3},
- {utc_location_search_poi_04,4},
- {utc_location_search_poi_05,5},
- {utc_location_search_poi_06,6},
- {utc_location_search_poi_07,7},
- {utc_location_search_poi_08,8},
- {utc_location_search_poi_09,9},
- {utc_location_search_poi_10,10},
- {NULL,0},
-};
-
-static GMainLoop *loop = NULL;
-LocationObject* loc;
-int ret;
-int isNetStarted = 0;
-
-static gboolean
-exit_loop (gpointer data)
-{
- g_main_loop_quit (loop);
- return FALSE;
-}
-
-static gboolean
-exit_loop_fail (gpointer data)
-{
- g_main_loop_quit (loop);
- tet_result(TET_FAIL);
- return FALSE;
-}
-
-static void startup()
-{
- location_init();
- loc = location_new(LOCATION_METHOD_GPS);
-
- loop = g_main_loop_new(NULL,FALSE);
- g_main_loop_run (loop);
-
- tet_printf("\n TC startup");
-}
-
-static void cleanup()
-{
- location_free(loc);
- tet_printf("\n TC End");
-}
-
-static void __location_POI_cb(LocationError error, guint req_id, GList * landmark_list, gchar * error_code, gchar * error_msg, gpointer userdata)
-{
- tet_printf("\n===== __location_POI_cb ======\n");
- if (error != LOCATION_ERROR_NONE) {
- tet_result(TET_FAIL);
- tet_printf("Failed :%d\n", error);
- }
-
- if (landmark_list) tet_result(TET_PASS);
- g_main_loop_quit (loop);
-}
-
-
-static void
-utc_location_search_poi_01()
-{
- guint req_id = 0;
- int ret = 0;
- tet_printf("Keyword-cafe, Max - 10 and sort by Distance");
- LocationPOIFilter *filter = location_poi_filter_new();
- gchar *key = g_strdup("KEYWORD");
- gchar *value = g_strdup("cafe");
- location_poi_filter_set(filter, key, value);
-
- LocationPOIPreference *pref = location_poi_pref_new();
- location_poi_pref_set_max_result(pref, 10);
- gchar *item = g_strdup("Distance");
- location_poi_pref_set_sort_by(pref, item);
- location_poi_pref_set_sort_order(pref, LOCATION_POI_PREF_SO_DESC);
-
- LocationPosition *position = location_position_new(0, 37.336723, -121.889555, 0, LOCATION_STATUS_2D_FIX);
-
- ret = location_search_poi(loc, filter, position, pref, __location_POI_cb, NULL, &req_id);
- if(ret != LOCATION_ERROR_NONE) {
- tet_result(TET_FAIL);
- tet_printf("Fail to search POI. Error[%d]\n", ret);
- } else {
- g_timeout_add_seconds(60, exit_loop_fail, NULL);
- tet_printf("Seach POI sucess, req_id %d\n", req_id);
- }
- location_poi_filter_free(filter);
- location_poi_pref_free(pref);
- location_position_free(position);
-}
-
-static void
-utc_location_search_poi_02()
-{
- guint req_id = 0;
- int ret = 0;
- tet_printf("Category-restaurant, Max - 10 and sort by Distance");
- LocationPOIFilter *filter = location_poi_filter_new();
- gchar *key = g_strdup("CATEGORY");
- gchar *value = g_strdup("restaurant");
- location_poi_filter_set(filter, key, value);
-
- LocationPOIPreference *pref = location_poi_pref_new();
- location_poi_pref_set_max_result(pref, 10);
- gchar *item = g_strdup("Distance");
- location_poi_pref_set_sort_by(pref, item);
- location_poi_pref_set_sort_order(pref, LOCATION_POI_PREF_SO_DESC);
-
- LocationPosition *position = location_position_new(0, 37.336723, -121.889555, 0, LOCATION_STATUS_2D_FIX);
-
- ret = location_search_poi(loc, filter, position, pref, __location_POI_cb, NULL, &req_id);
- if(ret != LOCATION_ERROR_NONE) {
- tet_result(TET_FAIL);
- tet_printf("Fail to search POI. Error[%d]\n", ret);
- } else {
- g_timeout_add_seconds(60, exit_loop_fail, NULL);
- tet_printf("Seach POI sucess, req_id %d\n", req_id);
- }
- location_poi_filter_free(filter);
- location_poi_pref_free(pref);
- location_position_free(position);
-}
-
-static void
-utc_location_search_poi_03()
-{
- guint req_id = 0;
- int ret = 0;
- tet_printf("POIName-cafe, Max - 20 and sort by Distance");
- LocationPOIFilter *filter = location_poi_filter_new();
- gchar *key = g_strdup("POIName");
- gchar *value = g_strdup("cafe");
- location_poi_filter_set(filter, key, value);
-
- LocationPOIPreference *pref = location_poi_pref_new();
- location_poi_pref_set_max_result(pref, 20);
- gchar *item = g_strdup("Distance");
- location_poi_pref_set_sort_by(pref, item);
- location_poi_pref_set_sort_order(pref, LOCATION_POI_PREF_SO_ASC);
-
- LocationPosition *position = location_position_new(0, 37.336723, -121.889555, 0, LOCATION_STATUS_2D_FIX);
-
- ret = location_search_poi(loc, filter, position, pref, __location_POI_cb, NULL, &req_id);
- if(ret != LOCATION_ERROR_NONE) {
- tet_result(TET_FAIL);
- tet_printf("Fail to search POI. Error[%d]\n", ret);
- } else {
- g_timeout_add_seconds(60, exit_loop_fail, NULL);
- tet_printf("Seach POI sucess, req_id %d\n", req_id);
- }
- location_poi_filter_free(filter);
- location_poi_pref_free(pref);
- location_position_free(position);
-}
-
-static void
-utc_location_search_poi_04()
-{
- guint req_id = 0;
- int ret = 0;
- tet_printf("POIName-restaurant, Max - 50 and sort by Distance");
- LocationPOIFilter *filter = location_poi_filter_new();
- gchar *key = g_strdup("POIName");
- gchar *value = g_strdup("restaurant");
- location_poi_filter_set(filter, key, value);
-
- LocationPOIPreference *pref = location_poi_pref_new();
- location_poi_pref_set_max_result(pref, 50);
- gchar *item = g_strdup("Distance");
- location_poi_pref_set_sort_by(pref, item);
- location_poi_pref_set_sort_order(pref, LOCATION_POI_PREF_SO_ASC);
-
- LocationPosition *position = location_position_new(0, 37.336723, -121.889555, 0, LOCATION_STATUS_2D_FIX);
-
- ret = location_search_poi(loc, filter, position, pref, __location_POI_cb, NULL, &req_id);
- if(ret != LOCATION_ERROR_NONE) {
- tet_result(TET_FAIL);
- tet_printf("Fail to search POI. Error[%d]\n", ret);
- } else {
- g_timeout_add_seconds(60, exit_loop_fail, NULL);
- tet_printf("Seach POI sucess, req_id %d\n", req_id);
- }
- location_poi_filter_free(filter);
- location_poi_pref_free(pref);
- location_position_free(position);
-}
-
-static void
-utc_location_search_poi_05()
-{
- guint req_id = 0;
- int ret = 0;
- tet_printf("POIName-restaurant, Max - 50 and sort by Distance");
- LocationPOIFilter *filter = location_poi_filter_new();
- gchar *key = g_strdup("POIName");
- gchar *value = g_strdup("restaurant");
- location_poi_filter_set(filter, key, value);
-
- LocationPOIPreference *pref = location_poi_pref_new();
- location_poi_pref_set_max_result(pref, 50);
- gchar *item = g_strdup("Distance");
- location_poi_pref_set_sort_by(pref, item);
- location_poi_pref_set_sort_order(pref, LOCATION_POI_PREF_SO_ASC);
-
- LocationPosition *position = location_position_new(0, 37.336723, -121.889555, 0, LOCATION_STATUS_2D_FIX);
-
- ret = location_search_poi(NULL, filter, position, pref, __location_POI_cb, NULL, &req_id);
- if(ret == LOCATION_ERROR_PARAMETER) {
- tet_result(TET_PASS);
- } else {
- tet_result(TET_FAIL);
- }
- location_poi_filter_free(filter);
- location_poi_pref_free(pref);
- location_position_free(position);
-}
-
-static void
-utc_location_search_poi_06()
-{
- guint req_id = 0;
- int ret = 0;
- tet_printf("POIName-restaurant, Max - 50 and sort by Distance");
-
- LocationPOIPreference *pref = location_poi_pref_new();
- location_poi_pref_set_max_result(pref, 50);
- gchar *item = g_strdup("Distance");
- location_poi_pref_set_sort_by(pref, item);
- location_poi_pref_set_sort_order(pref, LOCATION_POI_PREF_SO_ASC);
-
- LocationPosition *position = location_position_new(0, 37.336723, -121.889555, 0, LOCATION_STATUS_2D_FIX);
-
- ret = location_search_poi(loc, NULL, position, pref, __location_POI_cb, NULL, &req_id);
- if(ret == LOCATION_ERROR_PARAMETER) {
- tet_result(TET_PASS);
- } else {
- tet_result(TET_FAIL);
- }
- location_poi_pref_free(pref);
- location_position_free(position);
-}
-
-static void
-utc_location_search_poi_07()
-{
- guint req_id = 0;
- int ret = 0;
- tet_printf("POIName-restaurant, Max - 50 and sort by Distance");
- LocationPOIFilter *filter = location_poi_filter_new();
- gchar *key = g_strdup("POIName");
- gchar *value = g_strdup("restaurant");
- location_poi_filter_set(filter, key, value);
-
- LocationPosition *position = location_position_new(0, 37.336723, -121.889555, 0, LOCATION_STATUS_2D_FIX);
-
- ret = location_search_poi(loc, filter, position, NULL, __location_POI_cb, NULL, &req_id);
- if(ret == LOCATION_ERROR_PARAMETER) {
- tet_result(TET_PASS);
- } else {
- tet_result(TET_FAIL);
- }
- location_poi_filter_free(filter);
- location_position_free(position);
-}
-
-static void
-utc_location_search_poi_08()
-{
- guint req_id = 0;
- int ret = 0;
- tet_printf("POIName-restaurant, Max - 50 and sort by Distance");
- LocationPOIFilter *filter = location_poi_filter_new();
- gchar *key = g_strdup("POIName");
- gchar *value = g_strdup("restaurant");
- location_poi_filter_set(filter, key, value);
-
- LocationPOIPreference *pref = location_poi_pref_new();
- location_poi_pref_set_max_result(pref, 50);
- gchar *item = g_strdup("Distance");
- location_poi_pref_set_sort_by(pref, item);
- location_poi_pref_set_sort_order(pref, LOCATION_POI_PREF_SO_ASC);
-
- ret = location_search_poi(loc, filter, NULL, pref, __location_POI_cb, NULL, &req_id);
- if(ret == LOCATION_ERROR_PARAMETER) {
- tet_result(TET_PASS);
- } else {
- tet_result(TET_FAIL);
- }
-
- location_poi_filter_free(filter);
- location_poi_pref_free(pref);
-}
-
-static void
-utc_location_search_poi_09()
-{
- guint req_id = 0;
- int ret = 0;
- tet_printf("POIName-restaurant, Max - 50 and sort by Distance");
- LocationPOIFilter *filter = location_poi_filter_new();
- gchar *key = g_strdup("POIName");
- gchar *value = g_strdup("restaurant");
- location_poi_filter_set(filter, key, value);
-
- LocationPOIPreference *pref = location_poi_pref_new();
- location_poi_pref_set_max_result(pref, 50);
- gchar *item = g_strdup("Distance");
- location_poi_pref_set_sort_by(pref, item);
- location_poi_pref_set_sort_order(pref, LOCATION_POI_PREF_SO_ASC);
-
- LocationPosition *position = location_position_new(0, 37.336723, -121.889555, 0, LOCATION_STATUS_2D_FIX);
-
- ret = location_search_poi(loc, filter, position, pref, NULL, NULL, &req_id);
- if(ret == LOCATION_ERROR_PARAMETER) {
- tet_result(TET_PASS);
- } else {
- tet_result(TET_FAIL);
- }
-
- location_poi_filter_free(filter);
- location_poi_pref_free(pref);
- location_position_free(position);
-}
-
-static void
-utc_location_search_poi_10()
-{
- int ret = 0;
- tet_printf("POIName-restaurant, Max - 50 and sort by Distance");
- LocationPOIFilter *filter = location_poi_filter_new();
- gchar *key = g_strdup("POIName");
- gchar *value = g_strdup("restaurant");
- location_poi_filter_set(filter, key, value);
-
- LocationPOIPreference *pref = location_poi_pref_new();
- location_poi_pref_set_max_result(pref, 50);
- gchar *item = g_strdup("Distance");
- location_poi_pref_set_sort_by(pref, item);
- location_poi_pref_set_sort_order(pref, LOCATION_POI_PREF_SO_ASC);
-
- LocationPosition *position = location_position_new(0, 37.336723, -121.889555, 0, LOCATION_STATUS_2D_FIX);
-
- ret = location_search_poi(loc, filter, position, pref, __location_POI_cb, NULL, NULL);
- if(ret == LOCATION_ERROR_PARAMETER) {
- tet_result(TET_PASS);
- } else {
- tet_result(TET_FAIL);
- }
-
- location_poi_filter_free(filter);
- location_poi_pref_free(pref);
- location_position_free(position);
-}
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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 <glib.h>
-#include <location.h>
-
-static void startup(), cleanup();
-void (*tet_startup) () = startup;
-void (*tet_cleanup) () = cleanup;
-
-static void utc_location_start_01();
-static void utc_location_start_02();
-
-struct tet_testlist tet_testlist[] = {
- {utc_location_start_01,1},
- {utc_location_start_02,2},
- {NULL,0},
-};
-
-int ret;
-LocationObject* loc;
-
-static void startup()
-{
- ret = location_init();
- loc = location_new(LOCATION_METHOD_GPS);
- tet_printf("\n TC startup");
-}
-
-static void cleanup()
-{
- if( loc )
- location_free(loc);
- tet_printf("\n TC End");
-}
-
-static void
-utc_location_start_01()
-{
- ret = location_start(loc);
-
- tet_printf("Returned value: %d", ret);
- if (ret == LOCATION_ERROR_NONE) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
- location_stop(loc);
-}
-
-static void
-utc_location_start_02()
-{
- ret = location_start(NULL);
-
- tet_printf("Returned value: %d", ret);
- if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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 <glib.h>
-#include <location.h>
-
-static void startup(), cleanup();
-void (*tet_startup) () = startup;
-void (*tet_cleanup) () = cleanup;
-
-static void utc_location_stop_01();
-static void utc_location_stop_02();
-
-struct tet_testlist tet_testlist[] = {
- {utc_location_stop_01,1},
- {utc_location_stop_02,2},
- {NULL,0},
-};
-
-int ret;
-LocationObject* loc;
-
-static void startup()
-{
- ret = location_init();
- loc = location_new(LOCATION_METHOD_GPS);
- ret = location_start(loc);
- tet_printf("\n TC startup");
-}
-
-static void cleanup()
-{
- if( loc ){
- location_stop(loc);
- location_free(loc);
- }
- tet_printf("\n TC End");
-}
-
-static void
-utc_location_stop_01()
-{
- ret = location_stop(loc);
-
- tet_printf("Returned value: %d", ret);
- if (ret == LOCATION_ERROR_NONE) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
-static void
-utc_location_stop_02()
-{
- location_start(loc);
- ret = location_stop(NULL);
- tet_printf("Returned value: %d", ret);
- if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
-
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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 <glib.h>
-#include <location.h>
-
-#include "test_common.c"
-
-static gboolean g_is_found = FALSE;
-static void startup(), cleanup();
-void (*tet_startup) () = startup;
-void (*tet_cleanup) () = cleanup;
-
-static void utc_set_boundary_in_suwonHQ();
-static void utc_get_boundary_in_suwonHQ();
-
-struct tet_testlist tet_testlist[] = {
- {utc_set_boundary_in_suwonHQ,1},
- {utc_get_boundary_in_suwonHQ,2},
- {NULL,0},
-};
-
-int ret;
-LocationObject* loc;
-
-static void comp_boundary(LocationBoundary *bound, gpointer user_data)
-{
- LocationBoundary *check_bound = (LocationBoundary *) user_data;
-
- if(bound && bound->type == check_bound->type) {
- switch(bound->type) {
- case LOCATION_BOUNDARY_RECT:
- if(bound->rect.right_bottom->latitude == check_bound->rect.right_bottom->latitude &&
- bound->rect.right_bottom->longitude == check_bound->rect.right_bottom->longitude &&
- bound->rect.left_top->latitude == check_bound->rect.left_top->latitude &&
- bound->rect.left_top->longitude == check_bound->rect.left_top->longitude ){
- g_is_found = TRUE;
- }
- break;
-
- default:
- break;
- }
- }
-}
-
-static void startup()
-{
- location_init();
- loc = location_new(LOCATION_METHOD_GPS);
- location_start(loc);
- tet_printf("\n TC startup");
-}
-
-static void cleanup()
-{
- location_stop(loc);
- location_free(loc);
- tet_printf("\n TC End");
-}
-
-static void
-utc_set_boundary_in_suwonHQ()
-{
- int ret = 0;
- LocationPosition *rb = location_position_new(0, 37.258, 127.056, 0, LOCATION_STATUS_2D_FIX);
- LocationPosition *lt = location_position_new(0, 37.260, 127.054, 0, LOCATION_STATUS_2D_FIX);
- LocationBoundary* bound = location_boundary_new_for_rect(lt, rb);
-
- ret = location_boundary_add(loc, bound);
- if (!ret) {
- tet_result(TET_PASS);
- } else tet_result(TET_FAIL);
-
- location_position_free (rb);
- location_position_free (lt);
- location_boundary_free(bound);
-}
-
-static void
-utc_get_boundary_in_suwonHQ()
-{
- LocationPosition *rb = location_position_new(0, 37.258, 127.056, 0, LOCATION_STATUS_2D_FIX);
- LocationPosition *lt = location_position_new(0, 37.260, 127.054, 0, LOCATION_STATUS_2D_FIX);
- LocationBoundary* bound = location_boundary_new_for_rect(lt, rb);
-
- g_is_found = FALSE;
- location_boundary_foreach(loc, comp_boundary, bound);
- if(g_is_found) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-
- location_position_free (rb);
- location_position_free (lt);
- location_boundary_free (bound);
-}
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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 <glib.h>
-#include <location.h>
-
-static void startup(), cleanup();
-void (*tet_startup) () = startup;
-void (*tet_cleanup) () = cleanup;
-
-static void utc_get_method();
-
-struct tet_testlist tet_testlist[] = {
- {utc_get_method,1},
- {NULL,0},
-};
-
-int ret;
-LocationObject* loc;
-
-static void startup()
-{
- location_init();
- loc = location_new(LOCATION_METHOD_GPS);
- tet_printf("\n TC startup");
-}
-
-static void cleanup()
-{
- location_free(loc);
- tet_printf("\n TC End");
-}
-
-static void
-utc_get_method()
-{
- LocationMethod method;
- g_object_get(loc, "method", &method, NULL);
- if (method == LOCATION_METHOD_GPS) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
-}
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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 <glib.h>
-#include <location.h>
-
-static void startup(), cleanup();
-void (*tet_startup) () = startup;
-void (*tet_cleanup) () = cleanup;
-
-static void utc_location_svc_disabled();
-
-struct tet_testlist tet_testlist[] = {
- {utc_location_svc_disabled,1},
- {NULL,0},
-};
-
-static GMainLoop *loop = NULL;
-int ret;
-LocationObject* loc;
-
-gboolean
-exit_loop (gpointer data)
-{
- g_main_loop_quit (loop);
- tet_result(TET_FAIL);
- return FALSE;
-}
-
-static void startup()
-{
- location_init();
- loc = location_new(LOCATION_METHOD_GPS);
- location_start(loc);
- loop = g_main_loop_new(NULL,FALSE);
- tet_printf("\n TC startup");
-}
-
-static void cleanup()
-{
- location_stop(loc);
- location_free(loc);
- tet_printf("\n TC End");
-}
-
-static void
-cb_enabled (GObject *self,
- guint _status,
- gpointer userdata)
-{
- location_stop(loc);
-}
-
-static void
-cb_disabled (GObject *self,
- guint _status,
- gpointer userdata)
-{
- if( LOCATION_STATUS_NO_FIX <= _status && _status <= LOCATION_STATUS_3D_FIX) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
- g_main_loop_quit (loop);
-}
-
-static void
-utc_location_svc_disabled()
-{
- g_signal_connect (loc, "service-enabled", G_CALLBACK(cb_enabled), loc);
- g_signal_connect (loc, "service-disabled", G_CALLBACK(cb_disabled), loc);
- g_timeout_add_seconds(60, exit_loop, NULL);
- g_main_loop_run (loop);
-
-}
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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 <glib.h>
-#include <location.h>
-
-static void startup(), cleanup();
-void (*tet_startup) () = startup;
-void (*tet_cleanup) () = cleanup;
-
-static void utc_location_svc_enabled();
-
-struct tet_testlist tet_testlist[] = {
- {utc_location_svc_enabled,1},
- {NULL,0},
-};
-
-static GMainLoop *loop = NULL;
-int ret;
-LocationObject* loc;
-
-gboolean
-exit_loop (gpointer data)
-{
- g_main_loop_quit (loop);
- tet_result(TET_FAIL);
- return FALSE;
-}
-
-static void startup()
-{
- location_init();
- loc = location_new(LOCATION_METHOD_GPS);
- location_start(loc);
- loop = g_main_loop_new(NULL,FALSE);
- tet_printf("\n TC startup");
-}
-
-static void cleanup()
-{
- location_stop(loc);
- location_free(loc);
- tet_printf("\n TC End");
-}
-
-static void
-_cb_svc_enabled (GObject *self,
- guint _status,
- gpointer userdata)
-{
- if (LOCATION_STATUS_NO_FIX <= _status && _status <= LOCATION_STATUS_3D_FIX) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
- g_main_loop_quit(loop);
-}
-
-static void
-utc_location_svc_enabled()
-{
- g_signal_connect (loc, "service-enabled", G_CALLBACK(_cb_svc_enabled), loc);
- g_timeout_add_seconds(60, exit_loop, NULL);
- g_main_loop_run (loop);
-}
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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 <glib.h>
-#include <location.h>
-
-static void startup(), cleanup();
-void (*tet_startup) () = startup;
-void (*tet_cleanup) () = cleanup;
-
-static void utc_location_svc_updated();
-
-struct tet_testlist tet_testlist[] = {
- {utc_location_svc_updated,1},
- {NULL,0},
-};
-
-static GMainLoop *loop = NULL;
-int ret;
-LocationObject* loc;
-
-gboolean
-exit_loop (gpointer data)
-{
- g_main_loop_quit (loop);
- tet_result(TET_FAIL);
- return FALSE;
-}
-
-static void startup()
-{
- location_init();
- loc = location_new(LOCATION_METHOD_GPS);
- location_start(loc);
- loop = g_main_loop_new(NULL,FALSE);
- tet_printf("\n TC startup");
-}
-
-static void cleanup()
-{
- location_stop(loc);
- location_free(loc);
- tet_printf("\n TC End");
-}
-
-static void
-cb_updated (GObject *self,
- guint type,
- gpointer data,
- gpointer accuracy,
- gpointer userdata)
-{
- if ( POSITION_UPDATED <= type && type <= REVERSEGEOCODE_UPDATED) tet_result(TET_PASS);
- else tet_result(TET_FAIL);
- g_main_loop_quit (loop);
-}
-
-static void
-utc_location_svc_updated()
-{
- g_signal_connect (loc, "service-updated", G_CALLBACK(cb_updated), loc);
- g_timeout_add_seconds(60, exit_loop, NULL);
- g_main_loop_run (loop);
-}
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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 <glib.h>
-#include <location.h>
-
-static void startup(), cleanup();
-void (*tet_startup) () = startup;
-void (*tet_cleanup) () = cleanup;
-
-static void utc_zone_in();
-
-struct tet_testlist tet_testlist[] = {
- {utc_zone_in,1},
- {NULL,0},
-};
-
-static GMainLoop *loop = NULL;
-int ret;
-LocationObject* loc;
-
-gboolean
-exit_loop (gpointer data)
-{
- g_main_loop_quit (loop);
- tet_result(TET_FAIL);
- return FALSE;
-}
-
-static void startup()
-{
- location_init();
- loc = location_new(LOCATION_METHOD_GPS);
- location_start(loc);
- loop = g_main_loop_new(NULL,FALSE);
-
- LocationPosition *rb = location_position_new(0, 37.254, 127.057, 0, LOCATION_STATUS_2D_FIX);
- LocationPosition *lt = location_position_new(0, 37.261, 127.050, 0, LOCATION_STATUS_2D_FIX);
- LocationBoundary* bound = location_boundary_new_for_rect(lt, rb);
- location_boundary_add(loc, bound);
-
- location_position_free (rb);
- location_position_free (lt);
- location_boundary_free (bound);
- tet_printf("\n TC startup");
-}
-
-static void cleanup()
-{
- location_stop(loc);
- location_free(loc);
- tet_printf("\n TC End");
-}
-
-static void
-cb_zone_in(LocationObject *self,
- guint type,
- gpointer position,
- gpointer accuracy)
-{
- LocationPosition *pos = (LocationPosition*) position;
-
- if( (37.255 <= pos->latitude && pos->latitude <= 37.265) &&
- (127.052 <= pos->longitude && pos->longitude <= 127.058)) tet_result(TET_PASS); // I am in Suwon HQ
- else tet_result(TET_FAIL);
- g_main_loop_quit(loop);
-}
-
-static void
-utc_zone_in()
-{
- g_signal_connect (loc, "zone-in", G_CALLBACK(cb_zone_in), loc);
- g_timeout_add_seconds(60, exit_loop, NULL);
- g_main_loop_run (loop);
-}
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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 <glib.h>
-#include <location.h>
-
-static void startup(), cleanup();
-void (*tet_startup) () = startup;
-void (*tet_cleanup) () = cleanup;
-
-static void utc_zone_out();
-
-struct tet_testlist tet_testlist[] = {
- {utc_zone_out,1},
- {NULL,0},
-};
-
-static GMainLoop *loop = NULL;
-int ret;
-LocationObject* loc;
-
-gboolean
-exit_loop (gpointer data)
-{
- g_main_loop_quit (loop);
- tet_result(TET_FAIL);
- return FALSE;
-}
-
-static void startup()
-{
- location_init();
- loc = location_new(LOCATION_METHOD_GPS);
- location_start(loc);
- loop = g_main_loop_new(NULL,FALSE);
-
- LocationPosition *rb = location_position_new(0, 36.395, 25.41, 0, LOCATION_STATUS_2D_FIX);
- LocationPosition *lt = location_position_new(0, 36.413, 25.388, 0, LOCATION_STATUS_2D_FIX);
- LocationBoundary* bound = location_boundary_new_for_rect(lt, rb);
- location_boundary_add(loc, bound);
-
- location_position_free (rb);
- location_position_free (lt);
- location_boundary_free (bound);
- tet_printf("\n TC startup");
-}
-
-static void cleanup()
-{
- location_stop(loc);
- location_free(loc);
- tet_printf("\n TC End");
-}
-
-static void
-_cb_zone_out(LocationObject *self,
- guint type,
- gpointer position,
- gpointer accuracy)
-{
- LocationPosition *pos = (LocationPosition*) position;
-
- if( (37.255 <= pos->latitude && pos->latitude <= 37.265) &&
- (27.052 <= pos->longitude && pos->longitude <= 127.060) ) tet_result(TET_PASS); // I am in Suwon HQ
- else tet_result(TET_FAIL);
- g_main_loop_quit(loop);
-}
-
-
-static void
-utc_zone_out()
-{
- g_signal_connect (loc, "zone-out", G_CALLBACK(_cb_zone_out), loc);
- g_timeout_add_seconds(60, exit_loop, NULL);
- g_main_loop_run (loop);
-}
+++ /dev/null
-#!/bin/sh
-rm -f config.cache
-rm -f acconfig.h
-
-echo "- libtoolize..."
-libtoolize --force || exit $?
-
-echo "- aclocal..."
-aclocal --force -I m4 || exit $?
-
-echo "- autoheader..."
-autoheader --force || exit $?
-
-echo "- automake..."
-automake --add-missing --force-missing || exit $?
-
-echo "- autoconf..."
-autoconf --force || exit $?
-
-echo "- ready!"
-exit
+++ /dev/null
-# Initialize
-AC_PREREQ(2.61)
-AC_INIT(Location, 0.1, [sena06.kim@samsung.com])
-AC_CONFIG_AUX_DIR([build-aux])
-AC_CONFIG_MACRO_DIR([m4])
-AC_CONFIG_HEADER([config.h])
-AC_CONFIG_SRCDIR([location])
-AM_INIT_AUTOMAKE([1.10.2 foreign -Wall -Werror subdir-objects])
-
-# Check programs for making executable
-m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
-AC_PROG_CC
-AM_PROG_CC_C_O
-AC_PROG_INSTALL
-
-# Check programs for making libraries.
-AM_PROG_LIBTOOL
-AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
-
-# Add default build options to CFLAGS, LDFLAGS
-if test "x$GCC" = "xyes"; then
- CFLAGS="$CFLAGS -Wall" # -Werror
- LDFLAGS="$LDFLAGS -Wl,-z,defs -Wl,--as-needed -Wl,--hash-style=both"
-fi
-
-# Add -g option to CFLAGS
-AC_ARG_ENABLE([debug],
- [AC_HELP_STRING([--enable-debug],[turn on debugging [default=no]])],
- [case "${enableval}" in
- yes) enable_dbg=yes ;;
- no) enable_dbg=no ;;
- *) AC_MSG_ERROR([Bad value ${enableval} for --enable-debug]) ;;
- esac],[enable_dbg=no])
-if ([test "x$enable_dbg" = xyes]); then
- CFLAGS="$CFLAGS -g"
-fi
-
-# Check GCC EFL visibility
-AC_MSG_CHECKING(for ELF visibility)
-AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([[
- __attribute__((visibility("default")))
- int var=10;
- ]])],
- [has_visibility=yes
- AC_DEFINE([EXPORT_API], [__attribute__((visibility("default")))], [Symbol visibility prefix])
- CFLAGS="$CFLAGS -fvisibility=hidden"],
- [has_visibility=no
- AC_DEFINE([EXPORT_API], [], [Symbol visibility prefix]) ]
-)
-AC_MSG_RESULT($has_visibility)
-
-# Check dependencies
-PKG_CHECK_MODULES(LOCATION, [glib-2.0 gobject-2.0 dbus-glib-1 gmodule-2.0 vconf vconf-internal-keys])
-AC_SUBST(LOCATION_LIBS)
-AC_SUBST(LOCATION_CFLAGS)
-
-#PKG_CHECK_MODULES(TEST, [glib-2.0 gconf-2.0 json-glib-1.0])
-#AC_SUBST(TEST_LIBS)
-#AC_SUBST(TEST_CFLAGS)
-
-# Check dlog libraries
-AC_ARG_ENABLE([dlog],
- [AC_HELP_STRING([--enable-dlog],[show dlog message [default=no]])],
- [case "${enableval}" in
- yes) enable_dlog=yes ;;
- no) enable_dlog=no ;;
- *) AC_MSG_ERROR([Bad value ${enableval} for --enable-dlog]) ;;
- esac],[enable_dlog=no])
-if ([test "x$enable_dlog" = xyes]); then
- PKG_CHECK_MODULES(DLOG, [dlog], have_dlog="yes", have_dlog="no")
- AC_SUBST(DLOG_LIBS)
- AC_SUBST(DLOG_CFLAGS)
- if test "x$have_dlog" = "xyes"; then
- LOCATION_CFLAGS="$LOCATION_CFLAGS -DLOCATION_DLOG_DEBUG $DLOG_CFLAGS"
- LOCATION_LIBS="$LOCATION_LIBS $DLOG_LIBS"
- fi
-fi
-LOCATION_CFLAGS="$LOCATION_CFLAGS -DLIBPATH=\\\"$libdir\\\""
-# Generate files
-AC_CONFIG_FILES([
-location.pc
-Makefile
-location/Makefile
-location/manager/Makefile
-location/map-service/Makefile
-location/module/Makefile
-])
-
-AC_OUTPUT
--- /dev/null
+prefix=@PREFIX@
+exec_prefix=@PREFIX@
+libdir=@LIBDIR@
+includedir=@INCLUDEDIR@/location
+
+Name: location
+Description: Tizen Location FW
+Requires: glib-2.0 gobject-2.0 gmodule-2.0 vconf
+Version: @VERSION@
+Libs: -L${libdir} -llbs-location
+Cflags: -I${includedir} -I${includedir}/location
+++ /dev/null
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-datarootdir = @datarootdir@
-datadir=@datadir@
-
-Name: location
-Description: SLP Location FW
-Requires: glib-2.0 gobject-2.0 gmodule-2.0 vconf
-Version: @VERSION@
-Libs: -L${libdir} -lSLP-location
-Cflags: -I${includedir} -I${includedir}/location
--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(location C)
+
+SET(LIB_NAME "lbs-location")
+SET(INC_DIR "include")
+SET(MANAGER_DIR "manager")
+SET(MODULE_DIR "module")
+
+IF(FEATURE_PROFILE_WEARABLE)
+ MESSAGE("<<< Wearable Profile >>>")
+ELSE(FEATURE_PROFILE_WEARABLE)
+ MESSAGE("<<< Mobile Profile >>>")
+ ADD_DEFINITIONS("-DTIZEN_PROFILE_MOBILE")
+ENDIF(FEATURE_PROFILE_WEARABLE)
+
+ADD_DEFINITIONS("-DLIBDIR=\"${LIBDIR}\"")
+
+INCLUDE_DIRECTORIES(
+ ${INC_DIR}
+ ${MANAGER_DIR}
+ ${MODULE_DIR}
+)
+
+### Build ###
+SET(SRCS
+ ${MANAGER_DIR}/location.c
+ ${MANAGER_DIR}/location-marshal.c
+ ${MANAGER_DIR}/location-ielement.c
+ ${MANAGER_DIR}/location-setting.c
+ ${MANAGER_DIR}/location-position.c
+ ${MANAGER_DIR}/location-batch.c
+ ${MANAGER_DIR}/location-velocity.c
+ ${MANAGER_DIR}/location-accuracy.c
+ ${MANAGER_DIR}/location-boundary.c
+ ${MANAGER_DIR}/location-satellite.c
+ ${MANAGER_DIR}/location-signaling-util.c
+ ${MANAGER_DIR}/location-common-util.c
+ ${MANAGER_DIR}/location-gps.c
+ ${MANAGER_DIR}/location-wps.c
+ ${MANAGER_DIR}/location-privacy.c
+
+ ${MODULE_DIR}/module-internal.c
+)
+
+SET(SRCS_MOBILE
+ ${MANAGER_DIR}/location-hybrid-mobile.c
+)
+
+SET (INSTALL_HEADERS
+ ${INC_DIR}/location-types.h
+
+ ${MANAGER_DIR}/location.h
+ ${MANAGER_DIR}/location-position.h
+ ${MANAGER_DIR}/location-batch.h
+ ${MANAGER_DIR}/location-velocity.h
+ ${MANAGER_DIR}/location-accuracy.h
+ ${MANAGER_DIR}/location-boundary.h
+ ${MANAGER_DIR}/location-satellite.h
+
+ ${MODULE_DIR}/location-module.h
+)
+
+ADD_LIBRARY(${LIB_NAME} SHARED ${SRCS} ${SRCS_MOBILE})
+TARGET_LINK_LIBRARIES(${LIB_NAME} ${pkgs_LDFLAGS} -lm)
+SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES VERSION ${FULLVER} SOVERSION ${MAJORVER} CLEAN_DIRECT_OUTPUT 1)
+
+IF (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${MANAGER_DIR}/location-marshal.c)
+ MESSAGE ("")
+ MESSAGE ("<<< Generating location-marshal.c >>>")
+
+ EXECUTE_PROCESS(
+ COMMAND glib-genmarshal --header --prefix=location ${CMAKE_CURRENT_SOURCE_DIR}/manager/location-marshal.list
+ OUTPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/manager/location-marshal.h
+ )
+
+ EXECUTE_PROCESS(
+ COMMAND glib-genmarshal --body --prefix=location ${CMAKE_CURRENT_SOURCE_DIR}/manager/location-marshal.list
+ OUTPUT_VARIABLE marshal_var
+ )
+
+ EXECUTE_PROCESS(
+ COMMAND echo "#include \"location-marshal.h\" ${marshal_var}"
+ OUTPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/manager/location-marshal.c
+ )
+
+ENDIF (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${MANAGER_DIR}/location-marshal.c)
+
+INSTALL(TARGETS ${LIB_NAME} DESTINATION ${LIBDIR} COMPONENT Runtime)
+FOREACH(ITEM IN ITEMS ${INSTALL_HEADERS})
+ MESSAGE ("${ITEM}")
+ INSTALL(FILES ${ITEM} DESTINATION ${INCLUDEDIR}/${PROJECT_NAME})
+ENDFOREACH()
+++ /dev/null
-SUBDIRS = manager map-service module
-lib_LTLIBRARIES = libSLP-location.la
-
-COMMON_HEADER_DIR = include
-MANAGER_DIR = manager
-MAP_SERVICE_DIR = map-service
-MODULE_DIR = module
-
-libSLP_location_la_SOURCES = \
- manager/location.c\
- map-service/location-map-service.c
-
-
-libSLP_location_la_CFLAGS = \
- -fPIC\
- -I${srcdir} \
- -I${srcdir}/include \
- -I${srcdir}/${MANAGER_DIR} \
- -I${srcdir}/${MODULE_DIR} \
- -I${srcdir}/${MAP_SERVICE_DIR} \
- $(LOCATION_CFLAGS)
-
-libSLP_location_la_LIBADD = \
- ${MANAGER_DIR}/liblocation-manager.la \
- ${MAP_SERVICE_DIR}/liblocation-map-service.la \
- ${MODULE_DIR}/liblocation-module.la \
- -lm\
- $(LOCATION_LIBS)
-
-libSLP_location_includedir = $(includedir)/location
-libSLP_location_include_HEADERS = \
- ${COMMON_HEADER_DIR}/location-types.h \
- ${COMMON_HEADER_DIR}/location-map-types.h \
- ${MANAGER_DIR}/location.h \
- ${MANAGER_DIR}/location-position.h \
- ${MANAGER_DIR}/location-velocity.h \
- ${MANAGER_DIR}/location-accuracy.h \
- ${MANAGER_DIR}/location-boundary.h \
- ${MANAGER_DIR}/location-satellite.h \
- ${MAP_SERVICE_DIR}/location-address.h \
- ${MAP_SERVICE_DIR}/location-map-service.h \
- ${MAP_SERVICE_DIR}/location-map-service-ext.h \
- ${MAP_SERVICE_DIR}/location-poi.h \
- ${MAP_SERVICE_DIR}/location-route.h \
- ${MAP_SERVICE_DIR}/location-route-ext.h \
- ${MAP_SERVICE_DIR}/location-geocode.h \
- ${MAP_SERVICE_DIR}/location-map-pref.h \
- ${MAP_SERVICE_DIR}/location-landmark.h \
- ${MAP_SERVICE_DIR}/location-landmark-ext.h \
- ${MODULE_DIR}/location-module.h
* Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
+ * Genie Kim <daejins.kim@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/* Tag defines */
#define TAG_LOCATION_FWK "LOCATION"
-
-#ifdef LOCATION_DLOG_DEBUG /* if debug mode, show filename & line number */
-#include <dlog.h>
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#define LOG_TAG TAG_LOCATION_FWK
-#endif
-
-#define LOCATION_LOGD(fmt,args...) LOGD(fmt, ##args)
-#define LOCATION_LOGW(fmt,args...) LOGW(fmt, ##args)
-#define LOCATION_LOGI(fmt,args...) LOGI(fmt, ##args)
-#define LOCATION_LOGE(fmt,args...) LOGE(fmt, ##args)
-#elif LOCATION_DLOG_RELEASE /* if release mode */
#include <dlog.h>
-
#ifdef LOG_TAG
#undef LOG_TAG
#define LOG_TAG TAG_LOCATION_FWK
#endif
-#define LOCATION_LOGD(fmt,args...) LOGD(fmt, ##args)
-#define LOCATION_LOGW(fmt,args...) LOGW(fmt, ##args)
-#define LOCATION_LOGI(fmt,args...) LOGI(fmt, ##args)
-#define LOCATION_LOGE(fmt,args...) LOGE(fmt, ##args)
-#else /* if do not use dlog */
-#define LOCATION_LOGD(...) g_debug(__VA_ARGS__)
-#define LOCATION_LOGW(...) g_warning(__VA_ARGS__)
-#define LOCATION_LOGI(...) g_message(__VA_ARGS__)
-#define LOCATION_LOGE(...) g_error(__VA_ARGS__)
-#endif
+#define LOCATION_LOGD(fmt,args...) LOGD(fmt, ##args)
+#define LOCATION_LOGW(fmt,args...) LOGW(fmt, ##args)
+#define LOCATION_LOGI(fmt,args...) LOGI(fmt, ##args)
+#define LOCATION_LOGE(fmt,args...) LOGE(fmt, ##args)
+#define LOCATION_SECLOG(fmt,args...) SECURE_LOGW(fmt, ##args)
#endif
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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 __LOCATION_MAP_TYPES_H__
-#define __LOCATION_MAP_TYPES_H__
-
-#include <glib.h>
-#include <glib-object.h>
-#include <location-types.h>
-
-G_BEGIN_DECLS
-
-/**
- * @file location-map-types.h
- * @brief This file contains the Location related structure, enumeration, and asynchronous function definitions.
- * @addtogroup LocationFW
- * @{
- * @defgroup LocationMapTypes Location Map Types
- * @brief This sub module provides structure, enumeration, and asynchronous function definitions.
- * @addtogroup LocationMapTypes
- * @{
- */
-
-typedef enum {
- MAP_SERVICE_PREF_LANGUAGE,
- MAP_SERVICE_PREF_COUNTRY,
- MAP_SERVICE_PREF_DISTANCE_UNIT,
-
- MAP_SERVICE_PREF_PROPERTY,
-
- MAP_SERVICE_GEOCODE_TYPE,
- MAP_SERVICE_GEOCODE_PREF_PROPERTY,
- MAP_SERVICE_REVERSE_GEOCODE_TYPE,
-
- MAP_SERVICE_POI_TYPE,
- MAP_SERVICE_POI_SEARCH_BY_ADDRESS,
- MAP_SERVICE_POI_SEARCH_BY_FREEFORM_ADDRESS,
- MAP_SERVICE_POI_SEARCH_BY_CIRCLE_BOUNDARY,
- MAP_SERVICE_POI_SEARCH_BY_RECT_BOUNDARY,
- MAP_SERVICE_POI_SEARCH_BY_POLYGON_BOUNDARY,
- MAP_SERVICE_POI_PREF_SORT_BY,
- MAP_SERVICE_POI_PREF_PROPERTY,
- MAP_SERVICE_POI_FILTER,
- MAP_SERVICE_POI_FILTER_CATEGORY,
-
- MAP_SERVICE_ROUTE_REQUEST_FREEFORM_ADDR_TO_AVOID,
- MAP_SERVICE_ROUTE_REQUEST_STRUCTED_ADDR_TO_AVOID,
- MAP_SERVICE_ROUTE_REQUEST_CIRCLE_AREA_TO_AVOID,
- MAP_SERVICE_ROUTE_REQUEST_RECT_AREA_TO_AVOID,
- MAP_SERVICE_ROUTE_REQUEST_POLYGON_AREA_TO_AVOID,
- MAP_SERVICE_ROUTE_REQUEST_FEATURE_TO_AVOID,
- MAP_SERVICE_ROUTE_PREF_TYPE,
- MAP_SERVICE_ROUTE_PREF_TRANSPORT_MODE,
- MAP_SERVICE_ROUTE_PREF_GEOMETRY_BOUNDING_BOX,
- MAP_SERVICE_ROUTE_PREF_GEOMETRY_RETRIEVAL,
- MAP_SERVICE_ROUTE_PREF_INSTRUCTION_GEOMETRY,
- MAP_SERVICE_ROUTE_PREF_INSTRUCTION_BOUNDING_BOX,
- MAP_SERVICE_ROUTE_PREF_INSTRUCTION_RETRIEVAL,
- MAP_SERVICE_ROUTE_PREF_REALTIME_TRAFFIC,
- MAP_SERVICE_ROUTE_PREF_PROPERTY,
- MAP_SERVICE_ROUTE_DISTANCE_UNIT,
- MAP_SERVICE_ROUTE_PROPERTY,
- MAP_SERVICE_ROUTE_SEGMENT_PROPERTY,
- MAP_SERVICE_ROUTE_STEP_PROPERTY,
- MAP_SERVICE_TYPE_MAX
-
-} LocationMapServiceType;
-
-/**
-* This enumeration defines values that represent road and road feature
-* types.
-*/
-typedef enum {
- FOW_UNDEFINED, ///< Indicates that the road or road type is undefined/unknown.
- FOW_MOTORWAY, ///< Identifies a road as a motorway.
- FOW_MULTI_CARRIAGEWAY, ///< Identifies a road as a multi-lane carriageway.
- FOW_SINGLE_CARRIAGEWAY, ///< Identifies a road as a single carriageway.
- FOW_ROUNDABOUT, ///< Identifies a road feature as a roundabout/rotary.
- FOW_SPECIAL_TRAFFIC_FIGURE, ///< Identifies a road features as a special traffic figure.
- FOW_SLIPROAD, ///< Identifies a road as a slip road.
- FOW_PEDESTRIAN_ZONE, ///< Identifies an area or road section as a pedestrian zone.
- FOW_PEDESTRIAN_WALKWAY, ///< Identifies a pedestrian walkway.
- FOW_SERVICE_ACCESS_PARKING, ///< Identifies access to a parking facility.
- FOW_SERVICE_ACCESS_OTHER, ///< Identifies access to an unspecified service or facility.
- FOW_SERVICE_ROAD, ///< Identifies a road as a service road.
- FOW_ETA_PARKING_PLACE, ///< Identifies a parking facility.
- FOW_ETA_PARKING_BUILDING, ///< Identifies a parking house.
- FOW_ETA_UNSTRUCTURED_TRAFFIC_SQUARE, ///< Identifies an unstructured traffic square.
- FOW_ROAD_FOR_AUTHORITIES ///< Identifies a road restricted for authorized access only.
-} FormOfWay;
-
-/**
-* This enumeration defines identifiers indicating the validity of the
-* estimated time of arrival (ETA) and of the desired time of arrival (DTA)
-* set with <code>RoutePlan::set_time(...)</code>. These values are
-* returned by the method method <code>get_eta()</code>.
-*/
-typedef enum {
- ROUTE_ETA_INVALID, ///< Indicates that the ETA for the given route is not calculated or otherwise invalid.
- ROUTE_ETA_VALID, ///< Indicates that the ETA is valid, but the route plan did not include DTA.
- ROUTE_ETA_DTA_VALID, ///< Indicates that both the ETA and DTA are valid.
- ROUTE_ETA_DTA_LATE, ///< Indicates that the DTA cannot be achieved.
- ROUTE_ETA_DTA_IN_PAST ///< Indicates that the DTA is in the past.
-} RouteETAValidity;
-
-/**
-* This enumeration defines identifiers for travel direction indicators.
-*/
-typedef enum {
- UNDEFINED = 0x00, ///< Indicates that direction is undefined.
- STRAIGHT = 0x01, ///< Indicates direction as "straight".
- SLIGHTLY_RIGHT = 0x02, ///< Indicates direction as "slightly right".
- RIGHT = 0x04, ///< Indicates direction as "right".
- SHARP_RIGHT = 0x08, ///< Indicates direction as "sharp right".
- U_TURN_LEFT = 0x10, ///< Indicates a left u-turn.
- SHARP_LEFT = 0x20, ///< Indicates direction as "sharp left".
- LEFT = 0x40, ///< Indicates direction as "left".
- SLIGHTLY_LEFT = 0x80, ///< Indicates direction as "slightly left".
- U_TURN_RIGHT = 0x100, ///< Indicates a right u-turn.
- DIRECTION_UNKNOWN = 0xFFFFFFFF ///< Indicates that direction is unknown.
-} DIRECTION;
-
-/**
- * This enumeration defines identifiers to represent driving direction on a road segment.
- *
- * @ingroup basicTypes
- */
-typedef enum {
- DIR_BOTH, ///< Indicates that the road segment can be traveled in both directions.
- DIR_FORWARD, ///< Indicates that the road segment can be traveled from start to end, relative to the road geometry.
- DIR_BACKWARD ///< Indicates that the road segment can be traveled from end to start, relative to the road geometry.
-} DrivingDirection;
-
-
-/** Possible traffic directions - what side of road one
-* has to drive
-*/
-typedef enum {
- ///< Traffic is left sided (for example UK, Australia)
- TRAFFIC_DIR_LEFT,
- ///< Traffic is right sided
- TRAFFIC_DIR_RIGHT
-} TrafficDirection;
-
-/** Types of transit. */
-typedef enum {
- TRANSIT_TYPE_BUS_PUBLIC = 0,
- TRANSIT_TYPE_BUS_TOURISTIC,
- TRANSIT_TYPE_BUS_INTERCITY,
- TRANSIT_TYPE_BUS_EXPRESS,
- TRANSIT_TYPE_RAIL_METRO,
- TRANSIT_TYPE_RAIL_LIGHT,
- TRANSIT_TYPE_RAIL_REGIONAL,
- TRANSIT_TYPE_TRAIN_REGIONAL,
- TRANSIT_TYPE_TRAIN_INTERCITY,
- TRANSIT_TYPE_TRAIN_HIGH_SPEED,
- TRANSIT_TYPE_MONORAIL,
- TRANSIT_TYPE_AERIAL, ///< Cable car
- TRANSIT_TYPE_INCLINED,
- TRANSIT_TYPE_WATER,
- TRANSIT_TYPE_AIRLINE,
- TRANSIT_TYPE_RESERVED, ///< Reserved for future usage
- TRANSIT_TYPE_COUNT,
- TRANSIT_TYPE_UNKNOWN = TRANSIT_TYPE_COUNT
-} TransitType;
-
-typedef enum
-{
- OFFLINE, ///< Search offline
- ONLINE, ///< Search online
- HYBRID ///< Search online and offline, return results of one or both
-} ConnectivityMode;
-
-/**
- * @brief Location Map Object redefined by GObject.
- */
-typedef GObject LocationMapObject;
-
-/**
- * @brief This represents a structure of ratings.
- */
-typedef struct _LandmarkRating LandmarkRating;
-
-/**
- * @brief This represents address information such as building number, street name, etc.
- */
-typedef struct _LocationAddress LocationAddress;
-
-/**
- * @brief This represents a structure of Location geocode preference.
- */
-typedef struct _LocationGeocodePreference LocationGeocodePreference;
-
-/**
- * @brief This represents a structure of Location Map Preference.
- */
-typedef struct _LocationMapPref LocationMapPref;
-
-/**
- * @brief This represents a structure of Location POI filter.
- */
-typedef struct _LocationPOIFilter LocationPOIFilter;
-
-/**
- * @brief This represents a structure of Location POI preference.
- */
-typedef struct _LocationPOIPreference LocationPOIPreference;
-
-/**
- * @brief This represents a structure of Place Attribute.
- */
-typedef struct _LandmarkAttribute LandmarkAttribute;
-
-/**
- * @brief This represents a structure of Contact Detail.
- */
-typedef struct _LandmarkContact LandmarkContact;
-
-/**
- * @brief This represents a structure of Link Object.
- */
-typedef struct _LandmarkLinkObject LandmarkLinkObject;
-
-/**
- * @brief This represents a structure of LandmarkMedia.
- */
-
-typedef struct _LandmarkMedia LandmarkMedia;
-
-/**
- * @brief This represents a structure of LandmarkImage.
- */
-typedef struct _LandmarkImage LandmarkImage;
-
-/**
- * @brief This represents a structure of LandmarkCategory.
- */
-typedef struct _LandmarkCategory LandmarkCategory;
-
-/**
- * @brief This represents a structure of LandmarkEditorial.
- */
-typedef struct _LandmarkEditorial LandmarkEditorial;
-
-/**
- * @brief This represents a structure of LandmarkReview.
- */
-typedef struct _LandmarkReview LandmarkReview;
-
-/**
- * @brief This represents a structure of Landmark information.
- */
-typedef struct _LocationLandmark LocationLandmark;
-
-/**
- * @brief This represents a structure of Landmark Url.
- */
-typedef struct _LocationLandmarkUrl LocationLandmarkUrl;
-
-/**
- * @brief This represents a structure of Location route preference.
- */
-typedef struct _LocationRoutePreference LocationRoutePreference;
-
-/**
- * @brief This represents a structure of Location route.
- */
-typedef struct _LocationRoute LocationRoute;
-
-/**
- * @brief This represents a structure of Location route segment.
- */
-typedef struct _LocationRouteSegment LocationRouteSegment;
-
-/**
- * @brief This represents a structure of Location route step.
- */
-typedef struct _LocationRouteStep LocationRouteStep;
-
-/**
- * @brief This represents a structure of Location maneuver.
- */
-typedef struct _LocationRouteManeuver LocationRouteManeuver;
-
-/**
- * @brief This represents a structure of Location public transit stop.
- */
-typedef struct _LocationRouteTransitStop LocationRouteTransitStop;
-
-/**
- * @brief This represents a structure of Location Road or Public transit element.
- */
-typedef struct _LocationRoadElement LocationRoadElement;
-
-/**
- * @brief This represents a structure of Location Road Element Penalty.
- */
-typedef struct _LocationRoadElementPenalty LocationRoadElementPenalty;
-
-/**
- * @brief This represents a structure of Location Route Lane infomation.
- */
-typedef struct _LocationRouteLaneInfo LocationRouteLaneInfo;
-
-/**
- * @brief This represents a structure of Location Route options.
- */
-typedef struct _LocationRouteOptions LocationRouteOptions;
-
-
-/**
- * @brief This represents callback function which will be called to give position information.
- */
-typedef void (*LocationPositionCB)(LocationError error, GList *position_list, GList *accuracy_list, gpointer userdata);
-
-/**
- * @brief This represents callback function which will be called to give address information.
- */
-typedef void (*LocationAddressCB)(LocationError error, LocationAddress *address, LocationAccuracy *acc, gpointer userdata);
-
-/**
- * @brief This represents callback function which will be called to give POI information.
- */
-typedef void (*LocationPOICB)(LocationError error, guint req_id, GList *landmark_list, gchar *error_code, gchar *error_msg, gpointer userdata);
-
-/**
- * @brief This represents callback function which will be called to give Route information.
- */
-typedef void (*LocationRouteCB)(LocationError error, guint req_id, GList *route_list, gchar *error_code, gchar *error_msg, gpointer userdata);
-
-/**
- * @}@}
- */
-
-G_END_DECLS
-
-#endif /* __LOCATION_MAP_TYPES_H__ */
* Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
+ * Genie Kim <daejins.kim@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* @brief This represents the returned error code of used functions.
*/
typedef enum {
- LOCATION_ERROR_NONE = 0, ///< Success.
- LOCATION_ERROR_NOT_ALLOWED, ///< Location servie is not allowed.
- LOCATION_ERROR_NOT_AVAILABLE, ///< Location service is not available.
- LOCATION_ERROR_NETWORK_FAILED, ///< Network is not available.
- LOCATION_ERROR_NETWORK_NOT_CONNECTED, ///< Network is not connected.
- LOCATION_ERROR_CONFIGURATION, ///< Configuration setting is not correct.
- LOCATION_ERROR_PARAMETER, ///< Input parameter is not correct.
- LOCATION_ERROR_NOT_FOUND, ///< Output is not found.
- LOCATION_ERROR_NOT_SUPPORTED, ///< Not supported.
- LOCATION_ERROR_UNKNOWN, ///< Unknown error.
- LOCATION_ERROR_SETTING_OFF, ///< Location setting(GPS/WPS) is off
- LOCATION_ERROR_SECURITY_DENIED, ///< system disables location service.
+ LOCATION_ERROR_NONE = 0, /*/< Success. */
+ LOCATION_ERROR_NOT_ALLOWED, /*/< Location servie is not allowed from privacy settings. */
+ LOCATION_ERROR_NOT_AVAILABLE, /*/< Location service is not available. */
+ LOCATION_ERROR_NETWORK_FAILED, /*/< Network is not available. */
+ LOCATION_ERROR_NETWORK_NOT_CONNECTED, /*/< Network is not connected. */
+ LOCATION_ERROR_CONFIGURATION, /*/< Configuration setting is not correct. */
+ LOCATION_ERROR_PARAMETER, /*/< Input parameter is not correct. */
+ LOCATION_ERROR_NOT_FOUND, /*/< Output is not found. */
+ LOCATION_ERROR_NOT_SUPPORTED, /*/< Not supported. */
+ LOCATION_ERROR_UNKNOWN, /*/< Unknown error. */
+ LOCATION_ERROR_SETTING_OFF, /*/< Location service(GPS/WPS) is off in location settings. */
+ LOCATION_ERROR_SECURITY_DENIED, /*/< System disables location service. */
} LocationError;
/**
* @brief This represents location method to be used.
*/
-typedef enum
-{
- LOCATION_METHOD_NONE = -1, ///< Undefined method.
- LOCATION_METHOD_HYBRID = 0, ///< This method selects best method.
- LOCATION_METHOD_GPS, ///< This method uses Global Positioning System.
- LOCATION_METHOD_WPS, ///< This method uses Wifi Positioning System.
- LOCATION_METHOD_CPS, ///< This method uses cell ID of base station.
+typedef enum {
+ LOCATION_METHOD_NONE = -1, /*/< Undefined method. */
+ LOCATION_METHOD_HYBRID = 0, /*/< This method selects best method. */
+ LOCATION_METHOD_GPS, /*/< This method uses Global Positioning System. */
+ LOCATION_METHOD_WPS, /*/< This method uses Wifi Positioning System. */
+ LOCATION_METHOD_MAX, /*/< The numer of methods */
} LocationMethod;
/**
* @brief This represents the update type given by signal callback.
*/
typedef enum {
- UPDATE_TYPE_NONE = -1, ///< Undefined update type.
- POSITION_UPDATED = 0, ///< This type is used when position information is updated.
- VELOCITY_UPDATED, ///< This type is used when velocity information is updated.
- SATELLITE_UPDATED, ///< This type is used when satellite information is updated.
+ POSITION_UPDATED = 0x01, /*/< This type is used when position information is updated. */
+ VELOCITY_UPDATED = POSITION_UPDATED << 0x01, /*/< This type is used when velocity information is updated. */
+ SATELLITE_UPDATED = POSITION_UPDATED << 0x02, /*/< This type is used when satellite information is updated. */
+ DISTANCE_UPDATED = POSITION_UPDATED << 0x03, /*/< This type is used when distance information is updated. */
+ LOCATION_CHANGED = POSITION_UPDATED << 0x04, /*/< This type is used when location information is updated. */
} LocationUpdateType;
/**
* @brief This represents the state whether an application is able to use location service
*/
typedef enum {
- LOCATION_ACCESS_NONE, ///< An application is not registered.
- LOCATION_ACCESS_DENIED, ///< An application is not permited to use location service.
- LOCATION_ACCESS_ALLOWED, ///< An application is able to use location service.
+ LOCATION_ACCESS_NONE, /*/< An application is not registered. */
+ LOCATION_ACCESS_DENIED, /*/< An application is not permited to use location service. */
+ LOCATION_ACCESS_ALLOWED, /*/< An application is able to use location service. */
} LocationAccessState;
/**
/**
* @brief This represents position information such as latitude-longitude-altitude values and timestamp.
*/
-typedef struct _LocationPosition LocationPosition;
+typedef struct _LocationPosition LocationPosition;
/**
* @brief This represents last known position information such as latitude-longitude values and accuracy. \n
- * This would be deprecated soon.
+ * This would be deprecated soon.
*/
-typedef struct _LocationLastPosition LocationLastPosition;
+typedef struct _LocationLastPosition LocationLastPosition;
+
+/**
+ * @brief This represents location batch information such as Position, Satellite and Accuracy.
+ */
+typedef struct _LocationBatch LocationBatch;
/**
* @brief This represents position information such as number of satellites in used or in view.
*/
-typedef struct _LocationSatellite LocationSatellite;
+typedef struct _LocationSatellite LocationSatellite;
/**
* @brief This represents velocity information such as as speed, direction, climb.
*/
-typedef struct _LocationVelocity LocationVelocity;
+typedef struct _LocationVelocity LocationVelocity;
/**
* @brief This represents location accuracy information such as accuracy level, horizontal and vertical accuracy.
*/
-typedef struct _LocationAccuracy LocationAccuracy;
+typedef struct _LocationAccuracy LocationAccuracy;
/**
* @brief This represents boundary information such as rectangular or circle area.
*/
-typedef struct _LocationBoundary LocationBoundary;
+typedef struct _LocationBoundary LocationBoundary;
+
+typedef void (*LocationSettingCb)(LocationMethod method, gboolean enable, void *user_data);
/**
* @}@}
+++ /dev/null
-noinst_LTLIBRARIES = liblocation-manager.la\r
-\r
-COMMON_HEADER_DIR = include\r
-MANAGER_DIR = manager\r
-MAP_SERVICE_DIR = map-service\r
-MODULE_DIR = module\r
-\r
-liblocation_manager_la_SOURCES = \\r
- location-marshal.c \\r
- location-marshal.h \\r
- location-ielement.c \\r
- location-setting.c \\r
- location-position.c \\r
- location-velocity.c \\r
- location-accuracy.c \\r
- location-boundary.c \\r
- location-satellite.c \\r
- location-signaling-util.c \\r
- location-common-util.c \\r
- location-gps.c \\r
- location-wps.c \\r
- location-hybrid.c\r
-\r
-liblocation_manager_la_CFLAGS = \\r
- -fPIC\\r
- -I${srcdir} \\r
- -I${srcdir}/.. \\r
- -I${srcdir}/../include \\r
- -I${srcdir}/../${MANAGER_DIR} \\r
- -I${srcdir}/../${MODULE_DIR} \\r
- -I${srcdir}/../${MAP_SERVICE_DIR} \\r
- $(LOCATION_CFLAGS)\r
-\r
-EXTRA_DIST = \\r
- location-marshal.list\r
-\r
-location-marshal.h: location-marshal.list $(GLIB_GENMARSHAL)\r
- $(GLIB_GENMARSHAL) $< --header --prefix=location > $@\r
-location-marshal.c: location-marshal.list location-marshal.h $(GLIB_GENMARSHAL)\r
- echo "#include \"location-marshal.h\"" > $@ && $(GLIB_GENMARSHAL) location-marshal.list --body --prefix=location >> $@\r
* Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
+ * Genie Kim <daejins.kim@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include "location-log.h"
GType
-location_accuracy_get_type (void)
+location_accuracy_get_type(void)
{
static volatile gsize type_volatile = 0;
- if(g_once_init_enter(&type_volatile)) {
- GType type = g_boxed_type_register_static (
- g_intern_static_string ("LocationAccuracy"),
- (GBoxedCopyFunc) location_accuracy_copy,
- (GBoxedFreeFunc) location_accuracy_free);
+ if (g_once_init_enter(&type_volatile)) {
+ GType type = g_boxed_type_register_static(
+ g_intern_static_string("LocationAccuracy"),
+ (GBoxedCopyFunc) location_accuracy_copy,
+ (GBoxedFreeFunc) location_accuracy_free);
g_once_init_leave(&type_volatile, type);
}
return type_volatile;
}
-EXPORT_API LocationAccuracy*
-location_accuracy_new (LocationAccuracyLevel level,
- gdouble horizontal_accuracy,
- gdouble vertical_accuracy)
+EXPORT_API LocationAccuracy *
+location_accuracy_new(LocationAccuracyLevel level,
+ gdouble horizontal_accuracy,
+ gdouble vertical_accuracy)
{
- LocationAccuracy* accuracy = g_slice_new0 (LocationAccuracy);
+ LocationAccuracy *accuracy = g_slice_new0(LocationAccuracy);
+ g_return_val_if_fail(accuracy, NULL);
+
accuracy->level = level;
accuracy->horizontal_accuracy = horizontal_accuracy;
accuracy->vertical_accuracy = vertical_accuracy;
}
EXPORT_API void
-location_accuracy_free (LocationAccuracy* accuracy)
+location_accuracy_free(LocationAccuracy *accuracy)
{
- g_return_if_fail (accuracy);
- g_slice_free (LocationAccuracy, accuracy);
+ g_return_if_fail(accuracy);
+ g_slice_free(LocationAccuracy, accuracy);
}
static int
}
EXPORT_API int
-location_accuracy_compare (const LocationAccuracy *accuracy1, const LocationAccuracy *accuracy2)
+location_accuracy_compare(const LocationAccuracy *accuracy1, const LocationAccuracy *accuracy2)
{
int ret = 0;
ret = location_accuracy_level_compare(accuracy1, accuracy2);
- if(!ret){
+ if (!ret) {
ret = comp_double_reverse(accuracy1->horizontal_accuracy, accuracy2->horizontal_accuracy);
- if(!ret) return comp_double_reverse(accuracy1->vertical_accuracy, accuracy2->vertical_accuracy);
+ if (!ret) return comp_double_reverse(accuracy1->vertical_accuracy, accuracy2->vertical_accuracy);
}
return ret;
}
-EXPORT_API LocationAccuracy*
-location_accuracy_copy (const LocationAccuracy *accuracy)
+EXPORT_API LocationAccuracy *
+location_accuracy_copy(const LocationAccuracy *accuracy)
{
g_return_val_if_fail(accuracy, NULL);
return location_accuracy_new(accuracy->level,
- accuracy->horizontal_accuracy,
- accuracy->vertical_accuracy);
+ accuracy->horizontal_accuracy,
+ accuracy->vertical_accuracy);
}
* Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
+ * Genie Kim <daejins.kim@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* @brief This represents the approximate accuracy level of given information.
*/
typedef enum {
- LOCATION_ACCURACY_LEVEL_NONE = 0, ///< Invalid data.
- LOCATION_ACCURACY_LEVEL_COUNTRY, ///< Country accuracy level->
- LOCATION_ACCURACY_LEVEL_REGION, ///< Regional accuracy level->
- LOCATION_ACCURACY_LEVEL_LOCALITY, ///< Local accuracy level->
- LOCATION_ACCURACY_LEVEL_POSTALCODE, ///< Postal accuracy level->
- LOCATION_ACCURACY_LEVEL_STREET, ///< Street accuracy level->
- LOCATION_ACCURACY_LEVEL_DETAILED, ///< Detailed accuracy level->
+ LOCATION_ACCURACY_LEVEL_NONE = 0, /*/< Invalid data. */
+ LOCATION_ACCURACY_LEVEL_COUNTRY, /*/< Country accuracy level-> */
+ LOCATION_ACCURACY_LEVEL_REGION, /*/< Regional accuracy level-> */
+ LOCATION_ACCURACY_LEVEL_LOCALITY, /*/< Local accuracy level-> */
+ LOCATION_ACCURACY_LEVEL_POSTALCODE, /*/< Postal accuracy level-> */
+ LOCATION_ACCURACY_LEVEL_STREET, /*/< Street accuracy level-> */
+ LOCATION_ACCURACY_LEVEL_DETAILED, /*/< Detailed accuracy level-> */
} LocationAccuracyLevel;
/**
* @brief This represents location accuracy information such as accuracy level, horizontal and vertical accuracy.
*/
-struct _LocationAccuracy
-{
- LocationAccuracyLevel level; ///< The accuracy level of the location information.
- gdouble horizontal_accuracy; ///< The horizontal position uncertainty of the location in meters.
- gdouble vertical_accuracy; ///< The vertical position uncertainty of the location in meters.
+struct _LocationAccuracy {
+ LocationAccuracyLevel level; /*/< The accuracy level of the location information. */
+ gdouble horizontal_accuracy; /*/< The horizontal position uncertainty of the location in meters. */
+ gdouble vertical_accuracy; /*/< The vertical position uncertainty of the location in meters. */
};
/**
- * @brief Create a new #LocationAccuracy with given information.
+ * @brief Create a new #LocationAccuracy with given information.
* @remarks None.
- * @pre #location_init should be called before.\n
- * @post None.
- * @param [in] level - The accuracy level of the location information.
- * @param [in] horizontal_accuracy - The horizontal position uncertainty of the location in meters.
- * @param [in] vertical_accuracy - The vertical position uncertainty of the location in meters.
+ * @pre #location_init should be called before.\n
+ * @post None.
+ * @param [in] level - The accuracy level of the location information.
+ * @param [in] horizontal_accuracy - The horizontal position uncertainty of the location in meters.
+ * @param [in] vertical_accuracy - The vertical position uncertainty of the location in meters.
* @return a new #LocationAccuracy
* @retval NULL if error occured
*/
-LocationAccuracy *location_accuracy_new (LocationAccuracyLevel level, gdouble horizontal_accuracy, gdouble vertical_accuracy);
+LocationAccuracy *location_accuracy_new(LocationAccuracyLevel level, gdouble horizontal_accuracy, gdouble vertical_accuracy);
/**
- * @brief Free a #LocationAccuracy.
+ * @brief Free a #LocationAccuracy.
* @remarks None.
- * @pre #location_init should be called before.\n
- * @post None.
+ * @pre #location_init should be called before.\n
+ * @post None.
* @param [in] accuracy - a #LocationAccuracy.
* @return None.
*/
-void location_accuracy_free (LocationAccuracy *accuracy);
+void location_accuracy_free(LocationAccuracy *accuracy);
/**
- * @brief Compare for two accuracys.
+ * @brief Compare for two accuracys.
* @remarks None.
- * @pre #location_init should be called before.\n
- * @post None.
- * @param [in] accuracy1 - a #LocationAccuracy
- * @param [in] accuracy2 - another #LocationAccuracy
+ * @pre #location_init should be called before.\n
+ * @post None.
+ * @param [in] accuracy1 - a #LocationAccuracy
+ * @param [in] accuracy2 - another #LocationAccuracy
* @return integer
* @retval\n
* 0 - if the accuracy match\n
* positive value - if accuracy of accuracy1 is better than accuracy of accuracy2\n
* negative value - if accuracy of accuracy1 is worse than accuracy of accuracy2
*/
-int location_accuracy_compare (const LocationAccuracy *accuracy1, const LocationAccuracy *accuracy2);
+int location_accuracy_compare(const LocationAccuracy *accuracy1, const LocationAccuracy *accuracy2);
/**
- * @brief Compare for two accuracys' level.
+ * @brief Compare for two accuracys' level.
* @remarks None.
- * @pre #location_init should be called before.\n
- * @post None.
- * @param [in] accuracy1 - a #LocationAccuracy
- * @param [in] accuracy2 - another #LocationAccuracy
+ * @pre #location_init should be called before.\n
+ * @post None.
+ * @param [in] accuracy1 - a #LocationAccuracy
+ * @param [in] accuracy2 - another #LocationAccuracy
* @return integer
* @retval\n
* 0 - if the accuracy match\n
int location_accuracy_level_compare(const LocationAccuracy *accuracy1, const LocationAccuracy *accuracy2);
/**
- * @brief Makes a copy of #LocationAccuracy
+ * @brief Makes a copy of #LocationAccuracy
* @remarks None.
- * @pre #location_init should be called before.\n
- * @post None.
- * @param [in] accuracy - a #LocationAccuracy
+ * @pre #location_init should be called before.\n
+ * @post None.
+ * @param [in] accuracy - a #LocationAccuracy
* @return a new #LocationAccuracy
* @retval NULL if error occured
*/
-LocationAccuracy *location_accuracy_copy (const LocationAccuracy *accuracy);
+LocationAccuracy *location_accuracy_copy(const LocationAccuracy *accuracy);
/**
* @} @}
--- /dev/null
+/*
+ * libslp-location
+ *
+ * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
+ * Genie Kim <daejins.kim@samsung.com>
+ *
+ * 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#define MAX_BATCH_ITEM 8
+#define BATCH_SENTENCE_SIZE 256
+#define BATCH_LOG "/opt/usr/media/lbs-server/location_batch.log"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include "location-batch.h"
+#include "location-log.h"
+
+
+EXPORT_API LocationBatch *
+location_batch_new(int num_of_location)
+{
+ LocationBatch *batch = g_slice_new0(LocationBatch);
+ g_return_val_if_fail(batch, NULL);
+
+ batch->num_of_location = num_of_location;
+ batch->batch_data = g_new0(LocationBatchDetail, batch->num_of_location);
+ return batch;
+}
+
+EXPORT_API gboolean
+location_set_batch_parse_details(LocationBatch *batch, char *location_info, int i)
+{
+ g_return_val_if_fail(batch, FALSE);
+ g_return_val_if_fail(batch->batch_data, FALSE);
+
+ char location[128] = {0,};
+ char *last_location[MAX_BATCH_ITEM] = {0,};
+ char *last = NULL;
+ int index = 0;
+
+ snprintf(location, sizeof(location), "%s", location_info);
+
+ last_location[index] = (char *)strtok_r(location, ";", &last);
+ while (last_location[index++] != NULL) {
+ if (index == MAX_BATCH_ITEM)
+ break;
+ last_location[index] = (char *)strtok_r(NULL, ";", &last);
+ }
+ index = 0;
+
+ batch->batch_data[i].timestamp = strtod(last_location[index++], NULL);
+ batch->batch_data[i].latitude = strtod(last_location[index++], NULL);
+ batch->batch_data[i].longitude = strtod(last_location[index++], NULL);
+ batch->batch_data[i].altitude = strtod(last_location[index++], NULL);
+ batch->batch_data[i].speed = strtod(last_location[index++], NULL);
+ batch->batch_data[i].direction = strtod(last_location[index++], NULL);
+ batch->batch_data[i].horizontal_accuracy = strtod(last_location[index++], NULL);
+ batch->batch_data[i].vertical_accuracy = strtod(last_location[index++], NULL);
+
+ return TRUE;
+}
+
+EXPORT_API LocationBatch *
+location_get_batch_file(int num_of_location)
+{
+ LOCATION_LOGD("location_get_batch_file [num_of_location = %d]", num_of_location);
+ LocationBatch *batch = location_batch_new(num_of_location);
+ batch->num_of_location = num_of_location;
+
+ FILE *fd = fopen(BATCH_LOG, "r");
+ if (fd != NULL) {
+ char buf[BATCH_SENTENCE_SIZE] = { 0, };
+ int i = 0;
+
+ for (i = 0; i < num_of_location; i++) {
+ if (fgets(buf, BATCH_SENTENCE_SIZE, fd) != NULL) {
+ location_set_batch_parse_details(batch, buf, i);
+ }
+
+ }
+ fclose(fd);
+ } else {
+ LOCATION_LOGE("Batch fd is NULL");
+ }
+ return batch;
+}
+
+EXPORT_API LocationBatch *
+location_batch_copy(const LocationBatch *batch)
+{
+ g_return_val_if_fail(batch, NULL);
+ LocationBatch *batch_dup = location_batch_new(batch->num_of_location);
+ batch_dup->num_of_location = batch->num_of_location;
+ int i = 0;
+ for (i = 0 ; i < batch_dup->num_of_location; i++)
+ location_set_batch_details(batch_dup, i,
+ batch->batch_data[i].latitude,
+ batch->batch_data[i].longitude,
+ batch->batch_data[i].altitude,
+ batch->batch_data[i].speed,
+ batch->batch_data[i].direction,
+ batch->batch_data[i].horizontal_accuracy,
+ batch->batch_data[i].vertical_accuracy,
+ batch->batch_data[i].timestamp);
+ return batch_dup;
+}
+
+EXPORT_API gboolean
+location_get_batch_details(const LocationBatch *batch,
+ guint index,
+ gdouble *latitude,
+ gdouble *longitude,
+ gdouble *altitude,
+ gdouble *speed,
+ gdouble *direction,
+ gdouble *h_accuracy,
+ gdouble *v_accuracy,
+ guint *timestamp)
+{
+ g_return_val_if_fail(batch, FALSE);
+ g_return_val_if_fail(latitude, FALSE);
+ g_return_val_if_fail(longitude, FALSE);
+ g_return_val_if_fail(altitude, FALSE);
+ g_return_val_if_fail(speed, FALSE);
+ g_return_val_if_fail(direction, FALSE);
+ g_return_val_if_fail(h_accuracy, FALSE);
+ g_return_val_if_fail(v_accuracy, FALSE);
+ g_return_val_if_fail(timestamp, FALSE);
+ g_return_val_if_fail(batch->batch_data, FALSE);
+
+ *latitude = batch->batch_data[index].latitude;
+ *longitude = batch->batch_data[index].longitude;
+ *altitude = batch->batch_data[index].altitude;
+ *speed = batch->batch_data[index].speed;
+ *direction = batch->batch_data[index].direction;
+ *h_accuracy = batch->batch_data[index].horizontal_accuracy;
+ *v_accuracy = batch->batch_data[index].vertical_accuracy;
+ *timestamp = batch->batch_data[index].timestamp;
+
+ return TRUE;
+}
+
+EXPORT_API gboolean
+location_set_batch_details(LocationBatch *batch,
+ guint index,
+ gdouble latitude,
+ gdouble longitude,
+ gdouble altitude,
+ gdouble speed,
+ gdouble direction,
+ gdouble h_accuracy,
+ gdouble v_accuracy,
+ guint timestamp)
+{
+ g_return_val_if_fail(batch, FALSE);
+ g_return_val_if_fail(batch->batch_data, FALSE);
+ g_return_val_if_fail(index < batch->num_of_location, FALSE);
+
+ batch->batch_data[index].latitude = latitude;
+ batch->batch_data[index].longitude = longitude;
+ batch->batch_data[index].altitude = altitude;
+ batch->batch_data[index].speed = speed;
+ batch->batch_data[index].direction = direction;
+ batch->batch_data[index].horizontal_accuracy = h_accuracy;
+ batch->batch_data[index].vertical_accuracy = v_accuracy;
+ batch->batch_data[index].timestamp = timestamp;
+
+ return TRUE;
+}
+
+EXPORT_API void
+location_batch_free(LocationBatch *batch)
+{
+ g_return_if_fail(batch);
+ g_free(batch->batch_data);
+ g_slice_free(LocationBatch, batch);
+}
+
--- /dev/null
+/*
+ * libslp-location
+ *
+ * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
+ * Genie Kim <daejins.kim@samsung.com>
+ *
+ * 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 __LOCATION_BATCH_H_
+#define __LOCATION_BATCH_H_
+
+#include <location-types.h>
+
+G_BEGIN_DECLS
+
+GType location_batch_get_type(void);
+#define LOCATION_TYPE_BATCH (location_batch_get_type ())
+
+/**
+ * @file location-batch.h
+ * @brief This file contains the internal definitions and structures related to batch information.
+ */
+/**
+ * @addtogroup LocationAPI
+ * @{
+ * @defgroup LocationAPIBatch Location Batch
+ * @breif This provides APIs related to Location Batch
+ * @addtogroup LocationAPIBatch
+ * @{
+ */
+
+/**
+ * TBD
+ */
+typedef struct {
+ guint timestamp; /*/< Time stamp. */
+ guint level; /*/< Level. */
+ gdouble latitude; /*/< Latitude data. */
+ gdouble longitude; /*/< Longitude data. */
+ gdouble altitude; /*/< Altitude data. */
+ gdouble horizontal_accuracy; /*/< Horizontal accuracy data. */
+ gdouble vertical_accuracy; /*/< Vertical accuracy data. */
+ gdouble speed; /*/< The speed over ground. (km/h) */
+ gdouble direction; /*/< The course made in degrees relative to true north. The value is always in the range [0.0, 360.0] degree. */
+ gdouble climb; /*/< The vertical speed. (km/h) */
+} LocationBatchDetail;
+
+/**
+ * TBD
+ */
+struct _LocationBatch {
+ guint num_of_location; /*/< The number of location batch. */
+ LocationBatchDetail *batch_data;
+};
+
+LocationBatch *location_batch_new(int num_of_location);
+
+gboolean location_set_batch_parse_details(LocationBatch *batch, char *location_info, int i);
+
+gboolean location_get_batch_details(const LocationBatch *batch, guint index, gdouble *latitude, gdouble *longitude, gdouble *altitude, gdouble *speed, gdouble *direction, gdouble *h_accuracy, gdouble *v_accuracy, guint *timestamp);
+
+gboolean location_set_batch_details(LocationBatch *batch, guint index, gdouble latitude, gdouble longitude, gdouble altitude, gdouble speed, gdouble direction, gdouble h_accuracy, gdouble v_accuracy, guint timestamp);
+
+LocationBatch *location_batch_copy(const LocationBatch *batch);
+
+LocationBatch *location_get_batch_file(int num_of_location);
+
+void location_batch_free(LocationBatch *batch);
+
+/**
+ * @} @}
+ */
+
+G_END_DECLS
+
+#endif
/*
* location_boundary_if_inside(LocationBoundary* boundary,
- * LocationPosition* position)
+ * LocationPosition* position)
* code from
*
* Copyright (c) 1970-2003, Wm. Randolph Franklin
#include "location-log.h"
GType
-location_boundary_get_type (void)
+location_boundary_get_type(void)
{
static volatile gsize type_volatile = 0;
- if(g_once_init_enter(&type_volatile)) {
- GType type = g_boxed_type_register_static (
- g_intern_static_string ("LocationBoundary"),
- (GBoxedCopyFunc) location_boundary_copy,
- (GBoxedFreeFunc) location_boundary_free);
+ if (g_once_init_enter(&type_volatile)) {
+ GType type = g_boxed_type_register_static(
+ g_intern_static_string("LocationBoundary"),
+ (GBoxedCopyFunc) location_boundary_copy,
+ (GBoxedFreeFunc) location_boundary_free);
g_once_init_leave(&type_volatile, type);
}
return type_volatile;
g_return_if_fail(data);
g_return_if_fail(user_data);
- LocationBoundary* boundary = (LocationBoundary*)user_data;
- LocationPosition* position = (LocationPosition *)data;
- LocationPosition* new_position = location_position_copy(position);
+ LocationBoundary *boundary = (LocationBoundary *)user_data;
+ LocationPosition *position = (LocationPosition *)data;
+ LocationPosition *new_position = location_position_copy(position);
boundary->polygon.position_list = g_list_append(boundary->polygon.position_list, new_position);
}
{
g_return_if_fail(data);
- LocationPosition* position = (LocationPosition *)data;
+ LocationPosition *position = (LocationPosition *)data;
location_position_free(position);
}
EXPORT_API LocationBoundary *
-location_boundary_new_for_rect (LocationPosition* left_top,
- LocationPosition* right_bottom)
+location_boundary_new_for_rect(LocationPosition *left_top,
+ LocationPosition *right_bottom)
{
g_return_val_if_fail(left_top, NULL);
g_return_val_if_fail(right_bottom, NULL);
gdouble lon_interval = right_bottom->longitude - left_top->longitude;
- if(lon_interval < 180 && lon_interval > -180) {
- if(right_bottom->longitude <= left_top->longitude || right_bottom->latitude >= left_top->latitude)
+ if (lon_interval < 180 && lon_interval > -180) {
+ if (right_bottom->longitude <= left_top->longitude || right_bottom->latitude >= left_top->latitude)
return NULL;
- }
- else {
- if(right_bottom->longitude >= left_top->longitude || right_bottom->latitude >= left_top->latitude)
+ } else {
+ if (right_bottom->latitude >= left_top->latitude)
return NULL;
}
- LocationBoundary* boundary = g_slice_new0 (LocationBoundary);
+ LocationBoundary *boundary = g_slice_new0(LocationBoundary);
+ g_return_val_if_fail(boundary, NULL);
+
boundary->type = LOCATION_BOUNDARY_RECT;
boundary->rect.left_top = location_position_copy(left_top);
boundary->rect.right_bottom = location_position_copy(right_bottom);
}
EXPORT_API LocationBoundary *
-location_boundary_new_for_circle (LocationPosition* center,
- gdouble radius)
+location_boundary_new_for_circle(LocationPosition *center,
+ gdouble radius)
{
g_return_val_if_fail(center, NULL);
g_return_val_if_fail(radius > 0, NULL);
- LocationBoundary* boundary = g_slice_new0 (LocationBoundary);
+ LocationBoundary *boundary = g_slice_new0(LocationBoundary);
+ g_return_val_if_fail(boundary, NULL);
+
boundary->type = LOCATION_BOUNDARY_CIRCLE;
boundary->circle.center = location_position_copy(center);
boundary->circle.radius = radius;
g_return_val_if_fail(position_list, NULL);
g_return_val_if_fail(g_list_length(position_list) > 2, NULL);
- LocationBoundary *boundary = g_slice_new0 (LocationBoundary);
+ LocationBoundary *boundary = g_slice_new0(LocationBoundary);
+ g_return_val_if_fail(boundary, NULL);
g_list_foreach(position_list, (GFunc)_append_polygon_position, boundary);
boundary->type = LOCATION_BOUNDARY_POLYGON;
}
EXPORT_API void
-location_boundary_free (LocationBoundary* boundary)
+location_boundary_free(LocationBoundary *boundary)
{
g_return_if_fail(boundary);
g_slice_free(LocationBoundary, boundary);
}
-EXPORT_API LocationBoundary*
-location_boundary_copy (const LocationBoundary* boundary)
+EXPORT_API LocationBoundary *
+location_boundary_copy(const LocationBoundary *boundary)
{
g_return_val_if_fail(boundary, NULL);
if (boundary->type == LOCATION_BOUNDARY_RECT) {
}
EXPORT_API gboolean
-location_boundary_if_inside (LocationBoundary* boundary,
- LocationPosition* position)
+location_boundary_if_inside(LocationBoundary *boundary,
+ LocationPosition *position)
{
g_return_val_if_fail(boundary, FALSE);
g_return_val_if_fail(position, FALSE);
gboolean is_inside = FALSE;
- switch(boundary->type) {
+ switch (boundary->type) {
case LOCATION_BOUNDARY_RECT: {
- gdouble y = position->latitude;
- gdouble x = position->longitude;
-
- gdouble lt_y = boundary->rect.left_top->latitude;
- gdouble lt_x = boundary->rect.left_top->longitude;
- gdouble rb_y = boundary->rect.right_bottom->latitude;
- gdouble rb_x = boundary->rect.right_bottom->longitude;
-
- if (lt_x - rb_x < 180 && lt_x - rb_x > -180) {
- if ((rb_y < y && y < lt_y) && ( lt_x < x && x < rb_x)) {
- LOCATION_LOGD("\tInside of Rectangular boundary");
- is_inside = TRUE;
- }
- }
- else {
- if ((rb_y < y && y < lt_y) && ( lt_x < x || x < rb_x)) {
- LOCATION_LOGD("\tInside of Rectangular boundary near 180th meridian");
- is_inside = TRUE;
+ gdouble y = position->latitude;
+ gdouble x = position->longitude;
+
+ gdouble lt_y = boundary->rect.left_top->latitude;
+ gdouble lt_x = boundary->rect.left_top->longitude;
+ gdouble rb_y = boundary->rect.right_bottom->latitude;
+ gdouble rb_x = boundary->rect.right_bottom->longitude;
+
+ if (lt_x - rb_x < 180 && lt_x - rb_x > -180) {
+ if ((rb_y < y && y < lt_y) && (lt_x < x && x < rb_x)) {
+ LOCATION_LOGD("\tInside of Rectangular boundary");
+ is_inside = TRUE;
+ }
+ } else {
+ if ((rb_y < y && y < lt_y) && (lt_x < x || x < rb_x)) {
+ LOCATION_LOGD("\tInside of Rectangular boundary near 180th meridian");
+ is_inside = TRUE;
+ }
}
+ break;
}
- break;
- }
case LOCATION_BOUNDARY_CIRCLE: {
- LocationPosition center;
- gulong distance = 0;
+ LocationPosition center;
+ gulong distance = 0;
- center.latitude = boundary->circle.center->latitude;
- center.longitude = boundary->circle.center->longitude;
+ center.latitude = boundary->circle.center->latitude;
+ center.longitude = boundary->circle.center->longitude;
- location_get_distance(¢er, position, &distance);
- if (distance < boundary->circle.radius){
- LOCATION_LOGD("\tInside Circle boundary");
- is_inside = TRUE;
+ location_get_distance(¢er, position, &distance);
+ if (distance < boundary->circle.radius) {
+ LOCATION_LOGD("\tInside Circle boundary");
+ is_inside = TRUE;
+ }
+ break;
}
- break;
- }
case LOCATION_BOUNDARY_POLYGON: {
- int i, j;
- double interval_x = 0.0, interval_y = 0.0;
- double x0, y0;
- gboolean edge_area;
- int crossing_num = 0;
- GList *position_list = boundary->polygon.position_list;
- int count = g_list_length(position_list);
- GList *pos1_list = NULL;
- GList *pos2_list = NULL;
- LocationPosition* pos1 = NULL;
- LocationPosition* pos2 = NULL;
-
- i = 0;
- j = count - 1;
- pos1_list = g_list_first(position_list);
- pos2_list = g_list_last(position_list);
- while(pos1_list) {
- edge_area = FALSE;
- pos1 = pos1_list->data;
- pos2 = pos2_list->data;
- interval_y = pos1->longitude - pos2->longitude;
- interval_x = pos1->latitude - pos2->latitude;
- /**
- * Case 1. -180 < longitude2 - longitude1 < 180 : normal case
- * Case 2. longitude2 - longitude1 < -180 : interval_y = longitude2 - longitude1 + 360
- * Case 3. longitude2 - longitude1 > 180 : intreval_y = longitude2 - longitude1 - 360
- */
- if (interval_y > 180) {
- interval_y = interval_y - 360;
- edge_area = TRUE;
- }
- else if (interval_y < -180) {
- interval_y = interval_y + 360;
- edge_area = TRUE;
- }
+ double interval_x = 0.0, interval_y = 0.0;
+ double x0, y0;
+ gboolean edge_area;
+ int crossing_num = 0;
+ GList *position_list = boundary->polygon.position_list;
+ GList *pos1_list = NULL;
+ GList *pos2_list = NULL;
+ LocationPosition *pos1 = NULL;
+ LocationPosition *pos2 = NULL;
+
+ pos1_list = g_list_first(position_list);
+ pos2_list = g_list_last(position_list);
+ while (pos1_list) {
+ edge_area = FALSE;
+ pos1 = pos1_list->data;
+ pos2 = pos2_list->data;
+ interval_y = pos1->longitude - pos2->longitude;
+ interval_x = pos1->latitude - pos2->latitude;
+ /**
+ * Case 1. -180 < longitude2 - longitude1 < 180 : normal case
+ * Case 2. longitude2 - longitude1 < -180 : interval_y = longitude2 - longitude1 + 360
+ * Case 3. longitude2 - longitude1 > 180 : intreval_y = longitude2 - longitude1 - 360
+ */
+ if (interval_y > 180) {
+ interval_y = interval_y - 360;
+ edge_area = TRUE;
+ } else if (interval_y < -180) {
+ interval_y = interval_y + 360;
+ edge_area = TRUE;
+ }
- if (edge_area && (pos1->longitude > position->longitude) == (pos2->longitude > position->longitude)){
- if (pos2->longitude * position->longitude > 0) {
+ if (edge_area && (pos1->longitude > position->longitude) == (pos2->longitude > position->longitude)) {
+ if (pos2->longitude * position->longitude > 0) {
+ x0 = pos2->latitude;
+ y0 = pos2->longitude;
+ } else {
+ x0 = pos1->latitude;
+ y0 = pos1->longitude;
+ }
+
+ if (position->latitude < ((interval_x / interval_y) * (position->longitude - y0) + x0)) {
+
+ LOCATION_LOGD("Reverse");
+ crossing_num++;
+ }
+ } else if (!edge_area && (pos1->longitude > position->longitude) != (pos2->longitude > position->longitude)) {
x0 = pos2->latitude;
y0 = pos2->longitude;
- }
- else {
- x0 = pos1->latitude;
- y0 = pos1->longitude;
- }
-
- if (position->latitude < ((interval_x/interval_y)*(position->longitude - y0) + x0)) {
-
- LOCATION_LOGD("Reverse");
- crossing_num++;
- }
+ if (position->latitude < ((interval_x / interval_y) * (position->longitude - y0) + x0)) {
+ LOCATION_LOGD("Common");
+ crossing_num++;
+ }
+ } else LOCATION_LOGD("It is not crossed.");
+
+ pos2_list = pos1_list;
+ pos1_list = g_list_next(pos1_list);
}
- else if (!edge_area && (pos1->longitude > position->longitude) != (pos2->longitude > position->longitude)) {
- x0 = pos2->latitude;
- y0 = pos2->longitude;
- if (position->latitude < ((interval_x/interval_y)*(position->longitude - y0) + x0)) {
- LOCATION_LOGD("Common");
- crossing_num++;
- }
- }
- else LOCATION_LOGD("It is not crossed.");
+ LOCATION_LOGW("num[%d]", crossing_num);
+ is_inside = crossing_num & 1; /* Odd : inside, Even : outside */
- pos2_list = pos1_list;
- pos1_list = g_list_next(pos1_list);
+ break;
}
- LOCATION_LOGW("num[%d]", crossing_num);
- is_inside = crossing_num & 1; // Odd : inside, Even : outside
-
- break;
- }
default: {
- LOCATION_LOGW("\tboundary type is undefined.[%d]", boundary->type);
- break;
- }
+ LOCATION_LOGW("\tboundary type is undefined.[%d]", boundary->type);
+ break;
+ }
}
return is_inside;
EXPORT_API int
location_boundary_add(const LocationObject *obj, const LocationBoundary *boundary)
{
- g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (boundary, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(obj, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(boundary, LOCATION_ERROR_PARAMETER);
GList *boundary_priv_list = NULL;
LocationBoundaryPrivate *priv = g_slice_new0(LocationBoundaryPrivate);
+ g_return_val_if_fail(priv, LOCATION_ERROR_PARAMETER);
priv->boundary = location_boundary_copy(boundary);
priv->zone_status = ZONE_STATUS_NONE;
g_object_set(G_OBJECT(obj), "boundary", boundary_priv_list, NULL);
+ g_list_free(boundary_priv_list);
+
return LOCATION_ERROR_NONE;
}
EXPORT_API int
location_boundary_remove(const LocationObject *obj, const LocationBoundary *boundary)
{
- g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (boundary, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(obj, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(boundary, LOCATION_ERROR_PARAMETER);
g_object_set(G_OBJECT(obj), "removal-boundary", boundary, NULL);
EXPORT_API int
location_boundary_foreach(const LocationObject *obj, LocationBoundaryFunc func, gpointer user_data)
{
- g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (func, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(obj, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(func, LOCATION_ERROR_PARAMETER);
int index = 0;
- GList * boundary_priv_list = NULL;
- GList * boundary_list = NULL;
+ GList *boundary_priv_list = NULL;
+ GList *boundary_list = NULL;
LocationBoundaryPrivate *priv;
g_object_get(G_OBJECT(obj), "boundary", &boundary_priv_list, NULL);
return LOCATION_ERROR_UNKNOWN;
}
- while((priv = (LocationBoundaryPrivate *)g_list_nth_data(boundary_priv_list, index))!= NULL) {
+ while ((priv = (LocationBoundaryPrivate *)g_list_nth_data(boundary_priv_list, index)) != NULL) {
boundary_list = g_list_append(boundary_list, (gpointer) priv->boundary);
index++;
}
g_list_foreach(boundary_list, (GFunc)func, user_data);
+ g_list_free(boundary_list);
return LOCATION_ERROR_NONE;
}
EXPORT_API LocationBoundary *
-location_boundary_get_bounding_box (LocationBoundary *boundary)
+location_boundary_get_bounding_box(LocationBoundary *boundary)
{
- g_return_val_if_fail (boundary, NULL);
+ g_return_val_if_fail(boundary, NULL);
LocationBoundary *bbox = NULL;
return bbox;
}
EXPORT_API LocationPosition *
-location_boundary_get_center_position (LocationBoundary *boundary)
+location_boundary_get_center_position(LocationBoundary *boundary)
{
- g_return_val_if_fail (boundary, NULL);
+ g_return_val_if_fail(boundary, NULL);
LocationPosition *center = NULL;
- switch(boundary->type) {
+ switch (boundary->type) {
case LOCATION_BOUNDARY_RECT: {
- gdouble latitude, longitude, altitude;
- latitude = (boundary->rect.left_top->latitude + boundary->rect.right_bottom->latitude) / 2.0;
- longitude = (boundary->rect.left_top->longitude + boundary->rect.right_bottom->longitude) / 2.0;
- altitude = (boundary->rect.left_top->altitude + boundary->rect.right_bottom->altitude) / 2.0;
+ gdouble latitude, longitude, altitude;
+ latitude = (boundary->rect.left_top->latitude + boundary->rect.right_bottom->latitude) / 2.0;
+ longitude = (boundary->rect.left_top->longitude + boundary->rect.right_bottom->longitude) / 2.0;
+ altitude = (boundary->rect.left_top->altitude + boundary->rect.right_bottom->altitude) / 2.0;
- center = location_position_new(boundary->rect.left_top->timestamp, latitude, longitude, altitude, boundary->rect.left_top->status);
- break;
- }
+ center = location_position_new(boundary->rect.left_top->timestamp, latitude, longitude, altitude, boundary->rect.left_top->status);
+ break;
+ }
case LOCATION_BOUNDARY_CIRCLE: {
- center = location_position_copy(boundary->circle.center);
- break;
- }
+ center = location_position_copy(boundary->circle.center);
+ break;
+ }
case LOCATION_BOUNDARY_POLYGON: {
- gdouble center_latitude = 0.0;
- gdouble center_longitude = 0.0;
- gdouble area = 0.0;
-
- gdouble x1, y1;
- gdouble x2, y2;
- GList *position_list = boundary->polygon.position_list;
- GList *pos1_list = g_list_first(position_list);
- GList *pos2_list = g_list_next(pos1_list);
- LocationPosition* pos1 = NULL;
- LocationPosition* pos2 = NULL;
-
- while(pos2_list) {
+ gdouble center_latitude = 0.0;
+ gdouble center_longitude = 0.0;
+ gdouble area = 0.0;
+
+ gdouble x1, y1;
+ gdouble x2, y2;
+ GList *position_list = boundary->polygon.position_list;
+ GList *pos1_list = g_list_first(position_list);
+ GList *pos2_list = g_list_next(pos1_list);
+ LocationPosition *pos1 = NULL;
+ LocationPosition *pos2 = NULL;
+
+ while (pos2_list) {
+ pos1 = pos1_list->data;
+ pos2 = pos2_list->data;
+
+ x1 = pos1->latitude + 90.0;
+ y1 = pos1->longitude + 180.0;
+ x2 = pos2->latitude + 90.0;
+ y2 = pos2->longitude + 180.0;
+
+ center_latitude += (x1 + x2) * (x1 * y2 - x2 * y1);
+ center_longitude += (y1 + y2) * (x1 * y2 - x2 * y1);
+ area += x1 * y2 - x2 * y1;
+
+ pos1_list = pos2_list;
+ pos2_list = g_list_next(pos2_list);
+ }
+
+ pos2_list = g_list_first(position_list);
pos1 = pos1_list->data;
pos2 = pos2_list->data;
x2 = pos2->latitude + 90.0;
y2 = pos2->longitude + 180.0;
- center_latitude += (x1 + x2) * (x1*y2 - x2*y1);
- center_longitude += (y1 + y2) * (x1*y2 - x2*y1);
- area += x1*y2 - x2*y1;
+ center_latitude += (x1 + x2) * (x1 * y2 - x2 * y1);
+ center_longitude += (y1 + y2) * (x1 * y2 - x2 * y1);
+ area += x1 * y2 - x2 * y1;
- pos1_list = pos2_list;
- pos2_list = g_list_next(pos2_list);
- }
-
- pos2_list = g_list_first(position_list);
- pos1 = pos1_list->data;
- pos2 = pos2_list->data;
-
- x1 = pos1->latitude + 90.0;
- y1 = pos1->longitude + 180.0;
- x2 = pos2->latitude + 90.0;
- y2 = pos2->longitude + 180.0;
-
- center_latitude += (x1 + x2) * (x1*y2 - x2*y1);
- center_longitude += (y1 + y2) * (x1*y2 - x2*y1);
- area += x1*y2 - x2*y1;
-
- area = fabs(area / 2.0);
- if (area != 0) {
- center_latitude = (center_latitude - 90.0) / (6.0 * area);
- center_longitude = (center_longitude - 180.0) / (6.0 * area);
- center = location_position_new(0, center_latitude, center_longitude, 0, LOCATION_STATUS_2D_FIX);
+ area = fabs(area / 2.0);
+ if (area != 0) {
+ center_latitude = (center_latitude - 90.0) / (6.0 * area);
+ center_longitude = (center_longitude - 180.0) / (6.0 * area);
+ center = location_position_new(0, center_latitude, center_longitude, 0, LOCATION_STATUS_2D_FIX);
+ }
+ break;
}
+ default:
break;
- }
}
return center;
}
* Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
+ * Genie Kim <daejins.kim@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
G_BEGIN_DECLS
-GType location_boundary_get_type (void);
+GType location_boundary_get_type(void);
#define LOCATION_TYPE_BOUNDARY (location_boundary_get_type ())
/**
* @brief
* The type of the @location_boundary_foreach function of #LocationObject
*/
-typedef void (*LocationBoundaryFunc) (LocationBoundary *boundary, gpointer user_data);
+typedef void (*LocationBoundaryFunc)(LocationBoundary *boundary, gpointer user_data);
/**
* @brief This represents used geographical type, and supports rectangle or circle area.
*/
typedef enum {
- LOCATION_BOUNDARY_NONE = 0, ///< Undefined geographical area type.
- LOCATION_BOUNDARY_RECT, ///< Rectangular geographical area type.
- LOCATION_BOUNDARY_CIRCLE, ///< Circle geographical area type.
- LOCATION_BOUNDARY_POLYGON ///< Polygon geographical area type.
+ LOCATION_BOUNDARY_NONE = 0, /*/< Undefined geographical area type. */
+ LOCATION_BOUNDARY_RECT, /*/< Rectangular geographical area type. */
+ LOCATION_BOUNDARY_CIRCLE, /*/< Circle geographical area type. */
+ LOCATION_BOUNDARY_POLYGON /*/< Polygon geographical area type. */
} LocationBoundaryType;
/**
* @brief This represents a rectangular geographical area.
*/
typedef struct {
- LocationPosition* left_top; ///< The left top position of rectangle.
- LocationPosition* right_bottom; ///< The right bottom position of rectangle.
+ LocationPosition *left_top; /*/< The left top position of rectangle. */
+ LocationPosition *right_bottom; /*/< The right bottom position of rectangle. */
} LocationRect;
/**
* @brief This represents a circle geographical area with center geographic position and radius.
*/
typedef struct {
- LocationPosition* center; ///< The center position of a circle.
- gdouble radius; ///< The radius of a circle.
+ LocationPosition *center; /*/< The center position of a circle. */
+ gdouble radius; /*/< The radius of a circle. */
} LocationCircle;
/**
* @brief This represents a polygon geographical area.
*/
typedef struct {
- GList *position_list; ///< The collection of positions
+ GList *position_list; /*/< The collection of positions */
} LocationPolygon;
/**
* @brief This represents boundary information such as rectangular or circle area.
*/
-struct _LocationBoundary{
- LocationBoundaryType type; ///< The boundary type of this information.
+struct _LocationBoundary {
+ LocationBoundaryType type; /*/< The boundary type of this information. */
union {
- LocationRect rect; ///< The geographical information of a rectangle.
- LocationCircle circle; ///< The geographical information of a circle.
- LocationPolygon polygon; ///< The geographical information of a polygon.
+ LocationRect rect; /*/< The geographical information of a rectangle. */
+ LocationCircle circle; /*/< The geographical information of a circle. */
+ LocationPolygon polygon; /*/< The geographical information of a polygon. */
};
};
/**
- * @brief Create a rectangular type of new #LocationBoundary with given information.
- * @remarks None.
- * @pre #location_init should be called before.\n
- * @post None.
- * @param [in] left_top - left top position.
- * @param [in] right_bottom - right bottom position.
+ * @brief Create a rectangular type of new #LocationBoundary with given information.
+ * @remarks None.
+ * @pre #location_init should be called before.\n
+ * @post None.
+ * @param [in] left_top - left top position.
+ * @param [in] right_bottom - right bottom position.
* @return a new #LocationBoundary
* @retval NULL if error occured
*/
-LocationBoundary *location_boundary_new_for_rect (LocationPosition *left_top, LocationPosition *right_bottom);
+LocationBoundary *location_boundary_new_for_rect(LocationPosition *left_top, LocationPosition *right_bottom);
/**
- * @brief Create a circle type of new #LocationBoundary with given information.
- * @remarks None.
- * @pre #location_init should be called before.\n
- * @post None.
- * @param [in] center - center position.
- * @param [in] radius - radius.
+ * @brief Create a circle type of new #LocationBoundary with given information.
+ * @remarks None.
+ * @pre #location_init should be called before.\n
+ * @post None.
+ * @param [in] center - center position.
+ * @param [in] radius - radius.
* @return a new #LocationBoundary
* @retval NULL if error occured
*/
-LocationBoundary *location_boundary_new_for_circle (LocationPosition *center, gdouble radius);
+LocationBoundary *location_boundary_new_for_circle(LocationPosition *center, gdouble radius);
/**
- * @brief Create a polygon type of new #LocationBoundary with given information.
+ * @brief Create a polygon type of new #LocationBoundary with given information.
* @remarks None.
- * @pre #location_init should be called before.\n
- * @post None.
- * @param [in] position_list - the list of positions.
+ * @pre #location_init should be called before.\n
+ * @post None.
+ * @param [in] position_list - the list of positions.
* @return a new #LocationBoundary
* @retval NULL if error occured
*/
LocationBoundary *location_boundary_new_for_polygon(GList *position_list);
/**
- * @brief Free a #LocationBoundary.
+ * @brief Free a #LocationBoundary.
* @remarks None.
- * @pre #location_init should be called before.\n
- * @post None.
+ * @pre #location_init should be called before.\n
+ * @post None.
* @param [in] boundary - a #LocationBoundary.
* @return None.
*/
-void location_boundary_free (LocationBoundary *boundary);
+void location_boundary_free(LocationBoundary *boundary);
/**
- * @brief Makes a copy of #LocationBoundary
+ * @brief Makes a copy of #LocationBoundary
* @remarks None.
- * @pre #location_init should be called before.\n
- * @post None.
- * @param [in] boundary - a #LocationBoundary
+ * @pre #location_init should be called before.\n
+ * @post None.
+ * @param [in] boundary - a #LocationBoundary
* @return a new #LocationBoundary
* @retval NULL if error occured
*/
-LocationBoundary *location_boundary_copy (const LocationBoundary* boundary);
+LocationBoundary *location_boundary_copy(const LocationBoundary *boundary);
/**
* @brief
* Add Boundary on LocationFW.
* You should call this fuction when you want to receive a crossing signal(zone-in/zone-out) from #LocationBoundary.
* @remarks It supports multi-boundaries. \n
- However a duplicated boundary would not be allowed.
+ However a duplicated boundary would not be allowed.
* @pre
* #location_new should be called before.\n
* @post None.
- * @param [in] obj - a #LocationObject
- * @param [in] boundary - a #LocationBoundary
+ * @param [in] obj - a #LocationObject
+ * @param [in] boundary - a #LocationBoundary
* @return int
- * @retval 0 Success
+ * @retval 0 Success
* Please refer #LocationError for more information.
* @par Example
* @code
* @pre
* #location_init should be called before.\n
* @post None.
- * @param [in] obj - a #LocationObject
- * @param [in] boundary - a #LocationBoundary
+ * @param [in] obj - a #LocationObject
+ * @param [in] boundary - a #LocationBoundary
* @return int
- * @retval 0 Success
+ * @retval 0 Success
*
* Please refer #LocationError for more information.
* @par Example
* @pre
* #location_init should be called before.\n
* @post None.
- * @param [in] obj - a #LocationObject
- * @param [in] func - a #LocationBoundaryFunc
- * @param [in] user_data - a #void
+ * @param [in] obj - a #LocationObject
+ * @param [in] func - a #LocationBoundaryFunc
+ * @param [in] user_data - a #void
* @return int
- * @retval 0 Success
+ * @retval 0 Success
*
* Please refer #LocationError for more information.
* @par Example
/**
- * @brief Check if #LocationPosition is inside #LocationBoundary.
+ * @brief Check if #LocationPosition is inside #LocationBoundary.
* @remarks None.
- * @pre #location_init should be called before.\n
- * @post None.* @param [in] boundary - a #LocationBoundary
- * @param [in] position - a #LocationPosition
+ * @pre #location_init should be called before.\n
+ * @post None.* @param [in] boundary - a #LocationBoundary
+ * @param [in] position - a #LocationPosition
* @return gboolean
* @retval\n
* TRUE - if inside\n
* @endcode
*/
-gboolean location_boundary_if_inside (LocationBoundary *boundary, LocationPosition *position);
+gboolean location_boundary_if_inside(LocationBoundary *boundary, LocationPosition *position);
/**
* @brief Get bounding box of #LocationBoundary
*/
-LocationBoundary *location_boundary_get_bounding_box (LocationBoundary *boundary);
+LocationBoundary *location_boundary_get_bounding_box(LocationBoundary *boundary);
/**
* @brief Get the center position of #LocationBoundary
*/
-LocationPosition * location_boundary_get_center_position (LocationBoundary *boundary);
+LocationPosition *location_boundary_get_center_position(LocationBoundary *boundary);
/**
* @} @}
#endif
#include <stdio.h>
+#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include "location-setting.h"
#include "location-log.h"
-int location_application_get_authority (void)
+
+int location_application_get_authority(void)
{
return LOCATION_APP_ON;
}
-int location_application_set_authority (int auth)
+int location_application_set_authority(int auth)
{
return LOCATION_ERROR_NONE;
}
-int location_application_add_app_to_applist (void)
-{
- return TRUE;
-}
-
-int location_application_enabled (void)
-{
- return TRUE;
-}
-
-static gint compare_position (gconstpointer a, gconstpointer b)
+static gint compare_position(gconstpointer a, gconstpointer b)
{
g_return_val_if_fail(a, 1);
g_return_val_if_fail(b, -1);
- if(location_position_equal((LocationPosition*) a, (LocationPosition *)b) == TRUE) {
+ if (location_position_equal((LocationPosition *) a, (LocationPosition *)b) == TRUE) {
return 0;
}
}
static int
-boundary_compare (gconstpointer comp1, gconstpointer comp2)
+boundary_compare(gconstpointer comp1, gconstpointer comp2)
{
g_return_val_if_fail(comp1, 1);
g_return_val_if_fail(comp2, -1);
if (priv1->boundary->type == priv2->boundary->type) {
switch (priv1->boundary->type) {
case LOCATION_BOUNDARY_CIRCLE: {
- if (location_position_equal(priv1->boundary->circle.center, priv2->boundary->circle.center)
- && priv1->boundary->circle.radius == priv2->boundary->circle.radius) {
- ret = 0;
+ if (location_position_equal(priv1->boundary->circle.center, priv2->boundary->circle.center)
+ && priv1->boundary->circle.radius == priv2->boundary->circle.radius) {
+ ret = 0;
+ }
+ break;
}
- break;
- }
case LOCATION_BOUNDARY_RECT: {
- if (location_position_equal(priv1->boundary->rect.left_top, priv2->boundary->rect.left_top)
- && location_position_equal(priv1->boundary->rect.right_bottom, priv2->boundary->rect.right_bottom)) {
- ret = 0;
+ if (location_position_equal(priv1->boundary->rect.left_top, priv2->boundary->rect.left_top)
+ && location_position_equal(priv1->boundary->rect.right_bottom, priv2->boundary->rect.right_bottom)) {
+ ret = 0;
+ }
+ break;
}
- break;
- }
case LOCATION_BOUNDARY_POLYGON: {
- GList *boundary1_next = NULL;
- GList *boundary2_start = NULL, *boundary2_prev = NULL, *boundary2_next = NULL;
- if (g_list_length(priv1->boundary->polygon.position_list) != g_list_length(priv2->boundary->polygon.position_list)) {
- return -1;
- }
+ GList *boundary1_next = NULL;
+ GList *boundary2_start = NULL, *boundary2_prev = NULL, *boundary2_next = NULL;
+ if (g_list_length(priv1->boundary->polygon.position_list) != g_list_length(priv2->boundary->polygon.position_list)) {
+ return -1;
+ }
- // Find a matching index of Boundary2 with Boundary1's 1st postion.
- boundary2_start = g_list_find_custom(priv2->boundary->polygon.position_list, g_list_nth_data(priv1->boundary->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(priv2->boundary->polygon.position_list);
- if (boundary2_next == NULL) boundary2_next = g_list_first(priv2->boundary->polygon.position_list);
-
- boundary1_next = g_list_next(priv1->boundary->polygon.position_list);
- if (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(priv2->boundary->polygon.position_list);
- if (location_position_equal((LocationPosition*)boundary1_next->data, (LocationPosition*) boundary2_prev->data) == FALSE){
- return -1;
- }
+ /* Find a matching index of Boundary2 with Boundary1's 1st postion. */
+ boundary2_start = g_list_find_custom(priv2->boundary->polygon.position_list, g_list_nth_data(priv1->boundary->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(priv2->boundary->polygon.position_list);
+ if (boundary2_next == NULL) boundary2_next = g_list_first(priv2->boundary->polygon.position_list);
+
+ boundary1_next = g_list_next(priv1->boundary->polygon.position_list);
+ if (boundary1_next && location_position_equal((LocationPosition *)boundary1_next->data, (LocationPosition *)boundary2_prev->data) == TRUE) {
boundary1_next = g_list_next(boundary1_next);
- }
- ret = 0;
- }
- else if (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(priv2->boundary->polygon.position_list);
- if (location_position_equal((LocationPosition*)boundary1_next->data, (LocationPosition*) boundary2_next->data) == FALSE){
- return -1;
+ while (boundary1_next) {
+ boundary2_prev = g_list_previous(boundary2_prev);
+ if (boundary2_prev == NULL) boundary2_prev = g_list_last(priv2->boundary->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 && 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(priv2->boundary->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;
}
- ret = 0;
+ break;
}
- else {
- return -1;
+ default: {
+ ret = -1;
+ break;
}
- break;
- }
- default:{
- ret = -1;
- break;
- }
}
}
int set_prop_boundary(GList **prev_boundary_priv_list, GList *new_boundary_priv_list)
{
+ LOCATION_LOGD("ENTER >>>");
g_return_val_if_fail(new_boundary_priv_list, LOCATION_ERROR_PARAMETER);
int index = 0;
GList *check_list = NULL;
LocationBoundaryPrivate *new_priv = NULL;
- LocationBoundaryPrivate *copy_priv = g_slice_new0(LocationBoundaryPrivate);
- while((new_priv = (LocationBoundaryPrivate *) g_list_nth_data(new_boundary_priv_list, index)) != NULL) {
+ while ((new_priv = (LocationBoundaryPrivate *) g_list_nth_data(new_boundary_priv_list, index)) != NULL) {
+ *prev_boundary_priv_list = g_list_first(*prev_boundary_priv_list);
check_list = g_list_find_custom(*prev_boundary_priv_list, new_priv, (GCompareFunc)boundary_compare);
if (check_list == NULL) {
- LOCATION_LOGD("Set Prop >> boundary type: [%d]", new_priv->boundary->type);
+ LocationBoundaryPrivate *copy_priv = g_slice_new0(LocationBoundaryPrivate);
+ if (!copy_priv) break;
copy_priv->boundary = location_boundary_copy(new_priv->boundary);
+ if (!copy_priv->boundary) break;
copy_priv->zone_status = new_priv->zone_status;
*prev_boundary_priv_list = g_list_append(*prev_boundary_priv_list, copy_priv);
+
+ LOCATION_LOGD("copy_priv: %p, copy_priv->boundary: %p, copy_priv->boundary->type: %d",
+ copy_priv, copy_priv->boundary, copy_priv->boundary->type);
}
+ location_boundary_free(new_priv->boundary);
index++;
}
- *prev_boundary_priv_list = g_list_first(*prev_boundary_priv_list);
+ LOCATION_LOGD("EXIT <<<");
return LOCATION_ERROR_NONE;
}
-int set_prop_removal_boundary(GList **prev_boundary_list, LocationBoundary* boundary)
+int set_prop_removal_boundary(GList **prev_boundary_list, LocationBoundary *boundary)
{
+ LOCATION_LOGD("ENTER >>>");
g_return_val_if_fail(*prev_boundary_list, LOCATION_ERROR_PARAMETER);
GList *check_list = NULL;
LocationBoundaryPrivate *remove_priv = g_slice_new0(LocationBoundaryPrivate);
+ g_return_val_if_fail(remove_priv, LOCATION_ERROR_PARAMETER);
remove_priv->boundary = location_boundary_copy(boundary);
+ g_return_val_if_fail(remove_priv->boundary, LOCATION_ERROR_PARAMETER);
- check_list = g_list_find_custom (*prev_boundary_list, remove_priv, (GCompareFunc) boundary_compare);
+ check_list = g_list_find_custom(*prev_boundary_list, remove_priv, (GCompareFunc) boundary_compare);
if (check_list) {
LOCATION_LOGD("Found");
*prev_boundary_list = g_list_delete_link(*prev_boundary_list, check_list);
}
- if (g_list_length(*prev_boundary_list) == 0 ) {
+ if (g_list_length(*prev_boundary_list) == 0) {
LOCATION_LOGD("Boundary List is empty");
g_list_free(*prev_boundary_list);
*prev_boundary_list = NULL;
}
+ location_boundary_free(remove_priv->boundary);
g_slice_free(LocationBoundaryPrivate, remove_priv);
+
+ LOCATION_LOGD("EXIT <<<");
return LOCATION_ERROR_NONE;
}
-void free_boundary_list (gpointer data)
+void free_boundary_list(gpointer data)
{
- LocationBoundaryPrivate *priv= (LocationBoundaryPrivate *)data;
+ LocationBoundaryPrivate *priv = (LocationBoundaryPrivate *)data;
location_boundary_free(priv->boundary);
g_slice_free(LocationBoundaryPrivate, priv);
G_BEGIN_DECLS
+#define CAPP 1
+#define WEBAPP 2
+#define CPPAPP 3
+
typedef enum {
- LOCATION_APP_OFF = 0,
- LOCATION_APP_ON,
- LOCATION_APP_NOT_FOUND
+ LOCATION_APP_OFF = 0,
+ LOCATION_APP_ON,
+ LOCATION_APP_NOT_FOUND
} LOCATION_APP_STATE;
typedef enum {
- ZONE_STATUS_NONE = 0,
- ZONE_STATUS_IN,
- ZONE_STATUS_OUT,
+ ZONE_STATUS_NONE = 0,
+ ZONE_STATUS_IN,
+ ZONE_STATUS_OUT,
} ZoneStatus;
typedef struct _LocationBoundaryPrivate {
ZoneStatus zone_status;
} LocationBoundaryPrivate;
-int location_application_manager (void);
-int location_application_enabled (void);
-
int location_application_get_authority(void);
-int location_application_set_authority (int auth);
-int location_application_add_app_to_applist (void);
+int location_application_set_authority(int auth);
int set_prop_boundary(GList **prev_boundary_list, GList *new_boundary_list);
int set_prop_removal_boundary(GList **prev_boundary_list, LocationBoundary *boundary);
-void free_boundary_list (gpointer data);
+void free_boundary_list(gpointer data);
G_END_DECLS
* Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
+ * Genie Kim <daejins.kim@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include "config.h"
#endif
+#include <app_manager.h>
#include "location-setting.h"
#include "location-log.h"
#include "location-ielement.h"
#include "location-signaling-util.h"
#include "location-common-util.h"
+#include "location-privacy.h"
#include <vconf-internal-location-keys.h>
typedef struct _LocationGpsPrivate {
- LocationGpsMod* mod;
- gboolean is_started;
- gboolean set_noti;
- gboolean enabled;
- guint pos_updated_timestamp;
- guint pos_interval;
- guint vel_updated_timestamp;
- guint vel_interval;
- guint sat_updated_timestamp;
- guint sat_interval;
- LocationPosition* pos;
- LocationVelocity* vel;
- LocationAccuracy* acc;
- LocationSatellite* sat;
- GList* boundary_list;
-
- guint pos_searching_timer;
- guint vel_searching_timer;
+ LocationGpsMod *mod;
+ GMutex mutex;
+ gboolean is_started;
+ guint app_type;
+ gboolean set_noti;
+ gboolean enabled;
+ gint signal_type;
+ guint pos_updated_timestamp;
+ guint pos_interval;
+ guint vel_updated_timestamp;
+ guint vel_interval;
+ guint sat_updated_timestamp;
+ guint sat_interval;
+ guint loc_updated_timestamp;
+ guint loc_interval;
+ guint loc_timeout;
+ guint batch_interval;
+ guint batch_period;
+ guint dist_updated_timestamp;
+ guint min_interval;
+ gdouble min_distance;
+ LocationPosition *pos;
+ LocationBatch *batch;
+ LocationVelocity *vel;
+ LocationAccuracy *acc;
+ LocationSatellite *sat;
+ GList *boundary_list;
+#ifdef TIZEN_PROFILE_MOBILE
+ guint pos_searching_timer;
+ guint vel_searching_timer;
+#endif
} LocationGpsPrivate;
enum {
- PROP_0,
- PROP_DEV_NAME,
- PROP_METHOD_TYPE,
- PROP_IS_STARTED,
- PROP_LAST_POSITION,
- PROP_POS_INTERVAL,
- PROP_VEL_INTERVAL,
- PROP_SAT_INTERVAL,
- PROP_BOUNDARY,
- PROP_REMOVAL_BOUNDARY,
- PROP_NMEA,
- PROP_SATELLITE,
- PROP_MAX
+ PROP_0,
+ PROP_METHOD_TYPE,
+ PROP_IS_STARTED,
+ PROP_LAST_POSITION,
+ PROP_POS_INTERVAL,
+ PROP_VEL_INTERVAL,
+ PROP_SAT_INTERVAL,
+ PROP_LOC_INTERVAL,
+ PROP_BATCH_INTERVAL,
+ PROP_BATCH_PERIOD,
+ PROP_BOUNDARY,
+ PROP_REMOVAL_BOUNDARY,
+ PROP_NMEA,
+ PROP_SATELLITE,
+ PROP_MIN_INTERVAL,
+ PROP_MIN_DISTANCE,
+ PROP_MAX
};
static guint32 signals[LAST_SIGNAL] = {0, };
#define GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), LOCATION_TYPE_GPS, LocationGpsPrivate))
-static void location_ielement_interface_init (LocationIElementInterface *iface);
-
-G_DEFINE_TYPE_WITH_CODE (LocationGps, location_gps, G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE (LOCATION_TYPE_IELEMENT,
- location_ielement_interface_init));
+static void location_ielement_interface_init(LocationIElementInterface *iface);
+G_DEFINE_TYPE_WITH_CODE(LocationGps, location_gps, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE(LOCATION_TYPE_IELEMENT,
+ location_ielement_interface_init));
+#ifdef TIZEN_PROFILE_MOBILE
static gboolean
-_position_timeout_cb (gpointer data)
+_location_timeout_cb(gpointer data)
{
GObject *object = (GObject *)data;
LocationGpsPrivate *priv = GET_PRIVATE(object);
- if (!priv) return FALSE;
+ g_return_val_if_fail(priv, FALSE);
LocationPosition *pos = NULL;
+ LocationVelocity *vel = NULL;
LocationAccuracy *acc = NULL;
if (priv->pos) {
pos = location_position_copy(priv->pos);
} else {
- pos = location_position_new (0, 0.0, 0.0, 0.0, LOCATION_STATUS_NO_FIX);
+ pos = location_position_new(0, 0.0, 0.0, 0.0, LOCATION_STATUS_NO_FIX);
+ }
+
+ if (priv->vel) {
+ vel = location_velocity_copy(priv->vel);
+ } else {
+ vel = location_velocity_new(0, 0.0, 0.0, 0.0);
}
if (priv->acc) {
- acc = location_accuracy_copy (priv->acc);
+ acc = location_accuracy_copy(priv->acc);
} else {
- acc = location_accuracy_new (LOCATION_ACCURACY_LEVEL_NONE, 0.0, 0.0);
+ acc = location_accuracy_new(LOCATION_ACCURACY_LEVEL_NONE, 0.0, 0.0);
}
- LOCATION_LOGD("POSITION SERVICE_UPDATED");
- g_signal_emit(object, signals[SERVICE_UPDATED], 0, POSITION_UPDATED, pos, acc);
+ g_signal_emit(object, signals[SERVICE_UPDATED], 0, priv->signal_type, pos, vel, acc);
+ priv->signal_type = 0;
- location_position_free (pos);
- location_accuracy_free (acc);
+ location_position_free(pos);
+ location_velocity_free(vel);
+ location_accuracy_free(acc);
return TRUE;
}
static gboolean
-_velocity_timeout_cb (gpointer data)
+_position_timeout_cb(gpointer data)
{
GObject *object = (GObject *)data;
LocationGpsPrivate *priv = GET_PRIVATE(object);
- if (!priv) return FALSE;
+ g_return_val_if_fail(priv, FALSE);
- LocationVelocity *vel = NULL;
- LocationAccuracy *acc = NULL;
-
- if (priv->vel) {
- vel = location_velocity_copy(priv->vel);
+ if (priv->pos_interval == priv->vel_interval) {
+ priv->signal_type |= POSITION_UPDATED;
+ priv->signal_type |= VELOCITY_UPDATED;
} else {
- vel = location_velocity_new (0, 0.0, 0.0, 0.0);
+ priv->signal_type |= POSITION_UPDATED;
}
+ _location_timeout_cb(priv);
- if (priv->acc) {
- acc = location_accuracy_copy (priv->acc);
- } else {
- acc = location_accuracy_new (LOCATION_ACCURACY_LEVEL_NONE, 0.0, 0.0);
- }
+ return TRUE;
+}
- LOCATION_LOGD("VELOCITY SERVICE_UPDATED");
- g_signal_emit(object, signals[SERVICE_UPDATED], 0, VELOCITY_UPDATED, vel, acc);
+static gboolean
+_velocity_timeout_cb(gpointer data)
+{
+ GObject *object = (GObject *)data;
+ LocationGpsPrivate *priv = GET_PRIVATE(object);
+ g_return_val_if_fail(priv, FALSE);
- location_velocity_free (vel);
- location_accuracy_free (acc);
+ if (priv->pos_interval != priv->vel_interval) {
+ priv->signal_type |= VELOCITY_UPDATED;
+ _location_timeout_cb(priv);
+ }
return TRUE;
}
+#endif
+
static void
__reset_pos_data_from_priv(LocationGpsPrivate *priv)
{
priv->pos = NULL;
}
+ if (priv->batch) {
+ location_batch_free(priv->batch);
+ priv->batch = NULL;
+ }
+
if (priv->vel) {
location_velocity_free(priv->vel);
priv->vel = NULL;
location_accuracy_free(priv->acc);
priv->acc = NULL;
}
+ priv->pos_updated_timestamp = 0;
+ priv->vel_updated_timestamp = 0;
+ priv->sat_updated_timestamp = 0;
+ priv->loc_updated_timestamp = 0;
+}
+
+static gboolean
+__get_started(gpointer self)
+{
+ g_return_val_if_fail(self, FALSE);
+
+ LocationGpsPrivate *priv = GET_PRIVATE(self);
+ g_return_val_if_fail(priv, FALSE);
+
+ return priv->is_started;
+}
+
+static int
+__set_started(gpointer self, gboolean started)
+{
+ g_return_val_if_fail(self, -1);
+
+ LocationGpsPrivate *priv = GET_PRIVATE(self);
+ g_return_val_if_fail(priv, -1);
+
+ if (priv->is_started != started) {
+ g_mutex_lock(&priv->mutex);
+ priv->is_started = started;
+ g_mutex_unlock(&priv->mutex);
+ }
+
+ return 0;
}
static void
-gps_status_cb (gboolean enabled,
- LocationStatus status,
- gpointer self)
+gps_status_cb(gboolean enabled,
+ LocationStatus status,
+ gpointer self)
{
LOCATION_LOGD("gps_status_cb");
g_return_if_fail(self);
- LocationGpsPrivate* priv = GET_PRIVATE(self);
- if (!priv->enabled && enabled) { // Update satellite at searching status.
- if (priv->pos_searching_timer) g_source_remove (priv->pos_searching_timer);
- if (priv->vel_searching_timer) g_source_remove (priv->vel_searching_timer);
+ LocationGpsPrivate *priv = GET_PRIVATE(self);
+ g_return_if_fail(priv);
+ if (!priv->enabled && enabled) { /* Update satellite at searching status. */
+#ifdef TIZEN_PROFILE_MOBILE
+ if (priv->pos_searching_timer) g_source_remove(priv->pos_searching_timer);
+ if (priv->vel_searching_timer) g_source_remove(priv->vel_searching_timer);
priv->pos_searching_timer = 0;
priv->vel_searching_timer = 0;
- return; // Ignored: Support to get position at enabled callback
+#endif
+ return; /* Ignored: Support to get position at enabled callback */
} else if (priv->enabled == TRUE && enabled == FALSE) {
+ __set_started(self, FALSE);
enable_signaling(self, signals, &(priv->enabled), enabled, status);
}
}
static void
-gps_location_cb (gboolean enabled,
- LocationPosition *pos,
- LocationVelocity *vel,
- LocationAccuracy *acc,
- gpointer self)
+gps_location_cb(gboolean enabled,
+ LocationPosition *pos,
+ LocationVelocity *vel,
+ LocationAccuracy *acc,
+ gpointer self)
{
- LOCATION_LOGD("gps_location_cb");
g_return_if_fail(self);
g_return_if_fail(pos);
g_return_if_fail(vel);
g_return_if_fail(acc);
- LocationGpsPrivate* priv = GET_PRIVATE(self);
+ LocationGpsPrivate *priv = GET_PRIVATE(self);
+ g_return_if_fail(priv);
+
+ if (priv->min_interval != LOCATION_UPDATE_INTERVAL_NONE) {
+ distance_based_position_signaling(self,
+ signals,
+ enabled,
+ pos,
+ vel,
+ acc,
+ priv->min_interval,
+ priv->min_distance,
+ &(priv->enabled),
+ &(priv->dist_updated_timestamp),
+ &(priv->pos),
+ &(priv->vel),
+ &(priv->acc));
+ }
location_signaling(self,
- signals,
- enabled, // previous status
- priv->boundary_list,
- pos,
- vel,
- acc,
- priv->pos_interval,
- priv->vel_interval,
- &(priv->enabled),
- &(priv->pos_updated_timestamp),
- &(priv->vel_updated_timestamp),
- &(priv->pos),
- &(priv->vel),
- &(priv->acc));
+ signals,
+ enabled, /* previous status */
+ priv->boundary_list,
+ pos,
+ vel,
+ acc,
+ priv->pos_interval,
+ priv->vel_interval,
+ priv->loc_interval,
+ &(priv->enabled),
+ &(priv->pos_updated_timestamp),
+ &(priv->vel_updated_timestamp),
+ &(priv->loc_updated_timestamp),
+ &(priv->pos),
+ &(priv->vel),
+ &(priv->acc));
}
static void
-gps_satellite_cb (gboolean enabled,
- LocationSatellite *sat,
- gpointer self)
+gps_batch_cb(gboolean enabled,
+ guint num_of_location,
+ gpointer self)
{
- LOCATION_LOGD("gps_satellite_cb");
g_return_if_fail(self);
- LocationGpsPrivate* priv = GET_PRIVATE(self);
+ LocationGpsPrivate *priv = GET_PRIVATE(self);
+ g_return_if_fail(priv);
+
+ if (priv->batch != NULL) {
+ location_batch_free(priv->batch);
+ }
+ priv->batch = location_get_batch_file(num_of_location);
+
+ g_signal_emit(self, signals[BATCH_UPDATED], 0, num_of_location);
+}
+
+static void
+gps_satellite_cb(gboolean enabled,
+ LocationSatellite *sat,
+ gpointer self)
+{
+ g_return_if_fail(self);
+ LocationGpsPrivate *priv = GET_PRIVATE(self);
+ g_return_if_fail(priv);
+
satellite_signaling(self, signals, &(priv->enabled), priv->sat_interval, TRUE, &(priv->sat_updated_timestamp), &(priv->sat), sat);
}
+#ifdef TIZEN_PROFILE_MOBILE
static void
-location_setting_search_cb (keynode_t *key, gpointer self)
+location_setting_search_cb(keynode_t *key, gpointer self)
{
LOCATION_LOGD("location_setting_search_cb");
g_return_if_fail(key);
g_return_if_fail(self);
- LocationGpsPrivate* priv = GET_PRIVATE(self);
- g_return_if_fail (priv->mod);
- g_return_if_fail (priv->mod->handler);
+ LocationGpsPrivate *priv = GET_PRIVATE(self);
+ g_return_if_fail(priv);
+ g_return_if_fail(priv->mod);
+ g_return_if_fail(priv->mod->handler);
if (location_setting_get_key_val(key) == VCONFKEY_LOCATION_GPS_SEARCHING) {
- if (!priv->pos_searching_timer) priv->pos_searching_timer = g_timeout_add (priv->pos_interval * 1000, _position_timeout_cb, self);
- if (!priv->vel_searching_timer) priv->vel_searching_timer = g_timeout_add (priv->vel_interval * 1000, _velocity_timeout_cb, self);
+ if (!priv->pos_searching_timer) priv->pos_searching_timer = g_timeout_add(priv->pos_interval * 1000, _position_timeout_cb, self);
+ if (!priv->vel_searching_timer) priv->vel_searching_timer = g_timeout_add(priv->vel_interval * 1000, _velocity_timeout_cb, self);
} else {
- if (priv->pos_searching_timer) g_source_remove (priv->pos_searching_timer);
- if (priv->vel_searching_timer) g_source_remove (priv->vel_searching_timer);
+ if (priv->pos_searching_timer) g_source_remove(priv->pos_searching_timer);
+ if (priv->vel_searching_timer) g_source_remove(priv->vel_searching_timer);
priv->pos_searching_timer = 0;
priv->vel_searching_timer = 0;
}
}
+#endif
static void
-location_setting_gps_cb (keynode_t *key,
- gpointer self)
+location_setting_gps_cb(keynode_t *key,
+ gpointer self)
{
LOCATION_LOGD("location_setting_gps_cb");
g_return_if_fail(key);
g_return_if_fail(self);
- LocationGpsPrivate* priv = GET_PRIVATE(self);
- g_return_if_fail (priv->mod);
- g_return_if_fail (priv->mod->handler);
+ LocationGpsPrivate *priv = GET_PRIVATE(self);
+ g_return_if_fail(priv);
+ g_return_if_fail(priv->mod);
+ g_return_if_fail(priv->mod->handler);
int ret = LOCATION_ERROR_NONE;
- if (0 == location_setting_get_key_val(key) && priv->mod->ops.stop && priv->is_started) {
+ if (0 == location_setting_get_key_val(key) && priv->mod->ops.stop && __get_started(self)) {
LOCATION_LOGD("location stopped by setting");
+ __set_started(self, FALSE);
ret = priv->mod->ops.stop(priv->mod->handler);
if (ret == LOCATION_ERROR_NONE) {
- priv->is_started = FALSE;
__reset_pos_data_from_priv(priv);
+ } else {
+ LOCATION_LOGI("Fail to stop[%d]", ret);
}
- } else if (1 == location_setting_get_key_val(key) && priv->mod->ops.start && !priv->is_started) {
+
+ } else if (1 == location_setting_get_key_val(key) && priv->mod->ops.start && !__get_started(self)) {
LOCATION_LOGD("location resumed by setting");
- ret = priv->mod->ops.start (priv->mod->handler, gps_status_cb, gps_location_cb, gps_satellite_cb, self);
- if (ret == LOCATION_ERROR_NONE) {
- priv->is_started = TRUE;
+ __set_started(self, TRUE);
+ ret = priv->mod->ops.start(priv->mod->handler, priv->pos_interval, gps_status_cb, gps_location_cb, gps_satellite_cb, self);
+ if (ret != LOCATION_ERROR_NONE) {
+ __set_started(self, FALSE);
+ LOCATION_LOGI("Fail to start[%d]", ret);
}
}
}
static int
-location_gps_start (LocationGps *self)
+location_gps_start(LocationGps *self)
{
LOCATION_LOGD("location_gps_start");
- LocationGpsPrivate* priv = GET_PRIVATE(self);
- g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (priv->mod->ops.start, LOCATION_ERROR_NOT_AVAILABLE);
+ LocationGpsPrivate *priv = GET_PRIVATE(self);
+ g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod->ops.start, LOCATION_ERROR_NOT_AVAILABLE);
- if (priv->is_started == TRUE) return LOCATION_ERROR_NONE;
+ if (__get_started(self) == TRUE) return LOCATION_ERROR_NONE;
int ret = LOCATION_ERROR_NONE;
if (!location_setting_get_int(VCONFKEY_LOCATION_ENABLED)) {
ret = LOCATION_ERROR_SETTING_OFF;
+ } else if (location_setting_get_int(VCONFKEY_SETAPPL_PSMODE) == SETTING_PSMODE_WEARABLE_ENHANCED) {
+ return LOCATION_ACCESS_DENIED;
} else {
- ret = priv->mod->ops.start (priv->mod->handler, gps_status_cb, gps_location_cb, gps_satellite_cb, self);
- if (ret == LOCATION_ERROR_NONE) {
- priv->is_started = TRUE;
- } else {
+ __set_started(self, TRUE);
+ ret = priv->mod->ops.start(priv->mod->handler, priv->pos_interval, gps_status_cb, gps_location_cb, gps_satellite_cb, self);
+ if (ret != LOCATION_ERROR_NONE) {
+ LOCATION_LOGE("Fail to start gps. Error[%d]", ret);
+ __set_started(self, FALSE);
return ret;
}
}
- if(priv->set_noti == FALSE) {
- location_setting_add_notify (VCONFKEY_LOCATION_ENABLED, location_setting_gps_cb, self);
- location_setting_add_notify (VCONFKEY_LOCATION_GPS_STATE, location_setting_search_cb, self);
+ if (priv->app_type != CPPAPP && priv->set_noti == FALSE) {
+ location_setting_add_notify(VCONFKEY_LOCATION_ENABLED, location_setting_gps_cb, self);
+#ifdef TIZEN_PROFILE_MOBILE
+ location_setting_add_notify(VCONFKEY_LOCATION_GPS_STATE, location_setting_search_cb, self);
+#endif
priv->set_noti = TRUE;
}
}
static int
-location_gps_stop (LocationGps *self)
+location_gps_stop(LocationGps *self)
{
LOCATION_LOGD("location_gps_stop");
- LocationGpsPrivate* priv = GET_PRIVATE(self);
- g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (priv->mod->ops.stop, LOCATION_ERROR_NOT_AVAILABLE);
+ LocationGpsPrivate *priv = GET_PRIVATE(self);
+ g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod->ops.stop, LOCATION_ERROR_NOT_AVAILABLE);
int ret = LOCATION_ERROR_NONE;
- if (priv->is_started == TRUE) {
- ret = priv->mod->ops.stop (priv->mod->handler);
- if (ret == LOCATION_ERROR_NONE) {
- priv->is_started = FALSE;
- } else {
- LOCATION_LOGD("Failed to stop. Error[%d]", ret);
+ if (__get_started(self) == TRUE) {
+ __set_started(self, FALSE);
+ ret = priv->mod->ops.stop(priv->mod->handler);
+ if (ret != LOCATION_ERROR_NONE) {
+ LOCATION_LOGE("Failed to stop. Error[%d]", ret);
}
+ } else {
+ return LOCATION_ERROR_NONE;
}
- if (priv->pos_searching_timer ) g_source_remove (priv->pos_searching_timer);
- if (priv->vel_searching_timer ) g_source_remove (priv->vel_searching_timer);
+#ifdef TIZEN_PROFILE_MOBILE
+ if (priv->pos_searching_timer) g_source_remove(priv->pos_searching_timer);
+ if (priv->vel_searching_timer) g_source_remove(priv->vel_searching_timer);
priv->pos_searching_timer = 0;
priv->vel_searching_timer = 0;
+#endif
- if(priv->set_noti == TRUE) {
- location_setting_ignore_notify (VCONFKEY_LOCATION_ENABLED, location_setting_gps_cb);
- location_setting_ignore_notify (VCONFKEY_LOCATION_GPS_STATE, location_setting_search_cb);
+ if (priv->app_type != CPPAPP && priv->set_noti == TRUE) {
+ location_setting_ignore_notify(VCONFKEY_LOCATION_ENABLED, location_setting_gps_cb);
+#ifdef TIZEN_PROFILE_MOBILE
+ location_setting_ignore_notify(VCONFKEY_LOCATION_GPS_STATE, location_setting_search_cb);
+#endif
priv->set_noti = FALSE;
}
return ret;
}
+static int
+location_gps_start_batch(LocationGps *self)
+{
+ LOCATION_LOGD("location_gps_start_batch");
+ LocationGpsPrivate *priv = GET_PRIVATE(self);
+ g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod->ops.start_batch, LOCATION_ERROR_NOT_AVAILABLE);
+
+ if (__get_started(self) == TRUE) return LOCATION_ERROR_NONE;
+
+ int ret = LOCATION_ERROR_NONE;
+
+ if (!location_setting_get_int(VCONFKEY_LOCATION_ENABLED)) {
+ ret = LOCATION_ERROR_SETTING_OFF;
+ } else {
+ __set_started(self, TRUE);
+ ret = priv->mod->ops.start_batch(priv->mod->handler, gps_batch_cb, priv->batch_interval, priv->batch_period, self);
+ if (ret != LOCATION_ERROR_NONE) {
+ LOCATION_LOGE("Fail to start_batch. Error[%d]", ret);
+ __set_started(self, FALSE);
+ return ret;
+ }
+ }
+
+ return ret;
+}
+
+static int
+location_gps_stop_batch(LocationGps *self)
+{
+ LOCATION_LOGD("location_gps_stop_batch");
+ LocationGpsPrivate *priv = GET_PRIVATE(self);
+ g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod->ops.stop_batch, LOCATION_ERROR_NOT_AVAILABLE);
+
+ int ret = LOCATION_ERROR_NONE;
+
+ if (__get_started(self) == TRUE) {
+ __set_started(self, FALSE);
+ ret = priv->mod->ops.stop_batch(priv->mod->handler);
+ if (ret != LOCATION_ERROR_NONE) {
+ LOCATION_LOGE("Failed to stop_batch. Error[%d]", ret);
+ }
+ } else {
+ return LOCATION_ERROR_NONE;
+ }
+
+ __reset_pos_data_from_priv(priv);
+
+ return ret;
+}
+
static void
-location_gps_dispose (GObject *gobject)
+location_gps_dispose(GObject *gobject)
{
LOCATION_LOGD("location_gps_dispose");
- LocationGpsPrivate* priv = GET_PRIVATE(gobject);
+ LocationGpsPrivate *priv = GET_PRIVATE(gobject);
+ g_return_if_fail(priv);
+ g_mutex_clear(&priv->mutex);
- if (priv->pos_searching_timer) g_source_remove (priv->pos_searching_timer);
- if (priv->vel_searching_timer) g_source_remove (priv->vel_searching_timer);
+#ifdef TIZEN_PROFILE_MOBILE
+ if (priv->pos_searching_timer) g_source_remove(priv->pos_searching_timer);
+ if (priv->vel_searching_timer) g_source_remove(priv->vel_searching_timer);
+ if (priv->loc_timeout) g_source_remove(priv->loc_timeout);
priv->pos_searching_timer = 0;
priv->vel_searching_timer = 0;
+ priv->loc_timeout = 0;
+#endif
- if(priv->set_noti == TRUE) {
- location_setting_ignore_notify (VCONFKEY_LOCATION_ENABLED, location_setting_gps_cb);
- location_setting_ignore_notify (VCONFKEY_LOCATION_GPS_STATE, location_setting_search_cb);
+ if (priv->app_type != CPPAPP && priv->set_noti == TRUE) {
+ location_setting_ignore_notify(VCONFKEY_LOCATION_ENABLED, location_setting_gps_cb);
+#ifdef TIZEN_PROFILE_MOBILE
+ location_setting_ignore_notify(VCONFKEY_LOCATION_GPS_STATE, location_setting_search_cb);
+#endif
priv->set_noti = FALSE;
}
}
static void
-location_gps_finalize (GObject *gobject)
+location_gps_finalize(GObject *gobject)
{
LOCATION_LOGD("location_gps_finalize");
- LocationGpsPrivate* priv = GET_PRIVATE(gobject);
+ LocationGpsPrivate *priv = GET_PRIVATE(gobject);
+ g_return_if_fail(priv);
module_free(priv->mod, "gps");
priv->mod = NULL;
if (priv->boundary_list) {
- g_list_free_full (priv->boundary_list, free_boundary_list);
+ g_list_free_full(priv->boundary_list, free_boundary_list);
priv->boundary_list = NULL;
}
priv->pos = NULL;
}
+ if (priv->batch) {
+ location_batch_free(priv->batch);
+ priv->batch = NULL;
+ }
+
if (priv->vel) {
location_velocity_free(priv->vel);
priv->vel = NULL;
location_satellite_free(priv->sat);
priv->sat = NULL;
}
- G_OBJECT_CLASS (location_gps_parent_class)->finalize (gobject);
+ G_OBJECT_CLASS(location_gps_parent_class)->finalize(gobject);
}
static void
-location_gps_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
+location_gps_set_property(GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- LocationGpsPrivate* priv = GET_PRIVATE(object);
-
- g_return_if_fail (priv->mod);
- g_return_if_fail (priv->mod->handler);
- LocModGpsOps ops = priv->mod->ops;
+ LocationGpsPrivate *priv = GET_PRIVATE(object);
+ g_return_if_fail(priv);
+ g_return_if_fail(priv->mod);
+ g_return_if_fail(priv->mod->handler);
int ret = 0;
- switch (property_id){
- case PROP_DEV_NAME: {
- char* devname = g_value_dup_string(value);
- LOCATION_LOGD("Set prop>> device_name: %s", devname);
- if(ops.set_devname)
- ops.set_devname(priv->mod->handler, devname);
- g_free(devname);
- break;
- }
+ switch (property_id) {
case PROP_BOUNDARY: {
- GList *boundary_list = g_list_copy(g_value_get_pointer(value));
- ret = set_prop_boundary(&priv->boundary_list, boundary_list);
- if(ret != 0) LOCATION_LOGD("Set boundary. Error[%d]", ret);
- break;
- }
+ GList *boundary_list = g_list_copy(g_value_get_pointer(value));
+ ret = set_prop_boundary(&priv->boundary_list, boundary_list);
+ if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Set boundary. Error[%d]", ret);
+ if (boundary_list) g_list_free(boundary_list);
+ break;
+ }
case PROP_REMOVAL_BOUNDARY: {
- LocationBoundary *req_boundary = (LocationBoundary*) g_value_dup_boxed(value);
- ret = set_prop_removal_boundary(&priv->boundary_list, req_boundary);
- if(ret != 0) LOCATION_LOGD("Removal boundary. Error[%d]", ret);
- break;
- }
- case PROP_POS_INTERVAL: {
- guint interval = g_value_get_uint(value);
- LOCATION_LOGD("Set prop>> update-interval: %u", interval);
- if(interval > 0) {
- if(interval < LOCATION_UPDATE_INTERVAL_MAX)
- priv->pos_interval = interval;
- else
- priv->pos_interval = (guint)LOCATION_UPDATE_INTERVAL_MAX;
+ LocationBoundary *req_boundary = (LocationBoundary *) g_value_dup_boxed(value);
+ ret = set_prop_removal_boundary(&priv->boundary_list, req_boundary);
+ if (ret != 0) LOCATION_LOGD("Removal boundary. Error[%d]", ret);
+ break;
}
- else
- priv->pos_interval = (guint)LOCATION_UPDATE_INTERVAL_DEFAULT;
+ case PROP_POS_INTERVAL: {
+ guint interval = g_value_get_uint(value);
+ LOCATION_LOGD("Set prop>> PROP_POS_INTERVAL: %u", interval);
+ if (interval > 0) {
+ if (interval < LOCATION_UPDATE_INTERVAL_MAX)
+ priv->pos_interval = interval;
+ else
+ priv->pos_interval = (guint)LOCATION_UPDATE_INTERVAL_MAX;
+ } else
+ priv->pos_interval = (guint)LOCATION_UPDATE_INTERVAL_DEFAULT;
+
+#ifdef TIZEN_PROFILE_MOBILE
+ if (priv->pos_searching_timer) {
+ g_source_remove(priv->pos_searching_timer);
+ priv->pos_searching_timer = g_timeout_add(priv->pos_interval * 1000, _position_timeout_cb, object);
+ }
+#endif
- if (priv->pos_searching_timer) {
- g_source_remove (priv->pos_searching_timer);
- priv->pos_searching_timer = g_timeout_add (priv->pos_interval * 1000, _position_timeout_cb, object);
- }
+ if (__get_started(object) == TRUE) {
+ LOCATION_LOGD("[update_pos_interval]: update pos-interval while pos-tracking");
+ g_return_if_fail(priv->mod->ops.set_position_update_interval);
+ priv->mod->ops.set_position_update_interval(priv->mod->handler, priv->pos_interval);
+ }
- break;
- }
- case PROP_VEL_INTERVAL: {
- guint interval = g_value_get_uint(value);
- LOCATION_LOGD("Set prop>> update-interval: %u", interval);
- if(interval > 0) {
- if(interval < LOCATION_UPDATE_INTERVAL_MAX)
- priv->vel_interval = interval;
- else
- priv->vel_interval = (guint)LOCATION_UPDATE_INTERVAL_MAX;
+ break;
}
- else
- priv->vel_interval = (guint)LOCATION_UPDATE_INTERVAL_DEFAULT;
-
- if (priv->vel_searching_timer) {
- g_source_remove (priv->vel_searching_timer);
- priv->vel_searching_timer = g_timeout_add (priv->vel_interval * 1000, _velocity_timeout_cb, object);
+ case PROP_VEL_INTERVAL: {
+ guint interval = g_value_get_uint(value);
+ LOCATION_LOGD("Set prop>> PROP_VEL_INTERVAL: %u", interval);
+ if (interval > 0) {
+ if (interval < LOCATION_UPDATE_INTERVAL_MAX)
+ priv->vel_interval = interval;
+ else
+ priv->vel_interval = (guint)LOCATION_UPDATE_INTERVAL_MAX;
+ } else
+ priv->vel_interval = (guint)LOCATION_UPDATE_INTERVAL_DEFAULT;
+
+#ifdef TIZEN_PROFILE_MOBILE
+ if (priv->vel_searching_timer) {
+ g_source_remove(priv->vel_searching_timer);
+ priv->vel_searching_timer = g_timeout_add(priv->vel_interval * 1000, _velocity_timeout_cb, object);
+ }
+#endif
+ break;
}
-
- break;
- }
case PROP_SAT_INTERVAL: {
- guint interval = g_value_get_uint(value);
- LOCATION_LOGD("Set prop>> update-interval: %u", interval);
- if(interval > 0) {
- if(interval < LOCATION_UPDATE_INTERVAL_MAX)
- priv->sat_interval = interval;
- else
- priv->sat_interval = (guint)LOCATION_UPDATE_INTERVAL_MAX;
+ guint interval = g_value_get_uint(value);
+ LOCATION_LOGD("Set prop>> PROP_SAT_INTERVAL: %u", interval);
+ if (interval > 0) {
+ if (interval < LOCATION_UPDATE_INTERVAL_MAX)
+ priv->sat_interval = interval;
+ else
+ priv->sat_interval = (guint)LOCATION_UPDATE_INTERVAL_MAX;
+ } else
+ priv->sat_interval = (guint)LOCATION_UPDATE_INTERVAL_DEFAULT;
+
+ break;
+ }
+ case PROP_LOC_INTERVAL: {
+ guint interval = g_value_get_uint(value);
+ LOCATION_LOGD("Set prop>> PROP_LOC_INTERVAL: %u", interval);
+ if (interval > 0) {
+ if (interval < LOCATION_UPDATE_INTERVAL_MAX)
+ priv->loc_interval = interval;
+ else
+ priv->loc_interval = (guint)LOCATION_UPDATE_INTERVAL_MAX;
+ } else
+ priv->loc_interval = (guint)LOCATION_UPDATE_INTERVAL_DEFAULT;
+
+ break;
+ }
+ case PROP_BATCH_INTERVAL: {
+ guint interval = g_value_get_uint(value);
+ LOCATION_LOGD("Set prop>> PROP_BATCH_INTERVAL: %u", interval);
+ if (interval > 0) {
+ if (interval < LOCATION_UPDATE_INTERVAL_MAX)
+ priv->batch_interval = interval;
+ else
+ priv->batch_interval = (guint)LOCATION_UPDATE_INTERVAL_MAX;
+ } else
+ priv->batch_interval = (guint)LOCATION_UPDATE_INTERVAL_DEFAULT;
+
+ if (__get_started(object) == TRUE) {
+ LOCATION_LOGD("[update_batch_interval]: update batch-interval while pos-tracking");
+ g_return_if_fail(priv->mod->ops.set_position_update_interval);
+ priv->mod->ops.set_position_update_interval(priv->mod->handler, priv->batch_interval);
+ }
+ break;
+ }
+ case PROP_BATCH_PERIOD: {
+ guint interval = g_value_get_uint(value);
+ LOCATION_LOGD("Set prop>> PROP_BATCH_PERIOD: %u", interval);
+ if (interval > 0) {
+ if (interval < LOCATION_BATCH_PERIOD_MAX)
+ priv->batch_period = interval;
+ else
+ priv->batch_period = (guint)LOCATION_BATCH_PERIOD_MAX;
+ } else
+ priv->batch_period = (guint)LOCATION_BATCH_PERIOD_DEFAULT;
+
+ break;
+ }
+ case PROP_MIN_INTERVAL: {
+ guint interval = g_value_get_uint(value);
+ LOCATION_LOGD("Set prop>> PROP_MIN_INTERVAL: %u", interval);
+ if (interval > 0) {
+ if (interval < LOCATION_MIN_INTERVAL_MAX)
+ priv->min_interval = interval;
+ else
+ priv->min_interval = (guint)LOCATION_MIN_INTERVAL_MAX;
+ } else
+ priv->min_interval = (guint)LOCATION_MIN_INTERVAL_DEFAULT;
+
+ break;
+ }
+ case PROP_MIN_DISTANCE: {
+ gdouble distance = g_value_get_double(value);
+ LOCATION_LOGD("Set prop>> PROP_MIN_DISTANCE: %u", distance);
+ if (distance > 0) {
+ if (distance < LOCATION_MIN_DISTANCE_MAX)
+ priv->min_distance = distance;
+ else
+ priv->min_distance = (gdouble)LOCATION_MIN_DISTANCE_MAX;
+ } else
+ priv->min_distance = (gdouble)LOCATION_MIN_DISTANCE_DEFAULT;
+
+ break;
}
- else
- priv->sat_interval = (guint)LOCATION_UPDATE_INTERVAL_DEFAULT;
-
- break;
- }
default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
break;
}
}
static void
-location_gps_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
+location_gps_get_property(GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- LocationGpsPrivate *priv = GET_PRIVATE (object);
-
- g_return_if_fail (priv->mod);
- g_return_if_fail (priv->mod->handler);
+ LocationGpsPrivate *priv = GET_PRIVATE(object);
+ g_return_if_fail(priv);
+ g_return_if_fail(priv->mod);
+ g_return_if_fail(priv->mod->handler);
LocModGpsOps ops = priv->mod->ops;
switch (property_id) {
- case PROP_DEV_NAME: {
- char* devname = NULL;
- if(ops.get_devname)
- ops.get_devname(priv->mod->handler, &devname);
- LOCATION_LOGD ("Get prop>> device_name: %s", devname);
- g_value_set_string (value, devname);
- g_free(devname);
- break;
- }
case PROP_METHOD_TYPE:
g_value_set_int(value, LOCATION_METHOD_GPS);
break;
case PROP_IS_STARTED:
- g_value_set_boolean(value, priv->is_started);
+ g_value_set_boolean(value, __get_started(object));
break;
case PROP_LAST_POSITION:
- g_value_set_boxed (value, priv->pos);
+ g_value_set_boxed(value, priv->pos);
break;
case PROP_POS_INTERVAL:
g_value_set_uint(value, priv->pos_interval);
case PROP_SAT_INTERVAL:
g_value_set_uint(value, priv->sat_interval);
break;
+ case PROP_LOC_INTERVAL:
+ g_value_set_uint(value, priv->loc_interval);
+ break;
+ case PROP_BATCH_INTERVAL:
+ g_value_set_uint(value, priv->batch_interval);
+ break;
+ case PROP_BATCH_PERIOD:
+ g_value_set_uint(value, priv->batch_period);
+ break;
+ case PROP_MIN_INTERVAL:
+ g_value_set_uint(value, priv->min_interval);
+ break;
+ case PROP_MIN_DISTANCE:
+ g_value_set_double(value, priv->min_distance);
+ break;
case PROP_BOUNDARY:
g_value_set_pointer(value, g_list_first(priv->boundary_list));
break;
case PROP_NMEA: {
- char *nmea_data = NULL;
- if (ops.get_nmea && LOCATION_ERROR_NONE == ops.get_nmea(priv->mod->handler, &nmea_data) && nmea_data) {
- LOCATION_LOGD("Get prop>> Lastest nmea: \n%s", nmea_data);
- g_value_set_string(value, nmea_data);
- g_free(nmea_data);
- } else {
- LOCATION_LOGW("Get prop>> Lastest nmea: failed");
- g_value_set_string(value, NULL);
+ char *nmea_data = NULL;
+ if (ops.get_nmea && LOCATION_ERROR_NONE == ops.get_nmea(priv->mod->handler, &nmea_data) && nmea_data) {
+ LOCATION_SECLOG("Get prop>> Lastest nmea: \n%s", nmea_data);
+ g_value_set_string(value, nmea_data);
+ g_free(nmea_data);
+ } else {
+ LOCATION_LOGW("Get prop>> Lastest nmea: failed");
+ g_value_set_string(value, NULL);
+ }
+ break;
}
- break;
- }
case PROP_SATELLITE: {
- LocationSatellite *satellite = NULL;
- if (ops.get_satellite && priv->mod->handler && LOCATION_ERROR_NONE == ops.get_satellite(priv->mod->handler, &satellite) && satellite){
- LOCATION_LOGD("Get prop>> Last sat: num_used(%d) num_view(%d)", satellite->num_of_sat_used, satellite->num_of_sat_inview);
- g_value_set_boxed (value, satellite);
- location_satellite_free(satellite);
- } else {
- LOCATION_LOGW("Get prop>> Last sat: failed");
- g_value_set_boxed (value, NULL);
+ LocationSatellite *satellite = NULL;
+ if (ops.get_satellite && priv->mod->handler && LOCATION_ERROR_NONE == ops.get_satellite(priv->mod->handler, &satellite) && satellite) {
+ LOCATION_LOGD("Get prop>> Last sat: num_used(%d) num_view(%d)", satellite->num_of_sat_used, satellite->num_of_sat_inview);
+ g_value_set_boxed(value, satellite);
+ location_satellite_free(satellite);
+ } else {
+ LOCATION_LOGW("Get prop>> Last sat: failed");
+ g_value_set_boxed(value, NULL);
+ }
+ break;
}
- break;
- }
default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
break;
}
}
static int
-location_gps_get_position (LocationGps *self,
- LocationPosition **position,
- LocationAccuracy **accuracy)
+location_gps_get_position(LocationGps *self,
+ LocationPosition **position,
+ LocationAccuracy **accuracy)
{
int ret = LOCATION_ERROR_NOT_AVAILABLE;
- LOCATION_LOGD("location_gps_get_position");
- LocationGpsPrivate *priv = GET_PRIVATE (self);
- g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
+ LocationGpsPrivate *priv = GET_PRIVATE(self);
+ g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
setting_retval_if_fail(VCONFKEY_LOCATION_ENABLED);
- g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
- if (priv->is_started != TRUE) {
- LOCATION_LOGD("location is not started");
+ if (__get_started(self) != TRUE) {
+ LOCATION_LOGE("location is not started");
return LOCATION_ERROR_NOT_AVAILABLE;
}
if (priv->pos) {
- *position = location_position_copy (priv->pos);
- if (priv->acc) *accuracy = location_accuracy_copy (priv->acc);
+ *position = location_position_copy(priv->pos);
+ if (priv->acc) *accuracy = location_accuracy_copy(priv->acc);
else *accuracy = location_accuracy_new(LOCATION_ACCURACY_LEVEL_NONE, 0.0, 0.0);
ret = LOCATION_ERROR_NONE;
}
}
static int
-location_gps_get_position_ext (LocationGps *self,
- LocationPosition **position,
- LocationVelocity **velocity,
- LocationAccuracy **accuracy)
+location_gps_get_position_ext(LocationGps *self,
+ LocationPosition **position,
+ LocationVelocity **velocity,
+ LocationAccuracy **accuracy)
{
int ret = LOCATION_ERROR_NOT_AVAILABLE;
- LOCATION_LOGD("location_gps_get_position_ext");
- LocationGpsPrivate *priv = GET_PRIVATE (self);
- g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
+ LocationGpsPrivate *priv = GET_PRIVATE(self);
+ g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
setting_retval_if_fail(VCONFKEY_LOCATION_ENABLED);
- if (priv->is_started != TRUE) {
- LOCATION_LOGD("location is not started");
+ if (__get_started(self) != TRUE) {
+ LOCATION_LOGE("location is not started");
return LOCATION_ERROR_NOT_AVAILABLE;
}
if (priv->pos && priv->vel) {
- *position = location_position_copy (priv->pos);
- *velocity = location_velocity_copy (priv->vel);
- if (priv->acc) *accuracy = location_accuracy_copy (priv->acc);
+ *position = location_position_copy(priv->pos);
+ *velocity = location_velocity_copy(priv->vel);
+ if (priv->acc) *accuracy = location_accuracy_copy(priv->acc);
else *accuracy = location_accuracy_new(LOCATION_ACCURACY_LEVEL_NONE, 0.0, 0.0);
ret = LOCATION_ERROR_NONE;
}
}
static int
-location_gps_get_last_position (LocationGps *self,
- LocationPosition **position,
- LocationAccuracy **accuracy)
+location_gps_get_last_position(LocationGps *self,
+ LocationPosition **position,
+ LocationAccuracy **accuracy)
{
- LOCATION_LOGD("location_gps_get_last_position");
-
- LocationGpsPrivate *priv = GET_PRIVATE (self);
- g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
+ LocationGpsPrivate *priv = GET_PRIVATE(self);
+ g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
+ setting_retval_if_fail(VCONFKEY_LOCATION_ENABLED);
int ret = LOCATION_ERROR_NONE;
LocationVelocity *_velocity = NULL;
LocModGpsOps ops = priv->mod->ops;
- g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (ops.get_last_position, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(ops.get_last_position, LOCATION_ERROR_NOT_AVAILABLE);
ret = ops.get_last_position(priv->mod->handler, position, &_velocity, accuracy);
if (_velocity) location_velocity_free(_velocity);
}
static int
-location_gps_get_last_position_ext (LocationGps *self,
- LocationPosition **position,
- LocationVelocity **velocity,
- LocationAccuracy **accuracy)
+location_gps_get_last_position_ext(LocationGps *self,
+ LocationPosition **position,
+ LocationVelocity **velocity,
+ LocationAccuracy **accuracy)
{
- LOCATION_LOGD("location_gps_get_last_position_ext");
-
- LocationGpsPrivate *priv = GET_PRIVATE (self);
- g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
+ LocationGpsPrivate *priv = GET_PRIVATE(self);
+ g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
+ setting_retval_if_fail(VCONFKEY_LOCATION_ENABLED);
LocModGpsOps ops = priv->mod->ops;
- g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (ops.get_last_position, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(ops.get_last_position, LOCATION_ERROR_NOT_AVAILABLE);
return ops.get_last_position(priv->mod->handler, position, velocity, accuracy);
}
static int
-location_gps_get_velocity (LocationGps *self,
- LocationVelocity **velocity,
- LocationAccuracy **accuracy)
+location_gps_get_velocity(LocationGps *self,
+ LocationVelocity **velocity,
+ LocationAccuracy **accuracy)
{
- LOCATION_LOGD("location_gps_get_velocity");
-
int ret = LOCATION_ERROR_NOT_AVAILABLE;
- LocationGpsPrivate *priv = GET_PRIVATE (self);
- g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
+ LocationGpsPrivate *priv = GET_PRIVATE(self);
+ g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
setting_retval_if_fail(VCONFKEY_LOCATION_ENABLED);
- g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
- if (priv->is_started != TRUE) {
- LOCATION_LOGD("location is not started");
+ if (__get_started(self) != TRUE) {
+ LOCATION_LOGE("location is not started");
return LOCATION_ERROR_NOT_AVAILABLE;
}
-
+
if (priv->vel) {
- *velocity = location_velocity_copy (priv->vel);
- if (priv->acc) *accuracy = location_accuracy_copy (priv->acc);
+ *velocity = location_velocity_copy(priv->vel);
+ if (priv->acc) *accuracy = location_accuracy_copy(priv->acc);
else *accuracy = location_accuracy_new(LOCATION_ACCURACY_LEVEL_NONE, 0.0, 0.0);
ret = LOCATION_ERROR_NONE;
}
}
static int
-location_gps_get_last_velocity (LocationGps *self,
- LocationVelocity **velocity,
- LocationAccuracy **accuracy)
+location_gps_get_last_velocity(LocationGps *self,
+ LocationVelocity **velocity,
+ LocationAccuracy **accuracy)
{
- LOCATION_LOGD("location_gps_get_last_velocity");
-
- LocationGpsPrivate *priv = GET_PRIVATE (self);
- g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
+ LocationGpsPrivate *priv = GET_PRIVATE(self);
+ g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
setting_retval_if_fail(VCONFKEY_LOCATION_ENABLED);
int ret = LOCATION_ERROR_NONE;
LocationPosition *_position = NULL;
LocModGpsOps ops = priv->mod->ops;
- g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (ops.get_last_position, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(ops.get_last_position, LOCATION_ERROR_NOT_AVAILABLE);
ret = ops.get_last_position(priv->mod->handler, &_position, velocity, accuracy);
if (_position) location_position_free(_position);
return ret;
}
+static gboolean __single_location_timeout_cb(void *data)
+{
+ LOCATION_LOGD("__single_location_timeout_cb");
+ LocationGps *self = (LocationGps *)data;
+ LocationGpsPrivate *priv = GET_PRIVATE(self);
+ g_return_val_if_fail(priv, FALSE);
+
+ LocationPosition *pos = location_position_new(0, 0.0, 0.0, 0.0, LOCATION_STATUS_NO_FIX);
+ LocationVelocity *vel = location_velocity_new(0, 0.0, 0.0, 0.0);
+ LocationAccuracy *acc = location_accuracy_new(LOCATION_ACCURACY_LEVEL_NONE, 0.0, 0.0);
+
+ if (priv->loc_timeout) g_source_remove(priv->loc_timeout);
+ priv->loc_timeout = 0;
+
+ g_signal_emit(self, signals[LOCATION_UPDATED], LOCATION_ERROR_NOT_AVAILABLE, 0, pos, vel, acc);
+ location_gps_stop(self);
+
+ return FALSE;
+}
+
+static void
+gps_single_location_cb(gboolean enabled,
+ LocationPosition *pos,
+ LocationVelocity *vel,
+ LocationAccuracy *acc,
+ gpointer self)
+{
+ LOCATION_LOGD("gps_single_location_cb");
+ g_return_if_fail(self);
+ g_return_if_fail(pos);
+ g_return_if_fail(vel);
+ g_return_if_fail(acc);
+
+ LocationGps *obj = (LocationGps *)self;
+ LocationGpsPrivate *priv = GET_PRIVATE(obj);
+ g_return_if_fail(priv);
+
+ g_signal_emit(self, signals[LOCATION_UPDATED], LOCATION_ERROR_NONE, 0, pos, vel, acc);
+ if (priv->loc_timeout) {
+ g_source_remove(priv->loc_timeout);
+ priv->loc_timeout = 0;
+ }
+ location_gps_stop(self);
+}
+
+static int
+location_gps_request_single_location(LocationGps *self, int timeout)
+{
+ LOCATION_LOGD("location_gps_request_single_location");
+ LocationGpsPrivate *priv = GET_PRIVATE(self);
+ g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod->ops.start, LOCATION_ERROR_NOT_AVAILABLE);
+
+ if (__get_started(self) == TRUE) return LOCATION_ERROR_NONE;
+
+ int ret = LOCATION_ERROR_NONE;
+
+ __set_started(self, TRUE);
+ ret = priv->mod->ops.start(priv->mod->handler, priv->pos_interval, gps_status_cb, gps_single_location_cb, NULL, self);
+ if (ret != LOCATION_ERROR_NONE) {
+ LOCATION_LOGE("Fail to start request single. Error[%d]", ret);
+ __set_started(self, FALSE);
+ return ret;
+ } else {
+ if (priv->loc_timeout != 0) {
+ g_source_remove(priv->loc_timeout);
+ }
+ priv->loc_timeout = g_timeout_add_seconds(timeout, __single_location_timeout_cb, self);
+ }
+
+ return ret;
+}
+
static int
-location_gps_get_satellite (LocationGps *self,
- LocationSatellite **satellite)
+location_gps_get_nmea(LocationGps *self, char **nmea_data)
{
int ret = LOCATION_ERROR_NOT_AVAILABLE;
- LOCATION_LOGD("location_gps_get_satellite");
- LocationGpsPrivate *priv = GET_PRIVATE (self);
- g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
+ LocationGpsPrivate *priv = GET_PRIVATE(self);
+ g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod->ops.get_nmea, LOCATION_ERROR_NOT_AVAILABLE);
setting_retval_if_fail(VCONFKEY_LOCATION_ENABLED);
- if (priv->is_started != TRUE) {
- LOCATION_LOGD("location is not started");
+ ret = priv->mod->ops.get_nmea(priv->mod->handler, nmea_data);
+ if (ret != LOCATION_ERROR_NONE) {
+ LOCATION_LOGE("Failed to get_nmea. Error[%d]", ret);
+ }
+
+ return ret;
+}
+
+static int
+location_gps_get_batch(LocationGps *self,
+ LocationBatch **batch)
+{
+ int ret = LOCATION_ERROR_NOT_AVAILABLE;
+
+ LocationGpsPrivate *priv = GET_PRIVATE(self);
+ g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
+ setting_retval_if_fail(VCONFKEY_LOCATION_ENABLED);
+
+ if (__get_started(self) != TRUE) {
+ LOCATION_LOGE("location is not started");
+ return LOCATION_ERROR_NOT_AVAILABLE;
+ }
+
+ if (priv->batch) {
+ *batch = location_batch_copy(priv->batch);
+ ret = LOCATION_ERROR_NONE;
+ } else {
+ LOCATION_LOGE("priv->batch is null");
+ ret = LOCATION_ERROR_NOT_AVAILABLE;
+ }
+
+ return ret;
+}
+
+static int
+location_gps_get_satellite(LocationGps *self,
+ LocationSatellite **satellite)
+{
+ int ret = LOCATION_ERROR_NOT_AVAILABLE;
+
+ LocationGpsPrivate *priv = GET_PRIVATE(self);
+ g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
+ setting_retval_if_fail(VCONFKEY_LOCATION_ENABLED);
+
+ if (__get_started(self) != TRUE) {
+ LOCATION_LOGE("location is not started");
return LOCATION_ERROR_NOT_AVAILABLE;
}
if (priv->sat) {
- *satellite = location_satellite_copy (priv->sat);
+ *satellite = location_satellite_copy(priv->sat);
ret = LOCATION_ERROR_NONE;
}
-
+
return ret;
}
static int
-location_gps_get_last_satellite (LocationGps *self,
- LocationSatellite **satellite)
+location_gps_get_last_satellite(LocationGps *self,
+ LocationSatellite **satellite)
{
return location_gps_get_satellite(self, satellite);
}
static int
-location_gps_set_option (LocationGps *self, const char *option)
+location_gps_set_option(LocationGps *self, const char *option)
{
- LOCATION_LOGD("location_gps_set_option");
- LocationGpsPrivate* priv = GET_PRIVATE(self);
- g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
- //g_return_val_if_fail (priv->mod->ops.set_option, LOCATION_ERROR_NOT_AVAILABLE);
- return LOCATION_ERROR_NONE;
+ LocationGpsPrivate *priv = GET_PRIVATE(self);
+ g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod->ops.set_option, LOCATION_ERROR_NOT_AVAILABLE);
+
+ int ret = LOCATION_ERROR_NONE;
+
+ ret = priv->mod->ops.set_option(priv->mod->handler, option);
+ if (ret != LOCATION_ERROR_NONE) {
+ LOCATION_LOGE("Failed to set_option. Error[%d]", ret);
+ }
+
+ return ret;
}
static void
-location_ielement_interface_init (LocationIElementInterface *iface)
+location_ielement_interface_init(LocationIElementInterface *iface)
{
iface->start = (TYPE_START_FUNC)location_gps_start;
iface->stop = (TYPE_STOP_FUNC)location_gps_stop;
iface->get_satellite = (TYPE_GET_SATELLITE)location_gps_get_satellite;
iface->get_last_satellite = (TYPE_GET_SATELLITE)location_gps_get_last_satellite;
iface->set_option = (TYPE_SET_OPTION)location_gps_set_option;
+ iface->get_batch = (TYPE_GET_BATCH)location_gps_get_batch;
+ iface->start_batch = (TYPE_START_BATCH)location_gps_start_batch;
+ iface->stop_batch = (TYPE_STOP_BATCH)location_gps_stop_batch;
+
+ iface->request_single_location = (TYPE_REQUEST_SINGLE_LOCATION)location_gps_request_single_location;
+ iface->get_nmea = (TYPE_GET_NMEA)location_gps_get_nmea;
+
}
static void
-location_gps_init (LocationGps *self)
+location_gps_init(LocationGps *self)
{
LOCATION_LOGD("location_gps_init");
- LocationGpsPrivate* priv = GET_PRIVATE(self);
+ LocationGpsPrivate *priv = GET_PRIVATE(self);
+ g_return_if_fail(priv);
- priv->mod = (LocationGpsMod*)module_new("gps");
- if(!priv->mod) LOCATION_LOGW("module loading failed");
+ priv->mod = (LocationGpsMod *)module_new("gps");
+ if (!priv->mod) LOCATION_LOGW("module loading failed");
+ g_mutex_init(&priv->mutex);
priv->is_started = FALSE;
priv->set_noti = FALSE;
- priv->enabled= FALSE;
+ priv->enabled = FALSE;
+ priv->signal_type = 0;
- priv->pos_interval = LOCATION_UPDATE_INTERVAL_DEFAULT;
- priv->vel_interval = LOCATION_UPDATE_INTERVAL_DEFAULT;
- priv->sat_interval = LOCATION_UPDATE_INTERVAL_DEFAULT;
+ priv->pos_interval = LOCATION_UPDATE_INTERVAL_NONE;
+ priv->vel_interval = LOCATION_UPDATE_INTERVAL_NONE;
+ priv->sat_interval = LOCATION_UPDATE_INTERVAL_NONE;
+ priv->loc_interval = LOCATION_UPDATE_INTERVAL_NONE;
+ priv->batch_interval = LOCATION_UPDATE_INTERVAL_NONE;
+ priv->batch_period = LOCATION_BATCH_PERIOD_DEFAULT;
+ priv->min_interval = LOCATION_UPDATE_INTERVAL_NONE;
priv->pos_updated_timestamp = 0;
priv->vel_updated_timestamp = 0;
priv->sat_updated_timestamp = 0;
+ priv->loc_updated_timestamp = 0;
priv->pos = NULL;
+ priv->batch = NULL;
priv->vel = NULL;
priv->acc = NULL;
priv->sat = NULL;
priv->boundary_list = NULL;
+#ifdef TIZEN_PROFILE_MOBILE
priv->pos_searching_timer = 0;
priv->vel_searching_timer = 0;
+ priv->loc_timeout = 0;
+#endif
+
+ priv->app_type = location_get_app_type(NULL);
+ if (priv->app_type == 0) {
+ LOCATION_LOGW("Fail to get app_type");
+ }
}
static void
-location_gps_class_init (LocationGpsClass *klass)
+location_gps_class_init(LocationGpsClass *klass)
{
LOCATION_LOGD("location_gps_class_init");
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
gobject_class->set_property = location_gps_set_property;
gobject_class->get_property = location_gps_get_property;
gobject_class->dispose = location_gps_dispose;
gobject_class->finalize = location_gps_finalize;
- g_type_class_add_private (klass, sizeof (LocationGpsPrivate));
-
- signals[SERVICE_ENABLED] = g_signal_new ("service-enabled",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST |
- G_SIGNAL_NO_RECURSE,
- G_STRUCT_OFFSET (LocationGpsClass, enabled),
- NULL, NULL,
- location_VOID__UINT,
- G_TYPE_NONE, 1,
- G_TYPE_UINT);
-
- signals[SERVICE_DISABLED] = g_signal_new ("service-disabled",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST |
- G_SIGNAL_NO_RECURSE,
- G_STRUCT_OFFSET (LocationGpsClass, disabled),
- NULL, NULL,
- location_VOID__UINT,
- G_TYPE_NONE, 1,
- G_TYPE_UINT);
-
- signals[SERVICE_UPDATED] = g_signal_new ("service-updated",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST |
- G_SIGNAL_NO_RECURSE,
- G_STRUCT_OFFSET (LocationGpsClass, updated),
- NULL, NULL,
- location_VOID__UINT_POINTER_POINTER,
- G_TYPE_NONE, 3,
- G_TYPE_UINT,
- G_TYPE_POINTER,
- G_TYPE_POINTER);
-
- signals[ZONE_IN] = g_signal_new ("zone-in",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST |
- G_SIGNAL_NO_RECURSE,
- G_STRUCT_OFFSET (LocationGpsClass, zone_in),
- NULL, NULL,
- location_VOID__POINTER_POINTER_POINTER,
- G_TYPE_NONE, 3,
- G_TYPE_POINTER,
- G_TYPE_POINTER,
- G_TYPE_POINTER);
-
- signals[ZONE_OUT] = g_signal_new ("zone-out",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST |
- G_SIGNAL_NO_RECURSE,
- G_STRUCT_OFFSET (LocationGpsClass, zone_out),
- NULL, NULL,
- location_VOID__POINTER_POINTER_POINTER,
- G_TYPE_NONE, 3,
- G_TYPE_POINTER,
- G_TYPE_POINTER,
- G_TYPE_POINTER);
-
- properties[PROP_DEV_NAME] = g_param_spec_string ("dev-name",
- "gps device name prop",
- "gps device name",
- "/dev/rfcomm0",
- G_PARAM_READWRITE);
-
- properties[PROP_METHOD_TYPE] = g_param_spec_int ("method",
- "method type",
- "location method type name",
- LOCATION_METHOD_GPS,
- LOCATION_METHOD_GPS,
- LOCATION_METHOD_GPS,
- G_PARAM_READABLE);
-
- properties[PROP_IS_STARTED] = g_param_spec_boolean ("is_started",
- "gps is started prop",
- "gps is started status",
- FALSE,
- G_PARAM_READWRITE);
-
- properties[PROP_LAST_POSITION] = g_param_spec_boxed ("last-position",
- "gps last position prop",
- "gps last position data",
- LOCATION_TYPE_POSITION,
- G_PARAM_READABLE);
-
- properties[PROP_POS_INTERVAL] = g_param_spec_uint ("pos-interval",
- "gps position interval prop",
- "gps position interval data",
- LOCATION_UPDATE_INTERVAL_MIN,
- LOCATION_UPDATE_INTERVAL_MAX,
- LOCATION_UPDATE_INTERVAL_DEFAULT,
- G_PARAM_READWRITE);
-
- properties[PROP_VEL_INTERVAL] = g_param_spec_uint ("vel-interval",
- "gps velocity interval prop",
- "gps velocity interval data",
- LOCATION_UPDATE_INTERVAL_MIN,
- LOCATION_UPDATE_INTERVAL_MAX,
- LOCATION_UPDATE_INTERVAL_DEFAULT,
- G_PARAM_READWRITE);
-
- properties[PROP_SAT_INTERVAL] = g_param_spec_uint ("sat-interval",
- "gps satellite interval prop",
- "gps satellite interval data",
- LOCATION_UPDATE_INTERVAL_MIN,
- LOCATION_UPDATE_INTERVAL_MAX,
- LOCATION_UPDATE_INTERVAL_DEFAULT,
- G_PARAM_READWRITE);
-
- properties[PROP_BOUNDARY] = g_param_spec_pointer ("boundary",
- "gps boundary prop",
- "gps boundary data",
- G_PARAM_READWRITE);
+ g_type_class_add_private(klass, sizeof(LocationGpsPrivate));
+
+ signals[SERVICE_ENABLED] = g_signal_new("service-enabled",
+ G_TYPE_FROM_CLASS(klass),
+ G_SIGNAL_RUN_FIRST |
+ G_SIGNAL_NO_RECURSE,
+ G_STRUCT_OFFSET(LocationGpsClass, enabled),
+ NULL, NULL,
+ location_VOID__UINT,
+ G_TYPE_NONE, 1,
+ G_TYPE_UINT);
+
+ signals[SERVICE_DISABLED] = g_signal_new("service-disabled",
+ G_TYPE_FROM_CLASS(klass),
+ G_SIGNAL_RUN_FIRST |
+ G_SIGNAL_NO_RECURSE,
+ G_STRUCT_OFFSET(LocationGpsClass, disabled),
+ NULL, NULL,
+ location_VOID__UINT,
+ G_TYPE_NONE, 1,
+ G_TYPE_UINT);
+
+ signals[SERVICE_UPDATED] = g_signal_new("service-updated",
+ G_TYPE_FROM_CLASS(klass),
+ G_SIGNAL_RUN_FIRST |
+ G_SIGNAL_NO_RECURSE,
+ G_STRUCT_OFFSET(LocationGpsClass, updated),
+ NULL, NULL,
+ location_VOID__INT_POINTER_POINTER_POINTER,
+ G_TYPE_NONE, 4,
+ G_TYPE_INT,
+ G_TYPE_POINTER,
+ G_TYPE_POINTER,
+ G_TYPE_POINTER);
+
+#ifdef TIZEN_PROFILE_MOBILE
+ signals[LOCATION_UPDATED] = g_signal_new("location-updated",
+ G_TYPE_FROM_CLASS(klass),
+ G_SIGNAL_RUN_FIRST |
+ G_SIGNAL_NO_RECURSE,
+ G_STRUCT_OFFSET(LocationGpsClass, location_updated),
+ NULL, NULL,
+ location_VOID__INT_POINTER_POINTER_POINTER,
+ G_TYPE_NONE, 4,
+ G_TYPE_INT,
+ G_TYPE_POINTER,
+ G_TYPE_POINTER,
+ G_TYPE_POINTER);
+#endif
+
+ signals[BATCH_UPDATED] = g_signal_new("batch-updated",
+ G_TYPE_FROM_CLASS(klass),
+ G_SIGNAL_RUN_FIRST |
+ G_SIGNAL_NO_RECURSE,
+ G_STRUCT_OFFSET(LocationGpsClass, batch_updated),
+ NULL, NULL,
+ location_VOID__UINT,
+ G_TYPE_NONE, 1,
+ G_TYPE_UINT);
+
+ signals[ZONE_IN] = g_signal_new("zone-in",
+ G_TYPE_FROM_CLASS(klass),
+ G_SIGNAL_RUN_FIRST |
+ G_SIGNAL_NO_RECURSE,
+ G_STRUCT_OFFSET(LocationGpsClass, zone_in),
+ NULL, NULL,
+ location_VOID__POINTER_POINTER_POINTER,
+ G_TYPE_NONE, 3,
+ G_TYPE_POINTER,
+ G_TYPE_POINTER,
+ G_TYPE_POINTER);
+
+ signals[ZONE_OUT] = g_signal_new("zone-out",
+ G_TYPE_FROM_CLASS(klass),
+ G_SIGNAL_RUN_FIRST |
+ G_SIGNAL_NO_RECURSE,
+ G_STRUCT_OFFSET(LocationGpsClass, zone_out),
+ NULL, NULL,
+ location_VOID__POINTER_POINTER_POINTER,
+ G_TYPE_NONE, 3,
+ G_TYPE_POINTER,
+ G_TYPE_POINTER,
+ G_TYPE_POINTER);
+
+ properties[PROP_METHOD_TYPE] = g_param_spec_int("method",
+ "method type",
+ "location method type name",
+ LOCATION_METHOD_GPS,
+ LOCATION_METHOD_GPS,
+ LOCATION_METHOD_GPS,
+ G_PARAM_READABLE);
+
+ properties[PROP_IS_STARTED] = g_param_spec_boolean("is_started",
+ "gps is started prop",
+ "gps is started status",
+ FALSE,
+ G_PARAM_READWRITE);
+
+ properties[PROP_LAST_POSITION] = g_param_spec_boxed("last-position",
+ "gps last position prop",
+ "gps last position data",
+ LOCATION_TYPE_POSITION,
+ G_PARAM_READABLE);
+
+ properties[PROP_POS_INTERVAL] = g_param_spec_uint("pos-interval",
+ "gps position interval prop",
+ "gps position interval data",
+ LOCATION_UPDATE_INTERVAL_MIN,
+ LOCATION_UPDATE_INTERVAL_MAX,
+ LOCATION_UPDATE_INTERVAL_DEFAULT,
+ G_PARAM_READWRITE);
+
+ properties[PROP_VEL_INTERVAL] = g_param_spec_uint("vel-interval",
+ "gps velocity interval prop",
+ "gps velocity interval data",
+ LOCATION_UPDATE_INTERVAL_MIN,
+ LOCATION_UPDATE_INTERVAL_MAX,
+ LOCATION_UPDATE_INTERVAL_DEFAULT,
+ G_PARAM_READWRITE);
+
+ properties[PROP_SAT_INTERVAL] = g_param_spec_uint("sat-interval",
+ "gps satellite interval prop",
+ "gps satellite interval data",
+ LOCATION_UPDATE_INTERVAL_MIN,
+ LOCATION_UPDATE_INTERVAL_MAX,
+ LOCATION_UPDATE_INTERVAL_DEFAULT,
+ G_PARAM_READWRITE);
+
+ properties[PROP_LOC_INTERVAL] = g_param_spec_uint("loc-interval",
+ "gps location interval prop",
+ "gps location interval data",
+ LOCATION_UPDATE_INTERVAL_MIN,
+ LOCATION_UPDATE_INTERVAL_MAX,
+ LOCATION_UPDATE_INTERVAL_DEFAULT,
+ G_PARAM_READWRITE);
+
+ properties[PROP_BATCH_INTERVAL] = g_param_spec_uint("batch-interval",
+ "gps batch interval interval prop",
+ "gps batch interval interval data",
+ LOCATION_UPDATE_INTERVAL_MIN,
+ LOCATION_UPDATE_INTERVAL_MAX,
+ LOCATION_UPDATE_INTERVAL_DEFAULT,
+ G_PARAM_READWRITE);
+
+ properties[PROP_BATCH_PERIOD] = g_param_spec_uint("batch-period",
+ "gps batch period prop",
+ "gps batch period data",
+ LOCATION_BATCH_PERIOD_MIN,
+ LOCATION_BATCH_PERIOD_MAX,
+ LOCATION_BATCH_PERIOD_DEFAULT,
+ G_PARAM_READWRITE);
+
+ properties[PROP_MIN_INTERVAL] = g_param_spec_uint("min-interval",
+ "gps distance-based interval prop",
+ "gps distance-based interval data",
+ LOCATION_MIN_INTERVAL_MIN,
+ LOCATION_MIN_INTERVAL_MAX,
+ LOCATION_MIN_INTERVAL_DEFAULT,
+ G_PARAM_READWRITE);
+
+ properties[PROP_MIN_DISTANCE] = g_param_spec_double("min-distance",
+ "gps distance-based distance prop",
+ "gps distance-based distance data",
+ LOCATION_MIN_DISTANCE_MIN,
+ LOCATION_MIN_DISTANCE_MAX,
+ LOCATION_MIN_DISTANCE_DEFAULT,
+ G_PARAM_READWRITE);
+
+ properties[PROP_BOUNDARY] = g_param_spec_pointer("boundary",
+ "gps boundary prop",
+ "gps boundary data",
+ G_PARAM_READWRITE);
properties[PROP_REMOVAL_BOUNDARY] = g_param_spec_boxed("removal-boundary",
- "gps removal boundary prop",
- "gps removal boundary data",
- LOCATION_TYPE_BOUNDARY,
- G_PARAM_READWRITE);
-
-
- properties[PROP_NMEA] = g_param_spec_string ("nmea",
- "gps NMEA name prop",
- "gps NMEA",
- NULL,
- G_PARAM_READABLE);
-
- properties[PROP_SATELLITE] = g_param_spec_boxed ("satellite",
- "gps satellite prop",
- "gps satellite data",
- LOCATION_TYPE_SATELLITE,
- G_PARAM_READABLE);
-
- g_object_class_install_properties (gobject_class,
- PROP_MAX,
- properties);
+ "gps removal boundary prop",
+ "gps removal boundary data",
+ LOCATION_TYPE_BOUNDARY,
+ G_PARAM_READWRITE);
+
+
+ properties[PROP_NMEA] = g_param_spec_string("nmea",
+ "gps NMEA name prop",
+ "gps NMEA",
+ NULL,
+ G_PARAM_READABLE);
+
+ properties[PROP_SATELLITE] = g_param_spec_boxed("satellite",
+ "gps satellite prop",
+ "gps satellite data",
+ LOCATION_TYPE_SATELLITE,
+ G_PARAM_READABLE);
+
+ g_object_class_install_properties(gobject_class,
+ PROP_MAX,
+ properties);
}
G_BEGIN_DECLS
-#define LOCATION_TYPE_GPS (location_gps_get_type ())
-#define LOCATION_GPS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LOCATION_TYPE_GPS, LocationGps))
-#define LOCATION_IS_GPS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LOCATION_TYPE_GPS))
-#define LOCATION_GPS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), LOCATION_TYPE_GPS, LocationGpsClass))
-#define LOCATION_IS_GPS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LOCATION_TYPE_GPS))
-#define LOCATION_GPS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), LOCATION_TYPE_GPS, LocationGpsClass))
+#define LOCATION_TYPE_GPS (location_gps_get_type ())
+#define LOCATION_GPS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LOCATION_TYPE_GPS, LocationGps))
+#define LOCATION_IS_GPS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LOCATION_TYPE_GPS))
+#define LOCATION_GPS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), LOCATION_TYPE_GPS, LocationGpsClass))
+#define LOCATION_IS_GPS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LOCATION_TYPE_GPS))
+#define LOCATION_GPS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), LOCATION_TYPE_GPS, LocationGpsClass))
-typedef struct _LocationGps LocationGps;
-typedef struct _LocationGpsClass LocationGpsClass;
+typedef struct _LocationGps LocationGps;
+typedef struct _LocationGpsClass LocationGpsClass;
-struct _LocationGps
-{
+struct _LocationGps {
GObject parent_instance;
};
-struct _LocationGpsClass
-{
+struct _LocationGpsClass {
GObjectClass parent_class;
- void (* enabled) (guint type);
- void (* disabled) (guint type);
- void (* updated) (guint type, gpointer data, gpointer accuracy);
- void (* zone_in) (gpointer boundary, gpointer position, gpointer accuracy);
- void (* zone_out) (gpointer boundary, gpointer position, gpointer accuracy);
+ void (* enabled)(guint type);
+ void (* disabled)(guint type);
+ void (* updated)(gint type, gpointer data, gpointer velocity, gpointer accuracy);
+ void (* location_updated)(gint error, gpointer position, gpointer velocity, gpointer accuracy);
+ void (* batch_updated)(guint batch_interval, guint batch_period);
+ void (* zone_in)(gpointer boundary, gpointer position, gpointer accuracy);
+ void (* zone_out)(gpointer boundary, gpointer position, gpointer accuracy);
};
-GType location_gps_get_type (void);
+GType location_gps_get_type(void);
G_END_DECLS
--- /dev/null
+/*
+ * libslp-location
+ *
+ * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
+ * Genie Kim <daejins.kim@samsung.com>
+ *
+ * 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "location-setting.h"
+#include "location-log.h"
+
+#include "module-internal.h"
+
+#include "location-hybrid.h"
+#include "location-marshal.h"
+#include "location-ielement.h"
+#include "location-signaling-util.h"
+#include "location-common-util.h"
+
+#include "location-gps.h"
+#include "location-wps.h"
+
+typedef struct _LocationHybridPrivate {
+ gboolean gps_enabled;
+ gboolean wps_enabled;
+ gint signal_type;
+ guint pos_updated_timestamp;
+ guint pos_interval;
+ guint vel_updated_timestamp;
+ guint vel_interval;
+ guint sat_updated_timestamp;
+ guint sat_interval;
+ guint dist_updated_timestamp;
+ guint min_interval;
+ gdouble min_distance;
+ guint loc_updated_timestamp;
+ guint loc_interval;
+ LocationObject *gps;
+ LocationObject *wps;
+ gboolean enabled;
+ LocationMethod current_method;
+ LocationPosition *pos;
+ LocationVelocity *vel;
+ LocationAccuracy *acc;
+ LocationSatellite *sat;
+ GList *boundary_list;
+ gboolean set_noti;
+ guint pos_timer;
+ guint vel_timer;
+} LocationHybridPrivate;
+
+enum {
+ PROP_0,
+ PROP_METHOD_TYPE,
+ PROP_LAST_POSITION,
+ PROP_POS_INTERVAL,
+ PROP_VEL_INTERVAL,
+ PROP_SAT_INTERVAL,
+ PROP_LOC_INTERVAL,
+ PROP_BOUNDARY,
+ PROP_REMOVAL_BOUNDARY,
+ PROP_MIN_INTERVAL,
+ PROP_MIN_DISTANCE,
+ PROP_MAX
+};
+
+static guint32 signals[LAST_SIGNAL] = {0, };
+static GParamSpec *properties[PROP_MAX] = {NULL, };
+
+#define GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), LOCATION_TYPE_HYBRID, LocationHybridPrivate))
+
+static void location_ielement_interface_init(LocationIElementInterface *iface);
+
+G_DEFINE_TYPE_WITH_CODE(LocationHybrid, location_hybrid, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE(LOCATION_TYPE_IELEMENT,
+ location_ielement_interface_init));
+
+static LocationMethod
+hybrid_get_current_method(LocationHybridPrivate *priv)
+{
+ g_return_val_if_fail(priv, LOCATION_METHOD_NONE);
+ LOCATION_LOGW("Current Method [%d]\n", priv->current_method);
+ return priv->current_method;
+}
+
+static gboolean
+hybrid_set_current_method(LocationHybridPrivate *priv, GType g_type)
+{
+ g_return_val_if_fail(priv, FALSE);
+
+ if (g_type == LOCATION_TYPE_GPS) {
+ priv->current_method = LOCATION_METHOD_GPS;
+ } else if (g_type == LOCATION_TYPE_WPS) {
+ priv->current_method = LOCATION_METHOD_WPS;
+ } else if (g_type == LOCATION_TYPE_HYBRID) {
+ priv->current_method = LOCATION_METHOD_HYBRID;
+ } else
+ return FALSE;
+
+ return TRUE;
+}
+
+
+static int
+hybrid_get_update_method(LocationHybridPrivate *priv)
+{
+ if (!priv->gps && !priv->wps) return -1;
+
+ if (priv->gps_enabled) {
+ hybrid_set_current_method(priv, LOCATION_TYPE_GPS);
+ } else if (priv->wps_enabled) {
+ hybrid_set_current_method(priv, LOCATION_TYPE_WPS);
+ } else {
+ hybrid_set_current_method(priv, LOCATION_TYPE_HYBRID);
+ }
+
+ return 0;
+}
+
+#if 0
+static LocationObject *
+hybrid_get_current_object(LocationHybridPrivate *priv)
+{
+ LocationMethod method = hybrid_get_current_method(priv);
+
+ LocationObject *obj = NULL;
+ switch (method) {
+ case LOCATION_METHOD_GPS:
+ obj = priv->gps;
+ break;
+ case LOCATION_METHOD_WPS:
+ obj = priv->wps;
+ break;
+ default:
+ break;
+ }
+
+ return obj;
+}
+#endif
+
+static gboolean /* True : Receive more accurate info. False : Receive less accurate info */
+hybrid_compare_g_type_method(LocationHybridPrivate *priv, GType g_type)
+{
+ if (g_type == LOCATION_TYPE_GPS) {
+ hybrid_set_current_method(priv, LOCATION_TYPE_GPS);
+ return TRUE;
+ } else if (g_type == LOCATION_TYPE_WPS && hybrid_get_current_method(priv) == LOCATION_METHOD_WPS) {
+ hybrid_set_current_method(priv, LOCATION_TYPE_WPS);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static gboolean
+_location_timeout_cb(gpointer data)
+{
+ GObject *object = (GObject *)data;
+ if (!object) return FALSE;
+ LocationHybridPrivate *priv = GET_PRIVATE(object);
+ g_return_val_if_fail(priv, FALSE);
+
+ LocationPosition *pos = NULL;
+ LocationVelocity *vel = NULL;
+ LocationAccuracy *acc = NULL;
+
+ if (priv->pos) {
+ pos = location_position_copy(priv->pos);
+ } else {
+ pos = location_position_new(0, 0.0, 0.0, 0.0, LOCATION_STATUS_NO_FIX);
+ }
+
+ if (priv->vel) {
+ vel = location_velocity_copy(priv->vel);
+ } else {
+ vel = location_velocity_new(0, 0.0, 0.0, 0.0);
+ }
+
+ if (priv->acc) {
+ acc = location_accuracy_copy(priv->acc);
+ } else {
+ acc = location_accuracy_new(LOCATION_ACCURACY_LEVEL_NONE, 0.0, 0.0);
+ }
+
+ g_signal_emit(object, signals[SERVICE_UPDATED], 0, priv->signal_type, pos, vel, acc);
+ priv->signal_type = 0;
+
+ location_position_free(pos);
+ location_velocity_free(vel);
+ location_accuracy_free(acc);
+
+ return TRUE;
+}
+
+static gboolean
+_position_timeout_cb(gpointer data)
+{
+ GObject *object = (GObject *)data;
+ if (!object) return FALSE;
+ LocationHybridPrivate *priv = GET_PRIVATE(object);
+ g_return_val_if_fail(priv, FALSE);
+
+ if (priv->pos_interval == priv->vel_interval) {
+ priv->signal_type |= POSITION_UPDATED;
+ priv->signal_type |= VELOCITY_UPDATED;
+ } else {
+ priv->signal_type |= POSITION_UPDATED;
+ }
+ _location_timeout_cb(priv);
+
+ return TRUE;
+}
+
+static gboolean
+_velocity_timeout_cb(gpointer data)
+{
+ GObject *object = (GObject *)data;
+ LocationHybridPrivate *priv = GET_PRIVATE(object);
+ g_return_val_if_fail(priv, FALSE);
+
+ if (priv->pos_interval != priv->vel_interval) {
+ priv->signal_type |= VELOCITY_UPDATED;
+ _location_timeout_cb(priv);
+ }
+
+ return TRUE;
+}
+
+static void
+location_hybrid_gps_cb(keynode_t *key,
+ gpointer self)
+{
+ LOCATION_LOGD("location_hybrid_gps_cb");
+ g_return_if_fail(key);
+ g_return_if_fail(self);
+ LocationHybridPrivate *priv = GET_PRIVATE(self);
+ g_return_if_fail(priv);
+ g_return_if_fail(priv->wps);
+
+ gboolean wps_started = FALSE;
+ int ret = LOCATION_ERROR_NONE;
+ int onoff = 0;
+
+ onoff = location_setting_get_key_val(key);
+ if (0 == onoff) {
+ /* restart WPS when GPS stopped by setting */
+ g_object_get(priv->wps, "is_started", &wps_started, NULL);
+ if (wps_started == FALSE && 1 == location_setting_get_int(VCONFKEY_LOCATION_NETWORK_ENABLED)) {
+ LOCATION_LOGD("GPS stoped by setting, so restart WPS");
+ ret = location_start(priv->wps);
+ if (ret != LOCATION_ERROR_NONE) {
+ LOCATION_LOGW("Fail hyhrid/wps location_start : [%d]", ret);
+ return;
+ }
+ }
+ } else if (1 == onoff) {
+ LOCATION_LOGD("Hybrid GPS resumed by setting");
+
+ } else {
+ LOCATION_LOGD("Invalid Value[%d]", onoff);
+ }
+
+}
+
+static void
+hybrid_location_updated(GObject *obj,
+ guint error,
+ gpointer position,
+ gpointer velocity,
+ gpointer accuracy,
+ gpointer self)
+{
+ LocationPosition *pos = (LocationPosition *)position;
+ LocationVelocity *vel = (LocationVelocity *)velocity;
+ LocationAccuracy *acc = (LocationAccuracy *)accuracy;
+
+ LocationHybridPrivate *priv = GET_PRIVATE((LocationHybrid *)self);
+ g_return_if_fail(priv);
+
+ g_signal_emit(self, signals[LOCATION_UPDATED], LOCATION_ERROR_NONE, 0, pos, vel, acc);
+}
+
+static void
+hybrid_service_updated(GObject *obj,
+ gint type,
+ gpointer data,
+ gpointer velocity,
+ gpointer accuracy,
+ gpointer self)
+{
+ LOCATION_LOGD("hybrid_service_updated");
+ LocationPosition *pos = NULL;
+ LocationVelocity *vel = NULL;
+ LocationAccuracy *acc = NULL;
+ LocationSatellite *sat = NULL;
+ gboolean wps_started = FALSE;
+ int ret = LOCATION_ERROR_NONE;
+
+ /* To discard invalid data in a hybrid */
+ if (type == SATELLITE_UPDATED) {
+ sat = (LocationSatellite *)data;
+ if (!sat->timestamp) return;
+ } else {
+ pos = (LocationPosition *)data;
+ vel = (LocationVelocity *)velocity;
+ acc = (LocationAccuracy *)accuracy;
+ if (!pos->timestamp) return;
+ if (!vel->timestamp) return;
+ }
+
+ LocationHybridPrivate *priv = GET_PRIVATE((LocationHybrid *)self);
+ g_return_if_fail(priv);
+ GType g_type = G_TYPE_FROM_INSTANCE(obj);
+ if (g_type == LOCATION_TYPE_GPS) {
+ if (type == SATELLITE_UPDATED) {
+ satellite_signaling(self, signals, &(priv->enabled), priv->sat_interval, TRUE, &(priv->sat_updated_timestamp), &(priv->sat), sat);
+ return ;
+ } else if (location_setting_get_int(VCONFKEY_LOCATION_GPS_STATE) == VCONFKEY_LOCATION_GPS_SEARCHING) {
+ LOCATION_LOGD("Searching GPS");
+
+ /* restart WPS when GPS not available */
+ g_object_get(priv->wps, "is_started", &wps_started, NULL);
+ if (priv->wps && wps_started == FALSE) {
+ ret = location_start(priv->wps);
+ if (ret != LOCATION_ERROR_NONE) {
+ LOCATION_LOGW("Fail hyhrid location_start : [%d]", ret);
+ return;
+ }
+ }
+ return;
+ }
+
+ } else if (g_type == LOCATION_TYPE_WPS && location_setting_get_int(VCONFKEY_LOCATION_WPS_STATE) == VCONFKEY_LOCATION_WPS_SEARCHING) {
+ LOCATION_LOGD("Searching WPS");
+ return;
+ }
+
+ if (hybrid_compare_g_type_method(priv, g_type)) {
+
+ if (priv->pos) location_position_free(priv->pos);
+ if (priv->vel) location_velocity_free(priv->vel);
+ if (priv->acc) location_accuracy_free(priv->acc);
+
+ if (pos) priv->pos = location_position_copy(pos);
+ if (vel) priv->vel = location_velocity_copy(vel);
+ if (acc) priv->acc = location_accuracy_copy(acc);
+
+ if (!priv->enabled && pos) {
+ enable_signaling(self, signals, &(priv->enabled), TRUE, pos->status);
+ }
+
+ if (type == DISTANCE_UPDATED) {
+ distance_based_position_signaling(self, signals, priv->enabled, pos, vel, acc,
+ priv->min_interval, priv->min_distance, &(priv->enabled),
+ &(priv->dist_updated_timestamp), &(priv->pos), &(priv->vel), &(priv->acc));
+ } else {
+ position_velocity_signaling(self, signals, priv->pos_interval, priv->vel_interval, priv->loc_interval,
+ &(priv->pos_updated_timestamp), &(priv->vel_updated_timestamp), &(priv->loc_updated_timestamp),
+ priv->boundary_list, pos, vel, acc);
+ }
+
+ /* if receive GPS position then stop WPS.. */
+ g_object_get(priv->wps, "is_started", &wps_started, NULL);
+ if (LOCATION_TYPE_GPS == g_type && wps_started == TRUE) {
+ ret = location_stop(priv->wps);
+ if (ret != LOCATION_ERROR_NONE) {
+ LOCATION_LOGW("Fail hybrid location_stop : [%d]", ret);
+ return;
+ }
+ }
+
+ } else if (type == POSITION_UPDATED && priv->pos) {
+ if (pos->timestamp - priv->pos->timestamp > HYBRID_POSITION_EXPIRATION_TIME) {
+ hybrid_set_current_method(priv, g_type);
+ }
+ }
+}
+
+static void
+hybrid_service_enabled(GObject *obj,
+ guint status,
+ gpointer self)
+{
+ LOCATION_LOGD("hybrid_service_enabled");
+ LocationHybridPrivate *priv = GET_PRIVATE((LocationHybrid *)self);
+ g_return_if_fail(priv);
+ GType g_type = G_TYPE_FROM_INSTANCE(obj);
+ if (g_type == LOCATION_TYPE_GPS) {
+ priv->gps_enabled = TRUE;
+ } else if (g_type == LOCATION_TYPE_WPS) {
+ priv->wps_enabled = TRUE;
+ } else {
+ LOCATION_LOGW("Undefined GType enabled");
+ return;
+ }
+ hybrid_get_update_method(priv);
+}
+
+static void
+hybrid_service_disabled(GObject *obj,
+ guint status,
+ gpointer self)
+{
+ LOCATION_LOGD("hybrid_service_disabled");
+ LocationHybridPrivate *priv = GET_PRIVATE((LocationHybrid *)self);
+ g_return_if_fail(priv);
+ GType g_type = G_TYPE_FROM_INSTANCE(obj);
+ if (g_type == LOCATION_TYPE_GPS) {
+ priv->gps_enabled = FALSE;
+ } else if (g_type == LOCATION_TYPE_WPS) {
+ priv->wps_enabled = FALSE;
+ } else {
+ LOCATION_LOGW("Undefined GType disabled");
+ return;
+ }
+ hybrid_get_update_method(priv);
+ if (!priv->gps_enabled && !priv->wps_enabled)
+ enable_signaling(self, signals, &(priv->enabled), FALSE, status);
+
+}
+
+static int
+location_hybrid_start(LocationHybrid *self)
+{
+ LOCATION_LOGD("location_hybrid_start");
+
+ int ret_gps = LOCATION_ERROR_NONE;
+ int ret_wps = LOCATION_ERROR_NONE;
+ gboolean gps_started = FALSE;
+ gboolean wps_started = FALSE;
+
+ LocationHybridPrivate *priv = GET_PRIVATE(self);
+ g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
+
+ g_object_get(priv->gps, "is_started", &gps_started, NULL);
+ g_object_get(priv->wps, "is_started", &wps_started, NULL);
+
+ if ((gps_started == TRUE) || (wps_started == TRUE)) {
+ LOCATION_LOGD("Already started");
+ return LOCATION_ERROR_NONE;
+ }
+
+ if (priv->gps) ret_gps = location_start(priv->gps);
+ if (priv->wps) ret_wps = location_start(priv->wps);
+
+ if (ret_gps != LOCATION_ERROR_NONE) {
+ LOCATION_LOGD("ret_gps = %d, ret_wps = %d", ret_gps, ret_wps);
+ if (ret_gps == LOCATION_ERROR_SECURITY_DENIED) {
+ return LOCATION_ERROR_SECURITY_DENIED;
+ } else if (ret_gps == LOCATION_ERROR_SETTING_OFF) {
+ return LOCATION_ERROR_SETTING_OFF;
+ } else if (ret_gps == LOCATION_ERROR_NOT_ALLOWED) {
+ return LOCATION_ERROR_NOT_ALLOWED;
+ } else {
+ return LOCATION_ERROR_NOT_AVAILABLE;
+ }
+ } else if (ret_wps != LOCATION_ERROR_NONE) {
+ if (ret_wps == LOCATION_ERROR_SECURITY_DENIED) {
+ return LOCATION_ERROR_SECURITY_DENIED;
+ } else if (ret_wps == LOCATION_ERROR_SETTING_OFF) {
+ return LOCATION_ERROR_SETTING_OFF;
+ } else if (ret_wps == LOCATION_ERROR_NOT_ALLOWED) {
+ return LOCATION_ERROR_NOT_ALLOWED;
+ } else {
+ return LOCATION_ERROR_NOT_AVAILABLE;
+ }
+ }
+
+ if (priv->set_noti == FALSE) {
+ location_setting_add_notify(VCONFKEY_LOCATION_ENABLED, location_hybrid_gps_cb, self);
+ priv->set_noti = TRUE;
+ }
+
+ return LOCATION_ERROR_NONE;
+}
+
+static int
+location_hybrid_stop(LocationHybrid *self)
+{
+ LOCATION_LOGD("location_hybrid_stop");
+
+ LocationHybridPrivate *priv = GET_PRIVATE(self);
+ g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
+
+ LOCATION_LOGD("location_hybrid_stop started......!!!");
+
+ int ret_gps = LOCATION_ERROR_NOT_AVAILABLE;
+ int ret_wps = LOCATION_ERROR_NOT_AVAILABLE;
+ gboolean gps_started = FALSE;
+ gboolean wps_started = FALSE;
+
+ g_object_get(priv->gps, "is_started", &gps_started, NULL);
+ g_object_get(priv->wps, "is_started", &wps_started, NULL);
+
+ if ((gps_started == FALSE) && (wps_started == FALSE)) {
+ return LOCATION_ERROR_NONE;
+ }
+
+ if (priv->gps) ret_gps = location_stop(priv->gps);
+ if (priv->wps) ret_wps = location_stop(priv->wps);
+
+ if (ret_gps != LOCATION_ERROR_NONE && ret_wps != LOCATION_ERROR_NONE)
+ return LOCATION_ERROR_NOT_AVAILABLE;
+
+ if (priv->pos_timer) g_source_remove(priv->pos_timer);
+ if (priv->vel_timer) g_source_remove(priv->vel_timer);
+ priv->pos_timer = 0;
+ priv->vel_timer = 0;
+
+ if (priv->set_noti == TRUE) {
+ location_setting_ignore_notify(VCONFKEY_LOCATION_ENABLED, location_hybrid_gps_cb);
+ priv->set_noti = FALSE;
+ }
+
+ return LOCATION_ERROR_NONE;
+}
+
+static void
+location_hybrid_dispose(GObject *gobject)
+{
+ LOCATION_LOGD("location_hybrid_dispose");
+ LocationHybridPrivate *priv = GET_PRIVATE(gobject);
+ g_return_if_fail(priv);
+
+ if (priv->pos_timer) g_source_remove(priv->pos_timer);
+ if (priv->vel_timer) g_source_remove(priv->vel_timer);
+ priv->pos_timer = 0;
+ priv->vel_timer = 0;
+
+ if (priv->set_noti == TRUE) {
+ location_setting_ignore_notify(VCONFKEY_LOCATION_ENABLED, location_hybrid_gps_cb);
+ priv->set_noti = FALSE;
+ }
+
+ G_OBJECT_CLASS(location_hybrid_parent_class)->dispose(gobject);
+}
+
+static void
+location_hybrid_finalize(GObject *gobject)
+{
+ LOCATION_LOGD("location_hybrid_finalize");
+ LocationHybridPrivate *priv = GET_PRIVATE(gobject);
+ g_return_if_fail(priv);
+
+ if (priv->gps) {
+ g_signal_handlers_disconnect_by_func(priv->gps, G_CALLBACK(hybrid_service_enabled), gobject);
+ g_signal_handlers_disconnect_by_func(priv->gps, G_CALLBACK(hybrid_service_disabled), gobject);
+ g_signal_handlers_disconnect_by_func(priv->gps, G_CALLBACK(hybrid_service_updated), gobject);
+ g_signal_handlers_disconnect_by_func(priv->gps, G_CALLBACK(hybrid_location_updated), gobject);
+ location_free(priv->gps);
+ }
+ if (priv->wps) {
+ g_signal_handlers_disconnect_by_func(priv->wps, G_CALLBACK(hybrid_service_enabled), gobject);
+ g_signal_handlers_disconnect_by_func(priv->wps, G_CALLBACK(hybrid_service_disabled), gobject);
+ g_signal_handlers_disconnect_by_func(priv->wps, G_CALLBACK(hybrid_service_updated), gobject);
+ g_signal_handlers_disconnect_by_func(priv->wps, G_CALLBACK(hybrid_location_updated), gobject);
+ location_free(priv->wps);
+ }
+
+ if (priv->boundary_list) {
+ g_list_free_full(priv->boundary_list, free_boundary_list);
+ priv->boundary_list = NULL;
+ }
+
+ if (priv->pos) {
+ location_position_free(priv->pos);
+ priv->pos = NULL;
+ }
+
+ if (priv->vel) {
+ location_velocity_free(priv->vel);
+ priv->vel = NULL;
+ }
+
+ if (priv->acc) {
+ location_accuracy_free(priv->acc);
+ priv->acc = NULL;
+ }
+
+ if (priv->sat) {
+ location_satellite_free(priv->sat);
+ priv->sat = NULL;
+ }
+
+ G_OBJECT_CLASS(location_hybrid_parent_class)->finalize(gobject);
+}
+
+static void
+location_hybrid_set_property(GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ LocationHybridPrivate *priv = GET_PRIVATE(object);
+ g_return_if_fail(priv);
+ if (!priv->gps && !priv->wps) {
+ LOCATION_LOGW("Set property is not available now");
+ return;
+ }
+
+ int ret = 0;
+ switch (property_id) {
+ case PROP_BOUNDARY: {
+ GList *boundary_list = (GList *)g_list_copy(g_value_get_pointer(value));
+ ret = set_prop_boundary(&priv->boundary_list, boundary_list);
+ if (ret != 0) LOCATION_LOGD("Set boundary. Error[%d]", ret);
+ break;
+ }
+ case PROP_REMOVAL_BOUNDARY: {
+ LocationBoundary *req_boundary = (LocationBoundary *) g_value_dup_boxed(value);
+ ret = set_prop_removal_boundary(&priv->boundary_list, req_boundary);
+ if (ret != 0) LOCATION_LOGD("Removal boundary. Error[%d]", ret);
+ break;
+ }
+ case PROP_POS_INTERVAL: {
+ guint interval = g_value_get_uint(value);
+ LOCATION_LOGD("Set prop>> PROP_POS_INTERVAL: %u", interval);
+ if (interval > 0) {
+ if (interval < LOCATION_UPDATE_INTERVAL_MAX)
+ priv->pos_interval = interval;
+ else
+ priv->pos_interval = (guint) LOCATION_UPDATE_INTERVAL_MAX;
+ } else {
+ priv->pos_interval = LOCATION_UPDATE_INTERVAL_DEFAULT;
+ }
+
+ if (priv->pos_timer) {
+ g_source_remove(priv->pos_timer);
+ priv->pos_timer = g_timeout_add(priv->pos_interval * 1000, _position_timeout_cb, object);
+ }
+
+ if (priv->gps) g_object_set(priv->gps, "pos-interval", priv->pos_interval, NULL);
+ if (priv->wps) g_object_set(priv->wps, "pos-interval", priv->pos_interval, NULL);
+
+ break;
+ }
+ case PROP_VEL_INTERVAL: {
+ guint interval = g_value_get_uint(value);
+ LOCATION_LOGD("Set prop>> PROP_VEL_INTERVAL: %u", interval);
+ if (interval > 0) {
+ if (interval < LOCATION_UPDATE_INTERVAL_MAX)
+ priv->vel_interval = interval;
+ else
+ priv->vel_interval = (guint) LOCATION_UPDATE_INTERVAL_MAX;
+
+ } else
+ priv->vel_interval = LOCATION_UPDATE_INTERVAL_DEFAULT;
+
+ if (priv->vel_timer) {
+ g_source_remove(priv->vel_timer);
+ priv->vel_timer = g_timeout_add(priv->vel_interval * 1000, _velocity_timeout_cb, object);
+ }
+
+ if (priv->gps) g_object_set(priv->gps, "vel-interval", priv->vel_interval, NULL);
+ if (priv->wps) g_object_set(priv->wps, "vel-interval", priv->vel_interval, NULL);
+
+ break;
+ }
+ case PROP_SAT_INTERVAL: {
+ guint interval = g_value_get_uint(value);
+ LOCATION_LOGD("Set prop>> PROP_SAT_INTERVAL: %u", interval);
+ if (interval > 0) {
+ if (interval < LOCATION_UPDATE_INTERVAL_MAX)
+ priv->sat_interval = interval;
+ else
+ priv->sat_interval = (guint) LOCATION_UPDATE_INTERVAL_MAX;
+
+ } else
+ priv->sat_interval = LOCATION_UPDATE_INTERVAL_DEFAULT;
+
+ break;
+ }
+ case PROP_LOC_INTERVAL: {
+ guint interval = g_value_get_uint(value);
+ LOCATION_LOGD("Set prop>> PROP_LOC_INTERVAL: %u", interval);
+ if (interval > 0) {
+ if (interval < LOCATION_UPDATE_INTERVAL_MAX)
+ priv->loc_interval = interval;
+ else
+ priv->loc_interval = (guint)LOCATION_UPDATE_INTERVAL_MAX;
+ } else
+ priv->loc_interval = (guint)LOCATION_UPDATE_INTERVAL_DEFAULT;
+
+ if (priv->gps) g_object_set(priv->gps, "loc-interval", priv->loc_interval, NULL);
+ if (priv->wps) g_object_set(priv->wps, "loc-interval", priv->loc_interval, NULL);
+
+ break;
+ }
+ case PROP_MIN_INTERVAL: {
+ guint interval = g_value_get_uint(value);
+ LOCATION_LOGD("Set prop>> PROP_MIN_INTERVAL: %u", interval);
+ if (interval > 0) {
+ if (interval < LOCATION_MIN_INTERVAL_MAX)
+ priv->min_interval = interval;
+ else
+ priv->min_interval = (guint)LOCATION_MIN_INTERVAL_MAX;
+ } else
+ priv->min_interval = (guint)LOCATION_MIN_INTERVAL_DEFAULT;
+
+ if (priv->gps) g_object_set(priv->gps, "min-interval", priv->min_interval, NULL);
+ if (priv->wps) g_object_set(priv->wps, "min-interval", priv->min_interval, NULL);
+
+ break;
+ }
+ case PROP_MIN_DISTANCE: {
+ gdouble distance = g_value_get_double(value);
+ LOCATION_LOGD("Set prop>> PROP_MIN_DISTANCE: %u", distance);
+ if (distance > 0) {
+ if (distance < LOCATION_MIN_DISTANCE_MAX)
+ priv->min_distance = distance;
+ else
+ priv->min_distance = (gdouble)LOCATION_MIN_DISTANCE_MAX;
+ } else
+ priv->min_distance = (gdouble)LOCATION_MIN_DISTANCE_DEFAULT;
+
+ if (priv->gps) g_object_set(priv->gps, "min-distance", priv->min_distance, NULL);
+ if (priv->wps) g_object_set(priv->wps, "min-distance", priv->min_distance, NULL);
+
+ break;
+ }
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+location_hybrid_get_property(GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ LocationHybridPrivate *priv = GET_PRIVATE(object);
+ g_return_if_fail(priv);
+ if (!priv->gps && !priv->wps) {
+ LOCATION_LOGW("Get property is not available now");
+ return;
+ }
+
+ LOCATION_LOGW("Get Propery ID[%d]", property_id);
+
+ switch (property_id) {
+ case PROP_METHOD_TYPE:
+ g_value_set_int(value, hybrid_get_current_method(priv));
+ break;
+ case PROP_LAST_POSITION:
+ g_value_set_boxed(value, priv->pos);
+ break;
+ case PROP_BOUNDARY:
+ g_value_set_pointer(value, g_list_first(priv->boundary_list));
+ break;
+ case PROP_POS_INTERVAL:
+ g_value_set_uint(value, priv->pos_interval);
+ break;
+ case PROP_VEL_INTERVAL:
+ g_value_set_uint(value, priv->vel_interval);
+ break;
+ case PROP_SAT_INTERVAL:
+ g_value_set_uint(value, priv->sat_interval);
+ break;
+ case PROP_LOC_INTERVAL:
+ g_value_set_uint(value, priv->loc_interval);
+ break;
+ case PROP_MIN_INTERVAL:
+ g_value_set_uint(value, priv->min_interval);
+ break;
+ case PROP_MIN_DISTANCE:
+ g_value_set_double(value, priv->min_distance);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
+ break;
+ }
+}
+
+static int
+location_hybrid_get_position(LocationHybrid *self,
+ LocationPosition **position,
+ LocationAccuracy **accuracy)
+{
+ int ret = LOCATION_ERROR_NOT_AVAILABLE;
+ LOCATION_LOGD("location_hybrid_get_position");
+ if (!location_setting_get_int(VCONFKEY_LOCATION_ENABLED) && !location_setting_get_int(VCONFKEY_LOCATION_NETWORK_ENABLED)) {
+ return LOCATION_ERROR_SETTING_OFF;
+ }
+
+ LocationHybridPrivate *priv = GET_PRIVATE(self);
+ g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
+
+ if (priv->pos) {
+ *position = location_position_copy(priv->pos);
+ ret = LOCATION_ERROR_NONE;
+ }
+
+ if (priv->acc) {
+ *accuracy = location_accuracy_copy(priv->acc);
+ }
+
+ return ret;
+}
+
+static int
+location_hybrid_get_position_ext(LocationHybrid *self,
+ LocationPosition **position,
+ LocationVelocity **velocity,
+ LocationAccuracy **accuracy)
+{
+ LOCATION_LOGD("location_hybrid_get_position_ext");
+ if (!location_setting_get_int(VCONFKEY_LOCATION_ENABLED) && !location_setting_get_int(VCONFKEY_LOCATION_NETWORK_ENABLED)) {
+ return LOCATION_ERROR_SETTING_OFF;
+ }
+
+ LocationHybridPrivate *priv = GET_PRIVATE(self);
+ g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
+
+ if (priv->pos && priv->vel) {
+ *position = location_position_copy(priv->pos);
+ *velocity = location_velocity_copy(priv->vel);
+ } else {
+ LOCATION_LOGE("There is invalid data.");
+ return LOCATION_ERROR_NOT_AVAILABLE;
+ }
+
+ if (priv->acc) {
+ *accuracy = location_accuracy_copy(priv->acc);
+ } else {
+ *accuracy = location_accuracy_new(LOCATION_ACCURACY_LEVEL_NONE, 0.0, 0.0);
+ }
+
+ return LOCATION_ERROR_NONE;
+}
+
+
+static int
+location_hybrid_get_last_position(LocationHybrid *self,
+ LocationPosition **position,
+ LocationAccuracy **accuracy)
+{
+ LOCATION_LOGD("location_hybrid_get_last_position");
+
+ int ret = LOCATION_ERROR_NONE;
+ LocationPosition *gps_pos = NULL, *wps_pos = NULL;
+ LocationAccuracy *gps_acc = NULL, *wps_acc = NULL;
+ LocationHybridPrivate *priv = GET_PRIVATE(self);
+ g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
+
+ if (priv->gps) location_get_last_position(priv->gps, &gps_pos, &gps_acc);
+ if (priv->wps) location_get_last_position(priv->wps, &wps_pos, &wps_acc);
+
+ if (gps_pos && wps_pos) {
+ if (wps_pos->timestamp > gps_pos->timestamp) {
+ *position = wps_pos;
+ *accuracy = wps_acc;
+ location_position_free(gps_pos);
+ location_accuracy_free(gps_acc);
+ } else {
+ *position = gps_pos;
+ *accuracy = gps_acc;
+ location_position_free(wps_pos);
+ location_accuracy_free(wps_acc);
+ }
+ } else if (gps_pos) {
+ *position = gps_pos;
+ *accuracy = gps_acc;
+ } else if (wps_pos) {
+ *position = wps_pos;
+ *accuracy = wps_acc;
+ } else {
+ ret = LOCATION_ERROR_NOT_AVAILABLE;
+ }
+
+ return ret;
+}
+
+static int
+location_hybrid_get_last_position_ext(LocationHybrid *self,
+ LocationPosition **position,
+ LocationVelocity **velocity,
+ LocationAccuracy **accuracy)
+{
+ LOCATION_LOGD("location_hybrid_get_last_position_ext");
+
+ int ret = LOCATION_ERROR_NONE;
+ LocationPosition *gps_pos = NULL, *wps_pos = NULL;
+ LocationVelocity *gps_vel = NULL, *wps_vel = NULL;
+ LocationAccuracy *gps_acc = NULL, *wps_acc = NULL;
+ LocationHybridPrivate *priv = GET_PRIVATE(self);
+ g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
+
+ if (priv->gps) location_get_last_position_ext(priv->gps, &gps_pos, &gps_vel, &gps_acc);
+ if (priv->wps) location_get_last_position_ext(priv->wps, &wps_pos, &wps_vel, &wps_acc);
+
+ if (gps_pos && wps_pos && gps_vel && wps_vel) {
+ if (wps_pos->timestamp > gps_pos->timestamp) {
+ *position = wps_pos;
+ *velocity = wps_vel;
+ *accuracy = wps_acc;
+ location_position_free(gps_pos);
+ location_velocity_free(gps_vel);
+ location_accuracy_free(gps_acc);
+ } else {
+ *position = gps_pos;
+ *velocity = gps_vel;
+ *accuracy = gps_acc;
+ location_position_free(wps_pos);
+ location_velocity_free(wps_vel);
+ location_accuracy_free(wps_acc);
+ }
+ } else if (gps_pos && gps_vel) {
+ *position = gps_pos;
+ *velocity = gps_vel;
+ *accuracy = gps_acc;
+ } else if (wps_pos && wps_vel) {
+ *position = wps_pos;
+ *velocity = wps_vel;
+ *accuracy = wps_acc;
+ } else {
+ ret = LOCATION_ERROR_NOT_AVAILABLE;
+ }
+
+ return ret;
+}
+
+static int
+location_hybrid_get_velocity(LocationHybrid *self,
+ LocationVelocity **velocity,
+ LocationAccuracy **accuracy)
+{
+ int ret = LOCATION_ERROR_NOT_AVAILABLE;
+ LOCATION_LOGD("location_hybrid_get_velocity");
+ if (!location_setting_get_int(VCONFKEY_LOCATION_ENABLED) && !location_setting_get_int(VCONFKEY_LOCATION_NETWORK_ENABLED)) {
+ return LOCATION_ERROR_SETTING_OFF;
+ }
+
+ LocationHybridPrivate *priv = GET_PRIVATE(self);
+ g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
+
+ if (priv->vel) {
+ *velocity = location_velocity_copy(priv->vel);
+ ret = LOCATION_ERROR_NONE;
+ }
+
+ if (priv->acc) {
+ *accuracy = location_accuracy_copy(priv->acc);
+ }
+
+ return ret;
+}
+
+static int
+location_hybrid_get_last_velocity(LocationHybrid *self,
+ LocationVelocity **velocity,
+ LocationAccuracy **accuracy)
+{
+ LOCATION_LOGD("location_hybrid_get_last_velocity");
+
+ int ret = LOCATION_ERROR_NONE;
+ LocationHybridPrivate *priv = GET_PRIVATE(self);
+ g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
+ LocationVelocity *gps_vel = NULL, *wps_vel = NULL;
+ LocationAccuracy *gps_acc = NULL, *wps_acc = NULL;
+
+ if (priv->gps) location_get_last_velocity(priv->gps, &gps_vel, &gps_acc);
+ if (priv->wps) location_get_last_velocity(priv->wps, &wps_vel, &wps_acc);
+
+ if (gps_vel && wps_vel) {
+ if (wps_vel->timestamp > gps_vel->timestamp) {
+ *velocity = wps_vel;
+ *accuracy = wps_acc;
+ location_velocity_free(gps_vel);
+ location_accuracy_free(gps_acc);
+ } else {
+ *velocity = gps_vel;
+ *accuracy = gps_acc;
+ location_velocity_free(wps_vel);
+ location_accuracy_free(wps_acc);
+ }
+ } else if (gps_vel) {
+ *velocity = gps_vel;
+ *accuracy = gps_acc;
+ } else if (wps_vel) {
+ *velocity = wps_vel;
+ *accuracy = wps_acc;
+ } else {
+ *velocity = NULL;
+ *accuracy = NULL;
+ ret = LOCATION_ERROR_NOT_AVAILABLE;
+ }
+
+ return ret;
+}
+
+static int
+location_hybrid_get_satellite(LocationHybrid *self,
+ LocationSatellite **satellite)
+{
+ int ret = LOCATION_ERROR_NOT_AVAILABLE;
+ LOCATION_LOGD("location_hybrid_get_satellite");
+ if (!location_setting_get_int(VCONFKEY_LOCATION_ENABLED) && !location_setting_get_int(VCONFKEY_LOCATION_NETWORK_ENABLED)) {
+ return LOCATION_ERROR_SETTING_OFF;
+ }
+
+ LocationHybridPrivate *priv = GET_PRIVATE(self);
+ g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
+ if (priv->sat) {
+ *satellite = location_satellite_copy(priv->sat);
+ ret = LOCATION_ERROR_NONE;
+ }
+
+ return ret;
+}
+
+static int
+location_hybrid_get_last_satellite(LocationHybrid *self,
+ LocationSatellite **satellite)
+{
+ LOCATION_LOGD("location_hybrid_get_last_satellite");
+
+ int ret = LOCATION_ERROR_NONE;
+ LocationHybridPrivate *priv = GET_PRIVATE(self);
+ g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
+
+ if (priv->gps) {
+ ret = location_get_last_satellite(priv->gps, satellite);
+ } else {
+ *satellite = NULL;
+ ret = LOCATION_ERROR_NOT_AVAILABLE;
+ }
+
+ return ret;
+}
+
+static int
+location_hybrid_set_option(LocationHybrid *self, const char *option)
+{
+ LOCATION_LOGD("location_hybrid_set_option");
+ LocationHybridPrivate *priv = GET_PRIVATE(self);
+ g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
+
+ int ret_gps = LOCATION_ERROR_NOT_AVAILABLE;
+ int ret_wps = LOCATION_ERROR_NOT_AVAILABLE;
+
+ if (priv->gps) ret_gps = location_set_option(priv->gps, option);
+ if (priv->wps) ret_wps = location_set_option(priv->wps, option);
+
+ if (ret_gps != LOCATION_ERROR_NONE && ret_wps != LOCATION_ERROR_NONE)
+ return LOCATION_ERROR_NOT_AVAILABLE;
+
+ return LOCATION_ERROR_NONE;
+}
+
+static int
+location_hybrid_request_single_location(LocationHybrid *self, int timeout)
+{
+ LOCATION_LOGD("location_hybrid_request_single_location");
+ LocationHybridPrivate *priv = GET_PRIVATE(self);
+ g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
+
+ int ret = LOCATION_ERROR_NONE;
+
+ if (priv->gps) {
+ ret = location_request_single_location(priv->gps, timeout);
+ } else {
+ ret = location_request_single_location(priv->wps, timeout);
+ }
+
+ return ret;
+}
+
+static int
+location_hybrid_get_nmea(LocationHybrid *self,
+ char **nmea_data)
+{
+ LOCATION_LOGD("location_hybrid_get_nmea");
+ LocationHybridPrivate *priv = GET_PRIVATE(self);
+ g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
+
+ int ret = LOCATION_ERROR_NOT_AVAILABLE;
+
+ if (priv->gps) ret = location_get_nmea(priv->gps, nmea_data);
+
+ if (ret != LOCATION_ERROR_NONE)
+ return LOCATION_ERROR_NOT_AVAILABLE;
+
+ return LOCATION_ERROR_NONE;
+}
+
+
+static void
+location_ielement_interface_init(LocationIElementInterface *iface)
+{
+ iface->start = (TYPE_START_FUNC)location_hybrid_start;
+ iface->stop = (TYPE_STOP_FUNC)location_hybrid_stop;
+ iface->get_position = (TYPE_GET_POSITION)location_hybrid_get_position;
+ iface->get_position_ext = (TYPE_GET_POSITION_EXT)location_hybrid_get_position_ext;
+ iface->get_last_position = (TYPE_GET_POSITION)location_hybrid_get_last_position;
+ iface->get_last_position_ext = (TYPE_GET_POSITION_EXT)location_hybrid_get_last_position_ext;
+ iface->get_velocity = (TYPE_GET_VELOCITY)location_hybrid_get_velocity;
+ iface->get_last_velocity = (TYPE_GET_VELOCITY)location_hybrid_get_last_velocity;
+ iface->get_satellite = (TYPE_GET_SATELLITE)location_hybrid_get_satellite;
+ iface->get_last_satellite = (TYPE_GET_SATELLITE)location_hybrid_get_last_satellite;
+ iface->set_option = (TYPE_SET_OPTION)location_hybrid_set_option;
+ iface->request_single_location = (TYPE_REQUEST_SINGLE_LOCATION)location_hybrid_request_single_location;
+ iface->get_nmea = (TYPE_GET_NMEA)location_hybrid_get_nmea;
+}
+
+static void
+location_hybrid_init(LocationHybrid *self)
+{
+ LOCATION_LOGD("location_hybrid_init");
+ LocationHybridPrivate *priv = GET_PRIVATE(self);
+ g_return_if_fail(priv);
+
+ priv->pos_interval = LOCATION_UPDATE_INTERVAL_NONE;
+ priv->vel_interval = LOCATION_UPDATE_INTERVAL_NONE;
+ priv->sat_interval = LOCATION_UPDATE_INTERVAL_NONE;
+ priv->loc_interval = LOCATION_UPDATE_INTERVAL_NONE;
+ priv->min_interval = LOCATION_UPDATE_INTERVAL_NONE;
+
+ priv->pos_updated_timestamp = 0;
+ priv->vel_updated_timestamp = 0;
+ priv->sat_updated_timestamp = 0;
+ priv->loc_updated_timestamp = 0;
+
+ priv->gps_enabled = FALSE;
+ priv->wps_enabled = FALSE;
+ priv->gps = NULL;
+ priv->wps = NULL;
+
+ priv->set_noti = FALSE;
+ priv->signal_type = 0;
+ priv->pos_timer = 0;
+ priv->vel_timer = 0;
+
+ if (location_is_supported_method(LOCATION_METHOD_GPS)) priv->gps = location_new(LOCATION_METHOD_GPS);
+ if (location_is_supported_method(LOCATION_METHOD_WPS)) priv->wps = location_new(LOCATION_METHOD_WPS);
+
+ if (priv->gps) {
+ g_signal_connect(priv->gps, "service-enabled", G_CALLBACK(hybrid_service_enabled), self);
+ g_signal_connect(priv->gps, "service-disabled", G_CALLBACK(hybrid_service_disabled), self);
+ g_signal_connect(priv->gps, "service-updated", G_CALLBACK(hybrid_service_updated), self);
+ g_signal_connect(priv->gps, "location-updated", G_CALLBACK(hybrid_location_updated), self);
+ }
+ if (priv->wps) {
+ g_signal_connect(priv->wps, "service-enabled", G_CALLBACK(hybrid_service_enabled), self);
+ g_signal_connect(priv->wps, "service-disabled", G_CALLBACK(hybrid_service_disabled), self);
+ g_signal_connect(priv->wps, "service-updated", G_CALLBACK(hybrid_service_updated), self);
+ g_signal_connect(priv->wps, "location-updated", G_CALLBACK(hybrid_location_updated), self);
+ }
+
+ hybrid_set_current_method(priv, LOCATION_TYPE_HYBRID);
+ priv->enabled = FALSE;
+
+ priv->pos = NULL;
+ priv->vel = NULL;
+ priv->acc = NULL;
+ priv->sat = NULL;
+
+ priv->boundary_list = NULL;
+}
+
+static void
+location_hybrid_class_init(LocationHybridClass *klass)
+{
+ LOCATION_LOGD("location_hybrid_class_init");
+ GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
+
+ gobject_class->set_property = location_hybrid_set_property;
+ gobject_class->get_property = location_hybrid_get_property;
+
+ gobject_class->dispose = location_hybrid_dispose;
+ gobject_class->finalize = location_hybrid_finalize;
+
+ g_type_class_add_private(klass, sizeof(LocationHybridPrivate));
+
+ signals[SERVICE_ENABLED] = g_signal_new("service-enabled",
+ G_TYPE_FROM_CLASS(klass),
+ G_SIGNAL_RUN_FIRST |
+ G_SIGNAL_NO_RECURSE,
+ G_STRUCT_OFFSET(LocationHybridClass, enabled),
+ NULL, NULL,
+ location_VOID__UINT,
+ G_TYPE_NONE, 1,
+ G_TYPE_UINT);
+
+ signals[SERVICE_DISABLED] = g_signal_new("service-disabled",
+ G_TYPE_FROM_CLASS(klass),
+ G_SIGNAL_RUN_FIRST |
+ G_SIGNAL_NO_RECURSE,
+ G_STRUCT_OFFSET(LocationHybridClass, disabled),
+ NULL, NULL,
+ location_VOID__UINT,
+ G_TYPE_NONE, 1,
+ G_TYPE_UINT);
+
+ signals[SERVICE_UPDATED] = g_signal_new("service-updated",
+ G_TYPE_FROM_CLASS(klass),
+ G_SIGNAL_RUN_FIRST |
+ G_SIGNAL_NO_RECURSE,
+ G_STRUCT_OFFSET(LocationHybridClass, updated),
+ NULL, NULL,
+ location_VOID__INT_POINTER_POINTER_POINTER,
+ G_TYPE_NONE, 4,
+ G_TYPE_INT,
+ G_TYPE_POINTER,
+ G_TYPE_POINTER,
+ G_TYPE_POINTER);
+
+ signals[LOCATION_UPDATED] = g_signal_new("location-updated",
+ G_TYPE_FROM_CLASS(klass),
+ G_SIGNAL_RUN_FIRST |
+ G_SIGNAL_NO_RECURSE,
+ G_STRUCT_OFFSET(LocationHybridClass, location_updated),
+ NULL, NULL,
+ location_VOID__INT_POINTER_POINTER_POINTER,
+ G_TYPE_NONE, 4,
+ G_TYPE_INT,
+ G_TYPE_POINTER,
+ G_TYPE_POINTER,
+ G_TYPE_POINTER);
+
+ signals[ZONE_IN] = g_signal_new("zone-in",
+ G_TYPE_FROM_CLASS(klass),
+ G_SIGNAL_RUN_FIRST |
+ G_SIGNAL_NO_RECURSE,
+ G_STRUCT_OFFSET(LocationHybridClass, zone_in),
+ NULL, NULL,
+ location_VOID__POINTER_POINTER_POINTER,
+ G_TYPE_NONE, 3,
+ G_TYPE_POINTER,
+ G_TYPE_POINTER,
+ G_TYPE_POINTER);
+
+ signals[ZONE_OUT] = g_signal_new("zone-out",
+ G_TYPE_FROM_CLASS(klass),
+ G_SIGNAL_RUN_FIRST |
+ G_SIGNAL_NO_RECURSE,
+ G_STRUCT_OFFSET(LocationHybridClass, zone_out),
+ NULL, NULL,
+ location_VOID__POINTER_POINTER_POINTER,
+ G_TYPE_NONE, 3,
+ G_TYPE_POINTER,
+ G_TYPE_POINTER,
+ G_TYPE_POINTER);
+
+ properties[PROP_METHOD_TYPE] = g_param_spec_int("method",
+ "method type",
+ "location method type name",
+ LOCATION_METHOD_HYBRID,
+ LOCATION_METHOD_HYBRID,
+ LOCATION_METHOD_HYBRID,
+ G_PARAM_READABLE);
+
+ properties[PROP_LAST_POSITION] = g_param_spec_boxed("last-position",
+ "hybrid last position prop",
+ "hybrid last position data",
+ LOCATION_TYPE_POSITION,
+ G_PARAM_READABLE);
+
+ properties[PROP_POS_INTERVAL] = g_param_spec_uint("pos-interval",
+ "position interval prop",
+ "position interval data",
+ LOCATION_UPDATE_INTERVAL_MIN,
+ LOCATION_UPDATE_INTERVAL_MAX,
+ LOCATION_UPDATE_INTERVAL_DEFAULT,
+ G_PARAM_READWRITE);
+ properties[PROP_VEL_INTERVAL] = g_param_spec_uint("vel-interval",
+ "velocity interval prop",
+ "velocity interval data",
+ LOCATION_UPDATE_INTERVAL_MIN,
+ LOCATION_UPDATE_INTERVAL_MAX,
+ LOCATION_UPDATE_INTERVAL_DEFAULT,
+ G_PARAM_READWRITE);
+ properties[PROP_SAT_INTERVAL] = g_param_spec_uint("sat-interval",
+ "satellite interval prop",
+ "satellite interval data",
+ LOCATION_UPDATE_INTERVAL_MIN,
+ LOCATION_UPDATE_INTERVAL_MAX,
+ LOCATION_UPDATE_INTERVAL_DEFAULT,
+ G_PARAM_READWRITE);
+
+ properties[PROP_LOC_INTERVAL] = g_param_spec_uint("loc-interval",
+ "gps location interval prop",
+ "gps location interval data",
+ LOCATION_UPDATE_INTERVAL_MIN,
+ LOCATION_UPDATE_INTERVAL_MAX,
+ LOCATION_UPDATE_INTERVAL_DEFAULT,
+ G_PARAM_READWRITE);
+
+ properties[PROP_MIN_INTERVAL] = g_param_spec_uint("min-interval",
+ "gps distance-based interval prop",
+ "gps distance-based interval data",
+ LOCATION_MIN_INTERVAL_MIN,
+ LOCATION_MIN_INTERVAL_MAX,
+ LOCATION_MIN_INTERVAL_DEFAULT,
+ G_PARAM_READWRITE);
+
+ properties[PROP_MIN_DISTANCE] = g_param_spec_double("min-distance",
+ "gps distance-based distance prop",
+ "gps distance-based distance data",
+ LOCATION_MIN_DISTANCE_MIN,
+ LOCATION_MIN_DISTANCE_MAX,
+ LOCATION_MIN_DISTANCE_DEFAULT,
+ G_PARAM_READWRITE);
+
+ properties[PROP_BOUNDARY] = g_param_spec_pointer("boundary",
+ "hybrid boundary prop",
+ "hybrid boundary data",
+ G_PARAM_READWRITE);
+
+ properties[PROP_REMOVAL_BOUNDARY] = g_param_spec_boxed("removal-boundary",
+ "hybrid removal boundary prop",
+ "hybrid removal boundary data",
+ LOCATION_TYPE_BOUNDARY,
+ G_PARAM_READWRITE);
+
+ g_object_class_install_properties(gobject_class,
+ PROP_MAX,
+ properties);
+}
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "location-setting.h"
-#include "location-log.h"
-
-#include "module-internal.h"
-
-#include "location-hybrid.h"
-#include "location-marshal.h"
-#include "location-ielement.h"
-#include "location-signaling-util.h"
-#include "location-common-util.h"
-
-#include "location-gps.h"
-#include "location-wps.h"
-
-typedef struct _LocationHybridPrivate {
- gboolean gps_enabled;
- gboolean wps_enabled;
- guint pos_updated_timestamp;
- guint pos_interval;
- guint vel_updated_timestamp;
- guint vel_interval;
- guint sat_updated_timestamp;
- guint sat_interval;
- LocationObject *gps;
- LocationObject *wps;
- gboolean enabled;
- LocationMethod current_method;
- LocationPosition *pos;
- LocationVelocity *vel;
- LocationAccuracy *acc;
- LocationSatellite *sat;
- GList* boundary_list;
- gboolean set_noti;
- guint pos_timer;
- guint vel_timer;
-} LocationHybridPrivate;
-
-enum {
- PROP_0,
- PROP_METHOD_TYPE,
- PROP_LAST_POSITION,
- PROP_POS_INTERVAL,
- PROP_VEL_INTERVAL,
- PROP_SAT_INTERVAL,
- PROP_BOUNDARY,
- PROP_REMOVAL_BOUNDARY,
- PROP_MAX
-};
-
-static guint32 signals[LAST_SIGNAL] = {0, };
-static GParamSpec *properties[PROP_MAX] = {NULL, };
-
-#define GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), LOCATION_TYPE_HYBRID, LocationHybridPrivate))
-
-static void location_ielement_interface_init (LocationIElementInterface *iface);
-
-G_DEFINE_TYPE_WITH_CODE (LocationHybrid, location_hybrid, G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE (LOCATION_TYPE_IELEMENT,
- location_ielement_interface_init));
-
-static LocationMethod
-hybrid_get_current_method(LocationHybridPrivate* priv)
-{
- g_return_val_if_fail (priv, LOCATION_METHOD_NONE);
- LOCATION_LOGW("Current Method [%d]\n", priv->current_method);
- return priv->current_method;
-}
-
-static gboolean
-hybrid_set_current_method (LocationHybridPrivate* priv, GType g_type)
-{
- g_return_val_if_fail (priv, FALSE);
-
- if (g_type == LOCATION_TYPE_GPS) {
- priv->current_method = LOCATION_METHOD_GPS;
- LOCATION_LOGW("Set current Method [%d]\n", priv->current_method);
- } else if (g_type == LOCATION_TYPE_WPS) {
- priv->current_method = LOCATION_METHOD_WPS;
- LOCATION_LOGW("Set current Method [%d]\n", priv->current_method);
- } else if (g_type == LOCATION_TYPE_HYBRID){
- priv->current_method = LOCATION_METHOD_HYBRID;
- LOCATION_LOGW("Set current Method [%d]\n", priv->current_method);
- } else
- return FALSE;
-
- return TRUE;
-}
-
-
-static int
-hybrid_get_update_method (LocationHybridPrivate* priv)
-{
- if(!priv->gps && !priv->wps) return -1;
-
- if (priv->gps_enabled) {
- hybrid_set_current_method (priv, LOCATION_TYPE_GPS);
- } else if (priv->wps_enabled) {
- hybrid_set_current_method (priv, LOCATION_TYPE_WPS);
- } else {
- hybrid_set_current_method (priv,LOCATION_TYPE_HYBRID);
- }
-
- return 0;
-}
-
-static LocationObject *
-hybrid_get_current_object (LocationHybridPrivate* priv)
-{
- LocationMethod method = hybrid_get_current_method (priv);
-
- LocationObject *obj = NULL;
- switch (method) {
- case LOCATION_METHOD_GPS:
- obj = priv->gps;
- break;
- case LOCATION_METHOD_WPS:
- obj = priv->wps;
- break;
- default:
- break;
- }
-
- return obj;
-}
-
-static gboolean /* True : Receive more accurate info. False : Receive less accurate info */
-hybrid_compare_g_type_method(LocationHybridPrivate *priv, GType g_type)
-{
- if (g_type == LOCATION_TYPE_GPS) {
- hybrid_set_current_method(priv, LOCATION_TYPE_GPS);
- return TRUE;
- } else if (g_type == LOCATION_TYPE_WPS && hybrid_get_current_method(priv) == LOCATION_METHOD_WPS) {
- hybrid_set_current_method(priv, LOCATION_TYPE_WPS);
- return TRUE;
- }
-
- return FALSE;
-}
-
-static gboolean
-_position_timeout_cb (gpointer data)
-{
- LOCATION_LOGD("_position_timeout_cb");
- GObject *object = (GObject *)data;
- if (!object) return FALSE;
- LocationHybridPrivate *priv = GET_PRIVATE(object);
- if (!priv) return FALSE;
-
- LocationPosition *pos = NULL;
- LocationAccuracy *acc = NULL;
-
- if (priv->pos) {
- pos = location_position_copy (priv->pos);
- }
- else {
- pos = location_position_new (0, 0.0, 0.0, 0.0, LOCATION_STATUS_NO_FIX);
- }
-
- if (priv->acc) {
- acc = location_accuracy_copy (priv->acc);
- }
- else {
- acc = location_accuracy_new (LOCATION_ACCURACY_LEVEL_NONE, 0.0, 0.0);
- }
-
- LOCATION_LOGD("POSITION SERVICE_UPDATED");
- g_signal_emit(object, signals[SERVICE_UPDATED], 0, POSITION_UPDATED, pos, acc);
-
- location_position_free (pos);
- location_accuracy_free (acc);
-
- return TRUE;
-}
-
-static gboolean
-_velocity_timeout_cb (gpointer data)
-{
- LOCATION_LOGD("_velocity_timeout_cb");
- GObject *object = (GObject *)data;
- LocationHybridPrivate *priv = GET_PRIVATE(object);
- if (!priv) return FALSE;
-
- LocationVelocity *vel = NULL;
- LocationAccuracy *acc = NULL;
-
- if (priv->vel) {
- vel = location_velocity_copy(priv->vel);
- }
- else {
- vel = location_velocity_new (0, 0.0, 0.0, 0.0);
- }
-
- if (priv->acc) {
- acc = location_accuracy_copy (priv->acc);
- }
- else {
- acc = location_accuracy_new (LOCATION_ACCURACY_LEVEL_NONE, 0.0, 0.0);
- }
-
- LOCATION_LOGD("VELOCITY SERVICE_UPDATED");
- g_signal_emit(object, signals[SERVICE_UPDATED], 0, VELOCITY_UPDATED, vel, acc);
-
- location_velocity_free (vel);
- location_accuracy_free (acc);
-
- return TRUE;
-}
-
-static void
-location_hybrid_state_cb (keynode_t *key, gpointer self)
-{
- LOCATION_LOGD("location_hybrid_state_cb");
- g_return_if_fail (key);
- g_return_if_fail (self);
- LocationHybridPrivate *priv = GET_PRIVATE(self);
-
- if (location_setting_get_key_val (key) == VCONFKEY_LOCATION_POSITION_SEARCHING) {
- if (!priv->pos_timer) priv->pos_timer = g_timeout_add (priv->pos_interval * 1000, _position_timeout_cb, self);
- if (!priv->vel_timer) priv->vel_timer = g_timeout_add (priv->vel_interval * 1000, _velocity_timeout_cb, self);
-
- }
- else {
- if (priv->pos_timer) g_source_remove (priv->pos_timer);
- if (priv->vel_timer) g_source_remove (priv->vel_timer);
-
- priv->pos_timer = 0;
- priv->vel_timer = 0;
- }
-}
-
-static void
-hybrid_service_updated (GObject *obj,
- guint type,
- gpointer data,
- gpointer accuracy,
- gpointer self)
-{
- LocationPosition *pos = NULL;
- LocationVelocity *vel = NULL;
- LocationSatellite *sat = NULL;
- LOCATION_LOGD ("hybrid_service_updated");
-
- /* To discard invalid data in a hybrid */
- switch (type) {
- case POSITION_UPDATED: {
- pos = (LocationPosition *)data;
- if (!pos->timestamp) return;
- break;
- }
- case VELOCITY_UPDATED: {
- vel = (LocationVelocity *)data;
- if (!vel->timestamp) return;
- break;
- }
- case SATELLITE_UPDATED: {
- sat = (LocationSatellite *)data;
- if (!sat->timestamp) return;
- break;
- }
- }
-
- LocationHybridPrivate* priv = GET_PRIVATE((LocationHybrid*)self);
- GType g_type = G_TYPE_FROM_INSTANCE(obj);
- if (g_type == LOCATION_TYPE_GPS) {
- if (type == SATELLITE_UPDATED) {
- satellite_signaling(self, signals, &(priv->enabled), priv->sat_interval, TRUE, &(priv->sat_updated_timestamp), &(priv->sat), sat);
- return ;
- }
- else if (location_setting_get_int (VCONFKEY_LOCATION_GPS_STATE) == VCONFKEY_LOCATION_GPS_SEARCHING) {
- LOCATION_LOGD ("Searching GPS");
- return;
- }
-
- }
- else if (g_type == LOCATION_TYPE_WPS && location_setting_get_int (VCONFKEY_LOCATION_WPS_STATE) == VCONFKEY_LOCATION_WPS_SEARCHING) {
- LOCATION_LOGD ("Searching WPS");
- return;
- }
-
- if (hybrid_compare_g_type_method(priv, g_type)) {
- LocationAccuracy *acc = (LocationAccuracy*)accuracy;
- if (type == POSITION_UPDATED) {
- if (priv->pos) location_position_free(priv->pos);
- if (priv->acc) location_accuracy_free(priv->acc);
- priv->pos = location_position_copy(pos);
- priv->acc = location_accuracy_copy(acc);
- if (!priv->enabled) {
- enable_signaling(self, signals, &(priv->enabled), TRUE, pos->status);
- }
- position_signaling(self, signals, priv->pos_interval, &(priv->pos_updated_timestamp), priv->boundary_list, pos, acc);
- LOCATION_LOGW("Position updated. timestamp [%d]", priv->pos->timestamp);
- } else if (type == VELOCITY_UPDATED) {
- if (priv->vel) location_velocity_free(priv->vel);
- priv->vel = location_velocity_copy(vel);
- velocity_signaling(self, signals, priv->vel_interval, &(priv->vel_updated_timestamp), vel, acc);
- LOCATION_LOGW("Velocity updated. timestamp [%d]", priv->vel->timestamp);
- }
-
- } else if (type == POSITION_UPDATED && priv->pos) {
- if (pos->timestamp - priv->pos->timestamp > HYBRID_POSITION_EXPIRATION_TIME) {
- hybrid_set_current_method(priv, g_type);
- }
- }
-}
-
-static void
-hybrid_service_enabled (GObject *obj,
- guint status,
- gpointer self)
-{
- LOCATION_LOGD ("hybrid_service_enabled");
- LocationHybridPrivate* priv = GET_PRIVATE((LocationHybrid*)self);
- GType g_type = G_TYPE_FROM_INSTANCE(obj);
- if(g_type == LOCATION_TYPE_GPS) priv->gps_enabled = TRUE;
- else if(g_type == LOCATION_TYPE_WPS) priv->wps_enabled = TRUE;
- else {
- LOCATION_LOGW("Undefined GType enabled");
- return;
- }
- hybrid_get_update_method(priv);
-}
-
-static void
-hybrid_service_disabled (GObject *obj,
- guint status,
- gpointer self)
-{
- LOCATION_LOGD ("hybrid_service_disabled");
- LocationHybridPrivate* priv = GET_PRIVATE((LocationHybrid*)self);
- GType g_type = G_TYPE_FROM_INSTANCE(obj);
- if(g_type == LOCATION_TYPE_GPS) priv->gps_enabled = FALSE;
- else if(g_type == LOCATION_TYPE_WPS) priv->wps_enabled = FALSE;
- else {
- LOCATION_LOGW("Undefined GType disabled");
- return;
- }
- hybrid_get_update_method(priv);
- if(!priv->gps_enabled && !priv->wps_enabled)
- enable_signaling(self, signals, &(priv->enabled), FALSE, status);
-
-}
-
-static int
-location_hybrid_start (LocationHybrid *self)
-{
- LOCATION_LOGD("location_hybrid_start");
-
- int ret_gps = LOCATION_ERROR_NOT_AVAILABLE;
- int ret_wps = LOCATION_ERROR_NOT_AVAILABLE;
- gboolean gps_started = FALSE;
- gboolean wps_started = FALSE;
-
- LocationHybridPrivate* priv = GET_PRIVATE(self);
-
- g_object_get(priv->gps, "is_started", &gps_started, NULL);
- g_object_get(priv->wps, "is_started", &wps_started, NULL);
-
- if ((gps_started == TRUE) || (wps_started == TRUE))
- return LOCATION_ERROR_NONE;
-
- if (priv->gps) ret_gps = location_start(priv->gps);
- if (priv->wps) ret_wps = location_start(priv->wps);
-
- if (ret_gps != LOCATION_ERROR_NONE && ret_wps != LOCATION_ERROR_NONE) {
- if (ret_gps == LOCATION_ERROR_SECURITY_DENIED || ret_wps == LOCATION_ERROR_SECURITY_DENIED) {
- return LOCATION_ERROR_SECURITY_DENIED;
- } else if (ret_gps == LOCATION_ERROR_SETTING_OFF && ret_wps == LOCATION_ERROR_SETTING_OFF) {
- return LOCATION_ERROR_SETTING_OFF;
- } else {
- return LOCATION_ERROR_NOT_AVAILABLE;
- }
- }
-
- if (priv->set_noti == FALSE) {
- location_setting_add_notify (VCONFKEY_LOCATION_POSITION_STATE, location_hybrid_state_cb, self);
- priv->set_noti = TRUE;
- }
-
- return LOCATION_ERROR_NONE;
-}
-
-static int
-location_hybrid_stop (LocationHybrid *self)
-{
- LOCATION_LOGD("location_hybrid_stop");
-
- LocationHybridPrivate* priv = GET_PRIVATE(self);
-
- int ret_gps = LOCATION_ERROR_NOT_AVAILABLE;
- int ret_wps = LOCATION_ERROR_NOT_AVAILABLE;
- gboolean gps_started = FALSE;
- gboolean wps_started = FALSE;
-
- g_object_get(priv->gps, "is_started", &gps_started, NULL);
- g_object_get(priv->wps, "is_started", &wps_started, NULL);
-
- if ((gps_started == FALSE) && (wps_started == FALSE)) {
- return LOCATION_ERROR_NONE;
- }
-
- if (priv->gps) ret_gps = location_stop(priv->gps);
- if (priv->wps) ret_wps = location_stop(priv->wps);
-
- if (ret_gps != LOCATION_ERROR_NONE && ret_wps != LOCATION_ERROR_NONE)
- return LOCATION_ERROR_NOT_AVAILABLE;
-
- if (priv->pos_timer) g_source_remove (priv->pos_timer);
- if (priv->vel_timer) g_source_remove (priv->vel_timer);
- priv->pos_timer = 0;
- priv->vel_timer = 0;
-
- if (priv->set_noti == TRUE) {
- location_setting_ignore_notify (VCONFKEY_LOCATION_POSITION_STATE, location_hybrid_state_cb);
- priv->set_noti = FALSE;
- }
-
- return LOCATION_ERROR_NONE;
-}
-
-static void
-location_hybrid_dispose (GObject *gobject)
-{
- LOCATION_LOGD("location_hybrid_dispose");
- LocationHybridPrivate *priv = GET_PRIVATE(gobject);
-
- if (priv->pos_timer) g_source_remove (priv->pos_timer);
- if (priv->vel_timer) g_source_remove (priv->vel_timer);
- priv->pos_timer = 0;
- priv->vel_timer = 0;
-
- if (priv->set_noti == TRUE) {
- location_setting_ignore_notify (VCONFKEY_LOCATION_POSITION_STATE, location_hybrid_state_cb);
- priv->set_noti = FALSE;
- }
-
- G_OBJECT_CLASS (location_hybrid_parent_class)->dispose (gobject);
-}
-
-static void
-location_hybrid_finalize (GObject *gobject)
-{
- LOCATION_LOGD("location_hybrid_finalize");
- LocationHybridPrivate* priv = GET_PRIVATE(gobject);
-
- if (priv->gps) {
- g_signal_handlers_disconnect_by_func(priv->gps, G_CALLBACK (hybrid_service_enabled), gobject);
- g_signal_handlers_disconnect_by_func(priv->gps, G_CALLBACK (hybrid_service_disabled), gobject);
- g_signal_handlers_disconnect_by_func(priv->gps, G_CALLBACK (hybrid_service_updated), gobject);
- location_free(priv->gps);
- }
- if (priv->wps) {
- g_signal_handlers_disconnect_by_func(priv->wps, G_CALLBACK (hybrid_service_enabled), gobject);
- g_signal_handlers_disconnect_by_func(priv->wps, G_CALLBACK (hybrid_service_disabled), gobject);
- g_signal_handlers_disconnect_by_func(priv->wps, G_CALLBACK (hybrid_service_updated), gobject);
- location_free(priv->wps);
- }
-
- if (priv->boundary_list) {
- g_list_free_full(priv->boundary_list, free_boundary_list);
- priv->boundary_list = NULL;
- }
-
- if (priv->pos) {
- location_position_free(priv->pos);
- priv->pos = NULL;
- }
-
- if (priv->vel) {
- location_velocity_free(priv->vel);
- priv->vel = NULL;
- }
-
- if (priv->acc) {
- location_accuracy_free(priv->acc);
- priv->acc = NULL;
- }
-
- if (priv->sat) {
- location_satellite_free(priv->sat);
- priv->sat = NULL;
- }
-
- G_OBJECT_CLASS (location_hybrid_parent_class)->finalize (gobject);
-}
-
-static void
-location_hybrid_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- LocationHybridPrivate* priv = GET_PRIVATE(object);
- if (!priv->gps && !priv->wps) {
- LOCATION_LOGW("Set property is not available now");
- return;
- }
-
- int ret = 0;
- switch (property_id){
- case PROP_BOUNDARY:{
- GList *boundary_list = (GList *)g_list_copy(g_value_get_pointer(value));
- ret = set_prop_boundary(&priv->boundary_list, boundary_list);
- if(ret != 0) LOCATION_LOGD("Set boundary. Error[%d]", ret);
- break;
- }
- case PROP_REMOVAL_BOUNDARY: {
- LocationBoundary *req_boundary = (LocationBoundary*) g_value_dup_boxed(value);
- ret = set_prop_removal_boundary(&priv->boundary_list, req_boundary);
- if(ret != 0) LOCATION_LOGD("Removal boundary. Error[%d]", ret);
- break;
- }
- case PROP_POS_INTERVAL: {
- guint interval = g_value_get_uint(value);
- if(interval > 0) {
- if(interval < LOCATION_UPDATE_INTERVAL_MAX)
- priv->pos_interval = interval;
- else
- priv->pos_interval = (guint) LOCATION_UPDATE_INTERVAL_MAX;
-
- }
- else
- priv->pos_interval = LOCATION_UPDATE_INTERVAL_DEFAULT;
-
- if (priv->pos_timer) {
- g_source_remove (priv->pos_timer);
- priv->pos_timer = g_timeout_add (priv->pos_interval * 1000, _position_timeout_cb, object);
- }
-
- break;
- }
- case PROP_VEL_INTERVAL: {
- guint interval = g_value_get_uint(value);
- if(interval > 0) {
- if(interval < LOCATION_UPDATE_INTERVAL_MAX)
- priv->vel_interval = interval;
- else
- priv->vel_interval = (guint) LOCATION_UPDATE_INTERVAL_MAX;
-
- }
- else
- priv->vel_interval = LOCATION_UPDATE_INTERVAL_DEFAULT;
-
- if (priv->vel_timer) {
- g_source_remove (priv->vel_timer);
- priv->vel_timer = g_timeout_add (priv->vel_interval * 1000, _velocity_timeout_cb, object);
- }
-
- break;
- }
- case PROP_SAT_INTERVAL: {
- guint interval = g_value_get_uint(value);
- if(interval > 0) {
- if(interval < LOCATION_UPDATE_INTERVAL_MAX)
- priv->sat_interval = interval;
- else
- priv->sat_interval = (guint) LOCATION_UPDATE_INTERVAL_MAX;
-
- }
- else
- priv->sat_interval = LOCATION_UPDATE_INTERVAL_DEFAULT;
-
- break;
- }
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-static void
-location_hybrid_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
-{
- LocationHybridPrivate *priv = GET_PRIVATE (object);
- if(!priv->gps && !priv->wps){
- LOCATION_LOGW("Get property is not available now");
- return;
- }
-
- LOCATION_LOGW("Get Propery ID[%d]", property_id);
-
- switch (property_id){
- case PROP_METHOD_TYPE:
- g_value_set_int(value, hybrid_get_current_method (priv));
- break;
- case PROP_LAST_POSITION:
- g_value_set_boxed(value, priv->pos);
- break;
- case PROP_BOUNDARY:
- g_value_set_pointer(value, g_list_first(priv->boundary_list));
- break;
- case PROP_POS_INTERVAL:
- g_value_set_uint(value, priv->pos_interval);
- break;
- case PROP_VEL_INTERVAL:
- g_value_set_uint(value, priv->vel_interval);
- break;
- case PROP_SAT_INTERVAL:
- g_value_set_uint(value, priv->sat_interval);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-static int
-location_hybrid_get_position (LocationHybrid *self,
- LocationPosition **position,
- LocationAccuracy **accuracy)
-{
- int ret = LOCATION_ERROR_NOT_AVAILABLE;
- LOCATION_LOGD("location_hybrid_get_position");
- if (!location_setting_get_int(VCONFKEY_LOCATION_ENABLED) && !location_setting_get_int(VCONFKEY_LOCATION_NETWORK_ENABLED)) {
- return LOCATION_ERROR_SETTING_OFF;
- }
-
- LocationHybridPrivate *priv = GET_PRIVATE (self);
-
- if (priv->pos) {
- *position = location_position_copy (priv->pos);
- ret = LOCATION_ERROR_NONE;
- }
-
- if (priv->acc) {
- *accuracy = location_accuracy_copy (priv->acc);
- }
-
- return ret;
-}
-
-static int
-location_hybrid_get_position_ext (LocationHybrid *self,
- LocationPosition **position,
- LocationVelocity **velocity,
- LocationAccuracy **accuracy)
-{
- LOCATION_LOGD("location_hybrid_get_position_ext");
- if (!location_setting_get_int(VCONFKEY_LOCATION_ENABLED) && !location_setting_get_int(VCONFKEY_LOCATION_NETWORK_ENABLED)) {
- return LOCATION_ERROR_SETTING_OFF;
- }
-
- LocationHybridPrivate *priv = GET_PRIVATE (self);
-
- if (priv->pos && priv->vel) {
- *position = location_position_copy (priv->pos);
- *velocity = location_velocity_copy (priv->vel);
- }
- else {
- LOCATION_LOGE("There is invalid data.");
- return LOCATION_ERROR_NOT_AVAILABLE;
- }
-
- if (priv->acc) {
- *accuracy = location_accuracy_copy (priv->acc);
- }
- else {
- *accuracy = location_accuracy_new (LOCATION_ACCURACY_LEVEL_NONE, 0.0, 0.0);
- }
-
- return LOCATION_ERROR_NONE;
-}
-
-
-static int
-location_hybrid_get_last_position (LocationHybrid *self,
- LocationPosition **position,
- LocationAccuracy **accuracy)
-{
- LOCATION_LOGD("location_hybrid_get_last_position");
-
- int ret = LOCATION_ERROR_NONE;
- LocationPosition *gps_pos = NULL, *wps_pos = NULL;
- LocationAccuracy *gps_acc = NULL, *wps_acc = NULL;
- LocationHybridPrivate *priv = GET_PRIVATE (self);
-
- if (priv->gps) location_get_last_position (priv->gps, &gps_pos, &gps_acc);
- if (priv->wps) location_get_last_position (priv->wps, &wps_pos, &wps_acc);
-
- if (gps_pos && wps_pos) {
- if (wps_pos->timestamp > gps_pos->timestamp) {
- *position = wps_pos;
- *accuracy = wps_acc;
- location_position_free (gps_pos);
- location_accuracy_free (gps_acc);
- }
- else {
- *position = gps_pos;
- *accuracy = gps_acc;
- location_position_free (wps_pos);
- location_accuracy_free (wps_acc);
- }
- } else if (gps_pos) {
- *position = gps_pos;
- *accuracy = gps_acc;
- } else if (wps_pos) {
- *position = wps_pos;
- *accuracy = wps_acc;
- } else {
- ret = LOCATION_ERROR_NOT_AVAILABLE;
- }
-
- return ret;
-}
-
-static int
-location_hybrid_get_last_position_ext (LocationHybrid *self,
- LocationPosition **position,
- LocationVelocity **velocity,
- LocationAccuracy **accuracy)
-{
- LOCATION_LOGD("location_hybrid_get_last_position_ext");
-
- int ret = LOCATION_ERROR_NONE;
- LocationPosition *gps_pos = NULL, *wps_pos = NULL;
- LocationVelocity *gps_vel = NULL, *wps_vel = NULL;
- LocationAccuracy *gps_acc = NULL, *wps_acc = NULL;
- LocationHybridPrivate *priv = GET_PRIVATE (self);
-
- if (priv->gps) location_get_last_position_ext (priv->gps, &gps_pos, &gps_vel, &gps_acc);
- if (priv->wps) location_get_last_position_ext (priv->wps, &wps_pos, &wps_vel, &wps_acc);
-
- if (gps_pos && wps_pos && gps_vel && wps_vel) {
- if (wps_pos->timestamp > gps_pos->timestamp) {
- *position = wps_pos;
- *velocity = wps_vel;
- *accuracy = wps_acc;
- location_position_free (gps_pos);
- location_velocity_free (gps_vel);
- location_accuracy_free (gps_acc);
- }
- else {
- *position = gps_pos;
- *velocity = gps_vel;
- *accuracy = gps_acc;
- location_position_free (wps_pos);
- location_velocity_free (wps_vel);
- location_accuracy_free (wps_acc);
- }
- } else if (gps_pos && gps_vel) {
- *position = gps_pos;
- *velocity = gps_vel;
- *accuracy = gps_acc;
- } else if (wps_pos && wps_vel) {
- *position = wps_pos;
- *velocity = wps_vel;
- *accuracy = wps_acc;
- } else {
- ret = LOCATION_ERROR_NOT_AVAILABLE;
- }
-
- return ret;
-}
-
-static int
-location_hybrid_get_velocity (LocationHybrid *self,
- LocationVelocity **velocity,
- LocationAccuracy **accuracy)
-{
- int ret = LOCATION_ERROR_NOT_AVAILABLE;
- LOCATION_LOGD("location_hybrid_get_velocity");
- if (!location_setting_get_int(VCONFKEY_LOCATION_ENABLED) && !location_setting_get_int(VCONFKEY_LOCATION_NETWORK_ENABLED)) {
- return LOCATION_ERROR_SETTING_OFF;
- }
-
- LocationHybridPrivate *priv = GET_PRIVATE (self);
-
- if (priv->vel) {
- *velocity = location_velocity_copy (priv->vel);
- ret = LOCATION_ERROR_NONE;
- }
-
- if (priv->acc) {
- *accuracy = location_accuracy_copy (priv->acc);
- }
-
- return ret;
-}
-
-static int
-location_hybrid_get_last_velocity (LocationHybrid *self,
- LocationVelocity **velocity,
- LocationAccuracy **accuracy)
-{
- LOCATION_LOGD("location_hybrid_get_last_velocity");
-
- int ret = LOCATION_ERROR_NONE;
- LocationHybridPrivate *priv = GET_PRIVATE (self);
- LocationVelocity *gps_vel = NULL, *wps_vel = NULL;
- LocationAccuracy *gps_acc = NULL, *wps_acc = NULL;
-
- if (priv->gps) location_get_last_velocity (priv->gps, &gps_vel, &gps_acc);
- if (priv->wps) location_get_last_velocity (priv->wps, &wps_vel, &wps_acc);
-
- if (gps_vel && wps_vel) {
- if (wps_vel->timestamp > gps_vel->timestamp) {
- *velocity = wps_vel;
- *accuracy = wps_acc;
- location_velocity_free (gps_vel);
- location_accuracy_free (gps_acc);
- } else {
- *velocity = gps_vel;
- *accuracy = gps_acc;
- location_velocity_free (wps_vel);
- location_accuracy_free (wps_acc);
- }
- }
- else if (gps_vel) {
- *velocity = gps_vel;
- *accuracy = gps_acc;
- } else if (wps_vel) {
- *velocity = wps_vel;
- *accuracy = wps_acc;
- } else {
- *velocity = NULL;
- *accuracy = NULL;
- ret = LOCATION_ERROR_NOT_AVAILABLE;
- }
-
- return ret;
-}
-
-static int
-location_hybrid_get_satellite (LocationHybrid *self,
- LocationSatellite **satellite)
-{
- int ret = LOCATION_ERROR_NOT_AVAILABLE;
- LOCATION_LOGD("location_hybrid_get_satellite");
- if (!location_setting_get_int(VCONFKEY_LOCATION_ENABLED) && !location_setting_get_int(VCONFKEY_LOCATION_NETWORK_ENABLED)) {
- return LOCATION_ERROR_SETTING_OFF;
- }
-
- LocationHybridPrivate *priv = GET_PRIVATE (self);
- if (priv->sat) {
- *satellite = location_satellite_copy (priv->sat);
- ret = LOCATION_ERROR_NONE;
- }
-
- return ret;
-}
-
-static int
-location_hybrid_get_last_satellite (LocationHybrid *self,
- LocationSatellite **satellite)
-{
- LOCATION_LOGD("location_hybrid_get_last_satellite");
-
- int ret = LOCATION_ERROR_NONE;
- LocationHybridPrivate *priv = GET_PRIVATE (self);
-
- if (priv->gps) {
- ret = location_get_last_satellite (priv->gps, satellite);
- } else {
- *satellite = NULL;
- ret = LOCATION_ERROR_NOT_AVAILABLE;
- }
-
- return ret;
-}
-
-static int
-location_hybrid_set_option (LocationHybrid *self, const char *option)
-{
- LOCATION_LOGD("location_hybrid_set_option");
- LocationHybridPrivate *priv = GET_PRIVATE (self);
-
- int ret_gps = LOCATION_ERROR_NOT_AVAILABLE;
- int ret_wps = LOCATION_ERROR_NOT_AVAILABLE;
-
- if (priv->gps) ret_gps = location_set_option(priv->gps, option);
- if (priv->wps) ret_wps = location_set_option(priv->wps, option);
-
- if (ret_gps != LOCATION_ERROR_NONE && ret_wps != LOCATION_ERROR_NONE)
- return LOCATION_ERROR_NOT_AVAILABLE;
-
- return LOCATION_ERROR_NONE;
-}
-
-static void
-location_ielement_interface_init (LocationIElementInterface *iface)
-{
- iface->start = (TYPE_START_FUNC)location_hybrid_start;
- iface->stop = (TYPE_STOP_FUNC)location_hybrid_stop;
- iface->get_position = (TYPE_GET_POSITION)location_hybrid_get_position;
- iface->get_position_ext = (TYPE_GET_POSITION_EXT)location_hybrid_get_position_ext;
- iface->get_last_position = (TYPE_GET_POSITION)location_hybrid_get_last_position;
- iface->get_last_position_ext = (TYPE_GET_POSITION_EXT)location_hybrid_get_last_position_ext;
- iface->get_velocity = (TYPE_GET_VELOCITY)location_hybrid_get_velocity;
- iface->get_last_velocity = (TYPE_GET_VELOCITY)location_hybrid_get_last_velocity;
- iface->get_satellite = (TYPE_GET_SATELLITE)location_hybrid_get_satellite;
- iface->get_last_satellite = (TYPE_GET_SATELLITE)location_hybrid_get_last_satellite;
- iface->set_option = (TYPE_SET_OPTION)location_hybrid_set_option;
-}
-
-static void
-location_hybrid_init (LocationHybrid *self)
-{
- LOCATION_LOGD("location_hybrid_init");
- LocationHybridPrivate* priv = GET_PRIVATE(self);
-
- priv->pos_interval = LOCATION_UPDATE_INTERVAL_DEFAULT;
- priv->vel_interval = LOCATION_UPDATE_INTERVAL_DEFAULT;
- priv->sat_interval = LOCATION_UPDATE_INTERVAL_DEFAULT;
-
- priv->pos_updated_timestamp = 0;
- priv->vel_updated_timestamp = 0;
- priv->sat_updated_timestamp = 0;
-
- priv->gps_enabled = FALSE;
- priv->wps_enabled = FALSE;
-
- priv->gps = NULL;
- priv->wps = NULL;
-
- priv->set_noti = FALSE;
-
- priv->pos_timer = 0;
- priv->vel_timer = 0;
-
- if(location_is_supported_method(LOCATION_METHOD_GPS)) priv->gps = location_new (LOCATION_METHOD_GPS);
- if(location_is_supported_method(LOCATION_METHOD_WPS)) priv->wps = location_new (LOCATION_METHOD_WPS);
-
- if(priv->gps){
- g_signal_connect (priv->gps, "service-enabled", G_CALLBACK(hybrid_service_enabled), self);
- g_signal_connect (priv->gps, "service-disabled", G_CALLBACK(hybrid_service_disabled), self);
- g_signal_connect (priv->gps, "service-updated", G_CALLBACK(hybrid_service_updated), self);
- }
- if(priv->wps){
- g_signal_connect (priv->wps, "service-enabled", G_CALLBACK(hybrid_service_enabled), self);
- g_signal_connect (priv->wps, "service-disabled", G_CALLBACK(hybrid_service_disabled), self);
- g_signal_connect (priv->wps, "service-updated", G_CALLBACK(hybrid_service_updated), self);
- }
-
- hybrid_set_current_method (priv, LOCATION_TYPE_HYBRID);
- priv->enabled= FALSE;
-
- priv->pos = NULL;
- priv->vel = NULL;
- priv->acc = NULL;
- priv->sat = NULL;
-
- priv->boundary_list = NULL;
-}
-
-static void
-location_hybrid_class_init (LocationHybridClass *klass)
-{
- LOCATION_LOGD("location_hybrid_class_init");
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
- gobject_class->set_property = location_hybrid_set_property;
- gobject_class->get_property = location_hybrid_get_property;
-
- gobject_class->dispose = location_hybrid_dispose;
- gobject_class->finalize = location_hybrid_finalize;
-
- g_type_class_add_private (klass, sizeof (LocationHybridPrivate));
-
- signals[SERVICE_ENABLED] = g_signal_new ("service-enabled",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST |
- G_SIGNAL_NO_RECURSE,
- G_STRUCT_OFFSET (LocationHybridClass, enabled),
- NULL, NULL,
- location_VOID__UINT,
- G_TYPE_NONE, 1,
- G_TYPE_UINT);
-
- signals[SERVICE_DISABLED] = g_signal_new ("service-disabled",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST |
- G_SIGNAL_NO_RECURSE,
- G_STRUCT_OFFSET (LocationHybridClass, disabled),
- NULL, NULL,
- location_VOID__UINT,
- G_TYPE_NONE, 1,
- G_TYPE_UINT);
-
- signals[SERVICE_UPDATED] = g_signal_new ("service-updated",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST |
- G_SIGNAL_NO_RECURSE,
- G_STRUCT_OFFSET (LocationHybridClass, updated),
- NULL, NULL,
- location_VOID__UINT_POINTER_POINTER,
- G_TYPE_NONE, 3,
- G_TYPE_UINT,
- G_TYPE_POINTER,
- G_TYPE_POINTER);
-
- signals[ZONE_IN] = g_signal_new ("zone-in",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST |
- G_SIGNAL_NO_RECURSE,
- G_STRUCT_OFFSET (LocationHybridClass, zone_in),
- NULL, NULL,
- location_VOID__POINTER_POINTER_POINTER,
- G_TYPE_NONE, 3,
- G_TYPE_POINTER,
- G_TYPE_POINTER,
- G_TYPE_POINTER);
-
- signals[ZONE_OUT] = g_signal_new ("zone-out",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST |
- G_SIGNAL_NO_RECURSE,
- G_STRUCT_OFFSET (LocationHybridClass, zone_out),
- NULL, NULL,
- location_VOID__POINTER_POINTER_POINTER,
- G_TYPE_NONE, 3,
- G_TYPE_POINTER,
- G_TYPE_POINTER,
- G_TYPE_POINTER);
-
- properties[PROP_METHOD_TYPE] = g_param_spec_int ("method",
- "method type",
- "location method type name",
- LOCATION_METHOD_HYBRID,
- LOCATION_METHOD_HYBRID,
- LOCATION_METHOD_HYBRID,
- G_PARAM_READABLE);
-
- properties[PROP_LAST_POSITION] = g_param_spec_boxed ("last-position",
- "hybrid last position prop",
- "hybrid last position data",
- LOCATION_TYPE_POSITION,
- G_PARAM_READABLE);
-
- properties[PROP_POS_INTERVAL] = g_param_spec_uint ("pos-interval",
- "position interval prop",
- "position interval data",
- LOCATION_UPDATE_INTERVAL_MIN,
- LOCATION_UPDATE_INTERVAL_MAX,
- LOCATION_UPDATE_INTERVAL_DEFAULT,
- G_PARAM_READWRITE);
- properties[PROP_VEL_INTERVAL] = g_param_spec_uint ("vel-interval",
- "velocity interval prop",
- "velocity interval data",
- LOCATION_UPDATE_INTERVAL_MIN,
- LOCATION_UPDATE_INTERVAL_MAX,
- LOCATION_UPDATE_INTERVAL_DEFAULT,
- G_PARAM_READWRITE);
- properties[PROP_SAT_INTERVAL] = g_param_spec_uint ("sat-interval",
- "satellite interval prop",
- "satellite interval data",
- LOCATION_UPDATE_INTERVAL_MIN,
- LOCATION_UPDATE_INTERVAL_MAX,
- LOCATION_UPDATE_INTERVAL_DEFAULT,
- G_PARAM_READWRITE);
-
- properties[PROP_BOUNDARY] = g_param_spec_pointer ("boundary",
- "hybrid boundary prop",
- "hybrid boundary data",
- G_PARAM_READWRITE);
-
- properties[PROP_REMOVAL_BOUNDARY] = g_param_spec_boxed("removal-boundary",
- "hybrid removal boundary prop",
- "hybrid removal boundary data",
- LOCATION_TYPE_BOUNDARY,
- G_PARAM_READWRITE);
-
- g_object_class_install_properties (gobject_class,
- PROP_MAX,
- properties);
-}
* Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
+ * Genie Kim <daejins.kim@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* limitations under the License.
*/
-#ifndef __LOCATION_HYBRID_H__
-#define __LOCATION_HYBRID_H__
+#ifndef __LOCATION_HYBRID_MOBILE_H__
+#define __LOCATION_HYBRID_MOBILE_H__
#include <glib-object.h>
/**
- * @file location-hybrid.h
+ * @file location-hybrid-mobile.h
* @brief This file contains the internal definitions and structures related to Hybrid method.
*/
G_BEGIN_DECLS
-typedef struct _LocationHybrid LocationHybrid;
-typedef struct _LocationHybridClass LocationHybridClass;
+typedef struct _LocationHybrid LocationHybrid;
+typedef struct _LocationHybridClass LocationHybridClass;
-#define LOCATION_TYPE_HYBRID (location_hybrid_get_type ())
-#define LOCATION_HYBRID(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LOCATION_TYPE_HYBRID, LocationHybrid))
-#define LOCATION_IS_HYBRID(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LOCATION_TYPE_HYBRID))
-#define LOCATION_HYBRID_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), LOCATION_TYPE_HYBRID, LocationHybridClass))
-#define LOCATION_IS_HYBRID_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LOCATION_TYPE_HYBRID))
-#define LOCATION_HYBRID_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), LOCATION_TYPE_HYBRID, LocationHybridClass))
+#define LOCATION_TYPE_HYBRID (location_hybrid_get_type ())
+#define LOCATION_HYBRID(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LOCATION_TYPE_HYBRID, LocationHybrid))
+#define LOCATION_IS_HYBRID(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LOCATION_TYPE_HYBRID))
+#define LOCATION_HYBRID_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), LOCATION_TYPE_HYBRID, LocationHybridClass))
+#define LOCATION_IS_HYBRID_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LOCATION_TYPE_HYBRID))
+#define LOCATION_HYBRID_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), LOCATION_TYPE_HYBRID, LocationHybridClass))
-struct _LocationHybrid
-{
+struct _LocationHybrid {
GObject parent_instance;
};
-struct _LocationHybridClass
-{
+struct _LocationHybridClass {
GObjectClass parent_class;
- void (* enabled) (guint type);
- void (* disabled) (guint type);
- void (* updated) (guint type, gpointer data, gpointer accuracy);
- void (* zone_in) (gpointer boundary, gpointer position, gpointer accuracy);
- void (* zone_out) (gpointer boundary, gpointer position, gpointer accuracy);
+ void (* enabled)(guint type);
+ void (* disabled)(guint type);
+ void (* updated)(gint type, gpointer data, gpointer velocity, gpointer accuracy);
+ void (* location_updated)(gint error, gpointer position, gpointer velocity, gpointer accuracy);
+ void (* zone_in)(gpointer boundary, gpointer position, gpointer accuracy);
+ void (* zone_out)(gpointer boundary, gpointer position, gpointer accuracy);
};
-GType location_hybrid_get_type (void);
+GType location_hybrid_get_type(void);
#define HYBRID_POSITION_EXPIRATION_TIME 9
#include "location-ielement.h"
static void
-location_ielement_base_init (gpointer g_class)
+location_ielement_base_init(gpointer g_class)
{
static gboolean is_initialized = FALSE;
- if (is_initialized){
+ if (is_initialized) {
/* add properties and signals to the interface here */
is_initialized = TRUE;
}
GType
-location_ielement_get_type (void)
+location_ielement_get_type(void)
{
static GType iface_type = 0;
if (iface_type == 0) {
static const GTypeInfo info = {
- sizeof (LocationIElementInterface),
+ sizeof(LocationIElementInterface),
location_ielement_base_init, /* base_init */
NULL /* base_finalize */
};
- iface_type = g_type_register_static (G_TYPE_INTERFACE, "LocationIElement",
- &info, 0);
+ iface_type = g_type_register_static(G_TYPE_INTERFACE, "LocationIElement", &info, 0);
}
return iface_type;
}
int
-location_ielement_start (LocationIElement *self)
+location_ielement_start(LocationIElement *self)
{
- g_return_val_if_fail (LOCATION_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->start, LOCATION_ERROR_NOT_AVAILABLE);
- return LOCATION_IELEMENT_GET_INTERFACE (self)->start (self);
+ g_return_val_if_fail(LOCATION_IS_IELEMENT(self), LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(LOCATION_IELEMENT_GET_INTERFACE(self), LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(LOCATION_IELEMENT_GET_INTERFACE(self)->start, LOCATION_ERROR_NOT_AVAILABLE);
+ return LOCATION_IELEMENT_GET_INTERFACE(self)->start(self);
}
int
-location_ielement_stop (LocationIElement *self)
+location_ielement_stop(LocationIElement *self)
{
- g_return_val_if_fail (LOCATION_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->stop, LOCATION_ERROR_NOT_AVAILABLE);
- return LOCATION_IELEMENT_GET_INTERFACE (self)->stop (self);
+ g_return_val_if_fail(LOCATION_IS_IELEMENT(self), LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(LOCATION_IELEMENT_GET_INTERFACE(self), LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(LOCATION_IELEMENT_GET_INTERFACE(self)->stop, LOCATION_ERROR_NOT_AVAILABLE);
+ return LOCATION_IELEMENT_GET_INTERFACE(self)->stop(self);
}
int
-location_ielement_get_position (LocationIElement *self,
- LocationPosition **position,
- LocationAccuracy **accuracy)
+location_ielement_start_batch(LocationIElement *self)
{
- g_return_val_if_fail (LOCATION_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (position, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (accuracy, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->get_position, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(LOCATION_IS_IELEMENT(self), LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(LOCATION_IELEMENT_GET_INTERFACE(self), LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(LOCATION_IELEMENT_GET_INTERFACE(self)->start_batch, LOCATION_ERROR_NOT_AVAILABLE);
+ return LOCATION_IELEMENT_GET_INTERFACE(self)->start_batch(self);
+}
- return LOCATION_IELEMENT_GET_INTERFACE (self)->get_position (self, position, accuracy);
+int
+location_ielement_stop_batch(LocationIElement *self)
+{
+ g_return_val_if_fail(LOCATION_IS_IELEMENT(self), LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(LOCATION_IELEMENT_GET_INTERFACE(self), LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(LOCATION_IELEMENT_GET_INTERFACE(self)->stop_batch, LOCATION_ERROR_NOT_AVAILABLE);
+ return LOCATION_IELEMENT_GET_INTERFACE(self)->stop_batch(self);
}
int
-location_ielement_get_position_ext (LocationIElement *self,
- LocationPosition **position,
- LocationVelocity **velocity,
- LocationAccuracy **accuracy)
+location_ielement_request_single_location(LocationIElement *self, int timeout)
{
- g_return_val_if_fail (LOCATION_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (position, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (velocity, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (accuracy, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->get_position_ext, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(LOCATION_IS_IELEMENT(self), LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(LOCATION_IELEMENT_GET_INTERFACE(self), LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(LOCATION_IELEMENT_GET_INTERFACE(self)->request_single_location, LOCATION_ERROR_NOT_AVAILABLE);
- return LOCATION_IELEMENT_GET_INTERFACE (self)->get_position_ext (self, position, velocity, accuracy);
+ return LOCATION_IELEMENT_GET_INTERFACE(self)->request_single_location(self, timeout);
}
-
int
-location_ielement_get_last_position (LocationIElement *self,
- LocationPosition **position,
- LocationAccuracy **accuracy)
+location_ielement_get_position(LocationIElement *self,
+ LocationPosition **position,
+ LocationAccuracy **accuracy)
{
- g_return_val_if_fail (LOCATION_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (position, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (accuracy, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->get_last_position, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(LOCATION_IS_IELEMENT(self), LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(position, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(accuracy, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(LOCATION_IELEMENT_GET_INTERFACE(self), LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(LOCATION_IELEMENT_GET_INTERFACE(self)->get_position, LOCATION_ERROR_NOT_AVAILABLE);
+
+ return LOCATION_IELEMENT_GET_INTERFACE(self)->get_position(self, position, accuracy);
+}
- return LOCATION_IELEMENT_GET_INTERFACE (self)->get_last_position (self, position, accuracy);
+int
+location_ielement_get_position_ext(LocationIElement *self,
+ LocationPosition **position,
+ LocationVelocity **velocity,
+ LocationAccuracy **accuracy)
+{
+ g_return_val_if_fail(LOCATION_IS_IELEMENT(self), LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(position, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(velocity, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(accuracy, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(LOCATION_IELEMENT_GET_INTERFACE(self), LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(LOCATION_IELEMENT_GET_INTERFACE(self)->get_position_ext, LOCATION_ERROR_NOT_AVAILABLE);
+
+ return LOCATION_IELEMENT_GET_INTERFACE(self)->get_position_ext(self, position, velocity, accuracy);
}
+
int
-location_ielement_get_last_position_ext (LocationIElement *self,
- LocationPosition **position,
- LocationVelocity **velocity,
- LocationAccuracy **accuracy)
+location_ielement_get_last_position(LocationIElement *self,
+ LocationPosition **position,
+ LocationAccuracy **accuracy)
{
- g_return_val_if_fail (LOCATION_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (position, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (velocity, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (accuracy, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->get_last_position_ext, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(LOCATION_IS_IELEMENT(self), LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(position, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(accuracy, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(LOCATION_IELEMENT_GET_INTERFACE(self), LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(LOCATION_IELEMENT_GET_INTERFACE(self)->get_last_position, LOCATION_ERROR_NOT_AVAILABLE);
- return LOCATION_IELEMENT_GET_INTERFACE (self)->get_last_position_ext (self, position, velocity, accuracy);
+ return LOCATION_IELEMENT_GET_INTERFACE(self)->get_last_position(self, position, accuracy);
+}
+
+int
+location_ielement_get_last_position_ext(LocationIElement *self,
+ LocationPosition **position,
+ LocationVelocity **velocity,
+ LocationAccuracy **accuracy)
+{
+ g_return_val_if_fail(LOCATION_IS_IELEMENT(self), LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(position, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(velocity, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(accuracy, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(LOCATION_IELEMENT_GET_INTERFACE(self), LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(LOCATION_IELEMENT_GET_INTERFACE(self)->get_last_position_ext, LOCATION_ERROR_NOT_AVAILABLE);
+
+ return LOCATION_IELEMENT_GET_INTERFACE(self)->get_last_position_ext(self, position, velocity, accuracy);
}
int
-location_ielement_get_satellite (LocationIElement *self,
- LocationSatellite **satellite)
+location_ielement_get_batch(LocationIElement *self, LocationBatch **batch)
{
- g_return_val_if_fail (LOCATION_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (satellite, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->get_satellite, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(LOCATION_IS_IELEMENT(self), LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(batch, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(LOCATION_IELEMENT_GET_INTERFACE(self), LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(LOCATION_IELEMENT_GET_INTERFACE(self)->get_batch, LOCATION_ERROR_NOT_AVAILABLE);
- return LOCATION_IELEMENT_GET_INTERFACE (self)->get_satellite (self, satellite);
+ return LOCATION_IELEMENT_GET_INTERFACE(self)->get_batch(self, batch);
}
int
-location_ielement_get_last_satellite (LocationIElement *self,
- LocationSatellite **satellite)
+location_ielement_get_satellite(LocationIElement *self,
+ LocationSatellite **satellite)
{
- g_return_val_if_fail (LOCATION_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (satellite, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->get_last_satellite, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(LOCATION_IS_IELEMENT(self), LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(satellite, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(LOCATION_IELEMENT_GET_INTERFACE(self), LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(LOCATION_IELEMENT_GET_INTERFACE(self)->get_satellite, LOCATION_ERROR_NOT_AVAILABLE);
- return LOCATION_IELEMENT_GET_INTERFACE (self)->get_last_satellite (self, satellite);
+ return LOCATION_IELEMENT_GET_INTERFACE(self)->get_satellite(self, satellite);
}
+int
+location_ielement_get_last_satellite(LocationIElement *self,
+ LocationSatellite **satellite)
+{
+ g_return_val_if_fail(LOCATION_IS_IELEMENT(self), LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(satellite, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(LOCATION_IELEMENT_GET_INTERFACE(self), LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(LOCATION_IELEMENT_GET_INTERFACE(self)->get_last_satellite, LOCATION_ERROR_NOT_AVAILABLE);
+
+ return LOCATION_IELEMENT_GET_INTERFACE(self)->get_last_satellite(self, satellite);
+}
int
-location_ielement_get_velocity (LocationIElement *self,
- LocationVelocity **velocity,
- LocationAccuracy **accuracy)
+location_ielement_get_velocity(LocationIElement *self,
+ LocationVelocity **velocity,
+ LocationAccuracy **accuracy)
{
- g_return_val_if_fail (LOCATION_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (velocity, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->get_velocity, LOCATION_ERROR_NOT_AVAILABLE);
- return LOCATION_IELEMENT_GET_INTERFACE (self)->get_velocity (self, velocity, accuracy);
+ g_return_val_if_fail(LOCATION_IS_IELEMENT(self), LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(velocity, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(LOCATION_IELEMENT_GET_INTERFACE(self), LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(LOCATION_IELEMENT_GET_INTERFACE(self)->get_velocity, LOCATION_ERROR_NOT_AVAILABLE);
+ return LOCATION_IELEMENT_GET_INTERFACE(self)->get_velocity(self, velocity, accuracy);
}
int
-location_ielement_get_last_velocity (LocationIElement *self,
- LocationVelocity **velocity,
- LocationAccuracy **accuracy)
+location_ielement_get_last_velocity(LocationIElement *self,
+ LocationVelocity **velocity,
+ LocationAccuracy **accuracy)
{
- g_return_val_if_fail (LOCATION_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (velocity, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->get_last_velocity, LOCATION_ERROR_NOT_AVAILABLE);
- return LOCATION_IELEMENT_GET_INTERFACE (self)->get_last_velocity (self, velocity, accuracy);
+ g_return_val_if_fail(LOCATION_IS_IELEMENT(self), LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(velocity, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(LOCATION_IELEMENT_GET_INTERFACE(self), LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(LOCATION_IELEMENT_GET_INTERFACE(self)->get_last_velocity, LOCATION_ERROR_NOT_AVAILABLE);
+ return LOCATION_IELEMENT_GET_INTERFACE(self)->get_last_velocity(self, velocity, accuracy);
}
int
-location_ielement_set_option (LocationIElement *self, const char *option)
+location_ielement_set_option(LocationIElement *self, const char *option)
{
- g_return_val_if_fail (LOCATION_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
- return LOCATION_IELEMENT_GET_INTERFACE (self)->set_option (self, option);
-}
\ No newline at end of file
+ g_return_val_if_fail(LOCATION_IS_IELEMENT(self), LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(LOCATION_IELEMENT_GET_INTERFACE(self), LOCATION_ERROR_NOT_AVAILABLE);
+ return LOCATION_IELEMENT_GET_INTERFACE(self)->set_option(self, option);
+}
+
+int
+location_ielement_get_nmea(LocationIElement *self,
+ char **nmea)
+{
+ g_return_val_if_fail(LOCATION_IS_IELEMENT(self), LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(nmea, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(LOCATION_IELEMENT_GET_INTERFACE(self), LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(LOCATION_IELEMENT_GET_INTERFACE(self)->get_nmea, LOCATION_ERROR_NOT_AVAILABLE);
+
+ return LOCATION_IELEMENT_GET_INTERFACE(self)->get_nmea(self, nmea);
+}
#include <glib-object.h>
#include <location-types.h>
#include <location-position.h>
+#include <location-batch.h>
#include <location-velocity.h>
#include <location-accuracy.h>
-#include <location-address.h>
#include <location-boundary.h>
#include <location-satellite.h>
G_BEGIN_DECLS
-enum {
- SERVICE_ENABLED,
- SERVICE_DISABLED,
- SERVICE_UPDATED,
- ZONE_IN,
- ZONE_OUT,
- LAST_SIGNAL
-};
+typedef struct _LocationIElement LocationIElement;
+typedef struct _LocationIElementInterface LocationIElementInterface;
-#define LOCATION_TYPE_IELEMENT (location_ielement_get_type ())
-#define LOCATION_IELEMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LOCATION_TYPE_IELEMENT, LocationIElement))
-#define LOCATION_IS_IELEMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LOCATION_TYPE_IELEMENT))
-#define LOCATION_IELEMENT_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), LOCATION_TYPE_IELEMENT, LocationIElementInterface))
+#define LOCATION_TYPE_IELEMENT (location_ielement_get_type ())
+#define LOCATION_IELEMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LOCATION_TYPE_IELEMENT, LocationIElement))
+#define LOCATION_IS_IELEMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LOCATION_TYPE_IELEMENT))
+#define LOCATION_IELEMENT_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), LOCATION_TYPE_IELEMENT, LocationIElementInterface))
-typedef struct _LocationIElement LocationIElement;
-typedef struct _LocationIElementInterface LocationIElementInterface;
+enum {
+ SERVICE_ENABLED,
+ SERVICE_DISABLED,
+ SERVICE_UPDATED,
+ ZONE_IN,
+ ZONE_OUT,
+ LOCATION_UPDATED,
+ BATCH_UPDATED,
+ LAST_SIGNAL,
+};
typedef int (*TYPE_START_FUNC)(LocationIElement *self);
-typedef int (*TYPE_STOP_FUNC) (LocationIElement *self);
+typedef int (*TYPE_STOP_FUNC)(LocationIElement *self);
typedef int (*TYPE_GET_POSITION)(LocationIElement *self, LocationPosition **position, LocationAccuracy **accuracy);
typedef int (*TYPE_GET_POSITION_EXT)(LocationIElement *self, LocationPosition **position, LocationVelocity **velocity, LocationAccuracy **accuracy);
typedef int (*TYPE_GET_VELOCITY)(LocationIElement *self, LocationVelocity **velocity, LocationAccuracy **accuracy);
typedef int (*TYPE_GET_SATELLITE)(LocationIElement *self, LocationSatellite **satellite);
typedef int (*TYPE_SET_OPTION)(LocationIElement *self, const char *option);
+typedef int (*TYPE_REQUEST_SINGLE_LOCATION)(LocationIElement *self, int timeout);
+typedef int (*TYPE_GET_BATCH)(LocationIElement *self, LocationBatch **batch);
+typedef int (*TYPE_START_BATCH)(LocationIElement *self);
+typedef int (*TYPE_STOP_BATCH)(LocationIElement *self);
+typedef int (*TYPE_GET_NMEA)(LocationIElement *self, char **nmea);
+
-struct _LocationIElementInterface
-{
+struct _LocationIElementInterface {
GTypeInterface parent_iface;
TYPE_START_FUNC start;
TYPE_GET_SATELLITE get_satellite;
TYPE_GET_SATELLITE get_last_satellite;
TYPE_SET_OPTION set_option;
+ TYPE_REQUEST_SINGLE_LOCATION request_single_location;
+ TYPE_GET_BATCH get_batch;
+ TYPE_START_BATCH start_batch;
+ TYPE_STOP_BATCH stop_batch;
+ TYPE_GET_NMEA get_nmea;
};
-GType location_ielement_get_type (void);
+GType location_ielement_get_type(void);
-int location_ielement_start (LocationIElement *self);
+int location_ielement_start(LocationIElement *self);
int location_ielement_stop(LocationIElement *self);
-int location_ielement_get_position (LocationIElement *self, LocationPosition **position, LocationAccuracy **accuracy);
-int location_ielement_get_last_position (LocationIElement *self, LocationPosition **position, LocationAccuracy **accuracy);
-int location_ielement_get_velocity (LocationIElement *self, LocationVelocity **velocity, LocationAccuracy **accuracy);
-int location_ielement_get_last_velocity (LocationIElement *self, LocationVelocity **velocity, LocationAccuracy **accuracy);
-int location_ielement_get_satellite (LocationIElement *self, LocationSatellite **satellite);
-int location_ielement_get_last_satellite (LocationIElement *self, LocationSatellite **satellite);
-int location_ielement_set_option (LocationIElement *self, const char *option);
+int location_ielement_get_position(LocationIElement *self, LocationPosition **position, LocationAccuracy **accuracy);
+int location_ielement_get_position_ext(LocationIElement *self, LocationPosition **position, LocationVelocity **velocity, LocationAccuracy **accuracy);
+int location_ielement_get_last_position(LocationIElement *self, LocationPosition **position, LocationAccuracy **accuracy);
+int location_ielement_get_last_position_ext(LocationIElement *self, LocationPosition **position, LocationVelocity **velocity, LocationAccuracy **accuracy);
+int location_ielement_get_velocity(LocationIElement *self, LocationVelocity **velocity, LocationAccuracy **accuracy);
+int location_ielement_get_last_velocity(LocationIElement *self, LocationVelocity **velocity, LocationAccuracy **accuracy);
+int location_ielement_get_satellite(LocationIElement *self, LocationSatellite **satellite);
+int location_ielement_get_last_satellite(LocationIElement *self, LocationSatellite **satellite);
+int location_ielement_set_option(LocationIElement *self, const char *option);
+int location_ielement_request_single_location(LocationIElement *self, int timeout);
+int location_ielement_get_batch(LocationIElement *self, LocationBatch **batch);
+int location_ielement_start_batch(LocationIElement *self);
+int location_ielement_stop_batch(LocationIElement *self);
+int location_ielement_get_nmea(LocationIElement *self, char **nmea);
+
G_END_DECLS
VOID:POINTER,POINTER,POINTER
VOID:UINT,POINTER,POINTER
+VOID:INT,POINTER,POINTER,POINTER
VOID:UINT
#define DEG2RAD(x) ((x) * M_PI / 180)
GType
-location_position_get_type (void)
+location_position_get_type(void)
{
static volatile gsize type_volatile = 0;
- if(g_once_init_enter(&type_volatile)) {
- GType type = g_boxed_type_register_static (
- g_intern_static_string ("LocationPosition"),
- (GBoxedCopyFunc) location_position_copy,
- (GBoxedFreeFunc) location_position_free);
+ if (g_once_init_enter(&type_volatile)) {
+ GType type = g_boxed_type_register_static(
+ g_intern_static_string("LocationPosition"),
+ (GBoxedCopyFunc) location_position_copy,
+ (GBoxedFreeFunc) location_position_free);
g_once_init_leave(&type_volatile, type);
}
return type_volatile;
}
EXPORT_API LocationPosition *
-location_position_new (guint timestamp,
- gdouble latitude,
- gdouble longitude,
- gdouble altitude,
- LocationStatus status)
+location_position_new(guint timestamp,
+ gdouble latitude,
+ gdouble longitude,
+ gdouble altitude,
+ LocationStatus status)
{
if (latitude < -90 || latitude > 90) return NULL;
if (longitude < -180 || longitude > 180) return NULL;
- LocationPosition* position = g_slice_new0(LocationPosition);
+ LocationPosition *position = g_slice_new0(LocationPosition);
+ g_return_val_if_fail(position, NULL);
+
position->timestamp = timestamp;
position->latitude = latitude;
position->longitude = longitude;
}
EXPORT_API void
-location_position_free (LocationPosition* position)
+location_position_free(LocationPosition *position)
{
g_return_if_fail(position);
g_slice_free(LocationPosition, position);
}
EXPORT_API gboolean
-location_position_equal (const LocationPosition *position1, const LocationPosition *position2)
+location_position_equal(const LocationPosition *position1, const LocationPosition *position2)
{
g_return_val_if_fail(position1, FALSE);
g_return_val_if_fail(position2, FALSE);
if (position1->latitude == position2->latitude &&
- position1->longitude == position2->longitude &&
- position1->altitude == position2->altitude)
+ position1->longitude == position2->longitude &&
+ position1->altitude == position2->altitude)
return TRUE;
return FALSE;
}
-EXPORT_API LocationPosition*
-location_position_copy (const LocationPosition *position)
+EXPORT_API LocationPosition *
+location_position_copy(const LocationPosition *position)
{
g_return_val_if_fail(position, NULL);
LocationPosition *new_position = NULL;
- new_position = location_position_new (position->timestamp,
- position->latitude,
- position->longitude,
- position->altitude,
- position->status);
+ new_position = location_position_new(position->timestamp,
+ position->latitude,
+ position->longitude,
+ position->altitude,
+ position->status);
return new_position;
*distance = 0;
- const double a = 6378137.0, b = 6356752.314245, f = 1/298.257223563;
- double delta_lon = DEG2RAD(pos2->longitude-pos1->longitude);
- double u_1 = atan((1-f) * tan(DEG2RAD(pos1->latitude)));
- double u_2 = atan((1-f) * tan(DEG2RAD(pos2->latitude)));
+ const double a = 6378137.0, b = 6356752.314245, f = 1 / 298.257223563;
+ double delta_lon = DEG2RAD(pos2->longitude - pos1->longitude);
+ double u_1 = atan((1 - f) * tan(DEG2RAD(pos1->latitude)));
+ double u_2 = atan((1 - f) * tan(DEG2RAD(pos2->latitude)));
double lambdaP, iter_limit = 100.0;
double lambda = delta_lon;
- double sin_sigma, sin_alpha, cos_sigma, sigma, sq_cos_alpha, cos_2sigma, C;
+ double sin_sigma, sin_alpha, cos_sigma, sigma, sq_cos_alpha, cos_2sigma, C;
double sq_u, cal1, cal2, delta_sigma, cal_dist;
double sin_lambda, cos_lambda;
sin_lambda = sin(lambda);
cos_lambda = cos(lambda);
- sin_sigma = sqrt((cos_u2*sin_lambda)*(cos_u2*sin_lambda) + \
- (cos_u1*sin_u2-sin_u1*cos_u2*cos_lambda) * \
- (cos_u1*sin_u2-sin_u1*cos_u2*cos_lambda));
+ sin_sigma = sqrt((cos_u2 * sin_lambda) * (cos_u2 * sin_lambda) + \
+ (cos_u1 * sin_u2 - sin_u1 * cos_u2 * cos_lambda) * \
+ (cos_u1 * sin_u2 - sin_u1 * cos_u2 * cos_lambda));
- if (sin_sigma ==0)
- return LOCATION_ERROR_NONE; // co-incident points
+ if (sin_sigma == 0)
+ return LOCATION_ERROR_NONE; /* co-incident points */
- cos_sigma = sin_u1*sin_u2 + cos_u1*cos_u2*cos_lambda;
+ cos_sigma = sin_u1 * sin_u2 + cos_u1 * cos_u2 * cos_lambda;
sigma = atan2(sin_sigma, cos_sigma);
sin_alpha = cos_u1 * cos_u2 * sin_lambda / sin_sigma;
- sq_cos_alpha = 1.0 - sin_alpha*sin_alpha;
- cos_2sigma = cos_sigma - 2.0*sin_u1*sin_u2/sq_cos_alpha;
+ sq_cos_alpha = 1.0 - sin_alpha * sin_alpha;
+ cos_2sigma = cos_sigma - 2.0 * sin_u1 * sin_u2 / sq_cos_alpha;
if (isnan(cos_2sigma))
cos_2sigma = 0;
- C = f/16.0*sq_cos_alpha*(4.0+f*(4.0-3.0*sq_cos_alpha));
+ C = f / 16.0 * sq_cos_alpha * (4.0 + f * (4.0 - 3.0 * sq_cos_alpha));
lambdaP = lambda;
- lambda = delta_lon + (1.0-C) * f * sin_alpha * \
- (sigma + C*sin_sigma*(cos_2sigma+C*cos_sigma*(-1.0+2.0*cos_2sigma*cos_2sigma)));
+ lambda = delta_lon + (1.0 - C) * f * sin_alpha * \
+ (sigma + C * sin_sigma * (cos_2sigma + C * cos_sigma * (-1.0 + 2.0 * cos_2sigma * cos_2sigma)));
- } while (abs(lambda-lambdaP) > 1e-12 && --iter_limit>0);
+ } while (abs(lambda - lambdaP) > 1e-12 && --iter_limit > 0);
- if (iter_limit==0) return LOCATION_ERROR_UNKNOWN;
+ if (iter_limit == 0) return LOCATION_ERROR_UNKNOWN;
- sq_u = sq_cos_alpha * (a*a - b*b) / (b*b);
+ sq_u = sq_cos_alpha * (a * a - b * b) / (b * b);
- cal1 = 1.0 + sq_u/16384.0*(4096.0+sq_u*(-768.0+sq_u*(320.0-175.0*sq_u)));
- cal2 = sq_u/1024.0 * (256.0+sq_u*(-128.0+sq_u*(74.0-47.0*sq_u)));
+ cal1 = 1.0 + sq_u / 16384.0 * (4096.0 + sq_u * (-768.0 + sq_u * (320.0 - 175.0 * sq_u)));
+ cal2 = sq_u / 1024.0 * (256.0 + sq_u * (-128.0 + sq_u * (74.0 - 47.0 * sq_u)));
- delta_sigma = cal2*sin_sigma*(cos_2sigma+cal2/4.0*(cos_sigma*(-1.0+2.0*cos_2sigma*cos_2sigma)- \
- cal2/6.0*cos_2sigma*(-3.0+4.0*sin_sigma*sin_sigma)*(-3.0+4.0*cos_2sigma*cos_2sigma)));
- cal_dist = b*cal1*(sigma-delta_sigma);
+ delta_sigma = cal2 * sin_sigma * (cos_2sigma + cal2 / 4.0 * (cos_sigma * (-1.0 + 2.0 * cos_2sigma * cos_2sigma) - \
+ cal2 / 6.0 * cos_2sigma * (-3.0 + 4.0 * sin_sigma * sin_sigma) * (-3.0 + 4.0 * cos_2sigma * cos_2sigma)));
+ cal_dist = b * cal1 * (sigma - delta_sigma);
*distance = (gulong) cal_dist;
* Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
+ * Genie Kim <daejins.kim@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <location-types.h>
-#define MAX_KEY_LENGTH 16
-#define HALF_KEY_LENGTH 8
+#define MAX_KEY_LENGTH 16
+#define HALF_KEY_LENGTH 8
G_BEGIN_DECLS
-GType location_position_get_type (void);
+GType location_position_get_type(void);
#define LOCATION_TYPE_POSITION (location_position_get_type ())
/**
/**
* @brief This represents the various fix states.
*/
-typedef enum
-{
- LOCATION_STATUS_NO_FIX = 0, ///< No fix status.
- LOCATION_STATUS_2D_FIX, ///< 2D fix status (latitude/longitude/speed/direction).
- LOCATION_STATUS_3D_FIX ///< 3D fix status (altitude/climb as well).
+typedef enum {
+ LOCATION_STATUS_NO_FIX = 0, /*/< No fix status. */
+ LOCATION_STATUS_2D_FIX, /*/< 2D fix status (latitude/longitude/speed/direction). */
+ LOCATION_STATUS_3D_FIX /*/< 3D fix status (altitude/climb as well). */
} LocationStatus;
/**
* @brief This represents position information such as latitude-longitude-altitude values and timestamp.
*/
-struct _LocationPosition
-{
- guint timestamp; ///< Time stamp.
- gdouble latitude; ///< Latitude data.
- gdouble longitude; ///< Longitude data.
- gdouble altitude; ///< Altitude data.
- LocationStatus status; ///< Fix states.
+struct _LocationPosition {
+ guint timestamp; /*/< Time stamp. */
+ gdouble latitude; /*/< Latitude data. */
+ gdouble longitude; /*/< Longitude data. */
+ gdouble altitude; /*/< Altitude data. */
+ LocationStatus status; /*/< Fix states. */
};
/**
* @brief This represents last known position information such as latitude-longitude values and accuracy.
*/
-struct _LocationLastPosition
-{
- LocationMethod method; ///< Location Method.
- guint timestamp; ///< Time stamp.
- gdouble latitude; ///< Latitude data.
- gdouble longitude; ///< Longitude data.
- gdouble altitude; ///< Altitude data.
- gdouble horizontal_accuracy; ///< Horizontal accuracy data.
- gdouble vertical_accuracy; ///< Vertical accuracy data.
+struct _LocationLastPosition {
+ LocationMethod method; /*/< Location Method. */
+ guint timestamp; /*/< Time stamp. */
+ gdouble latitude; /*/< Latitude data. */
+ gdouble longitude; /*/< Longitude data. */
+ gdouble altitude; /*/< Altitude data. */
+ gdouble horizontal_accuracy; /*/< Horizontal accuracy data. */
+ gdouble vertical_accuracy; /*/< Vertical accuracy data. */
};
/**
* @brief Create a new #LocationPosition with given information.
* @remarks None.
- * @pre #location_init should be called before.\n
- * @post None.
+ * @pre #location_init should be called before.\n
+ * @post None.
* @param [in] timestamp - Time stamp.
* @param [in] latitude - Latitude data.
* @param [in] longitude - Longitude data.
* @return a new #LocationPosition
* @retval NULL if error occured
*/
-LocationPosition *location_position_new (guint timestamp, gdouble latitude, gdouble longitude, gdouble altitude, LocationStatus status);
+LocationPosition *location_position_new(guint timestamp, gdouble latitude, gdouble longitude, gdouble altitude, LocationStatus status);
/**
* @brief Free a #LocationPosition.
* @remarks None.
- * @pre #location_init should be called before.\n
- * @post None.
+ * @pre #location_init should be called before.\n
+ * @post None.
* @param [in] position - a #LocationPosition.
* @return None.
*/
-void location_position_free (LocationPosition *position);
+void location_position_free(LocationPosition *position);
/**
* @brief Compares two positions for equality, returning TRUE if they are equal.
* @remarks None.
- * @pre #location_init should be called before.\n
- * @post None.
+ * @pre #location_init should be called before.\n
+ * @post None.
* @param [in] position1 - a #LocationPosition
* @param [in] position2 - a #LocationPosition
* @return gboolean
* TRUE - if equal\n
* FALSE - if not equal\n
*/
-gboolean location_position_equal (const LocationPosition *position1, const LocationPosition *position2);
+gboolean location_position_equal(const LocationPosition *position1, const LocationPosition *position2);
/**
* @brief Makes a copy of #LocationPosition
* @remarks None.
- * @pre #location_init should be called before.\n
- * @post None.
+ * @pre #location_init should be called before.\n
+ * @post None.
* @param [in] position - a #LocationPosition
* @return a new #LocationPosition
* @retval NULL if error occured
*/
-LocationPosition *location_position_copy (const LocationPosition *position);
+LocationPosition *location_position_copy(const LocationPosition *position);
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-/* Vincenty Inverse Solution of Geodesics on the Ellipsoid (c) Chris Veness 2002-2010 */
-/* */
+/* Vincenty Inverse Solution of Geodesics on the Ellipsoid (c) Chris Veness 2002-2010 */
+/* */
/* from: Vincenty inverse formula - T Vincenty, "Direct and Inverse Solutions of Geodesics on the */
-/* Ellipsoid with application of nested equations", Survey Review, vol XXII no 176, 1975 */
-/* http://www.ngs.noaa.gov/PUBS_LIB/inverse.pdf */
+/* Ellipsoid with application of nested equations", Survey Review, vol XXII no 176, 1975 */
+/* http://www.ngs.noaa.gov/PUBS_LIB/inverse.pdf */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/**
* @brief Gets the approximate distance between two points. A distance is defined using the WGS84 ellipsoid.
* @remarks Uses meters as a unit of measurement for a distance.
- * @pre None.
- * @post None.
+ * @pre None.
+ * @post None.
* @param [in] pos1 - a #LocationPosition (decimal degree)
* @param [in] pos2 - a #LocationPosition (decimal degree)
* @param [out] distance - a #gulong (meters)
* @return int
- * @retval 0 Success.
+ * @retval 0 Success.
*
* Please refer #LocationError for more information.
*/
/**
* @brief Change position string to latitude and longitude integer.
* @remarks None.
- * @pre #location_init should be called before.\n
- * @post None.
+ * @pre #location_init should be called before.\n
+ * @post None.
* @param [in] position - string of last position.
* @param [in] lat - latitude.
* @param [in] lon - longitude.
--- /dev/null
+/*
+ * libslp-location
+ *
+ * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
+ * Genie Kim <daejins.kim@samsung.com>
+ *
+ * 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 <sys/types.h>
+#include <unistd.h>
+#include <glib.h>
+#include <stdlib.h>
+
+#include <app_manager.h>
+#include <package_manager.h>
+#include <pkgmgr-info.h>
+#include <privacy_checker_client.h>
+
+#include "location-common-util.h"
+#include "location-types.h"
+#include "location-log.h"
+#include "location-privacy.h"
+
+typedef struct _location_privilege_s {
+ char *name;
+ bool found;
+} location_privilege_s;
+
+int
+location_get_app_type(char *target_app_id)
+{
+ int ret = 0;
+ pid_t pid = 0;
+ char *app_id = NULL;
+ app_info_h app_info;
+ char *type = NULL;
+
+ if (target_app_id == NULL) {
+ pid = getpid();
+ ret = app_manager_get_app_id(pid, &app_id);
+ if (ret != APP_MANAGER_ERROR_NONE) {
+ LOCATION_LOGE("Fail to get app_id. Err[%d]", ret);
+ return LOCATION_ERROR_NONE;
+ }
+ } else {
+ app_id = g_strdup(target_app_id);
+ }
+
+ ret = app_info_create(app_id, &app_info);
+ if (ret != APP_MANAGER_ERROR_NONE) {
+ LOCATION_LOGE("Fail to get app_id. Err[%d]", ret);
+ g_free(app_id);
+ return 0;
+ }
+
+ ret = app_info_get_type(app_info, &type);
+ if (ret != APP_MANAGER_ERROR_NONE) {
+ LOCATION_LOGE("Fail to get type. Err[%d]", ret);
+ g_free(app_id);
+ app_info_destroy(app_info);
+ return 0;
+ }
+
+ if (strcmp(type, "c++app") == 0) {
+ ret = CPPAPP;
+ } else if (strcmp(type, "webapp") == 0) {
+ ret = WEBAPP;
+ } else {
+ ret = CAPP;
+ }
+
+ g_free(type);
+ g_free(app_id);
+ app_info_destroy(app_info);
+
+ return ret;
+}
+
+void
+location_privacy_initialize(void)
+{
+ int ret = 0;
+ pid_t pid = 0;
+ char *app_id = NULL;
+ char *package_id = NULL;
+ pkgmgrinfo_appinfo_h pkgmgrinfo_appinfo;
+
+ pid = getpid();
+ ret = app_manager_get_app_id(pid, &app_id);
+ if (ret != APP_MANAGER_ERROR_NONE) {
+ LOCATION_LOGE("Fail to get app_id. Err[%d]", ret);
+ return;
+ }
+
+ ret = pkgmgrinfo_appinfo_get_appinfo(app_id, &pkgmgrinfo_appinfo);
+ if (ret != PACKAGE_MANAGER_ERROR_NONE) {
+ LOCATION_LOGE("Fail to get appinfo for [%s]. Err[%d]", app_id, ret);
+ free(app_id);
+ return;
+ }
+
+ ret = pkgmgrinfo_appinfo_get_pkgname(pkgmgrinfo_appinfo, &package_id);
+ if (ret != PACKAGE_MANAGER_ERROR_NONE) {
+ LOCATION_LOGE("Fail to get package_id for [%s]. Err[%d]", app_id, ret);
+ pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo);
+ free(app_id);
+ return;
+ }
+
+ ret = privacy_checker_initialize(package_id);
+ if (ret != PRIV_MGR_ERROR_SUCCESS) {
+ LOCATION_LOGE("Fail to initialize privacy checker. err[%d]", ret);
+ pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo);
+ free(app_id);
+ return;
+ }
+
+ LOCATION_LOGD("Success to initialize privacy checker");
+
+ free(app_id);
+ pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo);
+}
+
+void
+location_privacy_finalize(void)
+{
+ int ret = 0;
+ ret = privacy_checker_finalize();
+ if (ret != PRIV_MGR_ERROR_SUCCESS) {
+ LOCATION_LOGE("Fail to finalize privacy_cehecker. Err[%d]", ret);
+ return;
+ }
+
+ LOCATION_LOGD("Success to finalize privacy checker");
+}
+
+int
+location_get_privacy(const char *privilege_name)
+{
+ int ret = 0;
+ pid_t pid = 0;
+ char *app_id = NULL;
+ char *package_id = NULL;
+ int app_type = 0;
+ pkgmgrinfo_appinfo_h pkgmgrinfo_appinfo;
+
+ pid = getpid();
+ ret = app_manager_get_app_id(pid, &app_id);
+ if (ret != APP_MANAGER_ERROR_NONE) {
+ LOCATION_LOGE("Fail to get app_id. Err[%d]", ret);
+ return LOCATION_ERROR_NONE;
+ }
+
+ app_type = location_get_app_type(app_id);
+ if (app_type == CPPAPP) {
+ LOCATION_LOGE("CPPAPP use location");
+ g_free(app_id);
+ return LOCATION_ERROR_NONE;
+ }
+
+ ret = pkgmgrinfo_appinfo_get_appinfo(app_id, &pkgmgrinfo_appinfo);
+ if (ret != PACKAGE_MANAGER_ERROR_NONE) {
+ LOCATION_LOGE("Fail to get appinfo for [%s]. Err[%d]", app_id, ret);
+ g_free(app_id);
+ return LOCATION_ERROR_NOT_ALLOWED;
+ }
+
+ ret = pkgmgrinfo_appinfo_get_pkgname(pkgmgrinfo_appinfo, &package_id);
+ if (ret != PACKAGE_MANAGER_ERROR_NONE) {
+ LOCATION_LOGE("Fail to get package_id for [%s]. Err[%d]", app_id, ret);
+ g_free(app_id);
+ pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo);
+ return LOCATION_ERROR_NOT_ALLOWED;
+ }
+
+#ifdef TIZEN_PROFILE_WERABLE
+ if (app_type == WEBAPP) {
+ LOCATION_LOGI("WEBAPP use location");
+ if (location_get_webapp_privilege(package_id, privilege_name) == 0) {
+ g_free(package_id);
+ g_free(app_id);
+ return LOCATION_ERROR_NONE;
+ }
+ }
+#endif
+
+ ret = privacy_checker_check_package_by_privilege(package_id, privilege_name);
+ if (ret != PRIV_MGR_ERROR_SUCCESS) {
+ LOCATION_LOGE("Fail to get privilege for [%s]. Err[%d]", package_id, ret);
+ pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo);
+ g_free(app_id);
+ return LOCATION_ERROR_NOT_ALLOWED;
+ }
+
+ pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo);
+ g_free(app_id);
+
+ return LOCATION_ERROR_NONE;
+}
+
+
+int
+location_check_privilege(const char *privilege_name)
+{
+ int ret = 0;
+ pid_t pid = 0;
+ char *app_id = NULL;
+ char *package_id = NULL;
+ int app_type = 0;
+ pkgmgrinfo_appinfo_h pkgmgrinfo_appinfo;
+
+ pid = getpid();
+ ret = app_manager_get_app_id(pid, &app_id);
+ if (ret != APP_MANAGER_ERROR_NONE) {
+ LOCATION_LOGE("Fail to get app_id. Err[%d]", ret);
+ return LOCATION_ERROR_NONE;
+ }
+
+ app_type = location_get_app_type(app_id);
+ if (app_type == CPPAPP) {
+ LOCATION_LOGE("CPPAPP use location");
+ g_free(app_id);
+ return LOCATION_ERROR_NONE;
+ }
+
+ ret = pkgmgrinfo_appinfo_get_appinfo(app_id, &pkgmgrinfo_appinfo);
+ if (ret != PACKAGE_MANAGER_ERROR_NONE) {
+ LOCATION_LOGE("Fail to get appinfo for [%s]. Err[%d]", app_id, ret);
+ g_free(app_id);
+ return LOCATION_ERROR_NOT_ALLOWED;
+ }
+
+ ret = pkgmgrinfo_appinfo_get_pkgname(pkgmgrinfo_appinfo, &package_id);
+ if (ret != PACKAGE_MANAGER_ERROR_NONE) {
+ LOCATION_LOGE("Fail to get package_id for [%s]. Err[%d]", app_id, ret);
+ g_free(app_id);
+ pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo);
+ return LOCATION_ERROR_NOT_ALLOWED;
+ }
+
+#ifdef TIZEN_WERABLE
+ if (app_type == WEBAPP) {
+ LOCATION_LOGE("WEBAPP use location");
+ if (location_get_webapp_privilege(package_id, privilege_name) == 0) {
+ g_free(package_id);
+ g_free(app_id);
+ return LOCATION_ERROR_NONE;
+ }
+ }
+#endif
+
+ ret = privacy_checker_initialize(package_id);
+ if (ret != PRIV_MGR_ERROR_SUCCESS) {
+ LOCATION_LOGE("Fail to initialize privacy checker. err[%d]", ret);
+ pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo);
+ g_free(app_id);
+ return LOCATION_ERROR_NOT_ALLOWED;
+ }
+
+ ret = privacy_checker_check_package_by_privilege(package_id, privilege_name);
+ if (ret != PRIV_MGR_ERROR_SUCCESS) {
+ LOCATION_LOGE("Fail to get privilege for [%s]. Err[%d]", package_id, ret);
+ pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo);
+ g_free(app_id);
+ return LOCATION_ERROR_NOT_ALLOWED;
+ }
+
+ pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo);
+ g_free(app_id);
+
+ ret = privacy_checker_finalize();
+ if (ret != PRIV_MGR_ERROR_SUCCESS) {
+ LOCATION_LOGE("Fail to finalize privacy_cehecker. Err[%d]", ret);
+ return LOCATION_ERROR_NOT_ALLOWED;
+ }
+
+ return LOCATION_ERROR_NONE;
+}
+
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
+#ifndef __LOCATION_PRIVACY_H__
+#define __LOCATION_PRIVACY_H__
+
+void location_privacy_initialize(void);
+void location_privacy_finalize(void);
+int location_get_app_type(char *app_id);
+int location_get_privacy(const char *privilege_name);
+int location_check_privilege(const char *privilege_name);
+
+
+#endif /* __LOCATION_PRIVACY_H__ */
#include "location-log.h"
GType
-location_satellite_get_type (void)
+location_satellite_get_type(void)
{
static volatile gsize type_volatile = 0;
- if(g_once_init_enter(&type_volatile)) {
- GType type = g_boxed_type_register_static (
- g_intern_static_string ("LocationSatellite"),
- (GBoxedCopyFunc) location_satellite_copy,
- (GBoxedFreeFunc) location_satellite_free);
+ if (g_once_init_enter(&type_volatile)) {
+ GType type = g_boxed_type_register_static(
+ g_intern_static_string("LocationSatellite"),
+ (GBoxedCopyFunc) location_satellite_copy,
+ (GBoxedFreeFunc) location_satellite_free);
g_once_init_leave(&type_volatile, type);
}
return type_volatile;
}
static void
-update_num_of_used (LocationSatellite *satellite)
+update_num_of_used(LocationSatellite *satellite)
{
g_return_if_fail(satellite);
satellite->num_of_sat_used = 0;
if (satellite->num_of_sat_inview > 0 && satellite->sat_inview) {
int i = 0;
for (i = 0 ; i < satellite->num_of_sat_inview ; i++)
- if(satellite->sat_inview[i].used) (satellite->num_of_sat_used)++;
+ if (satellite->sat_inview[i].used)(satellite->num_of_sat_used)++;
}
}
-EXPORT_API LocationSatellite*
-location_satellite_new (int num_of_sat_inview)
+EXPORT_API LocationSatellite *
+location_satellite_new(int num_of_sat_inview)
{
- LocationSatellite* satellite = g_slice_new0(LocationSatellite);
+ LocationSatellite *satellite = g_slice_new0(LocationSatellite);
+ g_return_val_if_fail(satellite, NULL);
+
satellite->num_of_sat_inview = num_of_sat_inview;
satellite->num_of_sat_used = 0;
satellite->sat_inview = g_new0(LocationSatelliteDetail, satellite->num_of_sat_inview);
}
EXPORT_API void
-location_satellite_free (LocationSatellite* satellite)
+location_satellite_free(LocationSatellite *satellite)
{
g_return_if_fail(satellite);
g_free(satellite->sat_inview);
g_slice_free(LocationSatellite, satellite);
}
-EXPORT_API LocationSatellite*
-location_satellite_copy (const LocationSatellite *satellite)
+EXPORT_API LocationSatellite *
+location_satellite_copy(const LocationSatellite *satellite)
{
g_return_val_if_fail(satellite, NULL);
- LocationSatellite* satellite_dup = location_satellite_new(satellite->num_of_sat_inview);
+ LocationSatellite *satellite_dup = location_satellite_new(satellite->num_of_sat_inview);
satellite_dup->timestamp = satellite->timestamp;
satellite_dup->num_of_sat_used = satellite->num_of_sat_used;
int i = 0;
for (i = 0 ; i < satellite_dup->num_of_sat_inview ; i++)
location_satellite_set_satellite_details(satellite_dup, i,
- satellite->sat_inview[i].prn,
- satellite->sat_inview[i].used,
- satellite->sat_inview[i].elevation,
- satellite->sat_inview[i].azimuth,
- satellite->sat_inview[i].snr);
+ satellite->sat_inview[i].prn,
+ satellite->sat_inview[i].used,
+ satellite->sat_inview[i].elevation,
+ satellite->sat_inview[i].azimuth,
+ satellite->sat_inview[i].snr);
return satellite_dup;
}
EXPORT_API gboolean
-location_satellite_get_satellite_details (const LocationSatellite *satellite,
- guint index,
- guint* prn,
- gboolean* used,
- guint* elevation,
- guint* azimuth,
- gint* snr)
+location_satellite_get_satellite_details(const LocationSatellite *satellite,
+ guint index,
+ guint *prn,
+ gboolean *used,
+ guint *elevation,
+ guint *azimuth,
+ gint *snr)
{
g_return_val_if_fail(satellite, FALSE);
g_return_val_if_fail(prn, FALSE);
}
EXPORT_API gboolean
-location_satellite_set_satellite_details (LocationSatellite *satellite,
- guint index,
- guint prn,
- gboolean used,
- guint elevation,
- guint azimuth,
- gint snr)
+location_satellite_set_satellite_details(LocationSatellite *satellite,
+ guint index,
+ guint prn,
+ gboolean used,
+ guint elevation,
+ guint azimuth,
+ gint snr)
{
g_return_val_if_fail(satellite, FALSE);
g_return_val_if_fail(satellite->sat_inview, FALSE);
g_return_val_if_fail(index < satellite->num_of_sat_inview, FALSE);
- satellite->sat_inview[index].prn= prn;
- satellite->sat_inview[index].used= used;
- satellite->sat_inview[index].elevation= elevation;
- satellite->sat_inview[index].azimuth= azimuth;
- satellite->sat_inview[index].snr= snr;
- update_num_of_used (satellite);
+ satellite->sat_inview[index].prn = prn;
+ satellite->sat_inview[index].used = used;
+ satellite->sat_inview[index].elevation = elevation;
+ satellite->sat_inview[index].azimuth = azimuth;
+ satellite->sat_inview[index].snr = snr;
+ update_num_of_used(satellite);
return TRUE;
}
* Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
+ * Genie Kim <daejins.kim@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
G_BEGIN_DECLS
-GType location_satellite_get_type (void);
+GType location_satellite_get_type(void);
#define LOCATION_TYPE_SATELLITE (location_satellite_get_type ())
/**
* @brief This represents one satellite information in view.
*/
typedef struct {
- guint prn; ///< The PRNs(Pseudo-Random Noise code) of a satellite.
- gboolean used; ///< TRUE if currently used satellite.
- guint elevation; ///< The elevation of a satellite.
- guint azimuth; ///< The degree from true north 000 to 359 of a satellite.
- gint snr; ///< The signal-to-noise ratio, dB of a satellite.
+ guint prn; /*/< The PRNs(Pseudo-Random Noise code) of a satellite. */
+ gboolean used; /*/< TRUE if currently used satellite. */
+ guint elevation; /*/< The elevation of a satellite. */
+ guint azimuth; /*/< The degree from true north 000 to 359 of a satellite. */
+ gint snr; /*/< The signal-to-noise ratio, dB of a satellite. */
} LocationSatelliteDetail;
/**
* @brief This represents position information such as number of satellites in used or in view.
*/
-struct _LocationSatellite
-{
- guint timestamp; ///< Time stamp.
- guint num_of_sat_inview; ///< The number of satellites in view.
- guint num_of_sat_used; ///< The number of satellites in used.
- LocationSatelliteDetail* sat_inview; ///< The information of satellites in view .
+struct _LocationSatellite {
+ guint timestamp; /*/< Time stamp. */
+ guint num_of_sat_inview; /*/< The number of satellites in view. */
+ guint num_of_sat_used; /*/< The number of satellites in used. */
+ LocationSatelliteDetail *sat_inview; /*/< The information of satellites in view . */
};
/**
- * @brief Create a new #LocationSatellite with given number of #LocationSatelliteDetail.
+ * @brief Create a new #LocationSatellite with given number of #LocationSatelliteDetail.
* @remarks None.
- * @pre #location_init should be called before.\n
- * @post None.
- * @param [in] num_of_sat_inview - number of #LocationSatelliteDetail.
+ * @pre #location_init should be called before.\n
+ * @post None.
+ * @param [in] num_of_sat_inview - number of #LocationSatelliteDetail.
* @return a new #LocationSatellite
* @retval NULL if error occured
*/
-LocationSatellite *location_satellite_new (int num_of_sat_inview);
+LocationSatellite *location_satellite_new(int num_of_sat_inview);
/**
- * @brief Free a #LocationSatellite.
+ * @brief Free a #LocationSatellite.
* @remarks None.
- * @pre #location_init should be called before.\n
- * @post None.
+ * @pre #location_init should be called before.\n
+ * @post None.
* @param [in] satellite - a #LocationSatellite.
* @return None.
*/
-void location_satellite_free (LocationSatellite *satellite);
+void location_satellite_free(LocationSatellite *satellite);
/**
- * @brief Makes a copy of #LocationSatellite
+ * @brief Makes a copy of #LocationSatellite
* @remarks None.
- * @pre #location_init should be called before.\n
- * @post None.
- * @param [in] satellite - a #LocationSatellite
+ * @pre #location_init should be called before.\n
+ * @post None.
+ * @param [in] satellite - a #LocationSatellite
* @return a new #LocationSatellite
* @retval NULL if error occured
*/
-LocationSatellite *location_satellite_copy (const LocationSatellite *satellite);
+LocationSatellite *location_satellite_copy(const LocationSatellite *satellite);
/**
- * @brief Get elements of #LocationSatelliteDetail with given index in #LocationSatellite.
+ * @brief Get elements of #LocationSatelliteDetail with given index in #LocationSatellite.
* @remarks None.
- * @pre #location_init should be called before.\n
- * @post None.
- * @param [in] satellite - a #LocationSatellite
- * @param [in] index - index of #LocationSatelliteDetail in #LocationSatellite
- * @param [out] prn - The PRNs(Pseudo-Random Noise code) of a #LocationSatellite
- * @param [out] used - TRUE if a #LocationSatellite in used.
- * @param [out] elevation - The elevation of a #LocationSatellite
- * @param [out] azimuth - The degree from true north 000 to 359 of a#LocationSatellite
- * @param [out] snr - The signal-to-noise ratio, dB of #LocationSatellite
+ * @pre #location_init should be called before.\n
+ * @post None.
+ * @param [in] satellite - a #LocationSatellite
+ * @param [in] index - index of #LocationSatelliteDetail in #LocationSatellite
+ * @param [out] prn - The PRNs(Pseudo-Random Noise code) of a #LocationSatellite
+ * @param [out] used - TRUE if a #LocationSatellite in used.
+ * @param [out] elevation - The elevation of a #LocationSatellite
+ * @param [out] azimuth - The degree from true north 000 to 359 of a#LocationSatellite
+ * @param [out] snr - The signal-to-noise ratio, dB of #LocationSatellite
* @return gboolean
* @retval\n
* TRUE - if success\n
* FALSE - if error occured\n
*/
-gboolean location_satellite_get_satellite_details (const LocationSatellite *satellite, guint index, guint *prn, gboolean *used, guint *elevation, guint *azimuth, gint *snr);
+gboolean location_satellite_get_satellite_details(const LocationSatellite *satellite, guint index, guint *prn, gboolean *used, guint *elevation, guint *azimuth, gint *snr);
/**
- * @brief Set elements of #LocationSatelliteDetail with given index in #LocationSatellite.
+ * @brief Set elements of #LocationSatelliteDetail with given index in #LocationSatellite.
* @remarks None.
- * @pre #location_init should be called before.\n
- * @post None.
+ * @pre #location_init should be called before.\n
+ * @post None.
* @param [in] satellite - a #LocationSatellite
* @param [in] index - index of #LocationSatelliteDetail in #LocationSatellite
* @param [in] prn - The PRNs(Pseudo-Random Noise code) of a #LocationSatellite
* TRUE - if success\n
* FALSE - if error occured\n
*/
-gboolean location_satellite_set_satellite_details( LocationSatellite *satellite, guint index, guint prn, gboolean used, guint elevation, guint azimuth, gint snr);
+gboolean location_satellite_set_satellite_details(LocationSatellite *satellite, guint index, guint prn, gboolean used, guint elevation, guint azimuth, gint snr);
/**
* @} @}
#endif
#include <glib.h>
+#include <bundle_internal.h>
+#include <eventsystem.h>
#include "location-log.h"
#include "location-setting.h"
{
g_return_val_if_fail(key, -1);
int val = -1;
- switch(vconf_keynode_get_type(key))
- {
+ switch (vconf_keynode_get_type(key)) {
case VCONF_TYPE_INT:
val = vconf_keynode_get_int(key);
- LOCATION_LOGD("Setting changed [%s]:[%d]", vconf_keynode_get_name(key), val);
+ LOCATION_SECLOG("Setting changed [%s]:[%d]", vconf_keynode_get_name(key), val);
break;
default:
LOCATION_LOGW("Unused type(%d)", vconf_keynode_get_type(key));
return val;
}
-gint location_setting_get_int(const gchar* path)
+gint location_setting_get_int(const gchar *path)
{
g_return_val_if_fail(path, -1);
int val = -1;
- if(vconf_get_int(path, &val)){
- LOCATION_LOGW("vconf_get_int: failed [%s]", path);
+ if (vconf_get_int(path, &val)) {
+ LOCATION_SECLOG("vconf_get_int: failed [%s]", path);
} else if (val == 0)
- LOCATION_LOGD("vconf_get_int: [%s]:[%d]", path, val);
+ LOCATION_SECLOG("vconf_get_int: [%s]:[%d]", path, val);
return val;
}
-gboolean location_setting_get_bool(const gchar* path)
+gboolean location_setting_get_bool(const gchar *path)
{
g_return_val_if_fail(path, -1);
gboolean val = FALSE;
- if(vconf_get_bool(path, &val)){
- LOCATION_LOGW("vconf_get_int: failed [%s]", path);
+ if (vconf_get_bool(path, &val)) {
+ LOCATION_SECLOG("vconf_get_int: failed [%s]", path);
}
return val;
}
-gchar *location_setting_get_string(const gchar* path)
+gchar *location_setting_get_string(const gchar *path)
{
- g_return_val_if_fail(path, -1);
+ g_return_val_if_fail(path, NULL);
return vconf_get_str(path);
}
-gint location_setting_add_notify(const gchar* path, SettingCB setting_cb, gpointer self)
+static unsigned int event_req_id;
+
+static char *convert_event_from_key(const char *key)
+{
+ char *event = NULL;
+ if (g_strcmp0(key, VCONFKEY_LOCATION_USE_MY_LOCATION) == 0) {
+ event = g_strdup(SYS_EVENT_LOCATION_ENABLE_STATE);
+ } else if (g_strcmp0(key, VCONFKEY_LOCATION_ENABLED) == 0) {
+ event = g_strdup(SYS_EVENT_GPS_ENABLE_STATE);
+ } else if (g_strcmp0(key, VCONFKEY_LOCATION_NETWORK_ENABLED) == 0) {
+ event = g_strdup(SYS_EVENT_NPS_ENABLE_STATE);
+ }
+
+ return event;
+}
+
+static void __event_handler(const char *event_name, bundle *data, void *self)
+{
+ const char *value = NULL;
+
+ if (g_strcmp0(event_name, SYS_EVENT_LOCATION_ENABLE_STATE) == 0) {
+ value = bundle_get_val(data, EVT_KEY_LOCATION_ENABLE_STATE);
+ } else if (g_strcmp0(event_name, SYS_EVENT_GPS_ENABLE_STATE) == 0) {
+ value = bundle_get_val(data, EVT_KEY_GPS_ENABLE_STATE);
+ } else if (g_strcmp0(event_name, SYS_EVENT_NPS_ENABLE_STATE) == 0) {
+ value = bundle_get_val(data, EVT_KEY_NPS_ENABLE_STATE);
+ }
+
+ LOCATION_SECLOG("get event state [%s]", value);
+}
+
+gint location_setting_add_notify(const gchar *path, SettingCB setting_cb, gpointer self)
{
g_return_val_if_fail(path, -1);
g_return_val_if_fail(self, -1);
- if(vconf_notify_key_changed(path, setting_cb, self)){
- LOCATION_LOGW("vconf notify add failed [%s]", path);
+ const char *event_name = NULL;
+ event_name = convert_event_from_key(path);
+
+ if (eventsystem_register_event(event_name,
+ &event_req_id,
+ (eventsystem_handler) __event_handler, NULL) != ES_R_OK) {
+
+ LOCATION_SECLOG("eventsystem_register_event failed");
+ return -1;
+ }
+
+ if (vconf_notify_key_changed(path, setting_cb, self)) {
+ LOCATION_SECLOG("vconf notify add failed [%s]", path);
return -1;
}
- LOCATION_LOGD("vconf notify added [%s]", path);
+ LOCATION_SECLOG("vconf notify added [%s]", path);
return 0;
}
-gint location_setting_ignore_notify(const gchar* path, SettingCB setting_cb)
+gint location_setting_ignore_notify(const gchar *path, SettingCB setting_cb)
{
g_return_val_if_fail(path, -1);
g_return_val_if_fail(setting_cb, -1);
- if(vconf_ignore_key_changed(path, setting_cb)){
- LOCATION_LOGW("vconf notify remove failed [%s]", path);
+ if (eventsystem_unregister_event(event_req_id) != ES_R_OK) {
+ LOCATION_SECLOG("eventsystem_unregister_event failed");
+ return -1;
+ }
+
+ if (vconf_ignore_key_changed(path, setting_cb)) {
+ LOCATION_SECLOG("vconf notify remove failed [%s]", path);
return -1;
}
- LOCATION_LOGD("vconf notify removed [%s]", path);
+ LOCATION_SECLOG("vconf notify removed [%s]", path);
return 0;
}
* @brief This file contains the definitions and functions for setting.
*/
+#define LOCATION_UPDATE_INTERVAL_NONE 0
#define LOCATION_UPDATE_INTERVAL_MIN 1
#define LOCATION_UPDATE_INTERVAL_MAX 120
-#define LOCATION_UPDATE_INTERVAL_DEFAULT LOCATION_UPDATE_INTERVAL_MIN
+#define LOCATION_UPDATE_INTERVAL_DEFAULT LOCATION_UPDATE_INTERVAL_MIN
+#define LOCATION_BATCH_PERIOD_MIN 120
+#define LOCATION_BATCH_PERIOD_MAX 600
+#define LOCATION_BATCH_PERIOD_DEFAULT LOCATION_BATCH_PERIOD_MIN
+#define LOCATION_MIN_INTERVAL_MIN 1
+#define LOCATION_MIN_INTERVAL_MAX 120
+#define LOCATION_MIN_INTERVAL_DEFAULT LOCATION_MIN_INTERVAL_MIN
+#define LOCATION_MIN_DISTANCE_MIN 1.0
+#define LOCATION_MIN_DISTANCE_MAX 120.0
+#define LOCATION_MIN_DISTANCE_DEFAULT LOCATION_MIN_DISTANCE_MIN
typedef void (*SettingCB)(keynode_t *key, gpointer data);
gint location_setting_get_key_val(keynode_t *key);
-gint location_setting_get_int(const gchar* path);
-gchar *location_setting_get_string(const gchar* path);
-gint location_setting_add_notify(const gchar* path, SettingCB setting_cb, gpointer self);
-gint location_setting_ignore_notify(const gchar* path, SettingCB setting_cb);
+gint location_setting_get_int(const gchar *path);
+gboolean location_setting_get_bool(const gchar *path);
+gchar *location_setting_get_string(const gchar *path);
+gint location_setting_add_notify(const gchar *path, SettingCB setting_cb, gpointer self);
+gint location_setting_ignore_notify(const gchar *path, SettingCB setting_cb);
#define setting_retval_if_fail(path) {\
- int val = location_setting_get_int(path);\
- if (val == -1){\
- return LOCATION_ERROR_UNKNOWN;\
- } else if (val == 0) {\
- return LOCATION_ERROR_SETTING_OFF;\
- }\
-}
+ int val = location_setting_get_int(path);\
+ if (val == -1){\
+ return LOCATION_ERROR_UNKNOWN;\
+ } else if (val == 0) {\
+ return LOCATION_ERROR_SETTING_OFF;\
+ }\
+ }
#endif
#include "location-signaling-util.h"
#include "location-common-util.h"
#include "location-log.h"
+#include "location-position.h"
+
void
-enable_signaling (LocationObject *obj,
- guint32 signals[LAST_SIGNAL],
- gboolean *prev_enabled,
- gboolean enabled,
- LocationStatus status)
+enable_signaling(LocationObject *obj,
+ guint32 signals[LAST_SIGNAL],
+ gboolean *prev_enabled,
+ gboolean enabled,
+ LocationStatus status)
{
g_return_if_fail(obj);
g_return_if_fail(signals);
if (*prev_enabled == TRUE && enabled == FALSE) {
*prev_enabled = FALSE;
LOCATION_LOGD("Signal emit: SERVICE_DISABLED");
- g_signal_emit (obj, signals[SERVICE_DISABLED], 0, LOCATION_STATUS_NO_FIX);
- } else if (*prev_enabled == FALSE && enabled == TRUE){
+ g_signal_emit(obj, signals[SERVICE_DISABLED], 0, LOCATION_STATUS_NO_FIX);
+ } else if (*prev_enabled == FALSE && enabled == TRUE) {
*prev_enabled = TRUE;
LOCATION_LOGD("Signal emit: SERVICE_ENABLED");
- g_signal_emit (obj, signals[SERVICE_ENABLED], 0, status);
+ g_signal_emit(obj, signals[SERVICE_ENABLED], 0, status);
}
}
void
-position_signaling (LocationObject *obj,
- guint32 signals[LAST_SIGNAL],
- int interval,
- guint *updated_timestamp,
- GList *prev_bound,
- LocationPosition *pos,
- LocationAccuracy *acc)
+position_velocity_signaling(LocationObject *obj,
+ guint32 signals[LAST_SIGNAL],
+ guint pos_interval,
+ guint vel_interval,
+ guint loc_interval,
+ guint *pos_updated_timestamp,
+ guint *vel_updated_timestamp,
+ guint *loc_updated_timestamp,
+ GList *prev_bound,
+ LocationPosition *pos,
+ LocationVelocity *vel,
+ LocationAccuracy *acc)
{
- g_return_if_fail(pos);
- g_return_if_fail(acc);
g_return_if_fail(obj);
g_return_if_fail(signals);
+ g_return_if_fail(pos);
int index = 0;
+ int signal_type = 0;
gboolean is_inside = FALSE;
GList *boundary_list = prev_bound;
LocationBoundaryPrivate *priv = NULL;
- if (!pos->timestamp) return;
+ if (!pos->timestamp) return;
+
+ if (pos_interval > 0) {
+ if (pos->timestamp - *pos_updated_timestamp >= pos_interval) {
+ signal_type |= POSITION_UPDATED;
+ *pos_updated_timestamp = pos->timestamp;
+ }
+ }
+
+ if (vel_interval > 0) {
+ if (vel->timestamp - *vel_updated_timestamp >= vel_interval) {
+ signal_type |= VELOCITY_UPDATED;
+ *vel_updated_timestamp = vel->timestamp;
+ }
+ }
+
+ if (loc_interval > 0) {
+ if (pos->timestamp - *loc_updated_timestamp >= loc_interval) {
+ signal_type |= LOCATION_CHANGED;
+ *loc_updated_timestamp = pos->timestamp;
+ }
+ }
+
+ if ((pos_interval == 0) && (vel_interval == 0) && (loc_interval == 0)) {
+ signal_type |= POSITION_UPDATED;
+ }
- if (pos->timestamp - *updated_timestamp >= interval) {
- LOCATION_LOGD("POSITION SERVICE_UPDATED");
- g_signal_emit(obj, signals[SERVICE_UPDATED], 0, POSITION_UPDATED, pos, acc);
- *updated_timestamp = pos->timestamp;
+ if (signal_type != 0) {
+ g_signal_emit(obj, signals[SERVICE_UPDATED], 0, signal_type, pos, vel, acc);
}
- if(boundary_list) {
- while((priv = (LocationBoundaryPrivate *)g_list_nth_data(boundary_list, index)) != NULL) {
+ if (boundary_list) {
+ while ((priv = (LocationBoundaryPrivate *)g_list_nth_data(boundary_list, index)) != NULL) {
is_inside = location_boundary_if_inside(priv->boundary, pos);
- if(is_inside) {
- if(priv->zone_status != ZONE_STATUS_IN) {
+ if (is_inside) {
+ if (priv->zone_status != ZONE_STATUS_IN) {
LOCATION_LOGD("Signal emit: ZONE IN");
g_signal_emit(obj, signals[ZONE_IN], 0, priv->boundary, pos, acc);
priv->zone_status = ZONE_STATUS_IN;
index++;
}
}
+
}
void
-velocity_signaling (LocationObject *obj,
- guint32 signals[LAST_SIGNAL],
- int interval,
- guint *updated_timestamp,
- LocationVelocity *vel,
- LocationAccuracy *acc)
+distance_based_position_signaling(LocationObject *obj,
+ guint32 signals[LAST_SIGNAL],
+ gboolean enabled,
+ LocationPosition *cur_pos,
+ LocationVelocity *cur_vel,
+ LocationAccuracy *cur_acc,
+ guint min_interval,
+ gdouble min_distance,
+ gboolean *prev_enabled,
+ guint *prev_dist_timestamp,
+ LocationPosition **prev_pos, /* prev : keeping lastest info. */
+ LocationVelocity **prev_vel,
+ LocationAccuracy **prev_acc)
{
- g_return_if_fail(obj);
- g_return_if_fail(signals);
- g_return_if_fail(vel);
+ if (!cur_pos->timestamp) {
+ LOCATION_LOGE("Invalid location with timestamp, 0");
+ return;
+ }
+
+ enable_signaling(obj, signals, prev_enabled, enabled, cur_pos->status);
- if (!vel->timestamp) return;
+ if (cur_pos->timestamp - *prev_dist_timestamp >= min_interval) {
+ g_signal_emit(obj, signals[SERVICE_UPDATED], 0, DISTANCE_UPDATED, cur_pos, cur_vel, cur_acc);
+ *prev_dist_timestamp = cur_pos->timestamp;
- if (vel->timestamp - *updated_timestamp >= interval) {
- LOCATION_LOGD("VELOCITY SERVICE_UPDATED");
- g_signal_emit(obj, signals[SERVICE_UPDATED], 0, VELOCITY_UPDATED, vel, acc);
- *updated_timestamp = vel->timestamp;
+ if (*prev_pos) location_position_free(*prev_pos);
+ *prev_pos = location_position_copy(cur_pos);
+
+ } else {
+ gulong distance;
+ int ret = location_get_distance(*prev_pos, cur_pos, &distance);
+ if (ret != LOCATION_ERROR_NONE) {
+ LOCATION_LOGE("Fail to get distance");
+ return;
+ }
+
+ if (distance > min_distance) {
+ g_signal_emit(obj, signals[SERVICE_UPDATED], 0, DISTANCE_UPDATED, cur_pos, cur_vel, cur_acc);
+ *prev_dist_timestamp = cur_pos->timestamp;
+
+ if (*prev_pos) location_position_free(*prev_pos);
+ *prev_pos = location_position_copy(cur_pos);
+ }
}
}
void
-location_signaling (LocationObject *obj,
- guint32 signals[LAST_SIGNAL],
- gboolean enabled,
- GList *boundary_list,
- LocationPosition *cur_pos,
- LocationVelocity *cur_vel,
- LocationAccuracy *cur_acc,
- guint pos_interval, // interval : support an update interval
- guint vel_interval,
- gboolean *prev_enabled,
- guint *prev_pos_timestamp,
- guint *prev_vel_timestamp,
- LocationPosition **prev_pos, // prev : keeping lastest info.
- LocationVelocity **prev_vel,
- LocationAccuracy **prev_acc)
+location_signaling(LocationObject *obj,
+ guint32 signals[LAST_SIGNAL],
+ gboolean enabled,
+ GList *boundary_list,
+ LocationPosition *cur_pos,
+ LocationVelocity *cur_vel,
+ LocationAccuracy *cur_acc,
+ guint pos_interval, /* interval : support an update interval */
+ guint vel_interval,
+ guint loc_interval,
+ gboolean *prev_enabled,
+ guint *prev_pos_timestamp,
+ guint *prev_vel_timestamp,
+ guint *prev_loc_timestamp,
+ LocationPosition **prev_pos, /* prev : keeping lastest info. */
+ LocationVelocity **prev_vel,
+ LocationAccuracy **prev_acc)
{
if (!cur_pos->timestamp) {
LOCATION_LOGD("Invalid location with timestamp, 0");
if (*prev_vel) location_velocity_free(*prev_vel);
if (*prev_acc) location_accuracy_free(*prev_acc);
- *prev_pos = location_position_copy (cur_pos);
- *prev_vel = location_velocity_copy (cur_vel);
- *prev_acc = location_accuracy_copy (cur_acc);
+ *prev_pos = location_position_copy(cur_pos);
+ *prev_vel = location_velocity_copy(cur_vel);
+ *prev_acc = location_accuracy_copy(cur_acc);
- enable_signaling (obj, signals, prev_enabled, enabled, cur_pos->status);
- position_signaling (obj, signals, pos_interval, prev_pos_timestamp, boundary_list, cur_pos, cur_acc);
- velocity_signaling (obj, signals, vel_interval, prev_vel_timestamp, cur_vel, cur_acc);
+ enable_signaling(obj, signals, prev_enabled, enabled, cur_pos->status);
+ position_velocity_signaling(obj, signals, pos_interval, vel_interval, loc_interval, prev_pos_timestamp, prev_vel_timestamp, prev_loc_timestamp, boundary_list, cur_pos, cur_vel, cur_acc);
}
void
satellite_signaling(LocationObject *obj,
- guint32 signals[LAST_SIGNAL],
- gboolean *prev_enabled,
- int interval,
- gboolean emit,
- guint *updated_timestamp,
- LocationSatellite **prev_sat,
- LocationSatellite *sat)
+ guint32 signals[LAST_SIGNAL],
+ gboolean *prev_enabled,
+ int interval,
+ gboolean emit,
+ guint *updated_timestamp,
+ LocationSatellite **prev_sat,
+ LocationSatellite *sat)
{
g_return_if_fail(obj);
g_return_if_fail(signals);
if (!sat->timestamp) return;
- if (*prev_sat) location_satellite_free (*prev_sat);
- *prev_sat = location_satellite_copy (sat);
+ if (*prev_sat) location_satellite_free(*prev_sat);
+ *prev_sat = location_satellite_copy(sat);
if (emit && sat->timestamp - *updated_timestamp >= interval) {
- LOCATION_LOGD("SATELLITE SERVICE_UPDATED");
- g_signal_emit(obj, signals[SERVICE_UPDATED], 0, SATELLITE_UPDATED, sat, NULL);
+ g_signal_emit(obj, signals[SERVICE_UPDATED], 0, SATELLITE_UPDATED, sat, NULL, NULL);
*updated_timestamp = sat->timestamp;
}
-}
\ No newline at end of file
+}
+
G_BEGIN_DECLS
-void enable_signaling (LocationObject *obj, guint32 signals[LAST_SIGNAL], gboolean *prev_enabled, gboolean enabled, LocationStatus status);
+void enable_signaling(LocationObject *obj, guint32 signals[LAST_SIGNAL], gboolean *prev_enabled, gboolean enabled, LocationStatus status);
-void position_signaling (LocationObject *obj, guint32 signals[LAST_SIGNAL],
- int interval, guint *updated_interval,
- GList *prev_bound, LocationPosition *pos, LocationAccuracy *acc);
-
-void velocity_signaling (LocationObject* obj, guint32 signals[LAST_SIGNAL],
- int interval, guint *updated_timestamp,
- LocationVelocity *vel, LocationAccuracy *acc);
+void position_velocity_signaling(LocationObject *obj, guint32 signals[LAST_SIGNAL],
+ guint pos_interval, guint vel_interval, guint loc_interval,
+ guint *pos_updated_timestamp, guint *vel_updated_timestamp, guint *loc_updated_timestamp,
+ GList *prev_bound, LocationPosition *pos, LocationVelocity *vel, LocationAccuracy *acc);
void satellite_signaling(LocationObject *obj, guint32 signals[LAST_SIGNAL],
- gboolean *prev_enabled, int interval, gboolean emit,
- guint *updated_timestamp, LocationSatellite **pre_sat,
- LocationSatellite *sat);
-
-void location_signaling (LocationObject *obj, guint32 signals[LAST_SIGNAL],
- gboolean enabled, GList *boundary_list,
- LocationPosition *cur_pos, LocationVelocity *cur_vel, LocationAccuracy *cur_acc,
- guint pos_interval, guint vel_interval,
- gboolean *prev_enabled, guint *prev_pos_timestamp, guint *prev_vel_timestamp,
- LocationPosition **prev_pos, LocationVelocity **prev_vel, LocationAccuracy **prev_acc);
+ gboolean *prev_enabled, int interval, gboolean emit,
+ guint *updated_timestamp, LocationSatellite **pre_sat,
+ LocationSatellite *sat);
+
+void location_signaling(LocationObject *obj, guint32 signals[LAST_SIGNAL],
+ gboolean enabled, GList *boundary_list,
+ LocationPosition *cur_pos, LocationVelocity *cur_vel, LocationAccuracy *cur_acc,
+ guint pos_interval, guint vel_interval, guint loc_interval,
+ gboolean *prev_enabled, guint *prev_pos_timestamp, guint *prev_vel_timestamp, guint *prev_loc_timestamp,
+ LocationPosition **prev_pos, LocationVelocity **prev_vel, LocationAccuracy **prev_acc);
+
+void distance_based_position_signaling(LocationObject *obj, guint32 signals[LAST_SIGNAL],
+ gboolean enabled,
+ LocationPosition *cur_pos, LocationVelocity *cur_vel, LocationAccuracy *cur_acc,
+ guint min_interval, gdouble min_distance, gboolean *prev_enabled, guint *prev_dist_timestamp,
+ LocationPosition **prev_pos, LocationVelocity **prev_vel, LocationAccuracy **prev_acc);
G_END_DECLS
#include "location-log.h"
GType
-location_velocity_get_type (void)
+location_velocity_get_type(void)
{
static volatile gsize type_volatile = 0;
- if(g_once_init_enter(&type_volatile)) {
- GType type = g_boxed_type_register_static (
- g_intern_static_string ("LocationVelocity"),
- (GBoxedCopyFunc) location_velocity_copy,
- (GBoxedFreeFunc) location_velocity_free);
+ if (g_once_init_enter(&type_volatile)) {
+ GType type = g_boxed_type_register_static(
+ g_intern_static_string("LocationVelocity"),
+ (GBoxedCopyFunc) location_velocity_copy,
+ (GBoxedFreeFunc) location_velocity_free);
g_once_init_leave(&type_volatile, type);
}
return type_volatile;
}
-EXPORT_API LocationVelocity*
-location_velocity_new (guint timestamp,
- gdouble speed,
- gdouble direction,
- gdouble climb)
+EXPORT_API LocationVelocity *
+location_velocity_new(guint timestamp,
+ gdouble speed,
+ gdouble direction,
+ gdouble climb)
{
- LocationVelocity* velocity = g_slice_new0(LocationVelocity);
+ LocationVelocity *velocity = g_slice_new0(LocationVelocity);
+ g_return_val_if_fail(velocity, NULL);
+
velocity->timestamp = timestamp;
velocity->speed = speed;
velocity->direction = direction;
}
EXPORT_API void
-location_velocity_free (LocationVelocity* velocity)
+location_velocity_free(LocationVelocity *velocity)
{
g_return_if_fail(velocity);
g_slice_free(LocationVelocity, velocity);
}
EXPORT_API gboolean
-location_velocity_equal (const LocationVelocity *velocity1, const LocationVelocity *velocity2)
+location_velocity_equal(const LocationVelocity *velocity1, const LocationVelocity *velocity2)
{
g_return_val_if_fail(velocity1, FALSE);
g_return_val_if_fail(velocity2, FALSE);
if (velocity1->timestamp == velocity2->timestamp &&
- velocity1->speed == velocity2->speed &&
- velocity1->direction == velocity2->direction &&
- velocity1->climb == velocity2->climb)
+ velocity1->speed == velocity2->speed &&
+ velocity1->direction == velocity2->direction &&
+ velocity1->climb == velocity2->climb)
return TRUE;
return FALSE;
}
-EXPORT_API LocationVelocity*
-location_velocity_copy (const LocationVelocity *velocity)
+EXPORT_API LocationVelocity *
+location_velocity_copy(const LocationVelocity *velocity)
{
g_return_val_if_fail(velocity, NULL);
LocationVelocity *new_velocity = NULL;
new_velocity = location_velocity_new(velocity->timestamp,
- velocity->speed,
- velocity->direction,
- velocity->climb);
+ velocity->speed,
+ velocity->direction,
+ velocity->climb);
return new_velocity;
}
* Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
+ * Genie Kim <daejins.kim@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
G_BEGIN_DECLS
-GType location_velocity_get_type (void);
-#define LOCATION_TYPE_VELOCITY (location_velocity_get_type ())
+GType location_velocity_get_type(void);
+#define LOCATION_TYPE_VELOCITY (location_velocity_get_type ())
/**
* @file location-velocity.h
/**
* @brief This represents velocity information such as as speed, direction, climb.
*/
-struct _LocationVelocity
-{
- guint timestamp; ///< Time stamp.
- gdouble speed; ///< The speed over ground. (km/h)
- gdouble direction; ///< The course made in degrees relative to true north. The value is always in the range [0.0, 360.0] degree.
- gdouble climb; ///< The vertical speed. (km/h)
+struct _LocationVelocity {
+ guint timestamp; /*/< Time stamp. */
+ gdouble speed; /*/< The speed over ground. (km/h) */
+ gdouble direction; /*/< The course made in degrees relative to true north. The value is always in the range [0.0, 360.0] degree. */
+ gdouble climb; /*/< The vertical speed. (km/h) */
};
/**
- * @brief Create a new #LocationVelocity with given information.
+ * @brief Create a new #LocationVelocity with given information.
* @remarks None.
- * @pre #location_init should be called before.\n
- * @post None.
- * @param [in] timestamp - Time stamp.
- * @param [in] speed - The speed over ground. (km/h)
- * @param [in] direction - The course made in degrees relative to true north. The value is always in the range [0.0, 360.0] degree.
- * @param [in] climb - The vertical speed. (km/h)
+ * @pre #location_init should be called before.\n
+ * @post None.
+ * @param [in] timestamp - Time stamp.
+ * @param [in] speed - The speed over ground. (km/h)
+ * @param [in] direction - The course made in degrees relative to true north. The value is always in the range [0.0, 360.0] degree.
+ * @param [in] climb - The vertical speed. (km/h)
* @return a new #LocationVelocity
* @retval NULL if error occured
*/
-LocationVelocity *location_velocity_new (guint timestamp, gdouble speed, gdouble direction, gdouble climb);
+LocationVelocity *location_velocity_new(guint timestamp, gdouble speed, gdouble direction, gdouble climb);
/**
- * @brief Free a #LocationVelocity.
+ * @brief Free a #LocationVelocity.
* @remarks None.
- * @pre #location_init should be called before.\n
- * @post None.
+ * @pre #location_init should be called before.\n
+ * @post None.
* @param [in] velocity - a #LocationVelocity.
* @return None.
*/
-void location_velocity_free (LocationVelocity *velocity);
+void location_velocity_free(LocationVelocity *velocity);
/**
- * @brief Compares two velocities for equality, returning TRUE if they are equal.
+ * @brief Compares two velocities for equality, returning TRUE if they are equal.
* @remarks None.
- * @pre #location_init should be called before.\n
- * @post None.
- * @param [in] velocity1 - a #LocationVelocity
- * @param [in] velocity2 - a #LocationVelocity
+ * @pre #location_init should be called before.\n
+ * @post None.
+ * @param [in] velocity1 - a #LocationVelocity
+ * @param [in] velocity2 - a #LocationVelocity
* @return gboolean
* @retval\n
* TRUE - if equal\n
* FALSE - if not equal\n
*/
-gboolean location_velocity_equal (const LocationVelocity *velocity1, const LocationVelocity *velocity2);
+gboolean location_velocity_equal(const LocationVelocity *velocity1, const LocationVelocity *velocity2);
/**
- * @brief Makes a copy of #LocationVelocity
+ * @brief Makes a copy of #LocationVelocity
* @remarks None.
- * @pre #location_init should be called before.\n
- * @post None.
- * @param [in] velocity - a #LocationVelocity
+ * @pre #location_init should be called before.\n
+ * @post None.
+ * @param [in] velocity - a #LocationVelocity
* @return a new #LocationVelocity
* @retval NULL if error occured
*/
-LocationVelocity *location_velocity_copy (const LocationVelocity *velocity);
+LocationVelocity *location_velocity_copy(const LocationVelocity *velocity);
/**
* @} @}
* Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
+ * Genie Kim <daejins.kim@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include "location-ielement.h"
#include "location-signaling-util.h"
#include "location-common-util.h"
+#include "location-privacy.h"
+
+#include <vconf-internal-location-keys.h>
+
/*
* forward definitions
*/
typedef struct _LocationWpsPrivate {
- LocationWpsMod* mod;
- gboolean is_started;
- gboolean set_noti;
- gboolean enabled;
- guint pos_updated_timestamp;
- guint pos_interval;
- guint vel_updated_timestamp;
- guint vel_interval;
- LocationPosition *pos;
- LocationVelocity *vel;
- LocationAccuracy *acc;
- GList *boundary_list;
+ LocationWpsMod *mod;
+ GMutex mutex;
+ gboolean is_started;
+ guint app_type;
+ gboolean set_noti;
+ gboolean enabled;
+ guint pos_updated_timestamp;
+ guint pos_interval;
+ guint vel_updated_timestamp;
+ guint vel_interval;
+ guint loc_updated_timestamp;
+ guint loc_interval;
+ guint loc_timeout;
+ guint dist_updated_timestamp;
+ guint min_interval;
+ gdouble min_distance;
+ LocationPosition *pos;
+ LocationVelocity *vel;
+ LocationAccuracy *acc;
+ GList *boundary_list;
} LocationWpsPrivate;
enum {
- PROP_0,
- PROP_METHOD_TYPE,
- PROP_IS_STARTED,
- PROP_LAST_POSITION,
- PROP_POS_INTERVAL,
- PROP_VEL_INTERVAL,
- PROP_BOUNDARY,
- PROP_REMOVAL_BOUNDARY,
- PROP_MAX
+ PROP_0,
+ PROP_METHOD_TYPE,
+ PROP_IS_STARTED,
+ PROP_LAST_POSITION,
+ PROP_POS_INTERVAL,
+ PROP_VEL_INTERVAL,
+ PROP_BOUNDARY,
+ PROP_REMOVAL_BOUNDARY,
+ PROP_MIN_INTERVAL,
+ PROP_MIN_DISTANCE,
+ PROP_MAX
};
static guint32 signals[LAST_SIGNAL] = {0, };
#define GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), LOCATION_TYPE_WPS, LocationWpsPrivate))
-static void location_ielement_interface_init (LocationIElementInterface *iface);
+static void location_ielement_interface_init(LocationIElementInterface *iface);
-G_DEFINE_TYPE_WITH_CODE (LocationWps, location_wps, G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE (LOCATION_TYPE_IELEMENT,
- location_ielement_interface_init));
+G_DEFINE_TYPE_WITH_CODE(LocationWps, location_wps, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE(LOCATION_TYPE_IELEMENT,
+ location_ielement_interface_init));
static void
__reset_pos_data_from_priv(LocationWpsPrivate *priv)
location_accuracy_free(priv->acc);
priv->acc = NULL;
}
+ priv->pos_updated_timestamp = 0;
+ priv->vel_updated_timestamp = 0;
+}
+
+static gboolean
+__get_started(gpointer self)
+{
+ LocationWpsPrivate *priv = GET_PRIVATE(self);
+ g_return_val_if_fail(priv, FALSE);
+
+ return priv->is_started;
+}
+
+static int
+__set_started(gpointer self, gboolean started)
+{
+ LocationWpsPrivate *priv = GET_PRIVATE(self);
+ g_return_val_if_fail(priv, -1);
+
+ if (priv->is_started != started) {
+ g_mutex_lock(&priv->mutex);
+ priv->is_started = started;
+ g_mutex_unlock(&priv->mutex);
+ }
+
+ return 0;
}
static void
-wps_status_cb (gboolean enabled,
- LocationStatus status,
- gpointer self)
+wps_status_cb(gboolean enabled,
+ LocationStatus status,
+ gpointer self)
{
LOCATION_LOGD("wps_status_cb");
g_return_if_fail(self);
- LocationWpsPrivate* priv = GET_PRIVATE(self);
+ LocationWpsPrivate *priv = GET_PRIVATE(self);
+ g_return_if_fail(priv);
if (priv->enabled == TRUE && enabled == FALSE) {
+ __set_started(self, FALSE);
enable_signaling(self, signals, &(priv->enabled), enabled, status);
}
}
static void
-wps_location_cb (gboolean enabled,
- LocationPosition *pos,
- LocationVelocity *vel,
- LocationAccuracy *acc,
- gpointer self)
+wps_location_cb(gboolean enabled,
+ LocationPosition *pos,
+ LocationVelocity *vel,
+ LocationAccuracy *acc,
+ gpointer self)
{
- LOCATION_LOGD("wps_location_cb");
g_return_if_fail(self);
g_return_if_fail(pos);
g_return_if_fail(vel);
g_return_if_fail(acc);
- LocationWpsPrivate* priv = GET_PRIVATE(self);
+ LocationWpsPrivate *priv = GET_PRIVATE(self);
+ g_return_if_fail(priv);
+ if (priv->min_interval != LOCATION_UPDATE_INTERVAL_NONE) {
+ distance_based_position_signaling(self,
+ signals,
+ enabled,
+ pos,
+ vel,
+ acc,
+ priv->min_interval,
+ priv->min_distance,
+ &(priv->enabled),
+ &(priv->dist_updated_timestamp),
+ &(priv->pos),
+ &(priv->vel),
+ &(priv->acc));
+ }
location_signaling(self,
- signals,
- enabled,
- priv->boundary_list,
- pos,
- vel,
- acc,
- priv->pos_interval,
- priv->vel_interval,
- &(priv->enabled),
- &(priv->pos_updated_timestamp),
- &(priv->vel_updated_timestamp),
- &(priv->pos),
- &(priv->vel),
- &(priv->acc));
+ signals,
+ enabled,
+ priv->boundary_list,
+ pos,
+ vel,
+ acc,
+ priv->pos_interval,
+ priv->vel_interval,
+ priv->loc_interval,
+ &(priv->enabled),
+ &(priv->pos_updated_timestamp),
+ &(priv->vel_updated_timestamp),
+ &(priv->loc_updated_timestamp),
+ &(priv->pos),
+ &(priv->vel),
+ &(priv->acc));
}
static void
location_setting_wps_cb(keynode_t *key,
- gpointer self)
+ gpointer self)
{
LOCATION_LOGD("location_setting_wps_cb");
g_return_if_fail(key);
g_return_if_fail(self);
- LocationWpsPrivate* priv = GET_PRIVATE(self);
- g_return_if_fail (priv->mod);
- g_return_if_fail (priv->mod->handler);
+ LocationWpsPrivate *priv = GET_PRIVATE(self);
+ g_return_if_fail(priv);
+ g_return_if_fail(priv->mod);
+ g_return_if_fail(priv->mod->handler);
int ret = LOCATION_ERROR_NONE;
if (location_setting_get_key_val(key) == 0) {
- if (priv->mod->ops.stop && priv->is_started) {
+ if (priv->mod->ops.stop && __get_started(self)) {
+ __set_started(self, FALSE);
ret = priv->mod->ops.stop(priv->mod->handler);
if (ret == LOCATION_ERROR_NONE) {
- priv->is_started = FALSE;
__reset_pos_data_from_priv(priv);
}
}
- }
- else {
- if (1 == location_setting_get_int(VCONFKEY_LOCATION_NETWORK_ENABLED) && priv->mod->ops.start && !priv->is_started) {
+ } else {
+ if (1 == location_setting_get_int(VCONFKEY_LOCATION_NETWORK_ENABLED) && priv->mod->ops.start && !__get_started(self)) {
LOCATION_LOGD("location resumed by setting");
- ret = priv->mod->ops.start (priv->mod->handler, wps_status_cb, wps_location_cb, NULL, self);
- if (ret == LOCATION_ERROR_NONE) {
- priv->is_started = TRUE;
+ __set_started(self, TRUE);
+ ret = priv->mod->ops.start(priv->mod->handler, wps_status_cb, wps_location_cb, NULL, self);
+ if (ret != LOCATION_ERROR_NONE) {
+ __set_started(self, FALSE);
+ LOCATION_LOGD("Fail to start. Error[%d]", ret);
}
}
}
}
static int
-location_wps_start (LocationWps *self)
+location_wps_start(LocationWps *self)
{
LOCATION_LOGD("location_wps_start");
- LocationWpsPrivate* priv = GET_PRIVATE(self);
- g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (priv->mod->ops.start, LOCATION_ERROR_NOT_AVAILABLE);
+ LocationWpsPrivate *priv = GET_PRIVATE(self);
+ g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod->ops.start, LOCATION_ERROR_NOT_AVAILABLE);
- if (priv->is_started == TRUE) return LOCATION_ERROR_NONE;
+ if (__get_started(self) == TRUE) return LOCATION_ERROR_NONE;
int ret = LOCATION_ERROR_NONE;
if (!location_setting_get_int(VCONFKEY_LOCATION_NETWORK_ENABLED)) {
ret = LOCATION_ERROR_SETTING_OFF;
} else {
- ret = priv->mod->ops.start (priv->mod->handler, wps_status_cb, wps_location_cb, NULL, self);
- if (ret == LOCATION_ERROR_NONE) {
- priv->is_started = TRUE;
- }
- else {
+ __set_started(self, TRUE);
+ ret = priv->mod->ops.start(priv->mod->handler, wps_status_cb, wps_location_cb, NULL, self);
+ if (ret != LOCATION_ERROR_NONE) {
+ __set_started(self, FALSE);
+ LOCATION_LOGE("Fail to start wps. Error[%d]", ret);
return ret;
}
}
- if (priv->set_noti == FALSE) {
- location_setting_add_notify (VCONFKEY_LOCATION_NETWORK_ENABLED, location_setting_wps_cb, self);
+ if (priv->app_type != CPPAPP && priv->set_noti == FALSE) {
+ location_setting_add_notify(VCONFKEY_LOCATION_NETWORK_ENABLED, location_setting_wps_cb, self);
priv->set_noti = TRUE;
}
}
static int
-location_wps_stop (LocationWps *self)
+location_wps_stop(LocationWps *self)
{
LOCATION_LOGD("location_wps_stop");
- LocationWpsPrivate* priv = GET_PRIVATE(self);
- g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (priv->mod->ops.stop, LOCATION_ERROR_NOT_AVAILABLE);
+ LocationWpsPrivate *priv = GET_PRIVATE(self);
+ g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod->ops.stop, LOCATION_ERROR_NOT_AVAILABLE);
int ret = LOCATION_ERROR_NONE;
- if (priv->is_started == TRUE) {
- ret = priv->mod->ops.stop (priv->mod->handler);
- if (ret == LOCATION_ERROR_NONE) {
- priv->is_started = FALSE;
- }
- else {
+ if (__get_started(self) == TRUE) {
+ __set_started(self, FALSE);
+ ret = priv->mod->ops.stop(priv->mod->handler);
+ if (ret != LOCATION_ERROR_NONE) {
LOCATION_LOGD("Failed to stop. Error[%d]", ret);
}
}
- if (priv->set_noti == TRUE) {
- location_setting_ignore_notify (VCONFKEY_LOCATION_NETWORK_ENABLED, location_setting_wps_cb);
+ if (priv->app_type != CPPAPP && priv->set_noti == TRUE) {
+ location_setting_ignore_notify(VCONFKEY_LOCATION_NETWORK_ENABLED, location_setting_wps_cb);
priv->set_noti = FALSE;
}
}
static void
-location_wps_dispose (GObject *gobject)
+location_wps_dispose(GObject *gobject)
{
LOCATION_LOGD("location_wps_dispose");
- LocationWpsPrivate* priv = GET_PRIVATE(gobject);
- if (priv->set_noti == TRUE) {
- location_setting_ignore_notify (VCONFKEY_LOCATION_NETWORK_ENABLED, location_setting_wps_cb);
+ LocationWpsPrivate *priv = GET_PRIVATE(gobject);
+ g_return_if_fail(priv);
+
+ g_mutex_clear(&priv->mutex);
+ if (priv->app_type != CPPAPP && priv->set_noti == TRUE) {
+ location_setting_ignore_notify(VCONFKEY_LOCATION_NETWORK_ENABLED, location_setting_wps_cb);
priv->set_noti = FALSE;
}
- G_OBJECT_CLASS (location_wps_parent_class)->dispose (gobject);
+ G_OBJECT_CLASS(location_wps_parent_class)->dispose(gobject);
}
static void
-location_wps_finalize (GObject *gobject)
+location_wps_finalize(GObject *gobject)
{
LOCATION_LOGD("location_wps_finalize");
- LocationWpsPrivate* priv = GET_PRIVATE(gobject);
+ LocationWpsPrivate *priv = GET_PRIVATE(gobject);
+ g_return_if_fail(priv);
module_free(priv->mod, "wps");
if (priv->boundary_list) {
- g_list_free_full (priv->boundary_list, free_boundary_list);
+ g_list_free_full(priv->boundary_list, free_boundary_list);
priv->boundary_list = NULL;
}
location_accuracy_free(priv->acc);
priv->acc = NULL;
}
- G_OBJECT_CLASS (location_wps_parent_class)->finalize (gobject);
+ G_OBJECT_CLASS(location_wps_parent_class)->finalize(gobject);
}
static void
-location_wps_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
+location_wps_set_property(GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- LocationWpsPrivate* priv = GET_PRIVATE(object);
+ LocationWpsPrivate *priv = GET_PRIVATE(object);
+ g_return_if_fail(priv);
int ret = 0;
- switch (property_id){
- case PROP_BOUNDARY:{
- GList *boundary_list = (GList *)g_list_copy(g_value_get_pointer(value));
- ret = set_prop_boundary(&priv->boundary_list, boundary_list);
- if(ret != 0) LOCATION_LOGD("Set boundary. Error[%d]", ret);
+ switch (property_id) {
+ case PROP_BOUNDARY: {
+ GList *boundary_list = (GList *)g_list_copy(g_value_get_pointer(value));
+ ret = set_prop_boundary(&priv->boundary_list, boundary_list);
+ if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Set boundary. Error[%d]", ret);
+ if (boundary_list) g_list_free(boundary_list);
break;
- }
+ }
case PROP_REMOVAL_BOUNDARY: {
- LocationBoundary *req_boundary = (LocationBoundary*) g_value_dup_boxed(value);
- ret = set_prop_removal_boundary(&priv->boundary_list, req_boundary);
- if(ret != 0) LOCATION_LOGD("Set removal boundary. Error[%d]", ret);
+ LocationBoundary *req_boundary = (LocationBoundary *) g_value_dup_boxed(value);
+ ret = set_prop_removal_boundary(&priv->boundary_list, req_boundary);
+ if (ret != 0) LOCATION_LOGD("Set removal boundary. Error[%d]", ret);
break;
- }
- case PROP_POS_INTERVAL: {
- guint interval = g_value_get_uint(value);
- if(interval > 0) {
- if(interval < LOCATION_UPDATE_INTERVAL_MAX)
- priv->pos_interval = interval;
- else
- priv->pos_interval = (guint)LOCATION_UPDATE_INTERVAL_MAX;
}
- else
- priv->pos_interval = (guint)LOCATION_UPDATE_INTERVAL_DEFAULT;
+ case PROP_POS_INTERVAL: {
+ guint interval = g_value_get_uint(value);
+ if (interval > 0) {
+ if (interval < LOCATION_UPDATE_INTERVAL_MAX)
+ priv->pos_interval = interval;
+ else
+ priv->pos_interval = (guint)LOCATION_UPDATE_INTERVAL_MAX;
+ } else
+ priv->pos_interval = (guint)LOCATION_UPDATE_INTERVAL_DEFAULT;
- break;
- }
+ break;
+ }
case PROP_VEL_INTERVAL: {
- guint interval = g_value_get_uint(value);
- if(interval > 0) {
- if(interval < LOCATION_UPDATE_INTERVAL_MAX)
- priv->vel_interval = interval;
- else
- priv->vel_interval = (guint)LOCATION_UPDATE_INTERVAL_MAX;
+ guint interval = g_value_get_uint(value);
+ if (interval > 0) {
+ if (interval < LOCATION_UPDATE_INTERVAL_MAX)
+ priv->vel_interval = interval;
+ else
+ priv->vel_interval = (guint)LOCATION_UPDATE_INTERVAL_MAX;
+ } else {
+ priv->vel_interval = (guint)LOCATION_UPDATE_INTERVAL_DEFAULT;
+ }
+ break;
}
- else {
- priv->vel_interval = (guint)LOCATION_UPDATE_INTERVAL_DEFAULT;
+ case PROP_MIN_INTERVAL: {
+ guint interval = g_value_get_uint(value);
+ LOCATION_LOGD("Set prop>> update-min-interval: %u", interval);
+ if (interval > 0) {
+ if (interval < LOCATION_MIN_INTERVAL_MAX)
+ priv->min_interval = interval;
+ else
+ priv->min_interval = (guint)LOCATION_MIN_INTERVAL_MAX;
+ } else
+ priv->min_interval = (guint)LOCATION_MIN_INTERVAL_DEFAULT;
+
+ break;
+ }
+ case PROP_MIN_DISTANCE: {
+ gdouble distance = g_value_get_double(value);
+ LOCATION_LOGD("Set prop>> update-min-distance: %u", distance);
+ if (distance > 0) {
+ if (distance < LOCATION_MIN_DISTANCE_MAX)
+ priv->min_distance = distance;
+ else
+ priv->min_distance = (gdouble)LOCATION_MIN_DISTANCE_MAX;
+ } else
+ priv->min_distance = (gdouble)LOCATION_MIN_DISTANCE_DEFAULT;
+
+ break;
}
- break;
- }
default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
break;
}
}
static void
-location_wps_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
+location_wps_get_property(GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- LocationWpsPrivate *priv = GET_PRIVATE (object);
+ LocationWpsPrivate *priv = GET_PRIVATE(object);
+ g_return_if_fail(priv);
- switch (property_id){
+ switch (property_id) {
case PROP_METHOD_TYPE:
g_value_set_int(value, LOCATION_METHOD_WPS);
break;
case PROP_IS_STARTED:
- g_value_set_boolean(value, priv->is_started);
+ g_value_set_boolean(value, __get_started(object));
break;
case PROP_LAST_POSITION:
- g_value_set_boxed (value, priv->pos);
+ g_value_set_boxed(value, priv->pos);
break;
case PROP_BOUNDARY:
g_value_set_pointer(value, g_list_first(priv->boundary_list));
case PROP_VEL_INTERVAL:
g_value_set_uint(value, priv->vel_interval);
break;
+ case PROP_MIN_INTERVAL:
+ g_value_set_uint(value, priv->min_interval);
+ break;
+ case PROP_MIN_DISTANCE:
+ g_value_set_double(value, priv->min_distance);
+ break;
default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
break;
}
}
static int
-location_wps_get_position (LocationWps *self,
- LocationPosition **position,
- LocationAccuracy **accuracy)
+location_wps_get_position(LocationWps *self,
+ LocationPosition **position,
+ LocationAccuracy **accuracy)
{
int ret = LOCATION_ERROR_NOT_AVAILABLE;
- LOCATION_LOGD("location_wps_get_position");
- LocationWpsPrivate *priv = GET_PRIVATE (self);
- g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
+ LocationWpsPrivate *priv = GET_PRIVATE(self);
+ g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
setting_retval_if_fail(VCONFKEY_LOCATION_NETWORK_ENABLED);
-
- if (priv->is_started != TRUE) {
- LOCATION_LOGD("location is not started");
+
+ if (__get_started(self) != TRUE) {
+ LOCATION_LOGE("location is not started");
return LOCATION_ERROR_NOT_AVAILABLE;
}
if (priv->pos) {
- *position = location_position_copy (priv->pos);
+ *position = location_position_copy(priv->pos);
if (priv->acc) *accuracy = location_accuracy_copy(priv->acc);
else *accuracy = location_accuracy_new(LOCATION_ACCURACY_LEVEL_NONE, 0.0, 0.0);
ret = LOCATION_ERROR_NONE;
}
static int
-location_wps_get_position_ext (LocationWps *self,
- LocationPosition **position,
- LocationVelocity **velocity,
- LocationAccuracy **accuracy)
+location_wps_get_position_ext(LocationWps *self,
+ LocationPosition **position,
+ LocationVelocity **velocity,
+ LocationAccuracy **accuracy)
{
int ret = LOCATION_ERROR_NOT_AVAILABLE;
- LOCATION_LOGD("location_wps_get_position_ext");
- LocationWpsPrivate *priv = GET_PRIVATE (self);
- g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
+ LocationWpsPrivate *priv = GET_PRIVATE(self);
+ g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
setting_retval_if_fail(VCONFKEY_LOCATION_NETWORK_ENABLED);
- if (priv->is_started != TRUE) {
- LOCATION_LOGD("location is not started");
+ if (__get_started(self) != TRUE) {
+ LOCATION_LOGE("location is not started");
return LOCATION_ERROR_NOT_AVAILABLE;
}
if (priv->pos && priv->vel) {
- *position = location_position_copy (priv->pos);
- *velocity = location_velocity_copy (priv->vel);
+ *position = location_position_copy(priv->pos);
+ *velocity = location_velocity_copy(priv->vel);
if (priv->acc) *accuracy = location_accuracy_copy(priv->acc);
else *accuracy = location_accuracy_new(LOCATION_ACCURACY_LEVEL_NONE, 0.0, 0.0);
ret = LOCATION_ERROR_NONE;
static int
-location_wps_get_last_position (LocationWps *self,
- LocationPosition **position,
- LocationAccuracy **accuracy)
+location_wps_get_last_position(LocationWps *self,
+ LocationPosition **position,
+ LocationAccuracy **accuracy)
{
- LOCATION_LOGD("location_wps_get_last_position");
-
- LocationWpsPrivate *priv = GET_PRIVATE (self);
- g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
+ LocationWpsPrivate *priv = GET_PRIVATE(self);
+ g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
+ setting_retval_if_fail(VCONFKEY_LOCATION_NETWORK_ENABLED);
int ret = LOCATION_ERROR_NONE;
LocationVelocity *_velocity = NULL;
LocModWpsOps ops = priv->mod->ops;
- g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (ops.get_last_position, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(ops.get_last_position, LOCATION_ERROR_NOT_AVAILABLE);
ret = ops.get_last_position(priv->mod->handler, position, &_velocity, accuracy);
if (_velocity) location_velocity_free(_velocity);
}
static int
-location_wps_get_last_position_ext (LocationWps *self,
- LocationPosition **position,
- LocationVelocity **velocity,
- LocationAccuracy **accuracy)
+location_wps_get_last_position_ext(LocationWps *self,
+ LocationPosition **position,
+ LocationVelocity **velocity,
+ LocationAccuracy **accuracy)
{
- LOCATION_LOGD("location_wps_get_last_position_ext");
-
- LocationWpsPrivate *priv = GET_PRIVATE (self);
- g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
+ LocationWpsPrivate *priv = GET_PRIVATE(self);
+ g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
+ setting_retval_if_fail(VCONFKEY_LOCATION_NETWORK_ENABLED);
LocModWpsOps ops = priv->mod->ops;
- g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (ops.get_last_position, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(ops.get_last_position, LOCATION_ERROR_NOT_AVAILABLE);
return ops.get_last_position(priv->mod->handler, position, velocity, accuracy);
}
static int
-location_wps_get_velocity (LocationWps *self,
- LocationVelocity **velocity,
- LocationAccuracy **accuracy)
+location_wps_get_velocity(LocationWps *self,
+ LocationVelocity **velocity,
+ LocationAccuracy **accuracy)
{
int ret = LOCATION_ERROR_NOT_AVAILABLE;
- LOCATION_LOGD("location_wps_get_velocity");
- LocationWpsPrivate *priv = GET_PRIVATE (self);
- g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
+ LocationWpsPrivate *priv = GET_PRIVATE(self);
+ g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
setting_retval_if_fail(VCONFKEY_LOCATION_NETWORK_ENABLED);
- if (priv->is_started != TRUE) {
- LOCATION_LOGD("location is not started");
+ if (__get_started(self) != TRUE) {
+ LOCATION_LOGE("location is not started");
return LOCATION_ERROR_NOT_AVAILABLE;
}
if (priv->vel) {
- *velocity = location_velocity_copy (priv->vel);
+ *velocity = location_velocity_copy(priv->vel);
if (priv->acc) *accuracy = location_accuracy_copy(priv->acc);
else *accuracy = location_accuracy_new(LOCATION_ACCURACY_LEVEL_NONE, 0.0, 0.0);
ret = LOCATION_ERROR_NONE;
}
static int
-location_wps_get_last_velocity (LocationWps *self,
- LocationVelocity **velocity,
- LocationAccuracy **accuracy)
+location_wps_get_last_velocity(LocationWps *self,
+ LocationVelocity **velocity,
+ LocationAccuracy **accuracy)
{
- LOCATION_LOGD("location_wps_get_last_velocity");
-
- LocationWpsPrivate *priv = GET_PRIVATE (self);
- g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
+ LocationWpsPrivate *priv = GET_PRIVATE(self);
+ g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
+ setting_retval_if_fail(VCONFKEY_LOCATION_NETWORK_ENABLED);
int ret = LOCATION_ERROR_NONE;
LocationPosition *_position = NULL;
LocModWpsOps ops = priv->mod->ops;
- g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
ret = ops.get_last_position(priv->mod->handler, &_position, velocity, accuracy);
if (!_position) location_position_free(_position);
return ret;
}
+static gboolean __single_location_timeout_cb(void *data)
+{
+ LOCATION_LOGD("__single_location_timeout_cb");
+ LocationWps *self = (LocationWps *)data;
+ LocationWpsPrivate *priv = GET_PRIVATE(self);
+ g_return_val_if_fail(priv, FALSE);
+
+ LocationPosition *pos = location_position_new(0, 0.0, 0.0, 0.0, LOCATION_STATUS_NO_FIX);
+ LocationVelocity *vel = location_velocity_new(0, 0.0, 0.0, 0.0);
+ LocationAccuracy *acc = location_accuracy_new(LOCATION_ACCURACY_LEVEL_NONE, 0.0, 0.0);
+
+ if (priv->loc_timeout) g_source_remove(priv->loc_timeout);
+ priv->loc_timeout = 0;
+
+ g_signal_emit(self, signals[LOCATION_UPDATED], LOCATION_ERROR_NOT_AVAILABLE, 0, pos, vel, acc);
+ location_wps_stop(self);
+
+ return FALSE;
+}
+
+static void
+wps_single_location_cb(gboolean enabled,
+ LocationPosition *pos,
+ LocationVelocity *vel,
+ LocationAccuracy *acc,
+ gpointer self)
+{
+ LOCATION_LOGD("wps_single_location_cb");
+ g_return_if_fail(self);
+ g_return_if_fail(pos);
+ g_return_if_fail(vel);
+ g_return_if_fail(acc);
+
+ LocationWpsPrivate *priv = GET_PRIVATE(self);
+ g_return_if_fail(priv);
+
+ g_signal_emit(self, signals[LOCATION_UPDATED], LOCATION_ERROR_NONE, 0, pos, vel, acc);
+ if (priv->loc_timeout) {
+ g_source_remove(priv->loc_timeout);
+ priv->loc_timeout = 0;
+ }
+ location_wps_stop(self);
+}
+
static int
-location_wps_get_satellite (LocationWps *self,
- LocationSatellite **satellite)
+location_wps_request_single_location(LocationWps *self, int timeout)
+{
+ LOCATION_LOGD("location_wps_request_single_location");
+ LocationWpsPrivate *priv = GET_PRIVATE(self);
+ g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod->ops.start, LOCATION_ERROR_NOT_AVAILABLE);
+
+ if (__get_started(self) == TRUE) return LOCATION_ERROR_NONE;
+
+ int ret = LOCATION_ERROR_NONE;
+
+ __set_started(self, TRUE);
+ ret = priv->mod->ops.start(priv->mod->handler, wps_status_cb, wps_single_location_cb, NULL, self);
+ if (ret != LOCATION_ERROR_NONE) {
+ LOCATION_LOGE("Fail to start request single. Error[%d]", ret);
+ __set_started(self, FALSE);
+ return ret;
+ } else {
+ if (priv->loc_timeout != 0) {
+ g_source_remove(priv->loc_timeout);
+ }
+ priv->loc_timeout = g_timeout_add_seconds(timeout, __single_location_timeout_cb, self);
+ }
+
+ return ret;
+}
+
+static int
+location_wps_get_satellite(LocationWps *self,
+ LocationSatellite **satellite)
{
- LOCATION_LOGD("location_wps_get_satellite");
return LOCATION_ERROR_NOT_SUPPORTED;
}
static int
-location_wps_get_last_satellite (LocationWps *self,
- LocationSatellite **satellite)
+location_wps_get_last_satellite(LocationWps *self,
+ LocationSatellite **satellite)
{
- LOCATION_LOGD("location_wps_get_last_satellite");
return LOCATION_ERROR_NOT_SUPPORTED;
}
static int
-location_wps_set_option (LocationWps *self, const char *option)
+location_wps_set_option(LocationWps *self, const char *option)
{
- LOCATION_LOGD("location_wps_set_option");
- LocationWpsPrivate* priv = GET_PRIVATE(self);
- g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
- //g_return_val_if_fail (priv->mod->ops.set_option, LOCATION_ERROR_NOT_AVAILABLE);
+ LocationWpsPrivate *priv = GET_PRIVATE(self);
+ g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
return LOCATION_ERROR_NONE;
}
+static int
+location_wps_get_nmea(LocationWps *self,
+ char **nmea_data)
+{
+ return LOCATION_ERROR_NOT_SUPPORTED;
+}
+
static void
-location_ielement_interface_init (LocationIElementInterface *iface)
+location_ielement_interface_init(LocationIElementInterface *iface)
{
iface->start = (TYPE_START_FUNC)location_wps_start;
iface->stop = (TYPE_STOP_FUNC)location_wps_stop;
iface->get_satellite = (TYPE_GET_SATELLITE)location_wps_get_satellite;
iface->get_last_satellite = (TYPE_GET_SATELLITE)location_wps_get_last_satellite;
iface->set_option = (TYPE_SET_OPTION)location_wps_set_option;
+ iface->request_single_location = (TYPE_REQUEST_SINGLE_LOCATION)location_wps_request_single_location;
+ iface->get_nmea = (TYPE_GET_NMEA)location_wps_get_nmea;
}
static void
-location_wps_init (LocationWps *self)
+location_wps_init(LocationWps *self)
{
LOCATION_LOGD("location_wps_init");
- LocationWpsPrivate* priv = GET_PRIVATE(self);
+ LocationWpsPrivate *priv = GET_PRIVATE(self);
+ g_return_if_fail(priv);
- priv->mod = (LocationWpsMod*)module_new("wps");
- if(!priv->mod) LOCATION_LOGW("module loading failed");
+ priv->mod = (LocationWpsMod *)module_new("wps");
+ if (!priv->mod) LOCATION_LOGW("module loading failed");
+ g_mutex_init(&priv->mutex);
priv->is_started = FALSE;
priv->set_noti = FALSE;
- priv->enabled= FALSE;
+ priv->enabled = FALSE;
priv->pos_interval = LOCATION_UPDATE_INTERVAL_DEFAULT;
priv->vel_interval = LOCATION_UPDATE_INTERVAL_DEFAULT;
+ priv->min_interval = 0;
priv->pos_updated_timestamp = 0;
priv->vel_updated_timestamp = 0;
priv->acc = NULL;
priv->boundary_list = NULL;
+ priv->loc_timeout = 0;
+
+ priv->app_type = location_get_app_type(NULL);
+ if (priv->app_type == 0) {
+ LOCATION_LOGW("Fail to get app_type");
+ }
}
static void
-location_wps_class_init (LocationWpsClass *klass)
+location_wps_class_init(LocationWpsClass *klass)
{
LOCATION_LOGD("location_wps_class_init");
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
gobject_class->set_property = location_wps_set_property;
gobject_class->get_property = location_wps_get_property;
gobject_class->dispose = location_wps_dispose;
gobject_class->finalize = location_wps_finalize;
- g_type_class_add_private (klass, sizeof (LocationWpsPrivate));
-
- signals[SERVICE_ENABLED] = g_signal_new ("service-enabled",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST |
- G_SIGNAL_NO_RECURSE,
- G_STRUCT_OFFSET (LocationWpsClass, enabled),
- NULL, NULL,
- location_VOID__UINT,
- G_TYPE_NONE, 1,
- G_TYPE_UINT);
-
- signals[SERVICE_DISABLED] = g_signal_new ("service-disabled",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST |
- G_SIGNAL_NO_RECURSE,
- G_STRUCT_OFFSET (LocationWpsClass, disabled),
- NULL, NULL,
- location_VOID__UINT,
- G_TYPE_NONE, 1,
- G_TYPE_UINT);
-
- signals[SERVICE_UPDATED] = g_signal_new ("service-updated",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST |
- G_SIGNAL_NO_RECURSE,
- G_STRUCT_OFFSET (LocationWpsClass, updated),
- NULL, NULL,
- location_VOID__UINT_POINTER_POINTER,
- G_TYPE_NONE, 3,
- G_TYPE_UINT,
- G_TYPE_POINTER,
- G_TYPE_POINTER);
-
- signals[ZONE_IN] = g_signal_new ("zone-in",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST |
- G_SIGNAL_NO_RECURSE,
- G_STRUCT_OFFSET (LocationWpsClass, zone_in),
- NULL, NULL,
- location_VOID__POINTER_POINTER_POINTER,
- G_TYPE_NONE, 3,
- G_TYPE_POINTER,
- G_TYPE_POINTER,
- G_TYPE_POINTER);
-
- signals[ZONE_OUT] = g_signal_new ("zone-out",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST |
- G_SIGNAL_NO_RECURSE,
- G_STRUCT_OFFSET (LocationWpsClass, zone_out),
- NULL, NULL,
- location_VOID__POINTER_POINTER_POINTER,
- G_TYPE_NONE, 3,
- G_TYPE_POINTER,
- G_TYPE_POINTER,
- G_TYPE_POINTER);
-
- properties[PROP_METHOD_TYPE] = g_param_spec_int ("method",
- "method type",
- "location method type name",
- LOCATION_METHOD_WPS,
- LOCATION_METHOD_WPS,
- LOCATION_METHOD_WPS,
- G_PARAM_READABLE);
-
- properties[PROP_IS_STARTED] = g_param_spec_boolean ("is_started",
- "wps is started prop",
- "wps is started status",
- FALSE,
- G_PARAM_READWRITE);
-
- properties[PROP_LAST_POSITION] = g_param_spec_boxed ("last-position",
- "wps last position prop",
- "wps last position data",
- LOCATION_TYPE_POSITION,
- G_PARAM_READABLE);
-
- properties[PROP_POS_INTERVAL] = g_param_spec_uint ("pos-interval",
- "wps position interval prop",
- "wps position interval data",
- LOCATION_UPDATE_INTERVAL_MIN,
- LOCATION_UPDATE_INTERVAL_MAX,
- LOCATION_UPDATE_INTERVAL_DEFAULT,
- G_PARAM_READWRITE);
-
- properties[PROP_VEL_INTERVAL] = g_param_spec_uint ("vel-interval",
- "wps velocity interval prop",
- "wps velocity interval data",
- LOCATION_UPDATE_INTERVAL_MIN,
- LOCATION_UPDATE_INTERVAL_MAX,
- LOCATION_UPDATE_INTERVAL_DEFAULT,
- G_PARAM_READWRITE);
-
- properties[PROP_BOUNDARY] = g_param_spec_pointer ("boundary",
- "wps boundary prop",
- "wps boundary data",
- G_PARAM_READWRITE);
+ g_type_class_add_private(klass, sizeof(LocationWpsPrivate));
+
+ signals[SERVICE_ENABLED] = g_signal_new("service-enabled",
+ G_TYPE_FROM_CLASS(klass),
+ G_SIGNAL_RUN_FIRST |
+ G_SIGNAL_NO_RECURSE,
+ G_STRUCT_OFFSET(LocationWpsClass, enabled),
+ NULL, NULL,
+ location_VOID__UINT,
+ G_TYPE_NONE, 1,
+ G_TYPE_UINT);
+
+ signals[SERVICE_DISABLED] = g_signal_new("service-disabled",
+ G_TYPE_FROM_CLASS(klass),
+ G_SIGNAL_RUN_FIRST |
+ G_SIGNAL_NO_RECURSE,
+ G_STRUCT_OFFSET(LocationWpsClass, disabled),
+ NULL, NULL,
+ location_VOID__UINT,
+ G_TYPE_NONE, 1,
+ G_TYPE_UINT);
+
+ signals[SERVICE_UPDATED] = g_signal_new("service-updated",
+ G_TYPE_FROM_CLASS(klass),
+ G_SIGNAL_RUN_FIRST |
+ G_SIGNAL_NO_RECURSE,
+ G_STRUCT_OFFSET(LocationWpsClass, updated),
+ NULL, NULL,
+ location_VOID__UINT_POINTER_POINTER,
+ G_TYPE_NONE, 3,
+ G_TYPE_UINT,
+ G_TYPE_POINTER,
+ G_TYPE_POINTER);
+
+ signals[LOCATION_UPDATED] = g_signal_new("location-updated",
+ G_TYPE_FROM_CLASS(klass),
+ G_SIGNAL_RUN_FIRST |
+ G_SIGNAL_NO_RECURSE,
+ G_STRUCT_OFFSET(LocationWpsClass, location_updated),
+ NULL, NULL,
+ location_VOID__INT_POINTER_POINTER_POINTER,
+ G_TYPE_NONE, 4,
+ G_TYPE_INT,
+ G_TYPE_POINTER,
+ G_TYPE_POINTER,
+ G_TYPE_POINTER);
+
+ signals[ZONE_IN] = g_signal_new("zone-in",
+ G_TYPE_FROM_CLASS(klass),
+ G_SIGNAL_RUN_FIRST |
+ G_SIGNAL_NO_RECURSE,
+ G_STRUCT_OFFSET(LocationWpsClass, zone_in),
+ NULL, NULL,
+ location_VOID__POINTER_POINTER_POINTER,
+ G_TYPE_NONE, 3,
+ G_TYPE_POINTER,
+ G_TYPE_POINTER,
+ G_TYPE_POINTER);
+
+ signals[ZONE_OUT] = g_signal_new("zone-out",
+ G_TYPE_FROM_CLASS(klass),
+ G_SIGNAL_RUN_FIRST |
+ G_SIGNAL_NO_RECURSE,
+ G_STRUCT_OFFSET(LocationWpsClass, zone_out),
+ NULL, NULL,
+ location_VOID__POINTER_POINTER_POINTER,
+ G_TYPE_NONE, 3,
+ G_TYPE_POINTER,
+ G_TYPE_POINTER,
+ G_TYPE_POINTER);
+
+ properties[PROP_METHOD_TYPE] = g_param_spec_int("method",
+ "method type",
+ "location method type name",
+ LOCATION_METHOD_WPS,
+ LOCATION_METHOD_WPS,
+ LOCATION_METHOD_WPS,
+ G_PARAM_READABLE);
+
+ properties[PROP_IS_STARTED] = g_param_spec_boolean("is_started",
+ "wps is started prop",
+ "wps is started status",
+ FALSE,
+ G_PARAM_READWRITE);
+
+ properties[PROP_LAST_POSITION] = g_param_spec_boxed("last-position",
+ "wps last position prop",
+ "wps last position data",
+ LOCATION_TYPE_POSITION,
+ G_PARAM_READABLE);
+
+ properties[PROP_POS_INTERVAL] = g_param_spec_uint("pos-interval",
+ "wps position interval prop",
+ "wps position interval data",
+ LOCATION_UPDATE_INTERVAL_MIN,
+ LOCATION_UPDATE_INTERVAL_MAX,
+ LOCATION_UPDATE_INTERVAL_DEFAULT,
+ G_PARAM_READWRITE);
+
+ properties[PROP_VEL_INTERVAL] = g_param_spec_uint("vel-interval",
+ "wps velocity interval prop",
+ "wps velocity interval data",
+ LOCATION_UPDATE_INTERVAL_MIN,
+ LOCATION_UPDATE_INTERVAL_MAX,
+ LOCATION_UPDATE_INTERVAL_DEFAULT,
+ G_PARAM_READWRITE);
+
+ properties[PROP_MIN_INTERVAL] = g_param_spec_uint("min-interval",
+ "wps distance-based interval prop",
+ "wps distance-based interval data",
+ LOCATION_MIN_INTERVAL_MIN,
+ LOCATION_MIN_INTERVAL_MAX,
+ LOCATION_MIN_INTERVAL_DEFAULT,
+ G_PARAM_READWRITE);
+
+ properties[PROP_MIN_DISTANCE] = g_param_spec_double("min-distance",
+ "wps distance-based distance prop",
+ "wps distance-based distance data",
+ LOCATION_MIN_DISTANCE_MIN,
+ LOCATION_MIN_DISTANCE_MAX,
+ LOCATION_MIN_DISTANCE_DEFAULT,
+ G_PARAM_READWRITE);
+
+ properties[PROP_BOUNDARY] = g_param_spec_pointer("boundary",
+ "wps boundary prop",
+ "wps boundary data",
+ G_PARAM_READWRITE);
properties[PROP_REMOVAL_BOUNDARY] = g_param_spec_boxed("removal-boundary",
- "wps removal boundary prop",
- "wps removal boundary data",
- LOCATION_TYPE_BOUNDARY,
- G_PARAM_READWRITE);
-
- g_object_class_install_properties (gobject_class,
- PROP_MAX,
- properties);
+ "wps removal boundary prop",
+ "wps removal boundary data",
+ LOCATION_TYPE_BOUNDARY,
+ G_PARAM_READWRITE);
+
+ g_object_class_install_properties(gobject_class,
+ PROP_MAX,
+ properties);
}
* Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
+ * Genie Kim <daejins.kim@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
G_BEGIN_DECLS
-#define LOCATION_TYPE_WPS (location_wps_get_type ())
-#define LOCATION_WPS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LOCATION_TYPE_WPS, LocationWps))
-#define LOCATION_IS_WPS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LOCATION_TYPE_WPS))
-#define LOCATION_WPS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), LOCATION_TYPE_WPS, LocationWpsClass))
-#define LOCATION_IS_WPS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LOCATION_TYPE_WPS))
-#define LOCATION_WPS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), LOCATION_TYPE_WPS, LocationWpsClass))
+#define LOCATION_TYPE_WPS (location_wps_get_type ())
+#define LOCATION_WPS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LOCATION_TYPE_WPS, LocationWps))
+#define LOCATION_IS_WPS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LOCATION_TYPE_WPS))
+#define LOCATION_WPS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), LOCATION_TYPE_WPS, LocationWpsClass))
+#define LOCATION_IS_WPS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LOCATION_TYPE_WPS))
+#define LOCATION_WPS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), LOCATION_TYPE_WPS, LocationWpsClass))
-typedef struct _LocationWps LocationWps;
-typedef struct _LocationWpsClass LocationWpsClass;
+typedef struct _LocationWps LocationWps;
+typedef struct _LocationWpsClass LocationWpsClass;
-struct _LocationWps
-{
+struct _LocationWps {
GObject parent_instance;
};
-struct _LocationWpsClass
-{
+struct _LocationWpsClass {
GObjectClass parent_class;
- void (* enabled) (guint type);
- void (* disabled) (guint type);
- void (* updated) (guint type, gpointer data, gpointer accuracy);
- void (* zone_in) (gpointer boundary, gpointer position, gpointer accuracy);
- void (* zone_out) (gpointer boundary, gpointer position, gpointer accuracy);
+ void (* enabled)(guint type);
+ void (* disabled)(guint type);
+ void (* updated)(gint type, gpointer data, gpointer velocity, gpointer accuracy);
+ void (* location_updated)(gint error, gpointer position, gpointer velocity, gpointer accuracy);
+ void (* zone_in)(gpointer boundary, gpointer position, gpointer accuracy);
+ void (* zone_out)(gpointer boundary, gpointer position, gpointer accuracy);
};
-GType location_wps_get_type (void);
+GType location_wps_get_type(void);
G_END_DECLS
* Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
+ * Genie Kim <daejins.kim@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <glib.h>
#include <stdio.h>
#include <pthread.h>
-#include <dbus/dbus-glib.h>
+#include <vconf.h>
#include "location.h"
#include "location-log.h"
#include "location-gps.h"
#include "location-wps.h"
#include "location-position.h"
-#include "map-service.h"
+#include "location-privacy.h"
#include "module-internal.h"
#include "location-common-util.h"
+#define LOCATION_PRIVILEGE "http://tizen.org/privilege/location"
+#define LOCATION_ENABLE_PRIVILEGE "http://tizen.org/privilege/location.enable"
+
+typedef struct _LocationSetting {
+ LocationSettingCb callback;
+ void *user_data;
+} LocationSetting;
+
+static LocationSetting g_location_setting;
+
+static char *__convert_setting_key(LocationMethod method)
+{
+ char *key = NULL;
+ switch (method) {
+ case LOCATION_METHOD_HYBRID:
+ key = g_strdup(VCONFKEY_LOCATION_USE_MY_LOCATION);
+ break;
+ case LOCATION_METHOD_GPS:
+ key = g_strdup(VCONFKEY_LOCATION_ENABLED);
+ break;
+ case LOCATION_METHOD_WPS:
+ key = g_strdup(VCONFKEY_LOCATION_NETWORK_ENABLED);
+ break;
+ default:
+ break;
+ }
+
+ return key;
+}
+
+static LocationMethod __convert_method_from_key(const char *key)
+{
+ LocationMethod _method = LOCATION_METHOD_NONE;
+ if (g_strcmp0(key, VCONFKEY_LOCATION_USE_MY_LOCATION) == 0) {
+ _method = LOCATION_METHOD_HYBRID;
+ } else if (g_strcmp0(key, VCONFKEY_LOCATION_ENABLED) == 0) {
+ _method = LOCATION_METHOD_GPS;
+ } else if (g_strcmp0(key, VCONFKEY_LOCATION_NETWORK_ENABLED) == 0) {
+ _method = LOCATION_METHOD_WPS;
+ }
+
+ return _method;
+}
+
+static void __location_setting_cb(keynode_t *key, gpointer data)
+{
+ if (key == NULL || data == NULL) {
+ return;
+ }
+ LocationSetting *_setting = (LocationSetting *)data;
+ LocationMethod _method = LOCATION_METHOD_NONE;
+
+ if (_setting->callback) {
+ _method = __convert_method_from_key(vconf_keynode_get_name(key));
+ _setting->callback(_method, location_setting_get_key_val(key), _setting->user_data);
+ }
+}
+
+
EXPORT_API
-int location_init (void)
+int location_init(void)
{
- LOCATION_LOGD("location_init");
- g_type_init ();
+#if !GLIB_CHECK_VERSION (2, 35, 0)
+ g_type_init();
+#endif
#if !GLIB_CHECK_VERSION (2, 31, 0)
- if (!g_thread_supported()) g_thread_init (NULL);
+ if (!g_thread_supported()) g_thread_init(NULL);
#endif
- dbus_g_thread_init ();
- if( FALSE == module_init() )
+ if (FALSE == module_init())
return LOCATION_ERROR_NOT_AVAILABLE;
+ location_privacy_initialize();
+
return LOCATION_ERROR_NONE;
}
-EXPORT_API LocationObject*
-location_new (LocationMethod method)
+EXPORT_API LocationObject *
+location_new(LocationMethod method)
{
LocationObject *self = NULL;
+ LOCATION_LOGD("method: %d", method);
switch (method) {
case LOCATION_METHOD_HYBRID:
- self = g_object_new (LOCATION_TYPE_HYBRID, NULL);
+ self = g_object_new(LOCATION_TYPE_HYBRID, NULL);
break;
case LOCATION_METHOD_GPS:
- self = g_object_new (LOCATION_TYPE_GPS, NULL);
+ self = g_object_new(LOCATION_TYPE_GPS, NULL);
break;
case LOCATION_METHOD_WPS:
- self = g_object_new (LOCATION_TYPE_WPS, NULL);
+ self = g_object_new(LOCATION_TYPE_WPS, NULL);
break;
- case LOCATION_METHOD_CPS:
default:
break;
}
- if (!self) LOCATION_LOGD("Fail to create location object. Method [%d]", method);
+ if (!self) LOCATION_LOGE("Fail to create location object. Method [%d]", method);
return self;
}
EXPORT_API int
-location_free (LocationObject *obj)
+location_free(LocationObject *obj)
{
- g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
-
- g_object_unref (obj);
+ g_return_val_if_fail(obj, LOCATION_ERROR_PARAMETER);
+ location_privacy_finalize();
+ g_object_unref(obj);
return LOCATION_ERROR_NONE;
}
EXPORT_API int
-location_start (LocationObject *obj)
+location_request_single_location(LocationObject *obj, int timeout)
+{
+ g_return_val_if_fail(obj, LOCATION_ERROR_PARAMETER);
+
+ int ret = LOCATION_ERROR_NONE;
+ ret = location_get_privacy(LOCATION_PRIVILEGE);
+ if (ret != LOCATION_ERROR_NONE) {
+ LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
+ return LOCATION_ERROR_NOT_ALLOWED;
+ }
+
+ ret = location_ielement_request_single_location(LOCATION_IELEMENT(obj), timeout);
+ if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to request single location. Error [%d]", ret);
+
+ return ret;
+}
+
+EXPORT_API int
+location_start(LocationObject *obj)
+{
+ g_return_val_if_fail(obj, LOCATION_ERROR_PARAMETER);
+
+ int ret = LOCATION_ERROR_NONE;
+ ret = location_get_privacy(LOCATION_PRIVILEGE);
+ if (ret != LOCATION_ERROR_NONE) {
+ LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
+ return LOCATION_ERROR_NOT_ALLOWED;
+ }
+
+ ret = location_ielement_start(LOCATION_IELEMENT(obj));
+ if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to start. Error [%d]", ret);
+
+ return ret;
+}
+
+EXPORT_API int
+location_stop(LocationObject *obj)
{
- g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (G_OBJECT_TYPE(obj) != MAP_TYPE_SERVICE, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(obj, LOCATION_ERROR_PARAMETER);
+ int ret = LOCATION_ERROR_NONE;
+ ret = location_get_privacy(LOCATION_PRIVILEGE);
+ if (ret != LOCATION_ERROR_NONE) {
+ LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
+ return LOCATION_ERROR_NOT_ALLOWED;
+ }
+
+ ret = location_ielement_stop(LOCATION_IELEMENT(obj));
+ if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to stop. Error [%d]", ret);
+ return ret;
+}
+
+EXPORT_API int
+location_start_batch(LocationObject *obj)
+{
+ g_return_val_if_fail(obj, LOCATION_ERROR_PARAMETER);
int ret = LOCATION_ERROR_NONE;
- ret = location_ielement_start (LOCATION_IELEMENT(obj));
- if (ret != LOCATION_ERROR_NONE) LOCATION_LOGD("Fail to start. Error [%d]", ret);
+ ret = location_get_privacy(LOCATION_PRIVILEGE);
+ if (ret != LOCATION_ERROR_NONE) {
+ LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
+ return LOCATION_ERROR_NOT_ALLOWED;
+ }
+
+ ret = location_ielement_start_batch(LOCATION_IELEMENT(obj));
+ if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to Batch start. Error [%d]", ret);
return ret;
}
EXPORT_API int
-location_stop (LocationObject *obj)
+location_stop_batch(LocationObject *obj)
{
- g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (G_OBJECT_TYPE(obj) != MAP_TYPE_SERVICE, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(obj, LOCATION_ERROR_PARAMETER);
int ret = LOCATION_ERROR_NONE;
- ret = location_ielement_stop (LOCATION_IELEMENT(obj));
- if (ret != LOCATION_ERROR_NONE) LOCATION_LOGD("Fail to stop. Error [%d]", ret);
+
+ ret = location_get_privacy(LOCATION_PRIVILEGE);
+ if (ret != LOCATION_ERROR_NONE) {
+ LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
+ return LOCATION_ERROR_NOT_ALLOWED;
+ }
+
+ ret = location_ielement_stop_batch(LOCATION_IELEMENT(obj));
+ if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to Batch stop. Error [%d]", ret);
return ret;
}
{
gboolean is_supported = FALSE;
- switch(method) {
- case LOCATION_METHOD_HYBRID:
- if(module_is_supported("gps") || module_is_supported("wps"))
- is_supported = TRUE;
- break;
- case LOCATION_METHOD_GPS:
- is_supported = module_is_supported("gps");
- break;
- case LOCATION_METHOD_WPS:
- is_supported = module_is_supported("wps");
- break;
- case LOCATION_METHOD_CPS:
- default:
- break;
+ switch (method) {
+ case LOCATION_METHOD_HYBRID:
+ if (module_is_supported("gps") || module_is_supported("wps"))
+ is_supported = TRUE;
+ break;
+ case LOCATION_METHOD_GPS:
+ is_supported = module_is_supported("gps");
+ break;
+ case LOCATION_METHOD_WPS:
+ is_supported = module_is_supported("wps");
+ break;
+ default:
+ break;
}
return is_supported;
}
-EXPORT_API gboolean
-location_is_enabled_gps(LocationObject *obj)
+EXPORT_API int
+location_is_enabled_method(LocationMethod method, int *is_enabled)
{
- g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (G_OBJECT_TYPE(obj) != MAP_TYPE_SERVICE, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(is_enabled, LOCATION_ERROR_PARAMETER);
+ int vconf_val = 0;
+ int vconf_ret = VCONF_ERROR;
+
+ char *_key = __convert_setting_key(method);
+ if (!_key) {
+ LOCATION_LOGE("Invalid method[%d]", method);
+ return LOCATION_ERROR_NOT_SUPPORTED;
+ }
+
+ vconf_ret = vconf_get_int(_key, &vconf_val);
+ if (vconf_ret != VCONF_OK) {
+ LOCATION_SECLOG("vconf_get_int: failed [%s], error [%d]", _key, vconf_ret);
+ g_free(_key);
+ return LOCATION_ERROR_NOT_AVAILABLE;
+ } else {
+ LOCATION_SECLOG("vconf_get_int: [%s]:[%d]", _key, vconf_val);
+ }
- return (gboolean) location_setting_get_int(VCONFKEY_LOCATION_ENABLED);
+ *is_enabled = vconf_val;
+ g_free(_key);
+
+ return LOCATION_ERROR_NONE;
+}
+
+EXPORT_API int
+location_enable_method(const LocationMethod method, const int enable)
+{
+ int ret = 0;
+ int i = 0;
+ char *_key = NULL;
+ ret = location_check_privilege(LOCATION_ENABLE_PRIVILEGE);
+ if (ret != LOCATION_ERROR_NONE) {
+ LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
+ return LOCATION_ERROR_NOT_ALLOWED;
+ }
+
+ if (method == LOCATION_METHOD_HYBRID) {
+ for (i = LOCATION_METHOD_HYBRID; i < LOCATION_METHOD_MAX; i++) {
+ _key = __convert_setting_key(i);
+ if (!_key) {
+ LOCATION_LOGE("Invalid method[%d]", method);
+ return LOCATION_ERROR_NOT_SUPPORTED;
+ }
+
+ ret = vconf_set_int(_key, enable);
+ if (ret != VCONF_OK) {
+ LOCATION_SECLOG("vconf_set_int failed [%s], error [%d]", _key, ret);
+ return LOCATION_ERROR_NOT_ALLOWED;
+ } else {
+ LOCATION_SECLOG("vconf_set_int: [%s]:[%d]", _key, ret);
+ }
+ g_free(_key);
+ }
+ } else {
+ _key = __convert_setting_key(method);
+ if (!_key) {
+ LOCATION_LOGE("Invalid method[%d]", method);
+ return LOCATION_ERROR_NOT_SUPPORTED;
+ }
+ ret = vconf_set_int(_key, enable);
+ if (ret != VCONF_OK) {
+ LOCATION_SECLOG("vconf_set_int failed [%s], error [%d]", _key, ret);
+ return LOCATION_ERROR_NOT_ALLOWED;
+ } else {
+ LOCATION_SECLOG("vconf_set_int: [%s]:[%d]", _key, ret);
+ }
+ g_free(_key);
+
+ _key = __convert_setting_key(LOCATION_METHOD_HYBRID);
+ if (!_key) {
+ LOCATION_LOGE("Invalid method[%d]", LOCATION_METHOD_HYBRID);
+ return LOCATION_ERROR_NOT_SUPPORTED;
+ }
+ ret = vconf_set_int(_key, enable);
+ if (ret != VCONF_OK) {
+ LOCATION_SECLOG("vconf_set_int failed [%s], error [%d]", _key, ret);
+ return LOCATION_ERROR_NOT_ALLOWED;
+ } else {
+ LOCATION_SECLOG("vconf_set_int: [%s]:[%d]", _key, ret);
+ }
+ g_free(_key);
+ }
+
+ return ret;
}
EXPORT_API int
-location_get_position (LocationObject *obj,
- LocationPosition **position,
- LocationAccuracy **accuracy)
+location_add_setting_notify(LocationMethod method, LocationSettingCb callback, void *user_data)
{
- g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (G_OBJECT_TYPE(obj) != MAP_TYPE_SERVICE, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (position, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (accuracy, LOCATION_ERROR_PARAMETER);
+ int ret = LOCATION_ERROR_NONE;
+ char *_key = __convert_setting_key(method);
+ if (!_key) {
+ LOCATION_LOGE("Invalid method[%d]", method);
+ return LOCATION_ERROR_PARAMETER;
+ }
+
+ g_location_setting.callback = callback;
+ g_location_setting.user_data = user_data;
+
+ ret = location_setting_add_notify(_key, __location_setting_cb, &g_location_setting);
+ g_free(_key);
+ return ret;
+}
+
+EXPORT_API int
+location_ignore_setting_notify(LocationMethod method, LocationSettingCb callback)
+{
int ret = LOCATION_ERROR_NONE;
- ret = location_ielement_get_position (LOCATION_IELEMENT(obj), position, accuracy);
- if (ret != LOCATION_ERROR_NONE) LOCATION_LOGD("Fail to get_position. Error [%d]", ret);
+ char *_key = __convert_setting_key(method);
+ if (!_key) {
+ LOCATION_LOGE("Invalid method[%d]", method);
+ return LOCATION_ERROR_PARAMETER;
+ }
+
+ g_location_setting.callback = NULL;
+ g_location_setting.user_data = NULL;
+
+ ret = location_setting_ignore_notify(_key, __location_setting_cb);
+ g_free(_key);
return ret;
}
+
EXPORT_API int
-location_get_position_ext (LocationObject *obj,
- LocationPosition **position,
- LocationVelocity **velocity,
- LocationAccuracy **accuracy)
+location_get_position(LocationObject *obj,
+ LocationPosition **position,
+ LocationAccuracy **accuracy)
{
- g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (G_OBJECT_TYPE(obj) != MAP_TYPE_SERVICE, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (position, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (velocity, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (accuracy, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(obj, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(position, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(accuracy, LOCATION_ERROR_PARAMETER);
int ret = LOCATION_ERROR_NONE;
- ret = location_ielement_get_position_ext (LOCATION_IELEMENT(obj), position, velocity, accuracy);
- if (ret != LOCATION_ERROR_NONE) LOCATION_LOGD("Fail to get_position_ext. Error [%d]", ret);
+ ret = location_get_privacy(LOCATION_PRIVILEGE);
+ if (ret != LOCATION_ERROR_NONE) {
+ LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
+ return LOCATION_ERROR_NOT_ALLOWED;
+ }
+
+ ret = location_ielement_get_position(LOCATION_IELEMENT(obj), position, accuracy);
+ if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to get_position. Error [%d]", ret);
return ret;
}
EXPORT_API int
-location_get_last_position (LocationObject *obj,
- LocationPosition **position,
- LocationAccuracy **accuracy)
+location_get_position_ext(LocationObject *obj,
+ LocationPosition **position,
+ LocationVelocity **velocity,
+ LocationAccuracy **accuracy)
{
- g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (G_OBJECT_TYPE(obj) != MAP_TYPE_SERVICE, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (position, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (accuracy, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(obj, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(position, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(velocity, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(accuracy, LOCATION_ERROR_PARAMETER);
int ret = LOCATION_ERROR_NONE;
- ret = location_ielement_get_last_position (LOCATION_IELEMENT(obj), position, accuracy);
- if (ret != LOCATION_ERROR_NONE) LOCATION_LOGD("Fail to get_last_position. Error [%d]", ret);
+ ret = location_get_privacy(LOCATION_PRIVILEGE);
+ if (ret != LOCATION_ERROR_NONE) {
+ LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
+ return LOCATION_ERROR_NOT_ALLOWED;
+ }
+
+ ret = location_ielement_get_position_ext(LOCATION_IELEMENT(obj), position, velocity, accuracy);
+ if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to get_position_ext. Error [%d]", ret);
return ret;
}
EXPORT_API int
-location_get_last_position_ext (LocationObject *obj,
- LocationPosition **position,
- LocationVelocity **velocity,
- LocationAccuracy **accuracy)
+location_get_last_position(LocationObject *obj,
+ LocationPosition **position,
+ LocationAccuracy **accuracy)
{
- g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (G_OBJECT_TYPE(obj) != MAP_TYPE_SERVICE, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (position, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (velocity, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (accuracy, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(obj, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(position, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(accuracy, LOCATION_ERROR_PARAMETER);
int ret = LOCATION_ERROR_NONE;
- ret = location_ielement_get_last_position_ext (LOCATION_IELEMENT(obj), position, accuracy);
- if (ret != LOCATION_ERROR_NONE) LOCATION_LOGD("Fail to get_last_position_ext. Error [%d]", ret);
+ ret = location_get_privacy(LOCATION_PRIVILEGE);
+ if (ret != LOCATION_ERROR_NONE) {
+ LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
+ return LOCATION_ERROR_NOT_ALLOWED;
+ }
+
+ ret = location_ielement_get_last_position(LOCATION_IELEMENT(obj), position, accuracy);
+ if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to get_last_position. Error [%d]", ret);
return ret;
}
EXPORT_API int
-location_get_satellite (LocationObject *obj, LocationSatellite **satellite)
+location_get_last_position_ext(LocationObject *obj,
+ LocationPosition **position,
+ LocationVelocity **velocity,
+ LocationAccuracy **accuracy)
{
- g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (G_OBJECT_TYPE(obj) != MAP_TYPE_SERVICE, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (satellite, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(obj, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(position, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(velocity, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(accuracy, LOCATION_ERROR_PARAMETER);
int ret = LOCATION_ERROR_NONE;
- ret = location_ielement_get_satellite (LOCATION_IELEMENT(obj), satellite);
- if (ret != LOCATION_ERROR_NONE) LOCATION_LOGD("Fail to get_satellite. Error [%d]", ret);
+
+ ret = location_get_privacy(LOCATION_PRIVILEGE);
+ if (ret != LOCATION_ERROR_NONE) {
+ LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
+ return LOCATION_ERROR_NOT_ALLOWED;
+ }
+
+ ret = location_ielement_get_last_position_ext(LOCATION_IELEMENT(obj), position, velocity, accuracy);
+ if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to get_last_position_ext. Error [%d]", ret);
return ret;
}
EXPORT_API int
-location_get_last_satellite (LocationObject *obj, LocationSatellite **satellite)
+location_get_nmea(LocationObject *obj, char **nmea)
{
- g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (G_OBJECT_TYPE(obj) != MAP_TYPE_SERVICE, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (satellite, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(obj, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(nmea, LOCATION_ERROR_PARAMETER);
int ret = LOCATION_ERROR_NONE;
- ret = location_ielement_get_last_satellite (LOCATION_IELEMENT(obj), satellite);
- if (ret != LOCATION_ERROR_NONE) LOCATION_LOGD("Fail to get_last_satellite. Error [%d]", ret);
+
+ ret = location_get_privacy(LOCATION_PRIVILEGE);
+ if (ret != LOCATION_ERROR_NONE) {
+ LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
+ return LOCATION_ERROR_NOT_ALLOWED;
+ }
+
+ ret = location_ielement_get_nmea(LOCATION_IELEMENT(obj), nmea);
+ if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to get_nmea. Error [%d]", ret);
return ret;
}
+
EXPORT_API int
-location_get_velocity (LocationObject *obj,
- LocationVelocity **velocity,
- LocationAccuracy **accuracy)
+location_get_satellite(LocationObject *obj, LocationSatellite **satellite)
{
- g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (G_OBJECT_TYPE(obj) != MAP_TYPE_SERVICE, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (velocity, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (accuracy, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(obj, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(satellite, LOCATION_ERROR_PARAMETER);
int ret = LOCATION_ERROR_NONE;
- ret = location_ielement_get_velocity (LOCATION_IELEMENT(obj), velocity, accuracy);
- if (ret != LOCATION_ERROR_NONE) LOCATION_LOGD("Fail to get_velocity. Error [%d]", ret);
+
+ ret = location_get_privacy(LOCATION_PRIVILEGE);
+ if (ret != LOCATION_ERROR_NONE) {
+ LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
+ return LOCATION_ERROR_NOT_ALLOWED;
+ }
+
+ ret = location_ielement_get_satellite(LOCATION_IELEMENT(obj), satellite);
+ if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to get_satellite. Error [%d]", ret);
return ret;
}
EXPORT_API int
-location_get_last_velocity (LocationObject *obj,
- LocationVelocity **velocity,
- LocationAccuracy **accuracy)
+location_get_batch(LocationObject *obj, LocationBatch **batch)
{
- g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (G_OBJECT_TYPE(obj) != MAP_TYPE_SERVICE, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (velocity, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (accuracy, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(obj, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(batch, LOCATION_ERROR_PARAMETER);
int ret = LOCATION_ERROR_NONE;
- ret = location_ielement_get_last_velocity (LOCATION_IELEMENT(obj), velocity, accuracy);
- if (ret != LOCATION_ERROR_NONE) LOCATION_LOGD("Fail to get_last_velocity. Error [%d]", ret);
+
+ ret = location_get_privacy(LOCATION_PRIVILEGE);
+ if (ret != LOCATION_ERROR_NONE) {
+ LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
+ return LOCATION_ERROR_NOT_ALLOWED;
+ }
+
+ ret = location_ielement_get_batch(LOCATION_IELEMENT(obj), batch);
+ if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to get_batch. Error [%d]", ret);
+
+ return ret;
+}
+
+EXPORT_API int
+location_get_last_satellite(LocationObject *obj, LocationSatellite **satellite)
+{
+ g_return_val_if_fail(obj, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(satellite, LOCATION_ERROR_PARAMETER);
+
+ int ret = LOCATION_ERROR_NONE;
+
+ ret = location_get_privacy(LOCATION_PRIVILEGE);
+ if (ret != LOCATION_ERROR_NONE) {
+ LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
+ return LOCATION_ERROR_NOT_ALLOWED;
+ }
+
+ ret = location_ielement_get_last_satellite(LOCATION_IELEMENT(obj), satellite);
+ if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to get_last_satellite. Error [%d]", ret);
return ret;
}
EXPORT_API int
-location_get_accessibility_state (LocationAccessState *state)
+location_get_velocity(LocationObject *obj,
+ LocationVelocity **velocity,
+ LocationAccuracy **accuracy)
{
- int auth = location_application_get_authority ();
+ g_return_val_if_fail(obj, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(velocity, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(accuracy, LOCATION_ERROR_PARAMETER);
+
+ int ret = LOCATION_ERROR_NONE;
+
+ ret = location_get_privacy(LOCATION_PRIVILEGE);
+ if (ret != LOCATION_ERROR_NONE) {
+ LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
+ return LOCATION_ERROR_NOT_ALLOWED;
+ }
+
+ ret = location_ielement_get_velocity(LOCATION_IELEMENT(obj), velocity, accuracy);
+ if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to get_velocity. Error [%d]", ret);
+
+ return ret;
+}
+
+EXPORT_API int
+location_get_last_velocity(LocationObject *obj,
+ LocationVelocity **velocity,
+ LocationAccuracy **accuracy)
+{
+ g_return_val_if_fail(obj, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(velocity, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(accuracy, LOCATION_ERROR_PARAMETER);
+
+ int ret = LOCATION_ERROR_NONE;
+
+ ret = location_get_privacy(LOCATION_PRIVILEGE);
+ if (ret != LOCATION_ERROR_NONE) {
+ LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
+ return LOCATION_ERROR_NOT_ALLOWED;
+ }
+
+ ret = location_ielement_get_last_velocity(LOCATION_IELEMENT(obj), velocity, accuracy);
+ if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to get_last_velocity. Error [%d]", ret);
+
+ return ret;
+}
+
+EXPORT_API int
+location_get_accessibility_state(LocationAccessState *state)
+{
+ int auth = location_application_get_authority();
switch (auth) {
case LOCATION_APP_OFF:
*state = LOCATION_ACCESS_DENIED;
}
EXPORT_API int
-location_set_accessibility_state (LocationAccessState state)
+location_set_accessibility_state(LocationAccessState state)
{
int auth = LOCATION_APP_NOT_FOUND;
int ret = LOCATION_ERROR_NONE;
EXPORT_API int
location_send_command(const char *cmd)
{
- g_return_val_if_fail (cmd, LOCATION_ERROR_PARAMETER);
- return LOCATION_ACCESS_NONE;
+ g_return_val_if_fail(cmd, LOCATION_ERROR_PARAMETER);
+ return LOCATION_ERROR_NOT_AVAILABLE;
}
EXPORT_API int
-location_set_option (LocationObject *obj, const char *option)
+location_set_option(LocationObject *obj, const char *option)
{
- g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(obj, LOCATION_ERROR_PARAMETER);
int ret = LOCATION_ERROR_NONE;
+
+ ret = location_get_privacy(LOCATION_PRIVILEGE);
+ if (ret != LOCATION_ERROR_NONE) {
+ LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
+ return LOCATION_ERROR_NOT_ALLOWED;
+ }
+
+ ret = location_ielement_set_option(LOCATION_IELEMENT(obj), option);
+ if (ret != LOCATION_ERROR_NONE)
+ LOCATION_LOGE("Fail to get_velocity. Error [%d]", ret);
return ret;
}
* Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
+ * Genie Kim <daejins.kim@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <glib.h>
#include <location-types.h>
#include <location-position.h>
+#include <location-batch.h>
#include <location-velocity.h>
#include <location-accuracy.h>
-#include <location-address.h>
#include <location-boundary.h>
#include <location-satellite.h>
* @pre None.
* @post None.
* @return int
- * @retval 0 Success
+ * @retval 0 Success
*
* Please refer #LocationError for more information.
* @see None.
*/
-int location_init (void);
+int location_init(void);
/**
* @brief
* @param [in]
* method - Location method to be used.
* @return a new #LocationObject
- * @retval NULL if error occured
+ * @retval NULL if error occured
* @see location_free
*/
-LocationObject *location_new (LocationMethod method);
+LocationObject *location_new(LocationMethod method);
/**
* @brief
* @param [in]
* obj - a #LocationObject created by #location_new.
* @return int
- * @retval 0 Success.
+ * @retval 0 Success.
*
* Please refer #LocationError for more information.
* @see location_new
{
LocationObject *loc = NULL;
location_init ();
- loc = location_new (LOCATION_METHOD_GPS);
+ loc = location_new (LOCATION_METHOD_GPS);
if(!loc)
return -1;
}
* @endcode
*/
-int location_free (LocationObject *obj);
+int location_free(LocationObject *obj);
/**
* @brief
* @param [in]
* obj - a #LocationObject created by #location_new
* @return int
- * @retval 0 Success.
+ * @retval 0 Success.
*
* Please refer #LocationError for more information.
* @see location_stop
static void
cb_service_updated (GObject *self,
- guint type,
- gpointer data,
- gpointer accuracy,
- gpointer userdata)
+ guint type,
+ gpointer data,
+ gpointer accuracy,
+ gpointer userdata)
{
LocationAccuracy *acc = (LocationAccuracy*) accuracy;
switch (type) {
int main (int argc, char *argv[])
{
LocationObject *loc = NULL;
- int interval = 6; //seconds
+ int interval = 6; //seconds
location_init ();
- loc = location_new (LOCATION_METHOD_GPS);
+ loc = location_new (LOCATION_METHOD_GPS);
if(!loc)
return -1;
location_start(loc);
loop = g_main_loop_new (NULL, TRUE);
- g_main_loop_run (loop); // GMainLoop is needed for receiving signals.
+ g_main_loop_run (loop); // GMainLoop is needed for receiving signals.
// ...
return 0;
}
* @endcode
*/
-int location_start (LocationObject *obj);
+int location_start(LocationObject *obj);
/**
* @brief
* @param [in]
* obj - a #LocationObject created by #location_new
* @return int
- * @retval 0 Success
+ * @retval 0 Success
*
* Please refer #LocationError for more information.
* @see location_start
{
LocationObject *loc = NULL;
location_init ();
- loc = location_new (LOCATION_METHOD_GPS);
+ loc = location_new (LOCATION_METHOD_GPS);
if(!loc)
return -1;
}
* @endcode
*/
-int location_stop (LocationObject *obj);
+int location_stop(LocationObject *obj);
+
+int location_request_single_location(LocationObject *obj, int timeout);
/**
* @brief
* @param [in] method - a #LocationMethod
* @return int
* @retval True Supported
- * False Not supported
+ * False Not supported
* @par Example
#include <location.h>
static GMainLoop *loop = NULL;
*/
gboolean location_is_supported_method(LocationMethod method);
-/**
- * @brief
- * Check wheither GPS is turned on or off.
- * @remarks
- * @pre
- * #location_init should be called before.\n
- * @post None.
- * @param [in] method - a #LocationMethod
- * @return int
- * @retval True Turned on
- * False Turned off
- * @par Example
- #include <location.h>
-static GMainLoop *loop = NULL;
-
-int main (int argc, char *argv[])
-{
- gboolean is_enabled = FALSE;
-
- // ....
+int location_is_enabled_method(LocationMethod method, int *is_enabled);
- is_enabled = location_is_enabled_gps(loc);
- if(is_enable == TRUE)
- g_printf("GPS is turned on.\n");
- else
- g_printf("GPS is turned off.\n");
+int location_enable_method(const LocationMethod method, const int enable);
- return 0;
-}* @code
- * @endcode
- */
-gboolean location_is_enabled_gps(LocationObject *obj);
/**
* @brief
* @param [out]
* accuracy - a new #LocationAccuracy
* @return int
- * @retval 0 Success
+ * @retval 0 Success
*
* Please refer #LocationError for more information.
* @see location_get_velocity
location_init ();
loop = g_main_loop_new (NULL, TRUE);
- loc = location_new (LOCATION_METHOD_GPS);
+ loc = location_new (LOCATION_METHOD_GPS);
if(!loc){
g_debug("location_new failed");
return -1;
}
* @endcode
*/
-int location_get_position (LocationObject *obj, LocationPosition **position, LocationAccuracy **accuracy);
+int location_get_position(LocationObject *obj, LocationPosition **position, LocationAccuracy **accuracy);
/**
* @brief
* @param [out] velocity - a new #LocationVelocity
* @param [out] accuracy - a new #LocationAccuracy
* @return int
- * @retval 0 Success
+ * @retval 0 Success
*
* Please refer #LocationError for more information.
* @see location_get_position
location_init ();
loop = g_main_loop_new (NULL, TRUE);
- loc = location_new (LOCATION_METHOD_GPS);
+ loc = location_new (LOCATION_METHOD_GPS);
if(!loc){
g_debug("location_new failed");
return -1;
}
* @endcode
*/
-int location_get_position_ext (LocationObject *obj, LocationPosition **position, LocationVelocity **velocity, LocationAccuracy **accuracy);
+int location_get_position_ext(LocationObject *obj, LocationPosition **position, LocationVelocity **velocity, LocationAccuracy **accuracy);
/**
* @brief
* @param [out] position - a new #LocationPosition
* @param [out] accuracy - a new #LocationAccuracy
* @return int
- * @retval 0 Success
+ * @retval 0 Success
*
* Please refer #LocationError for more information.
* @see location_get_position
LocationAccuracy *last_acc = NULL;
location_init ();
- loc = location_new (LOCATION_METHOD_GPS);
+ loc = location_new (LOCATION_METHOD_GPS);
if(!loc){
g_debug("location_new failed");
return -1;
}
* @endcode
*/
-int location_get_last_position (LocationObject *obj, LocationPosition **position, LocationAccuracy **accuracy);
+int location_get_last_position(LocationObject *obj, LocationPosition **position, LocationAccuracy **accuracy);
/**
* @brief
* @param [out] velocity - a new #LocationVelocity
* @param [out] accuracy - a new #LocationAccuracy
* @return int
- * @retval 0 Success
+ * @retval 0 Success
*
* Please refer #LocationError for more information.
* @see location_get_position_ext
LocationAccuracy *last_acc = NULL;
location_init ();
- loc = location_new (LOCATION_METHOD_GPS);
+ loc = location_new (LOCATION_METHOD_GPS);
if(!loc){
g_debug("location_new failed");
return -1;
}
* @endcode
*/
-int location_get_last_position_ext (LocationObject *obj, LocationPosition **position, LocationVelocity **velocity, LocationAccuracy **accuracy);
+int location_get_last_position_ext(LocationObject *obj, LocationPosition **position, LocationVelocity **velocity, LocationAccuracy **accuracy);
/**
* @brief
* Get last satellite information.
* @remarks This API is not implemented now. \n
- * Out parameters are should be freed.
+ * Out parameters are should be freed.
* @pre
* #location_init should be called before.
* @post None.
* obj - a #LocationObject created by #location_new
* @param [out] satellite - a new #LocationSatellite
* @return int
- * @retval 0 Success
+ * @retval 0 Success
* Please refer #LocationError for more information.
* @see location_get_last_satellite
* @par Example
gint snr;
location_init ();
- loc = location_new (LOCATION_METHOD_GPS);
+ loc = location_new (LOCATION_METHOD_GPS);
if(!loc){
g_debug("location_new failed");
return -1;
}
* @endcode
*/
-int location_get_satellite (LocationObject *obj, LocationSatellite **satellite);
+int location_get_satellite(LocationObject *obj, LocationSatellite **satellite);
+
+
+int location_start_batch(LocationObject *obj);
+
+int location_stop_batch(LocationObject *obj);
+
+int location_get_batch(LocationObject *obj, LocationBatch **batch);
+
/**
* @brief
* Get last satellite information.
* @remarks This API is not implemented now. \n
- * Out parameters are should be freed.
+ * Out parameters are should be freed.
* @pre
* #location_init should be called before.
* @post None.
* @param [out]
* satellite - a new #LocationSatellite
* @return int
- * @retval 0 Success
+ * @retval 0 Success
*
* Please refer #LocationError for more information.
* @par Example
gint snr;
location_init ();
- loc = location_new (LOCATION_METHOD_GPS);
+ loc = location_new (LOCATION_METHOD_GPS);
if(!loc){
g_debug("location_new failed");
return -1;
}
* @endcode
*/
-int location_get_last_satellite (LocationObject *obj, LocationSatellite **satellite);
+int location_get_last_satellite(LocationObject *obj, LocationSatellite **satellite);
/**
* @brief
* @param [out]
* accuracy - a new #LocationAccuracy
* @return int
- * @retval 0 Success
+ * @retval 0 Success
*
* Please refer #LocationError for more information.
* @see location_get_position
loop = g_main_loop_new (NULL, TRUE);
- loc = location_new (LOCATION_METHOD_GPS);
+ loc = location_new (LOCATION_METHOD_GPS);
if(!loc){
g_debug("location_new failed");
return -1;
* @endcode
*/
-int location_get_velocity (LocationObject *obj, LocationVelocity **velocity, LocationAccuracy **accuracy);
+int location_get_velocity(LocationObject *obj, LocationVelocity **velocity, LocationAccuracy **accuracy);
/**
* @brief
* @param [out]
* accuracy - a new #LocationAccuracy
* @return int
- * @retval 0 Success
+ * @retval 0 Success
*
* Please refer #LocationError for more information.
* @see location_get_position
location_init ();
- loc = location_new (LOCATION_METHOD_GPS);
+ loc = location_new (LOCATION_METHOD_GPS);
if(!loc){
g_debug("location_new failed");
return -1;
}
* @endcode
*/
-int location_get_last_velocity (LocationObject *obj, LocationVelocity **velocity, LocationAccuracy **accuracy);
+int location_get_last_velocity(LocationObject *obj, LocationVelocity **velocity, LocationAccuracy **accuracy);
/**
* @brief
* @pre
* #location_init should be called before.\n
* @post None.
- * @param [out] state - a #LocationAccessState
+ * @param [out] state - a #LocationAccessState
* @return int
- * @retval 0 Success
+ * @retval 0 Success
*
* Please refer #LocationError for more information.
*/
-int location_get_accessibility_state (LocationAccessState *state);
-
+int location_get_accessibility_state(LocationAccessState *state);
+
/**
* @brief
* Send command to the server.
* Calling application must have glib or ecore main loop.\n
* Calling application must have an active data connection.
* @post None.
- * @param [in] cmd - a #char
+ * @param [in] cmd - a #char
* @return int
- * @retval 0 Success
+ * @retval 0 Success
*
* Please refer #LocationError for more information.
*/
* @param [in] obj - a #LocationObject created by #location_new
* @param [in] option - a #char
* @return int
- * @retval 0 Success
+ * @retval 0 Success
*
* Please refer #LocationError for more information.
*/
int location_set_option(LocationObject *obj, const char *option);
+int location_add_setting_notify(LocationMethod method, LocationSettingCb callback, void *user_data);
+
+int location_ignore_setting_notify(LocationMethod method, LocationSettingCb callback);
+
+int location_get_nmea(LocationObject *obj, char **nmea_data);
+
+
/**
* @} @}
*/
+++ /dev/null
-noinst_LTLIBRARIES = liblocation-map-service.la\r
-\r
-COMMON_HEADER_DIR = include\r
-MANAGER_DIR = manager\r
-MAP_SERVICE_DIR = map-service\r
-MODULE_DIR = module\r
-\r
-liblocation_map_service_la_SOURCES = \\r
- location-map-pref.c \\r
- location-map-ielement.c \\r
- location-address.c \\r
- location-geocode.c \\r
- location-poi.c \\r
- location-landmark.c \\r
- location-route.c \\r
- map-service.c \\r
- map-internal.c\r
-\r
-liblocation_map_service_la_CFLAGS = \\r
- -fPIC\\r
- -I${srcdir} \\r
- -I${srcdir}/.. \\r
- -I${srcdir}/../include \\r
- -I${srcdir}/../${MANAGER_DIR} \\r
- -I${srcdir}/../${MODULE_DIR} \\r
- -I${srcdir}/../${MAP_SERVICE_DIR} \\r
- $(LOCATION_CFLAGS)\r
-\r
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "location-address.h"
-#include "location-log.h"
-
-GType
-location_address_get_type (void)
-{
- static volatile gsize type_volatile = 0;
- if(g_once_init_enter(&type_volatile)) {
- GType type = g_boxed_type_register_static (
- g_intern_static_string ("LocationAddress"),
- (GBoxedCopyFunc) location_address_copy,
- (GBoxedFreeFunc) location_address_free);
- g_once_init_leave(&type_volatile, type);
- }
- return type_volatile;
-}
-
-EXPORT_API LocationAddress*
-location_address_new (const gchar *building_number,
- const gchar *street,
- const gchar *district,
- const gchar *city,
- const gchar *state,
- const gchar *country_code,
- const gchar *postal_code,
- const gchar *text,
- const gchar *country,
- const gchar *county)
-{
- LocationAddress* address = g_slice_new0(LocationAddress);
- g_return_val_if_fail (address, NULL);
-
- if (building_number) address->building_number = g_strdup(building_number);
- if (street) address->street = g_strdup(street);
- if (district) address->district = g_strdup(district);
- if (city) address->city = g_strdup(city);
- if (state) address->state = g_strdup(state);
- if (country_code) address->country_code = g_strdup(country_code);
- if (postal_code) address->postal_code = g_strdup(postal_code);
- if (text) address->text = g_strdup(text);
- if (country) address->country = g_strdup(country);
- if (county) address->county = g_strdup(county);
-
- return address;
-}
-
-EXPORT_API void
-location_address_free (LocationAddress* address)
-{
- g_return_if_fail(address);
- if (address->building_number) g_free(address->building_number);
- if (address->street) g_free(address->street);
- if (address->district) g_free(address->district);
- if (address->city) g_free(address->city);
- if (address->state) g_free(address->state);
- if (address->country_code) g_free(address->country_code);
- if (address->postal_code) g_free(address->postal_code);
- if (address->text) g_free(address->text);
- if (address->country) g_free(address->country);
- if (address->county) g_free(address->county);
- g_slice_free(LocationAddress, address);
-}
-
-EXPORT_API LocationAddress*
-location_address_copy (const LocationAddress *address)
-{
- g_return_val_if_fail(address, NULL);
- return location_address_new(address->building_number,
- address->street,
- address->district,
- address->city,
- address->state,
- address->country_code,
- address->postal_code,
- address->text,
- address->country,
- address->county
- );
-}
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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 __LOCATION_ADDRESS_H_
-#define __LOCATION_ADDRESS_H_
-
-#include <location-map-types.h>
-
-G_BEGIN_DECLS
-
-GType location_address_get_type(void);
-#define LOCATION_TYPE_ADDRESS (location_address_get_type())
-
-/**
- * @file location-address.h
- * @brief This file contains the definitions, structures, and functions related to address information.
- * @addtogroup LocationMapService
- * @{
- * @defgroup LocationMapServiceGeocode Location Geocode
- * @brief This sub module provides structure, enumeration, and asynchronous function definitions.
- * @addtogroup LocationMapServiceGeocode
- * @{
- */
-
-/**
- * @brief This represents address information such as building number, street name, etc.
- */
-struct _LocationAddress
-{
- gchar *building_number; ///< Building number.
- gchar *street; ///< Full street name.
- gchar *district; ///< Municipal district name.
- gchar *city; ///< City name.
- gchar *state; ///< State or province region of a nation.
- gchar *country_code; ///< Country name.
- gchar *postal_code; ///< Postal delivery code.
-
- gchar *text; ///<freeform address input
- gchar *country; ///<country name
- gchar *county; ///<county name
-};
-
-/**
- * @brief Create a new #LocationAddress with given information.
- * @remarks None.
- * @pre #location_init should be called before.\n
- * @post None.
- * @param [in] building_number - Building number
- * @param [in] street - Full street name.
- * @param [in] district - Municipal district name.
- * @param [in] city - City name.
- * @param [in] state - State or province region of a nation.
- * @param [in] country_code - Country name.
- * @param [in] postal_code - Postal delivery code.
- * @param [in] text - freeform address input.
- * @param [in] country - country name.
- * @param [in] county - county name.
- * @return a new #LocationAddress
- * @retval NULL if error occured
- */
-LocationAddress *location_address_new (const gchar *building_number, const gchar *street, const gchar *district, const gchar *city, const gchar *state, const gchar *country_code, const gchar *postal_code,const gchar *text,const gchar *country,const gchar *county);
-
-/**
- * @brief Free a #LocationAddress.
- * @remarks None.
- * @pre #location_init should be called before.\n
- * @post None.
- * @param [in] address - a #LocationAddress.
- * @return None.
- */
-void location_address_free (LocationAddress *address);
-
-/**
- * @brief Makes a copy of #LocationAddress
- * @remarks None.
- * @pre #location_init should be called before.\n
- * @post None.
- * @param [in] address - a #LocationAddress
- * @return a new #LocationAddress
- * @retval NULL if error occured
- */
-LocationAddress *location_address_copy (const LocationAddress *address);
-
-/**
- * @} @}
- */
-
-G_END_DECLS
-
-#endif
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>, Madhu Sudhan<madhu.panga@samsung.com>
- *
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "location-geocode.h"
-#include "location-log.h"
-
-
-struct _LocationGeocodePreference {
- guint max_result_cnt; ///< Maximum number of results
- gchar* item;
- GHashTable *properties;
-};
-
-
-EXPORT_API LocationGeocodePreference *
-location_geocode_pref_new (void)
-{
- LocationGeocodePreference *pref = g_slice_new0 (LocationGeocodePreference);
- g_return_val_if_fail(pref, NULL);
-
- pref->max_result_cnt = 0;
- pref->properties = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
-
- return pref;
-}
-
-EXPORT_API void
-location_geocode_pref_free (LocationGeocodePreference * pref)
-{
- g_return_if_fail(pref);
-
- if (pref->properties) g_hash_table_destroy (pref->properties);
-
- g_slice_free(LocationGeocodePreference, pref);
-}
-
-EXPORT_API gpointer
-location_geocode_pref_get_property (const LocationGeocodePreference *pref, gconstpointer key)
-{
- g_return_val_if_fail (pref, NULL);
- g_return_val_if_fail (key, NULL);
-
- if (!pref->properties) return NULL;
-
- return g_hash_table_lookup (pref->properties, key);
-}
-
-EXPORT_API gboolean
-location_geocode_pref_set_property (LocationGeocodePreference *pref, gconstpointer key, gconstpointer value)
-{
- g_return_val_if_fail(pref, FALSE);
- g_return_val_if_fail(key, FALSE);
- g_return_val_if_fail(pref->properties, FALSE);
-
- if (value) {
- gchar *re_key = g_strdup (key);
- gchar *re_val = g_strdup (value);
- g_hash_table_insert (pref->properties, re_key, re_val);
- } else g_hash_table_remove (pref->properties, key);
-
- return TRUE;
-}
-
-EXPORT_API guint
-location_geocode_pref_get_max_result (const LocationGeocodePreference *pref)
-{
- g_return_val_if_fail(pref, 0);
-
- return pref->max_result_cnt;
-}
-
-EXPORT_API gboolean
-location_geocode_pref_set_max_result (LocationGeocodePreference *pref, guint max_num)
-{
- g_return_val_if_fail(pref, FALSE);
- g_return_val_if_fail(max_num > 0, FALSE);
-
- pref->max_result_cnt = max_num;
-
- return TRUE;
-}
-static void geocode_pref_property_copy_cb (gpointer key, gpointer value, gpointer user_data)
-{
- g_return_if_fail (key);
- g_return_if_fail (value);
- g_return_if_fail (user_data);
-
- LocationGeocodePreference *pref = (LocationGeocodePreference *) user_data;
- if (pref->properties) {
- gchar *re_key = g_strdup (key);
- gchar *re_val = g_strdup (value);
- g_hash_table_insert (pref->properties, re_key, re_val);
- }
-}
-
-EXPORT_API LocationGeocodePreference *
-location_geocode_pref_copy (LocationGeocodePreference *pref)
-{
- LocationGeocodePreference *new_pref = location_geocode_pref_new();
- g_return_val_if_fail (new_pref, NULL);
-
- location_geocode_pref_set_max_result(new_pref, location_geocode_pref_get_max_result(pref));
-
- g_hash_table_foreach (pref->properties, geocode_pref_property_copy_cb ,new_pref);
-
- return new_pref;
-}
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com> , Madhu Sudhan<madhu.panga@samsung.com>
- *
- * 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 __LOCATION_GEOCODE_H__
-#define __LOCATION_GEOCODE_H__
-
-#include <location-map-types.h>
-
-G_BEGIN_DECLS
-
-/**
- * @file location-geocode.h
- * @brief This file contains the internal definitions and structures related to geocode.
- * @addtogroup LocationMapService
- * @{
- * @}
- */
-
-/**
- * @brief Retrive LocationPreperence that the given LocationGeocodePreference inherits.
- */
-
-/**
- * @brief Create a new LocationGeocodePreference
- * @remarks None.
- * @pre None
- * @post None.
- * @return #LocationGeocodePreference
- * @retval NULL if error occured
- * @see location_location_geocode_pref_free
- *
- */
-LocationGeocodePreference *location_geocode_pref_new (void);
-
-/**
- * @brief Free a LocationGeocodePreference
- * @remarks None.
- * @pre #location_geocode_pref_new should be called before.
- * @post None.
- * @param [in] pref - #LocationGeocodePreference
- * @return void
- * @retval NULL if error occured
- * @see location_location_geocode_pref_set_pref
- */
-void location_geocode_pref_free (LocationGeocodePreference * pref);
-
-/**
- * @brief Get the property of geocode preference
- * @remarks None.
- * @pre #location_geocode_pref_new should be called before.
- * @post None.
- * @param [in] pref - #LocationGeocodePreference
- * @param [in] key - gconstpointer
- * @return gconstpointer
- * @retval property value
- * @see location_geocode_pref_set_property
- */
-gpointer location_geocode_pref_get_property (const LocationGeocodePreference *pref, gconstpointer key);
-
-/**
- * @brief Set property of geocode preference.
- * @remarks The previous value of the #LocationGeocodePreference matching to key will be removed if an value is NULL.
- * @pre #location_geocode_pref_new should be called before.
- * @post None.
- * @param [in] pref - #LocationGeocodePreference
- * @param [in] key - gconstpoiner
- * @param [in] value - gconstpointer or NULL if reset
- * @return gboolean
- * @retval TRUE if success
- * @see location_geocode_pref_get_property
- */
-gboolean location_geocode_pref_set_property (LocationGeocodePreference *pref, gconstpointer key, gconstpointer value);
-
-/**
- * @brief Set the maximum number of results for geocode service.
- * @remarks None.
- * @pre #location_geocode_pref_new should be called before.
- * @post None.
- * @param [in] pref - #LocationGeocodePreference
- * @param [in] max_num - #guint
- * @return gboolean
- * @retval TRUE if success
- * @see location_geocode_pref_get_max_result
- */
-gboolean location_geocode_pref_set_max_result (LocationGeocodePreference * pref, guint max_num);
-
-/**
- * @brief Get the maximum number of results for geocode service.
- * @remarks None.
- * @pre #location_geocode_pref_new should be called before.
- * @post None.
- * @param [in] pref - #LocationGeocodePreference
- * @return guint
- * @retval 0 if error occured
- * @see location_geocode_pref_set_max_result
- */
-guint location_geocode_pref_get_max_result (const LocationGeocodePreference * pref);
-
-/**
- * @brief Copy a LocationGeocodePreference
- * @remarks None.
- * @pre None
- * @post None.
- * @return #LocationGeocodePreference
- * @retval NULL if error occured
- * @see location_location_geocode_pref_free
- *
- */
-LocationGeocodePreference *location_geocode_pref_copy(LocationGeocodePreference *pref);
-
-G_END_DECLS
-
-#endif
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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 __LOCATION_LANDMARK_EXT_H__
-#define __LOCATION_LANDMARK_EXT_H__
-
-#include <location-map-types.h>
-
-G_BEGIN_DECLS
-
-/**
- * @file location-landmark-ext.h
- * @brief This file contains the extensional definitions and structures related to Landmark.
- */
-
-/**
- * @addtogroup LocationMapServicePOI
- * @{
- * @defgroup LocationMapServiceLandmarkExt Location Landmark Ext
- * @brief This provides Location Landmark Ext APIs
- * @addtogroup LocationMapServiceLandmarkExt
- * @{
- */
-
-/**
- * @brief Set the ID of the given #LocationLandmark
- * @remarks None.
- * @pre None.
- * @post None.
- * @param [in] landmark - a #LocationLandmark
- * @param [in] id - a guint
- * @return gboolean
- * @retval TRUE if success
- * @see location_landmark_get_id
- */
-gboolean location_landmark_set_id (LocationLandmark *landmark, guint id);
-
-/**
- * @brief Set the name of the given #LocationLandmark
- * @remarks The previous name of the #LocationLandmark will be removed if a name is NULL.
- * @pre None.
- * @post None.
- * @param [in] landmark - a #LocationLandmark
- * @param [in] name - a gchar
- * @return gboolean
- * @retval TRUE if success
- * @see location_landmark_get_name
- */
-gboolean location_landmark_set_name (LocationLandmark *landmark, const gchar *name);
-
-/**
- * @brief Set the position in the given #LocationLandmark
- * @remarks The previous position of the #LocationLandmark will be removed if a position is NULL.
- * @pre None.
- * @post None.
- * @param [in] landmark - a #LocationLandmark
- * @param [in] position - a #LocationPosition
- * @return gboolean
- * @retval TRUE if success
- * @see location_landmark_get_position
- */
-gboolean location_landmark_set_position (LocationLandmark *landmark, const LocationPosition *position);
-
-/**
- * @brief Set the address of the given #LocationLandmark
- * @remarks The previous address of the #LocationLandmark will be removed if an addr is NULL.
- * @pre None.
- * @post None.
- * @param [in] landmark - a #LocationLandmark
- * @param [in] addr - a #LocationAddress
- * @return gboolean
- * @retval TRUE if success
- * @see location_landmark_get_address
- */
-gboolean location_landmark_set_address (LocationLandmark *landmark, const LocationAddress *addr);
-
-/**
- * @brief Set the description of the given #LocationLandmark
- * @remarks The previous description of the #LocationLandmark will be removed if a desc is NULL.
- * @pre None.
- * @post None.
- * @param [in] landmark - a #LocationLandmark
- * @param [in] desc - a gchar
- * @return gboolean
- * @retval TRUE if success
- * @see location_landmark_get_description
- */
-gboolean location_landmark_set_description (LocationLandmark *landmark, const gchar *desc);
-
-/**
- * @brief Set the timestamp of the given #LocationLandmark
- * @remarks None.
- * @pre None.
- * @post None.
- * @param [in] landmark - a #LocationLandmark
- * @param [in] timestamp - a guint
- * @return gboolean
- * @retval TRUE if success
- * @see location_landmark_get_timestamp
- */
-gboolean location_landmark_set_timestamp (LocationLandmark *landmark, guint timestamp);
-
-/**
- * @brief Set the priority of the given #LocationLandmark
- * @remarks None.
- * @pre None.
- * @post None.
- * @param [in] landmark - a #LocationLandmark
- * @param [in] priority - a guint
- * @return gboolean
- * @retval TRUE if success
- * @see location_landmark_get_priority
- */
-gboolean location_landmark_set_priority (LocationLandmark *landmark, guint priority);
-
-/**
- * @brief Set the boundary of the given #LocationLandmark
- * @remarks The previous bounding box of the #LocationLandmark will be removed if a bbox is NULL.
- * @pre None.
- * @post None.
- * @param [in] landmark - a #LocationLandmark
- * @param [in] bbox - a #LocationBoundary
- * @return gboolean
- * @retval TRUE if success
- * @see location_landmark_get_bounding_box
- */
-gboolean location_landmark_set_bounding_box (LocationLandmark *landmark, const LocationBoundary *bbox);
-
-/**
- * @brief Set the author of the given #LocationLandmark
- * @remarks The previous author of the #LocationLandmark will be removed if a author is NULL.
- * @pre None.
- * @post None.
- * @param [in] landmark - a #LocationLandmark
- * @param [in] author - a gchar
- * @return gboolean
- * @retval TRUE if success
- * @see location_landmark_get_author
- */
-gboolean location_landmark_set_author (LocationLandmark *landmark, const gchar *author);
-
-/**
- * @brief Set the urls of the given #LocationLandmark
- * @remarks The previous url of the #LocationLandmark will be removed if an url is NULL.
- * @pre None.
- * @post None.
- * @param [in] landmark - a #LocationLandmark
- * @param [in] url - a GList
- * @return gboolean
- * @retval TRUE if success
- * @see location_landmark_get_url
- */
-gboolean location_landmark_set_url (LocationLandmark *landmark, GList *url);
-
-/**
- * @brief Set the categories of the given #LocationLandmark
- * @remarks The previous categories of the #LocationLandmark will be removed if a category is NULL.
- * @pre None.
- * @post None.
- * @param [out] landmark - a #LocationLandmark
- * @param [in] category - a GList
- * @return gboolean
- * @retval TRUE if success
- * @see location_landmark_get_category
- */
-gboolean location_landmark_set_category (LocationLandmark *landmark, GList *category);
-
-/**
- * @brief Set the phone number of the given #LocationLandmark
- * @remarks The previous phone number of the #LocationLandmark will be removed if a number is NULL.
- * @pre None.
- * @post None.
- * @param [out] landmark - a #LocationLandmark
- * @param [in] number - a gchar
- * @return gboolean
- * @retval TRUE if success
- * @see location_landmark_get_phone_number
- */
-gboolean location_landmark_set_phone_number (LocationLandmark *landmark, const gchar *number);
-
-/**
- * @brief Set the property data of the given #LocationLandmark
- * @remarks The previous value of the #LocationLandmark matching to key will be removed if a value is NULL.
- * @pre None.
- * @post None.
- * @param [out] landmark - a #LocationLandmark
- * @param [in] key - a gconstpointer
- * @param [in] value - a gconstpointer
- * @return gboolean
- * @retval TRUE if success
- * @see location_landmark_get_property
- */
-gboolean location_landmark_set_property (LocationLandmark *landmark, gconstpointer key, gconstpointer value);
-
-/**
- * @brief Set url of the given #LocationLandmarkUrl
- * @remarks The previous url path of the #LocationLandmarkUrl will be removed if a path is NULL.
- * @pre None.
- * @post None.
- * @param [in] url - a #LocationLandmarkUrl
- * @param [in] path - a gchar
- * @return gboolean
- * @retval TRUE if success
- * @see location_landmark_url_get_url_path
- */
-gboolean location_landmark_url_set_url_path (LocationLandmarkUrl *url, const gchar *path);
-
-/**
- * @brief Set the description of the given #LocationLandmarkUrl
- * @remarks The previous description of the #LocationLandmarkUrl will be removed if a desc is NULL.
- * @pre None.
- * @post None.
- * @param [in] url - a #LocationLandmarkUrl
- * @param [in] desc - a gchar
- * @return gboolean
- * @retval TRUE if success
- * @see location_landmark_url_get_description
- */
-gboolean location_landmark_url_set_description (LocationLandmarkUrl *url, const gchar *desc);
-
-/**
- * @brief Set the rating of the given #LocationLandmark
- * @remarks The previous description of the #LocationLandmark will be removed if a desc is NULL.
- * @pre None.
- * @post None.
- * @param [in] landmark - a #LocationLandmark
- * @param [in] rating - a #LandmarkRating
- * @return gboolean
- * @retval TRUE if success
- * @see location_landmark_get_ratings
- */
-gboolean location_landmark_set_rating (LocationLandmark *landmark, const LandmarkRating *rating);
-
-/**
- * @brief Set the rating' count of the given #LandmarkRating
- * @pre None.
- * @post None.
- * @param [in] rating - a #LandmarkRating
- * @param [in] count - a gint
- * @return gboolean
- * @retval TRUE if success
- * @see landmark_ratings_get_count
- */
-gboolean landmark_rating_set_count (LandmarkRating *rating, gint count);
-
-/**
- * @brief Set the rating' average of the given #LandmarkRating
- * @pre None.
- * @post None.
- * @param [in] rating - a #LandmarkRating
- * @param [in] average - a gdouble
- * @return gboolean
- * @retval TRUE if success
- * @see landmark_ratings_get_average
- */
-gboolean landmark_rating_set_average(LandmarkRating *rating, gdouble average);
-
-/**
- * @brief Set the attribute' label of the given #LocationLandmark
- * @pre None.
- * @post None.
- * @param [in] attribute - a #LandmarkAttribute
- * @param [in] label - a gchar
- * @return gboolean
- * @retval TRUE if success
- * @see landmark_attributes_get_label
- */
-gboolean landmark_attribute_set_label(LandmarkAttribute *attribute, const gchar *label);
-
-/**
- * @brief Set the attribute' text of the given #LocationLandmark
- * @pre None.
- * @post None.
- * @param [in] attribute - a #LandmarkAttribute
- * @param [in] text - a gchar
- * @return gboolean
- * @retval TRUE if success
- * @see landmark_attributes_get_text
- */
-gboolean landmark_attribute_set_text(LandmarkAttribute *attribute, const gchar *text);
-
-/**
- * @brief Set the attribute' identifier of the given #LocationLandmark
- * @pre None.
- * @post None.
- * @param [in] attribute - a #LandmarkAttribute
- * @param [in] identifier - a gchar
- * @return gboolean
- * @retval TRUE if success
- * @see landmark_attributes_get_identifier
- */
-gboolean landmark_attribute_set_identifier(LandmarkAttribute *attribute, const gchar *identifier);
-
-/**
- * @brief Set the attribute of the given #LocationLandmark
- * @pre None.
- * @post None.
- * @param [in] landmark - a #LocationLandmark
- * @param [in] attribute - a glist
- * @return gboolean
- * @retval TRUE if success
- * @see location_landmark_get_attributes
- */
-gboolean location_landmark_set_attribute(LocationLandmark *landmark, GList *attribute);
-
-/**
- * @brief Set the contact detail type of the given #LandmarkContact
- * @pre None.
- * @post None.
- * @param [in] contact - a #LandmarkContact
- * @param [in] type - a gchar pointer
- * @return gboolean
- * @retval TRUE if success
- * @see landmark_contacts_get_type
- */
-gboolean landmark_contact_set_type(LandmarkContact *contact, const gchar *type);
-
-/**
- * @brief Set the contact detail label of the given #LandmarkContact
- * @pre None.
- * @post None.
- * @param [in] contact - a #LandmarkContact
- * @param [in] label - a gchar pointer
- * @return gboolean
- * @retval TRUE if success
- * @see landmark_contacts_get_label
- */
-gboolean landmark_contact_set_label(LandmarkContact *contact, const gchar *label);
-
-/**
- * @brief Set the contact detail value of the given #LandmarkContact
- * @pre None.
- * @post None.
- * @param [in] contact - a #LandmarkContact
- * @param [in] value - a gchar pointer
- * @return gboolean
- * @retval TRUE if success
- * @see landmark_contacts_get_value
- */
-gboolean landmark_contact_set_value(LandmarkContact *contact, const gchar *value);
-
-/**
- * @brief Set the contact details of the given #LocationLandmark
- * @pre None.
- * @post None.
- * @param [in] landmark - a #LocationLandmark
- * @param [in] contact - a glist
- * @return gboolean
- * @retval TRUE if success
- * @see location_landmark_get_contacts
- */
-gboolean location_landmark_set_contact(LocationLandmark *landmark, GList *contact);
-
-/**
- * @brief Set the supplier link of the given #LocationLandmark
- * @pre None.
- * @post None.
- * @param [in] landmark - a #LocationLandmark
- * @param [in] link - a gchar
- * @return gboolean
- * @retval TRUE if success
- * @see location_landmark_get_supplier
- */
-gboolean location_landmark_set_supplier(LocationLandmark *landmark, const LandmarkLinkObject *supplier);
-
-/**
- * @brief Set the media list of the given #LandmarkMedia
- * @pre None.
- * @post None.
- * @param [in] media - a #LandmarkMedia
- * @param [in] attribution - a gchar
- * @return gboolean
- * @retval TRUE if success
- * @see landmark_media_get_attribution
- */
-gboolean landmark_media_set_attribution (LandmarkMedia *media, const gchar *attribution);
-
-/**
- * @brief Set the media list of the given #LandmarkMedia
- * @pre None.
- * @post None.
- * @param [in] media - a #LandmarkMedia
- * @param [in] supplier - a #LandmarkLinkObject
- * @return gboolean
- * @retval TRUE if success
- * @see landmark_media_get_media_supplier
- */
-gboolean landmark_media_set_media_supplier(LandmarkMedia *media, const LandmarkLinkObject *mediaSupplier);
-
-/**
- * @brief Set the media list of the given #LandmarkMedia
- * @pre None.
- * @post None.
- * @param [in] media - a #LandmarkMedia
- * @param [in] via - a #LandmarkLinkObject
- * @return gboolean
- * @retval TRUE if success
- * @see landmark_media_get_via
- */
-gboolean landmark_media_set_via(LandmarkMedia *media, const LandmarkLinkObject *via);
-
-/**
- * @brief Set the editorial list of the given #LocationLandmark
- * @pre None.
- * @post None.
- * @param [in] landmark - a #LocationLandmark
- * @param [in] editorial - a glist
- * @return gboolean
- * @retval TRUE if success
- * @see location_landmark_get_editorials
- */
-gboolean location_landmark_set_editorial(LocationLandmark *landmark, GList *editorial);
-
-/**
- * @brief Set the editorial list of the given #LandmarkEditorial
- * @pre None.
- * @post None.
- * @param [in] editorial - a #LandmarkEditorial
- * @param [in] media - a #LandmarkMedia
- * @return gboolean
- * @retval TRUE if success
- * @see location_landmark_get_editorials
- */
-gboolean landmark_editorial_set_media(LandmarkEditorial *editorial, const LandmarkMedia *media);
-
-/**
- * @brief Set the description of the given #LandmarkEditorial
- * @pre None.
- * @post None.
- * @param [in] editorial - a #LandmarkEditorial
- * @param [in] description - a gchar
- * @return gboolean
- * @retval TRUE if success
- * @see location_landmark_editorials_get_attribution
- */
-gboolean landmark_editorial_set_description(LandmarkEditorial *editorial, const gchar *description);
-
-/**
- * @brief Set the language of the given #LandmarkEditorial
- * @pre None.
- * @post None.
- * @param [in] editorial - a #LandmarkEditorial
- * @param [in] language - a gchar
- * @return gboolean
- * @retval TRUE if success
- * @see location_landmark_editorials_get_attribution
- */
-gboolean landmark_editorial_set_language(LandmarkEditorial *editorial, const gchar *language);
-
-/**
- * @brief Set the attribution of the given #LandmarkImage
- * @pre None.
- * @post None.
- * @param [in] image - a #LandmarkImage
- * @param [in] media - a #LandmarkMedia
- * @return gboolean
- * @retval TRUE if success
- * @see location_landmark_get_images
- */
-gboolean landmark_image_set_media(LandmarkImage *image, const LandmarkMedia *media);
-
-/**
- * @brief Set the attribution of the given #LandmarkImage
- * @pre None.
- * @post None.
- * @param [in] image - a #LandmarkImage
- * @param [in] image - a glist
- * @return gboolean
- * @retval TRUE if success
- * @see landmark_images_get_url
- */
-gboolean landmark_image_set_url(LandmarkImage *image, const gchar *url);
-
-/**
- * @brief Set the attribution of the given #LandmarkImage
- * @pre None.
- * @post None.
- * @param [in] image - a #LandmarkImage
- * @param [in] image - a glist
- * @return gboolean
- * @retval TRUE if success
- * @see location_landmark_get_images
- */
-gboolean landmark_image_set_id(LandmarkImage *image, const gchar *identifier);
-
-/**
- * @brief Set the attribution of the given #LandmarkImage
- * @pre None.
- * @post None.
- * @param [in] image - a #LandmarkImage
- * @param [in] image - a glist
- * @return gboolean
- * @retval TRUE if success
- * @see landmark_images_get_width
- */
-gboolean landmark_image_set_width(LandmarkImage *image, guint width);
-
-/**
- * @brief Set the attribution of the given #LandmarkImage
- * @pre None.
- * @post None.
- * @param [in] image - a #LandmarkImage
- * @param [in] image - a glist
- * @return gboolean
- * @retval TRUE if success
- * @see landmark_images_get_height
- */
-gboolean landmark_image_set_height(LandmarkImage *image, guint height);
-
-/**
- * @brief Set the attribution of the given #LandmarkImage
- * @pre None.
- * @post None.
- * @param [in] image - a #LandmarkImage
- * @param [in] image - a glist
- * @return gboolean
- * @retval TRUE if success
- * @see location_landmark_get_images
- */
-gboolean landmark_image_set_image_user(LandmarkImage *image, const LandmarkLinkObject *imageUser);
-
-/**
- * @brief Set the image list of the given #LocationLandmark
- * @pre None.
- * @post None.
- * @param [in] landmark - a #LocationLandmark
- * @param [in] image - a glist
- * @return gboolean
- * @retval TRUE if success
- * @see location_landmark_get_images
- */
-gboolean location_landmark_set_image(LocationLandmark *landmark, GList *image);
-
-/**
- * @brief Set the review list of the given #LandmarkMedia
- * @pre None.
- * @post None.
- * @param [in] review - a #LandmarkReview
- * @param [in] media - a #LandmarkMedia
- * @return gboolean
- * @retval TRUE if success
- * @see landmark_reviews_get_media
- */
-gboolean landmark_review_set_media(LandmarkReview *review, const LandmarkMedia *media);
-
-/**
- * @brief Set the date of the given #LandmarkReview
- * @pre None.
- * @post None.
- * @param [in] review - a #LandmarkReview
- * @param [in] date - a gchar
- * @return gboolean
- * @retval TRUE if success
- * @see landmark_reviews_get_date
- */
-gboolean landmark_review_set_date(LandmarkReview *review, const gchar *date);
-
-/**
- * @brief Set the title of the given #LandmarkReview
- * @pre None.
- * @post None.
- * @param [in] review - a #LandmarkReview
- * @param [in] title - a gchar
- * @return gboolean
- * @retval TRUE if success
- * @see landmark_reviews_get_title
- */
-gboolean landmark_review_set_title(LandmarkReview *review, const gchar *title);
-
-/**
- * @brief Set the rating of the given #LandmarkReview
- * @pre None.
- * @post None.
- * @param [in] review - a #LandmarkReview
- * @param [in] rating - a gdouble
- * @return gboolean
- * @retval TRUE if success
- * @see landmark_reviews_get_rating
- */
-gboolean landmark_review_set_rating(LandmarkReview *review, gdouble rating);
-
-/**
- * @brief Set the rating of the given #LandmarkReview
- * @pre None.
- * @post None.
- * @param [in] review - a #LandmarkReview
- * @param [in] description - a gchar
- * @return gboolean
- * @retval TRUE if success
- * @see landmark_reviews_get_description
- */
-gboolean landmark_review_set_description(LandmarkReview *review, const gchar *description);
-
-/**
- * @brief Set the language of the given #LandmarkReview
- * @pre None.
- * @post None.
- * @param [in] review - a #LandmarkReview
- * @param [in] language - a gchar
- * @return gboolean
- * @retval TRUE if success
- * @see landmark_reviews_get_language
- */
-gboolean landmark_review_set_language(LandmarkReview *review, const gchar *language);
-
-/**
- * @brief Set the language of the given #LandmarkReview
- * @pre None.
- * @post None.
- * @param [in] review - a #LandmarkReview
- * @param [in] user - a #LandmarkLinkObject
- * @return gboolean
- * @retval TRUE if success
- * @see landmark_reviews_get_review_user
- */
-gboolean landmark_review_set_review_user(LandmarkReview *review, const LandmarkLinkObject *reviewUser);
-
-/**
- * @brief Set the review of the given #landmark
- * @pre None.
- * @post None.
- * @param [in] landmark - a #LocationLandmark
- * @param [in] review - a #GList
- * @return gboolean
- * @retval TRUE if success
- * @see location_landmark_get_reviews
- */
-gboolean location_landmark_set_review(LocationLandmark *landmark, GList *review);
-
-/**
- * @brief Set the linkObject of the given #LocationLandmark
- * @pre None.
- * @post None.
- * @param [in] landmark - a #LocationLandmark
- * @param [in] linkObject - a #LandmarkLinkObject
- * @return gboolean
- * @retval TRUE if success
- * @see location_landmark_get_related
- */
-gboolean location_landmark_set_related(LocationLandmark *landmark, const LandmarkLinkObject *related);
-
-/**
- * @brief Set the id of the given #LandmarkCategory
- * @pre None.
- * @post None.
- * @param [in] category - a #LandmarkCategory
- * @param [in] id - a gchar
- * @return gboolean
- * @retval TRUE if success
- * @see landmark_category_get_id
- */
-gboolean landmark_category_set_id (LandmarkCategory *category, const gchar *id);
-
-/**
- * @brief Set the name of the given #LandmarkCategory
- * @pre None.
- * @post None.
- * @param [in] category - a #LandmarkCategory
- * @param [in] name - a gchar
- * @return gboolean
- * @retval TRUE if success
- * @see landmark_category_get_name
- */
-gboolean landmark_category_set_name (LandmarkCategory *category, const gchar *name);
-
-/**
- * @brief Set the url of the given #LandmarkCategory
- * @pre None.
- * @post None.
- * @param [in] category - a #LandmarkCategory
- * @param [in] url - a gchar
- * @return gboolean
- * @retval TRUE if success
- * @see landmark_category_get_url
- */
-gboolean landmark_category_set_url (LandmarkCategory *category, const gchar *url);
-
-/**
- * @brief Set the subcategories of the given #LandmarkCategory
- * @pre None.
- * @post None.
- * @param [in] category - a #LandmarkCategory
- * @param [in] subcategories - a #GList
- * @return gboolean
- * @retval TRUE if success
- * @see landmark_category_get_subcategories
- */
-gboolean landmark_category_set_subcategories (LandmarkCategory *category, GList *subcategories);
-
-/**
- * @brief Set the value of the given #LandmarkLinkObject
- * @pre None.
- * @post None.
- * @param [in] link - a #LandmarkLinkObject
- * @param [in] value - a gchar
- * @return gboolean
- * @retval TRUE if success
- * @see landmark_linkobject_get_link_string
- */
-gboolean landmark_linkobject_set_link_string(LandmarkLinkObject *link, const gchar *linkString);
-
-/**
- * @brief Set the value of the given #LandmarkLinkObject
- * @pre None.
- * @post None.
- * @param [in] link - a #LandmarkLinkObject
- * @param [in] type - a gchar
- * @return gboolean
- * @retval TRUE if success
- * @see landmark_linkobject_get_type
- */
-gboolean landmark_linkobject_set_type(LandmarkLinkObject *link, const gchar *type);
-
-/**
- * @brief Set the value of the given #LandmarkLinkObject
- * @pre None.
- * @post None.
- * @param [in] link - a #LandmarkLinkObject
- * @param [in] name - a gchar
- * @return gboolean
- * @retval TRUE if success
- * @see landmark_linkobject_get_name
- */
-gboolean landmark_linkobject_set_name(LandmarkLinkObject *link, const gchar *name);
-
-/**
- * @brief Set the id of the given #LandmarkLinkObject
- * @pre None.
- * @post None.
- * @param [in] link - a #LandmarkLinkObject
- * @param [in] id - a gchar
- * @return gboolean
- * @retval TRUE if success
- * @see landmark_linkobject_get_id
- */
-gboolean landmark_linkobject_set_id(LandmarkLinkObject *link, const gchar *id);
-
-/**
- * @} @}
- */
-
-G_END_DECLS
-
-#endif
-
-
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "location-log.h"
-#include "location.h"
-#include "location-types.h"
-#include "map-service.h"
-
-#include "location-landmark.h"
-#include "location-landmark-ext.h"
-
-
-struct _LandmarkAttribute {
- gchar *label;
- gchar *text;
- gchar *id;
-};
-
-struct _LandmarkContact {
- gchar *type; ///< the contact detail type
- gchar *label; ///< the contact detail label
- gchar *value; ///< the contact detail value
-};
-
-struct _LandmarkLinkObject {
- gchar *linkString; ///< a string containing the link string
- gchar *type; ///< a value representing the link type
- gchar *name; ///< the link name
- gchar *id; ///< the identifier of the given link object
-};
-
-
-struct _LandmarkMedia {
- gchar *attribution; ///< the attribution text
- LandmarkLinkObject *mediaSupplier; ///< information about the supplier of the media
- LandmarkLinkObject *via; ///< the external link through which the media item was sourced (not the original owner/creator)
-};
-
-struct _LandmarkCategory {
- gchar *name; ///< the name of the category
- gchar *id; ///< the category id
- GList *subcategories; ///< a list containing the child categories
- gchar *url; ///< the category URL
-};
-
-struct _LandmarkImage {
- LandmarkMedia *media; ///< media items information
- gchar *url; ///< the image URL
- gchar *id; ///< the id of the image
- guint width; ///< the width of the image
- guint height; ///< the height of the image
- LandmarkLinkObject *imageUser; ///< the image user link
-};
-
-struct _LandmarkEditorial {
- LandmarkMedia *media; ///< media items information
- gchar *description; ///< the description (text of the given editorial)
- gchar *language; ///< the language of the editorial
-};
-
-struct _LandmarkReview {
- LandmarkMedia *media;///< media items information
- gchar *date; ///< the review date
- gchar *title; ///< the review title
- gdouble rating; ///< the review rating
- gchar *description; ///< the review description (text)
- gchar *language; ///< the review language
- LandmarkLinkObject *reviewUser; ///< the user (a link to the user's Web site)
-};
-
-struct _LandmarkRating {
- gint count;
- gdouble average; ///< rating average score
-};
-
-struct _LocationLandmark {
-
- guint id; ///< Unique identifier of the landmark
- guint priority; ///< Degree of importance of the landmark (Between HIGHEST_LANDMARK_PRIORITY and LOWEST_LANDMARK_PRIORITY)
- gchar *name; ///< Name of landmark
- LocationPosition *position; ///< Positon of the landmark, may be null if not known
- LocationAddress *addr; ///< Textual address information of the landmark, may be null if not
- LocationBoundary *bbox; ///< Coverage area of the landmark, may be null if not available
- guint timestamp; ///< Time when the landmark data was last updated (updated by system and used to facilitate tracking)
-
- gchar *author; ///< Provider of the landmark data, may be null
- gchar *store; ///< Name of landmark store that the landmark belongs to
- gchar *phone_number; ///< Nhone number of the landmark, may be null
- GList *category; ///< Categories to which the landmark belongs to
- GList *url; ///< Url to additional content (Optional)
- gchar *desc; ///< Description of the landmark, may be null if not available
-
- GHashTable *properties; ///< Extra info of the landmark
- LandmarkRating *rating; ///< the rating for the given place.
- GList *attribute; ///< list of LandmarkAttribute, place attribute
- GList *contact; ///< list of LandmarkContact, contact details
- LandmarkLinkObject *supplier;///< a link to the supplier of information about the given place
- GList *editorial; ///< a list of list editorial relating to the given place
- GList *image; ///< a list of image relating to the given place
- GList *review; ///< a list of review relating to the given place
- LandmarkLinkObject *related;///< related places (for example "recommended" places)
-};
-
-struct _LocationLandmarkUrl {
- gchar *path; ///< Url of landmark url info
- gchar *desc; ///< Description of landmark url info
-};
-
-EXPORT_API guint
-location_landmark_get_id (const LocationLandmark *landmark)
-{
- g_return_val_if_fail(landmark, 0);
-
- return landmark->id;
-}
-
-
-EXPORT_API gchar *
-location_landmark_get_name (const LocationLandmark *landmark)
-{
- g_return_val_if_fail(landmark, NULL);
-
- return landmark->name;
-}
-
-EXPORT_API LocationPosition *
-location_landmark_get_position (const LocationLandmark *landmark)
-{
- g_return_val_if_fail(landmark, NULL);
-
- return landmark->position;
-}
-
-EXPORT_API LocationAddress *
-location_landmark_get_address (const LocationLandmark *landmark)
-{
- g_return_val_if_fail(landmark, NULL);
-
- return landmark->addr;
-}
-
-EXPORT_API gchar *
-location_landmark_get_description (const LocationLandmark *landmark)
-{
- g_return_val_if_fail(landmark, NULL);
-
- return landmark->desc;
-}
-
-EXPORT_API guint
-location_landmark_get_timestamp (const LocationLandmark *landmark)
-{
- g_return_val_if_fail(landmark, 0);
-
- return landmark->timestamp;
-}
-
-EXPORT_API guint
-location_landmark_get_priority (const LocationLandmark *landmark)
-{
- g_return_val_if_fail(landmark, 0);
-
- return landmark->priority;
-}
-
-EXPORT_API LocationBoundary *
-location_landmark_get_bounding_box (const LocationLandmark *landmark)
-{
- g_return_val_if_fail(landmark, NULL);
-
- return landmark->bbox;
-}
-
-EXPORT_API gchar *
-location_landmark_get_author (const LocationLandmark *landmark)
-{
- g_return_val_if_fail(landmark, NULL);
-
- return landmark->author;
-}
-
-EXPORT_API GList *
-location_landmark_get_url (const LocationLandmark *landmark)
-{
- g_return_val_if_fail(landmark, NULL);
-
- return landmark->url;
-}
-
-EXPORT_API GList *
-location_landmark_get_category (const LocationLandmark *landmark)
-{
- g_return_val_if_fail(landmark, NULL);
-
- return landmark->category;
-}
-
-EXPORT_API gchar *
-location_landmark_get_phone_number (const LocationLandmark *landmark)
-{
- g_return_val_if_fail(landmark, NULL);
-
- return landmark->phone_number;
-}
-
-EXPORT_API GList *
-location_landmark_get_property_key (const LocationLandmark *landmark)
-{
- g_return_val_if_fail(landmark, NULL);
-
- return g_hash_table_get_keys (landmark->properties);
-}
-
-EXPORT_API gconstpointer
-location_landmark_get_property (const LocationLandmark *landmark, gconstpointer key)
-{
- g_return_val_if_fail(landmark, NULL);
- g_return_val_if_fail(key, NULL);
- if (!landmark->properties) {
- return NULL;
- }
-
- return g_hash_table_lookup (landmark->properties, key);
-}
-
-EXPORT_API gboolean
-location_landmark_set_id (LocationLandmark *landmark, guint id)
-{
- g_return_val_if_fail(landmark, FALSE);
-
- landmark->id = id;
-
- return TRUE;
-}
-
-EXPORT_API gboolean
-location_landmark_set_name (LocationLandmark *landmark, const gchar *name)
-{
- g_return_val_if_fail(landmark, FALSE);
-
- if (landmark->name) {
- g_free(landmark->name);
- landmark->name = NULL;
- }
- if (name) {
- landmark->name = g_strdup (name);
- }
-
- return TRUE;
-}
-
-EXPORT_API gboolean
-location_landmark_set_position (LocationLandmark *landmark, const LocationPosition *position)
-{
- g_return_val_if_fail(landmark, FALSE);
-
- if (landmark->position) {
- location_position_free(landmark->position);
- landmark->position = NULL;
- }
-
- if (position) {
- landmark->position = location_position_copy (position);
- }
-
- return TRUE;
-
-}
-
-EXPORT_API gboolean
-location_landmark_set_address (LocationLandmark *landmark, const LocationAddress *addr)
-{
- g_return_val_if_fail(landmark, FALSE);
-
- if (landmark->addr) {
- location_address_free (landmark->addr);
- landmark->addr = NULL;
- }
-
- if (addr) {
- landmark->addr = location_address_copy (addr);
- }
-
- return TRUE;
-
-}
-
-EXPORT_API gboolean
-location_landmark_set_description (LocationLandmark *landmark, const gchar *desc)
-{
- g_return_val_if_fail(landmark, FALSE);
-
- if (landmark->desc) {
- g_free(landmark->desc);
- landmark->desc = NULL;
- }
-
- if (desc) {
- landmark->desc = g_strdup (desc);
- }
-
- return TRUE;
-}
-
-EXPORT_API gboolean
-location_landmark_set_timestamp (LocationLandmark *landmark, guint timestamp)
-{
- g_return_val_if_fail(landmark, FALSE);
-
- landmark->timestamp = timestamp;
-
- return TRUE;
-
-}
-
-EXPORT_API gboolean
-location_landmark_set_priority (LocationLandmark *landmark, guint priority)
-{
- g_return_val_if_fail(landmark, FALSE);
-
- landmark->priority = priority;
-
- return TRUE;
-}
-
-EXPORT_API gboolean
-location_landmark_set_bounding_box (LocationLandmark *landmark, const LocationBoundary *bbox)
-{
- g_return_val_if_fail(landmark, FALSE);
-
- if (landmark->bbox) {
- location_boundary_free(landmark->bbox);
- landmark->bbox = NULL;
- }
-
- if (bbox) {
- landmark->bbox = location_boundary_copy (bbox);
- }
-
- return TRUE;
-}
-
-EXPORT_API gboolean
-location_landmark_set_author (LocationLandmark *landmark, const gchar *author)
-{
- g_return_val_if_fail(landmark, FALSE);
-
- if (landmark->author) {
- g_free(landmark->author);
- landmark->author = NULL;
- }
- if (author) {
- landmark->author = g_strdup (author);
- }
-
- return TRUE;
-}
-
-EXPORT_API gboolean
-location_landmark_url_set_url_path (LocationLandmarkUrl *url, const gchar *path)
-{
- g_return_val_if_fail (url, FALSE);
-
- if (url->path) {
- g_free(url->path);
- url->path = NULL;
- }
-
- if (path) {
- url->path = g_strdup (path);
- }
-
- return TRUE;
-}
-
-EXPORT_API gboolean
-location_landmark_url_set_description (LocationLandmarkUrl *url, const gchar *desc)
-{
- g_return_val_if_fail (url, FALSE);
-
- if (url->desc) {
- g_free(url->desc);
- url->desc = NULL;
- }
-
- if (desc) {
- url->desc = g_strdup (desc);
- }
-
- return TRUE;
-}
-
-
-EXPORT_API void
-location_landmark_url_free (LocationLandmarkUrl * url)
-{
- g_return_if_fail (url);
-
- location_landmark_url_set_url_path(url, NULL);
- location_landmark_url_set_description(url, NULL);
-
- g_slice_free(LocationLandmarkUrl, url);
-}
-
-static void landmark_url_foreach_free (gpointer data)
-{
- g_return_if_fail(data);
-
- LocationLandmarkUrl *url = (LocationLandmarkUrl *)data;
-
- location_landmark_url_free (url);
-}
-
-static void landmark_foreach_url_copy (gpointer data, gpointer user_data)
-{
- g_return_if_fail(data);
- g_return_if_fail(user_data);
-
- LocationLandmarkUrl *url = (LocationLandmarkUrl *)data;
- LocationLandmark *landmark = (LocationLandmark *) user_data;
-
- if(!url || !landmark) {
- return;
- }
-
- landmark->url = g_list_append(landmark->url, url);
-}
-
-EXPORT_API gboolean
-location_landmark_set_url (LocationLandmark *landmark, GList *url)
-{
- g_return_val_if_fail(landmark, FALSE);
-
- if (landmark->url) {
- g_list_free_full(landmark->url, landmark_url_foreach_free);
- landmark->url = NULL;
- }
-
- if (url) {
- g_list_foreach (url, landmark_foreach_url_copy, landmark);
- }
-
- return TRUE;
-}
-
-EXPORT_API void landmark_category_free (LandmarkCategory *category)
-{
- g_return_if_fail (category);
-
- landmark_category_set_name(category, NULL);
- landmark_category_set_id (category, NULL);
- landmark_category_set_subcategories (category, NULL);
- landmark_category_set_url(category, NULL);
-
- g_slice_free(LandmarkCategory, category);
-}
-
-static void landmark_category_foreach_free (gpointer data)
-{
- g_return_if_fail(data);
-
- LandmarkCategory *category = (LandmarkCategory *)data;
-
- landmark_category_free (category);
-}
-
-
-EXPORT_API LandmarkCategory *landmark_category_new (void)
-{
- LandmarkCategory *category = g_slice_new0 (LandmarkCategory);
- g_return_val_if_fail(category, NULL);
-
- return category;
-}
-
-static void landmark_foreach_copy_category (gpointer data, gpointer user_data)
-{
- g_return_if_fail (data);
- g_return_if_fail (user_data);
-
- LandmarkCategory *category = (LandmarkCategory *)data;
- LocationLandmark *landmark = (LocationLandmark *) user_data;
- landmark->category = g_list_append (landmark->category, landmark_category_copy(category));
-}
-
-
-EXPORT_API gboolean landmark_category_set_id (LandmarkCategory *category, const gchar *id)
-{
- g_return_val_if_fail(category, FALSE);
- if (category->id) {
- g_free(category->id);
- category->id = NULL;
- }
-
- if (id) {
- category->id = g_strdup (id);
- }
-
- return TRUE;
-}
-
-EXPORT_API gchar *landmark_category_get_id (const LandmarkCategory *category)
-{
- g_return_val_if_fail(category, NULL);
-
- return category->id;
-}
-
-
-EXPORT_API gboolean landmark_category_set_name (LandmarkCategory *category, const gchar *name)
-{
- g_return_val_if_fail(category, FALSE);
-
- if (category->name) {
- g_free(category->name);
- category->name = NULL;
- }
-
- if (name) {
- category->name = g_strdup (name);
- }
-
- return TRUE;
-}
-
-EXPORT_API gchar *landmark_category_get_name (const LandmarkCategory *category)
-{
- g_return_val_if_fail(category, NULL);
-
- return category->name;
-}
-
-EXPORT_API gboolean landmark_category_set_url (LandmarkCategory *category, const gchar *url)
-{
- g_return_val_if_fail(category, FALSE);
- if (category->url) {
- g_free(category->url);
- category->url = NULL;
- }
-
- if (url) {
- category->url = g_strdup (url);
- }
-
- return TRUE;
-}
-
-EXPORT_API gchar *landmark_category_get_url (const LandmarkCategory *category)
-{
- g_return_val_if_fail(category, NULL);
-
- return category->url;
-}
-
-EXPORT_API gboolean landmark_category_set_subcategories (LandmarkCategory *category, GList *subcategories)
-{
- g_return_val_if_fail(category, FALSE);
-
- if (category->subcategories) {
- g_list_free_full(category->subcategories, landmark_category_foreach_free);
- category->subcategories = NULL;
- }
-
- if (subcategories) {
- g_list_foreach ((GList*) subcategories, landmark_foreach_copy_category, category);
- }
-
- return TRUE;
-}
-
-
-EXPORT_API GList *landmark_category_get_subcategories (const LandmarkCategory *category)
-{
- g_return_val_if_fail(category, NULL);
-
- return category->subcategories;
-}
-
-EXPORT_API LandmarkCategory *landmark_category_copy (const LandmarkCategory *category)
-{
- g_return_val_if_fail(category, NULL);
-
- LandmarkCategory *new_category = landmark_category_new();
- g_return_val_if_fail(new_category, NULL);
-
- landmark_category_set_id (new_category, landmark_category_get_id (category));
- landmark_category_set_url (new_category, landmark_category_get_url (category));
- landmark_category_set_name (new_category, landmark_category_get_name (category));
- landmark_category_set_subcategories (new_category, landmark_category_get_subcategories (category));
-
- return new_category;
-}
-
-EXPORT_API gboolean
-location_landmark_set_category (LocationLandmark *landmark, GList *category)
-{
- g_return_val_if_fail(landmark, FALSE);
-
- if (landmark->category) {
- g_list_free_full(landmark->category, landmark_category_foreach_free);
- landmark->category = NULL;
- }
-
- if (category) {
- g_list_foreach ((GList*) category, landmark_foreach_copy_category, landmark);
- }
-
- return TRUE;
-}
-
-EXPORT_API gboolean
-location_landmark_set_phone_number (LocationLandmark *landmark, const gchar *number)
-{
- g_return_val_if_fail(landmark, FALSE);
- g_return_val_if_fail(number, FALSE);
-
- if (landmark->phone_number) {
- g_free(landmark->phone_number);
- landmark->phone_number = NULL;
- }
-
- if (number) {
- landmark->phone_number = g_strdup (number);
- }
-
- return TRUE;
-}
-
-EXPORT_API gboolean
-location_landmark_set_property(LocationLandmark *landmark, gconstpointer key, gconstpointer value)
-{
- g_return_val_if_fail(landmark, FALSE);
- g_return_val_if_fail(key, FALSE);
- if (!landmark->properties) {
- return FALSE;
- }
-
- if (value) {
- gchar *re_key = g_strdup (key);
- gchar *re_val = g_strdup (value);
- g_hash_table_insert(landmark->properties, re_key, re_val);
- } else {
- g_hash_table_remove (landmark->properties, key);
- }
-
- return TRUE;
-}
-
-EXPORT_API gchar *
-location_landmark_url_get_url_path (const LocationLandmarkUrl *url)
-{
- g_return_val_if_fail (url, NULL);
-
- return url->path;
-}
-
-EXPORT_API gchar *
-location_landmark_url_get_description (const LocationLandmarkUrl *url)
-{
- g_return_val_if_fail (url, NULL);
-
- return url->desc;
-}
-
-EXPORT_API LocationLandmarkUrl *
-location_landmark_url_new (void)
-{
- LocationLandmarkUrl *url = g_slice_new0 (LocationLandmarkUrl);
- g_return_val_if_fail(url, NULL);
-
- return url;
-}
-
-EXPORT_API LocationLandmarkUrl *
-location_landmark_url_copy (const LocationLandmarkUrl *url)
-{
- g_return_val_if_fail(url, NULL);
-
- LocationLandmarkUrl *new_url = location_landmark_url_new();
-
- location_landmark_url_set_url_path(new_url, location_landmark_url_get_url_path(url));
- location_landmark_url_set_description(new_url, location_landmark_url_get_description(url));
-
- return new_url;
-}
-
-EXPORT_API LocationLandmark *
-location_landmark_new (void)
-{
- LocationLandmark *landmark = g_slice_new0 (LocationLandmark);
- if (!landmark) {
- return NULL;
- }
-
- landmark->properties = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
-
- return landmark;
-}
-
-EXPORT_API gboolean landmark_rating_set_count (LandmarkRating *rating, gint count)
-{
- g_return_val_if_fail(rating, FALSE);
- g_return_val_if_fail(count >= 0, FALSE);
-
- rating->count = count;
-
- return TRUE;
-}
-
-EXPORT_API gint landmark_rating_get_count(const LandmarkRating *rating)
-{
- g_return_val_if_fail(rating, 0);
-
- return rating->count;
-}
-
-EXPORT_API gboolean landmark_rating_set_average(LandmarkRating *rating, gdouble average)
-{
- g_return_val_if_fail(rating, FALSE);
-
- rating->average = average;
-
- return TRUE;
-}
-
-EXPORT_API gdouble landmark_rating_get_average(const LandmarkRating *rating)
-{
- g_return_val_if_fail(rating, 0);
-
- return rating->average;
-}
-
-EXPORT_API LandmarkRating *landmark_rating_new (void)
-{
- LandmarkRating *rating = g_slice_new0 (LandmarkRating);
- g_return_val_if_fail(rating, NULL);
-
- return rating;
-}
-
-EXPORT_API void landmark_rating_free (LandmarkRating *rating)
-{
- g_return_if_fail (rating);
-
- landmark_rating_set_count(rating, 0);
- landmark_rating_set_average(rating, 0);
-
- g_slice_free(LandmarkRating, rating);
-}
-
-EXPORT_API LandmarkRating *landmark_rating_copy(const LandmarkRating *rating)
-{
- g_return_val_if_fail (rating, NULL);
- LandmarkRating *new_ratings = landmark_rating_new();
- g_return_val_if_fail (new_ratings, NULL);
-
- landmark_rating_set_count(new_ratings, landmark_rating_get_count(rating));
- landmark_rating_set_average(new_ratings, landmark_rating_get_average(rating));
-
- return new_ratings;
-}
-
-EXPORT_API gboolean location_landmark_set_rating(LocationLandmark *landmark, const LandmarkRating *rating)
-{
- g_return_val_if_fail (landmark, FALSE);
-
- if (landmark->rating) {
- g_slice_free(LandmarkRating, landmark->rating);
- landmark->rating = NULL;
- }
-
- if (rating) {
- landmark->rating = landmark_rating_copy (rating);
- }
-
- return TRUE;
-}
-
-
-EXPORT_API LandmarkRating *location_landmark_get_rating(const LocationLandmark *landmark)
-{
- g_return_val_if_fail (landmark, NULL);
-
- return landmark->rating;
-}
-
-EXPORT_API gboolean landmark_attribute_set_label(LandmarkAttribute *attribute, const gchar *label)
-{
- g_return_val_if_fail(attribute, FALSE);
-
- if (attribute->label) {
- g_free(attribute->label);
- attribute->label = NULL;
- }
-
- if (label) {
- attribute->label = g_strdup (label);
- }
-
- return TRUE;
-}
-
-EXPORT_API gchar *landmark_attribute_get_label(const LandmarkAttribute *attribute)
-{
- g_return_val_if_fail(attribute, NULL);
-
- return attribute->label;
-}
-
-
-EXPORT_API gboolean landmark_attribute_set_text(LandmarkAttribute *attribute, const gchar *text)
-{
- g_return_val_if_fail(attribute, FALSE);
-
- if (attribute->text) {
- g_free(attribute->text);
- attribute->text = NULL;
- }
-
- if (text) {
- attribute->text = g_strdup (text);
- }
-
- return TRUE;
-}
-EXPORT_API gchar *landmark_attribute_get_text(const LandmarkAttribute *attribute)
-{
- g_return_val_if_fail(attribute, NULL);
-
- return attribute->text;
-}
-
-EXPORT_API gboolean landmark_attribute_set_identifier(LandmarkAttribute *attribute, const gchar *identifier)
-{
- g_return_val_if_fail(attribute, FALSE);
-
- if (attribute->id) {
- g_free(attribute->id);
- attribute->id = NULL;
- }
-
- if (identifier) {
- attribute->id = g_strdup (identifier);
- }
-
- return TRUE;
-}
-
-EXPORT_API gchar *landmark_attribute_get_identifier (const LandmarkAttribute *attribute)
-{
- g_return_val_if_fail(attribute, NULL);
-
- return attribute->id;
-}
-
-EXPORT_API LandmarkAttribute *landmark_attribute_new (void)
-{
- LandmarkAttribute *attribute = g_slice_new0 (LandmarkAttribute);
- g_return_val_if_fail(attribute, NULL);
-
- return attribute;
-}
-
-EXPORT_API void landmark_attribute_free (LandmarkAttribute *attribute)
-{
- g_return_if_fail (attribute);
-
- landmark_attribute_set_label(attribute, NULL);
- landmark_attribute_set_text(attribute, NULL);
- landmark_attribute_set_identifier(attribute, NULL);
-
- g_slice_free(LandmarkAttribute, attribute);
-}
-
-EXPORT_API LandmarkAttribute *landmark_attribute_copy(const LandmarkAttribute *attribute)
-{
- g_return_val_if_fail(attribute, NULL);
-
- LandmarkAttribute *new_attribute = landmark_attribute_new();
- g_return_val_if_fail(new_attribute, NULL);
-
- landmark_attribute_set_label(new_attribute, landmark_attribute_get_label(attribute));
- landmark_attribute_set_text(new_attribute, landmark_attribute_get_text(attribute));
- landmark_attribute_set_identifier(new_attribute, landmark_attribute_get_identifier(attribute));
-
- return new_attribute;
-}
-
-static void landmark_attribute_foreach_copy (gpointer data, gpointer user_data)
-{
- g_return_if_fail (data);
- g_return_if_fail (user_data);
-
- LandmarkAttribute *attribute = (LandmarkAttribute *)data;
- LocationLandmark *landmark = (LocationLandmark *)user_data;
-
- landmark->attribute = g_list_append (landmark->attribute, landmark_attribute_copy(attribute));
-}
-
-EXPORT_API gboolean landmark_contact_set_type(LandmarkContact *contact, const gchar *type)
-{
- g_return_val_if_fail(contact, FALSE);
-
- if (contact->type) {
- g_free(contact->type);
- contact->type = NULL;
- }
-
- if (type) {
- contact->type = g_strdup (type);
- }
-
- return TRUE;
-}
-
-EXPORT_API gchar *landmark_contact_get_type(const LandmarkContact *contact)
-{
- g_return_val_if_fail(contact, NULL);
-
- return contact->type;
-}
-
-EXPORT_API gboolean landmark_contact_set_label(LandmarkContact *contact, const gchar *label)
-{
- g_return_val_if_fail(contact, FALSE);
-
- if (contact->label) {
- g_free(contact->label);
- contact->label = NULL;
- }
-
- if (label) {
- contact->label = g_strdup (label);
- }
-
- return TRUE;
-}
-
-EXPORT_API gchar *landmark_contact_get_label(const LandmarkContact *contact)
-{
- g_return_val_if_fail(contact, NULL);
-
- return contact->label;
-}
-
-EXPORT_API gboolean landmark_contact_set_value(LandmarkContact *contact, const gchar *value)
-{
- g_return_val_if_fail(contact, FALSE);
- if (contact->value) {
- g_free(contact->value);
- contact->value = NULL;
- }
-
- if (value) {
- contact->value = g_strdup (value);
- }
-
- return TRUE;
-}
-
-EXPORT_API gchar *landmark_contact_get_value(const LandmarkContact *contact)
-{
- g_return_val_if_fail(contact, NULL);
-
- return contact->value;
-}
-
-static void landmark_attribute_foreach_free (gpointer data)
-{
- g_return_if_fail(data);
-
- LandmarkAttribute *attribute = (LandmarkAttribute *)data;
-
- landmark_attribute_free (attribute);
-}
-
-EXPORT_API gboolean location_landmark_set_attribute(LocationLandmark *landmark, GList *attribute)
-{
- g_return_val_if_fail(landmark, FALSE);
-
- if (landmark->attribute) {
- g_list_free_full(landmark->attribute, landmark_attribute_foreach_free);
- landmark->attribute = NULL;
- }
-
- if (attribute) {
- g_list_foreach (attribute, landmark_attribute_foreach_copy, landmark);
- }
-
- return TRUE;
-}
-
-EXPORT_API GList *location_landmark_get_attribute(const LocationLandmark *landmark)
-{
- g_return_val_if_fail(landmark, NULL);
-
- return landmark->attribute;
-}
-
-
-EXPORT_API void landmark_contact_free (LandmarkContact *contact)
-{
- g_return_if_fail (contact);
-
- landmark_contact_set_type(contact, NULL);
- landmark_contact_set_label(contact, NULL);
- landmark_contact_set_value(contact, NULL);
-
- g_slice_free(LandmarkContact, contact);
-}
-
-static void landmark_contact_foreach_free (gpointer data)
-{
- g_return_if_fail(data);
- LandmarkContact *contact = (LandmarkContact *)data;
-
- landmark_contact_free (contact);
-}
-
-EXPORT_API LandmarkContact *landmark_contact_new (void)
-{
- LandmarkContact *contact = g_slice_new0 (LandmarkContact);
- g_return_val_if_fail(contact, NULL);
-
- return contact;
-}
-
-EXPORT_API LandmarkContact *landmark_contact_copy (const LandmarkContact *contact)
-{
- g_return_val_if_fail(contact, NULL);
-
- LandmarkContact *new_contact = landmark_contact_new();
- g_return_val_if_fail(new_contact, NULL);
-
- landmark_contact_set_type(new_contact, landmark_contact_get_type(contact));
- landmark_contact_set_label(new_contact, landmark_contact_get_label(contact));
- landmark_contact_set_value(new_contact, landmark_contact_get_value(contact));
-
- return new_contact;
-}
-
-static void landmark_contact_foreach_copy (gpointer data, gpointer user_data)
-{
- g_return_if_fail (data);
- g_return_if_fail (user_data);
- LandmarkContact *contact = (LandmarkContact *)data;
- LocationLandmark *landmark = (LocationLandmark *)user_data;
-
- landmark->contact = g_list_append (landmark->contact, landmark_contact_copy(contact));
-}
-
-EXPORT_API gboolean location_landmark_set_contact(LocationLandmark *landmark, GList *contact)
-{
- g_return_val_if_fail(landmark, FALSE);
-
- if (landmark->contact) {
- g_list_free_full(landmark->contact, landmark_contact_foreach_free);
- landmark->contact = NULL;
- }
-
- if (contact) {
- g_list_foreach (contact, landmark_contact_foreach_copy, landmark);
- }
-
- return TRUE;
-}
-
-EXPORT_API GList *location_landmark_get_contact(const LocationLandmark *landmark)
-{
- g_return_val_if_fail(landmark, NULL);
-
- return landmark->contact;
-}
-
-EXPORT_API gchar *landmark_linkobject_get_link_string(const LandmarkLinkObject *link)
-{
- g_return_val_if_fail(link, NULL);
-
- return link->linkString;
-}
-
-EXPORT_API gboolean landmark_linkobject_set_link_string(LandmarkLinkObject *link, const gchar *linkString)
-{
- g_return_val_if_fail(link, FALSE);
- if (link->linkString) {
- g_free(link->linkString);
- link->linkString = NULL;
- }
-
- if (linkString) {
- link->linkString = g_strdup (linkString);
- }
-
- return TRUE;
-}
-
-EXPORT_API gchar *landmark_linkobject_get_type(const LandmarkLinkObject *link)
-{
- g_return_val_if_fail(link, NULL);
-
- return link->type;
-}
-
-EXPORT_API gboolean landmark_linkobject_set_type(LandmarkLinkObject *link, const gchar *type)
-{
- g_return_val_if_fail(link, FALSE);
- if (link->type) {
- g_free(link->type);
- link->type = NULL;
- }
-
- if (type) {
- link->type = g_strdup (type);
- }
-
- return TRUE;
-}
-
-EXPORT_API gchar *landmark_linkobject_get_name(const LandmarkLinkObject *link)
-{
- g_return_val_if_fail(link, NULL);
-
- return link->name;
-}
-
-EXPORT_API gboolean landmark_linkobject_set_name(LandmarkLinkObject *link, const gchar *name)
-{
- g_return_val_if_fail(link, FALSE);
- if (link->name) {
- g_free(link->name);
- link->name = NULL;
- }
-
- if (name) {
- link->name = g_strdup (name);
- }
-
- return TRUE;
-}
-
-EXPORT_API gchar *landmark_linkobject_get_id(const LandmarkLinkObject *link)
-{
- g_return_val_if_fail(link, NULL);
-
- return link->id;
-}
-
-EXPORT_API gboolean landmark_linkobject_set_id(LandmarkLinkObject *link, const gchar *value)
-{
- g_return_val_if_fail(link, FALSE);
- if (link->id) {
- g_free(link->id);
- link->id = NULL;
- }
-
- if (value) {
- link->id = g_strdup (value);
- }
-
- return TRUE;
-}
-
-EXPORT_API LandmarkLinkObject *landmark_linkobject_new (void)
-{
- LandmarkLinkObject *link = g_slice_new0 (LandmarkLinkObject);
- g_return_val_if_fail(link, NULL);
-
- return link;
-}
-
-EXPORT_API LandmarkLinkObject *landmark_linkobject_copy (const LandmarkLinkObject *link)
-{
- g_return_val_if_fail(link, NULL);
-
- LandmarkLinkObject *new_link = landmark_linkobject_new();
- g_return_val_if_fail(new_link, NULL);
-
- landmark_linkobject_set_link_string(new_link, landmark_linkobject_get_link_string(link));
- landmark_linkobject_set_type(new_link, landmark_linkobject_get_type(link));
- landmark_linkobject_set_name(new_link, landmark_linkobject_get_name(link));
- landmark_linkobject_set_id(new_link, landmark_linkobject_get_id(link));
-
- return new_link;
-}
-
-EXPORT_API void landmark_linkobject_free (LandmarkLinkObject *linkObject)
-{
- g_return_if_fail(linkObject);
-
- landmark_linkobject_set_link_string(linkObject, NULL);
- landmark_linkobject_set_type(linkObject, NULL);
- landmark_linkobject_set_name(linkObject, NULL);
- landmark_linkobject_set_id(linkObject, NULL);
- g_slice_free(LandmarkLinkObject, linkObject);
-}
-
-EXPORT_API gboolean location_landmark_set_supplier(LocationLandmark *landmark, const LandmarkLinkObject *supplier)
-{
- g_return_val_if_fail (landmark, FALSE);
-
- if (landmark->supplier) {
- landmark_linkobject_free(landmark->supplier);
- landmark->supplier = NULL;
- }
-
- if (supplier) {
- landmark->supplier = landmark_linkobject_copy(supplier);
- }
-
- return TRUE;
-}
-
-EXPORT_API LandmarkLinkObject *location_landmark_get_supplier(const LocationLandmark *landmark)
-{
- g_return_val_if_fail(landmark, NULL);
-
- return landmark->supplier;
-}
-
-EXPORT_API GList *location_landmark_get_editorial(const LocationLandmark *landmark)
-{
- g_return_val_if_fail(landmark, NULL);
-
- return landmark->editorial;
-}
-
-EXPORT_API gboolean landmark_media_set_attribution (LandmarkMedia *media, const gchar *attribution)
-{
- g_return_val_if_fail(media, FALSE);
-
- if (media->attribution) {
- g_free(media->attribution);
- media->attribution = NULL;
- }
-
- media->attribution = g_strdup (attribution);
-
- return TRUE;
-}
-
-EXPORT_API gchar *landmark_media_get_attribution(const LandmarkMedia *media)
-{
- g_return_val_if_fail(media, NULL);
-
- return media->attribution;
-}
-
-EXPORT_API gboolean landmark_media_set_media_supplier(LandmarkMedia *media, const LandmarkLinkObject *mediaSupplier)
-{
- g_return_val_if_fail(media, FALSE);
-
- if (media->mediaSupplier) {
- landmark_linkobject_free(media->mediaSupplier);
- media->mediaSupplier = NULL;
- }
-
- if (mediaSupplier) {
- media->mediaSupplier = landmark_linkobject_copy(mediaSupplier);
- }
-
- return TRUE;
-}
-
-EXPORT_API LandmarkLinkObject *landmark_media_get_media_supplier(const LandmarkMedia *media)
-{
- g_return_val_if_fail(media, NULL);
-
- return media->mediaSupplier;
-}
-
-EXPORT_API gboolean landmark_media_set_via(LandmarkMedia *media, const LandmarkLinkObject *via)
-{
- g_return_val_if_fail(media, FALSE);
-
- if (media->via) {
- landmark_linkobject_free(media->via);
- media->via = NULL;
- }
-
- if (via) {
- media->via = landmark_linkobject_copy(via);
- }
-
- return TRUE;
-}
-
-EXPORT_API LandmarkLinkObject *landmark_media_get_via(const LandmarkMedia *media)
-{
- g_return_val_if_fail(media, NULL);
-
- return media->via;
-}
-
-EXPORT_API void landmark_media_free (LandmarkMedia *media)
-{
- g_return_if_fail(media);
-
- landmark_media_set_attribution(media, NULL);
- landmark_media_set_media_supplier(media, NULL);
- landmark_media_set_via(media, NULL);
-
- g_slice_free(LandmarkMedia, media);
-}
-
-EXPORT_API LandmarkMedia *landmark_media_new (void)
-{
- LandmarkMedia *media = g_slice_new0 (LandmarkMedia);
- g_return_val_if_fail(media, NULL);
-
- return media;
-}
-
-EXPORT_API LandmarkMedia *landmark_media_copy (const LandmarkMedia *media)
-{
- g_return_val_if_fail(media, NULL);
-
- LandmarkMedia *new_media = landmark_media_new();
- g_return_val_if_fail(new_media, NULL);
-
- landmark_media_set_attribution(new_media, landmark_media_get_attribution(media));
- landmark_media_set_media_supplier(new_media, landmark_media_get_media_supplier(media));
- landmark_media_set_via(new_media, landmark_media_get_via(media));
-
- return new_media;
-}
-
-EXPORT_API gboolean landmark_editorial_set_media(LandmarkEditorial *editorial, const LandmarkMedia *media)
-{
- g_return_val_if_fail(editorial, FALSE);
-
- if (editorial->media) {
- landmark_media_free(editorial->media);
- editorial->media = NULL;
- }
-
- if (media) {
- editorial->media = landmark_media_copy(media);
- }
-
- return TRUE;
-}
-
-EXPORT_API LandmarkMedia *landmark_editorial_get_media(const LandmarkEditorial *editorial)
-{
- g_return_val_if_fail(editorial, NULL);
-
- return editorial->media;
-}
-
-EXPORT_API gboolean landmark_editorial_set_description(LandmarkEditorial *editorial, const gchar *description)
-{
- g_return_val_if_fail(editorial, FALSE);
-
- if (editorial->description) {
- g_free(editorial->description);
- editorial->description = NULL;
- }
-
- if (description) {
- editorial->description = g_strdup (description);
- }
-
- return TRUE;
-}
-
-EXPORT_API gchar *landmark_editorial_get_description(const LandmarkEditorial *editorial)
-{
- g_return_val_if_fail(editorial, NULL);
-
- return editorial->description;
-}
-
-EXPORT_API gboolean landmark_editorial_set_language(LandmarkEditorial *editorial, const gchar *language)
-{
- g_return_val_if_fail(editorial, FALSE);
-
- if (editorial->language) {
- g_free(editorial->language);
- editorial->language = NULL;
- }
-
- if (language) {
- editorial->language = g_strdup (language);
- }
-
- return TRUE;
-}
-
-EXPORT_API gchar *landmark_editorial_get_language(const LandmarkEditorial *editorial)
-{
- g_return_val_if_fail(editorial, NULL);
-
- return editorial->language;
-}
-
-
-EXPORT_API void landmark_editorial_free (LandmarkEditorial *editorial)
-{
- g_return_if_fail (editorial);
-
- landmark_editorial_set_media(editorial, NULL);
- landmark_editorial_set_description(editorial, NULL);
- landmark_editorial_set_language(editorial, NULL);
-
- g_slice_free(LandmarkEditorial, editorial);
-}
-
-static void landmark_editorial_foreach_free (gpointer data)
-{
- g_return_if_fail(data);
-
- LandmarkEditorial *editorial = (LandmarkEditorial *)data;
-
- landmark_editorial_free (editorial);
-}
-
-EXPORT_API LandmarkEditorial *landmark_editorial_new (void)
-{
- LandmarkEditorial *editorial = g_slice_new0 (LandmarkEditorial);
- g_return_val_if_fail(editorial, NULL);
-
- return editorial;
-}
-
-
-EXPORT_API LandmarkEditorial *landmark_editorial_copy (const LandmarkEditorial *editorial)
-{
- g_return_val_if_fail(editorial, NULL);
-
- LandmarkEditorial *new_editorial = landmark_editorial_new();
- g_return_val_if_fail(new_editorial, NULL);
-
- landmark_editorial_set_media(new_editorial, landmark_editorial_get_media(editorial));
- landmark_editorial_set_description(new_editorial, landmark_editorial_get_description(editorial));
- landmark_editorial_set_language(new_editorial, landmark_editorial_get_language(editorial));
-
- return new_editorial;
-}
-
-static void landmark_editorial_foreach_copy (gpointer data, gpointer user_data)
-{
- g_return_if_fail (data);
- g_return_if_fail (user_data);
- LandmarkEditorial *editorial = (LandmarkEditorial *)data;
- LocationLandmark *landmark = (LocationLandmark *)user_data;
-
- landmark->editorial = g_list_append (landmark->editorial, landmark_editorial_copy(editorial));
-}
-
-EXPORT_API gboolean location_landmark_set_editorial(LocationLandmark *landmark, GList *editorial)
-{
- g_return_val_if_fail(landmark, FALSE);
-
- if (landmark->editorial) {
- g_list_free_full(landmark->editorial, landmark_editorial_foreach_free);
- landmark->editorial = NULL;
- }
-
- if (editorial) {
- g_list_foreach (editorial, landmark_editorial_foreach_copy, landmark);
- }
-
- return TRUE;
-}
-
-EXPORT_API GList *location_landmark_get_image(const LocationLandmark *landmark)
-{
- g_return_val_if_fail(landmark, NULL);
-
- return landmark->image;
-}
-
-EXPORT_API gboolean landmark_image_set_media(LandmarkImage *image, const LandmarkMedia *media)
-{
- g_return_val_if_fail(image, FALSE);
-
- if (image->media) {
- landmark_media_free(image->media);
- image->media = NULL;
- }
-
- if (media) {
- image->media = landmark_media_copy(media);
- }
-
- return TRUE;
-}
-
-EXPORT_API LandmarkMedia *landmark_image_get_media(const LandmarkImage *image)
-{
- g_return_val_if_fail(image, NULL);
-
- return image->media;
-}
-
-EXPORT_API gboolean landmark_image_set_url(LandmarkImage *image, const gchar *url)
-{
- g_return_val_if_fail(image, FALSE);
-
- if (image->url) {
- g_free(image->url);
- image->url = NULL;
- }
-
- if (url) {
- image->url = g_strdup (url);
- }
-
- return TRUE;
-}
-
-EXPORT_API gchar *landmark_image_get_url(const LandmarkImage *image)
-{
- g_return_val_if_fail(image, NULL);
-
- return image->url;
-}
-
-EXPORT_API gboolean landmark_image_set_id(LandmarkImage *image, const gchar *identifier)
-{
- g_return_val_if_fail(image, FALSE);
-
- if (image->id) {
- g_free(image->id);
- image->id = NULL;
- }
-
- if (identifier) {
- image->id = g_strdup (identifier);
- }
-
- return TRUE;
-}
-
-EXPORT_API gchar *landmark_image_get_id(const LandmarkImage *image)
-{
- g_return_val_if_fail(image, NULL);
-
- return image->id;
-}
-
-EXPORT_API gboolean landmark_image_set_width(LandmarkImage *image, guint width)
-{
- g_return_val_if_fail(image, FALSE);
-
- image->width = width;
-
- return TRUE;
-}
-
-EXPORT_API guint landmark_image_get_width(const LandmarkImage *image)
-{
- g_return_val_if_fail(image, 0);
-
- return image->width;
-}
-
-EXPORT_API gboolean landmark_image_set_height(LandmarkImage *image, guint height)
-{
- g_return_val_if_fail(image, FALSE);
-
- image->height= height;
-
- return TRUE;
-}
-
-EXPORT_API guint landmark_image_get_height(const LandmarkImage *image)
-{
- g_return_val_if_fail(image, 0);
-
- return image->height;
-}
-
-EXPORT_API gboolean landmark_image_set_image_user(LandmarkImage *image, const LandmarkLinkObject *imageUser)
-{
- g_return_val_if_fail(image, FALSE);
-
- if (image->imageUser) {
- landmark_linkobject_free(image->imageUser);
- image->imageUser = NULL;
- }
-
- if (imageUser) {
- image->imageUser = landmark_linkobject_copy(imageUser);
- }
-
- return TRUE;
-}
-
-EXPORT_API LandmarkLinkObject *landmark_image_get_image_user(const LandmarkImage *image)
-{
- g_return_val_if_fail(image, NULL);
-
- return image->imageUser;
-}
-
-EXPORT_API void landmark_image_free (LandmarkImage *image)
-{
- g_return_if_fail (image);
-
- landmark_image_set_media(image, NULL);
- landmark_image_set_url(image, NULL);
- landmark_image_set_id(image, NULL);
- landmark_image_set_width(image, 0);
- landmark_image_set_height(image, 0);
- landmark_image_set_image_user(image, NULL);
-
- g_slice_free(LandmarkImage, image);
-}
-
-static void landmark_image_foreach_free (gpointer data)
-{
- g_return_if_fail(data);
- LandmarkImage *image = (LandmarkImage *)data;
-
- landmark_image_free (image);
-}
-
-EXPORT_API LandmarkImage *landmark_image_new (void)
-{
- LandmarkImage *image = g_slice_new0 (LandmarkImage);
- g_return_val_if_fail(image, NULL);
-
- return image;
-}
-
-EXPORT_API LandmarkImage *landmark_image_copy (const LandmarkImage *image)
-{
- g_return_val_if_fail(image, NULL);
-
- LandmarkImage *new_image = landmark_image_new();
- g_return_val_if_fail(new_image, NULL);
-
- landmark_image_set_media(new_image, landmark_image_get_media(image));
- landmark_image_set_url(new_image, landmark_image_get_url(image));
- landmark_image_set_id(new_image, landmark_image_get_id(image));
- landmark_image_set_width(new_image, landmark_image_get_width(image));
- landmark_image_set_height(new_image, landmark_image_get_height(image));
- landmark_image_set_image_user(new_image, landmark_image_get_image_user(image));
-
- return new_image;
-}
-
-static void landmark_image_foreach_copy (gpointer data, gpointer user_data)
-{
- g_return_if_fail (data);
- g_return_if_fail (user_data);
- LandmarkImage *image = (LandmarkImage *)data;
- LocationLandmark *landmark = (LocationLandmark *)user_data;
-
- landmark->image = g_list_append (landmark->image, landmark_image_copy(image));
-}
-
-EXPORT_API gboolean location_landmark_set_image(LocationLandmark *landmark, GList *image)
-{
- g_return_val_if_fail(landmark, FALSE);
-
- if (landmark->image) {
- g_list_free_full(landmark->image, landmark_image_foreach_free);
- landmark->image = NULL;
- }
-
- if (image) {
- g_list_foreach (image, landmark_image_foreach_copy, landmark);
- }
-
- return TRUE;
-}
-
-EXPORT_API GList *location_landmark_get_review(const LocationLandmark *landmark)
-{
- g_return_val_if_fail(landmark, NULL);
-
- return landmark->review;
-}
-
-EXPORT_API gboolean landmark_review_set_media(LandmarkReview *review, const LandmarkMedia *media)
-{
- g_return_val_if_fail(review, FALSE);
-
- if (review->media) {
- landmark_media_free(review->media);
- review->media = NULL;
- }
-
- if (media) {
- review->media = landmark_media_copy(media);
- }
-
- return TRUE;
-}
-
-EXPORT_API LandmarkMedia *landmark_review_get_media(const LandmarkReview *review)
-{
- g_return_val_if_fail(review, NULL);
-
- return review->media;
-}
-
-EXPORT_API gboolean landmark_review_set_date(LandmarkReview *review, const gchar *date)
-{
- g_return_val_if_fail(review, FALSE);
-
- if (review->date) {
- g_free(review->date);
- review->date = NULL;
- }
-
- if (date) {
- review->date = g_strdup (date);
- }
-
- return TRUE;
-}
-
-EXPORT_API gchar *landmark_review_get_date(const LandmarkReview *review)
-{
- g_return_val_if_fail(review, NULL);
-
- return review->date;
-}
-
-EXPORT_API gboolean landmark_review_set_title(LandmarkReview *review, const gchar *title)
-{
- g_return_val_if_fail(review, FALSE);
-
- if (review->title) {
- g_free(review->title);
- review->title = NULL;
- }
-
- if (title) {
- review->title = g_strdup (title);
- }
-
- return TRUE;
-}
-
-EXPORT_API gchar *landmark_review_get_title(const LandmarkReview *review)
-{
- g_return_val_if_fail(review, NULL);
-
- return review->title;
-}
-
-
-EXPORT_API gboolean landmark_review_set_rating(LandmarkReview *review, gdouble rating)
-{
- g_return_val_if_fail(review, FALSE);
- g_return_val_if_fail(rating >= 0, FALSE);
-
- review->rating = rating;
-
- return TRUE;
-}
-
-EXPORT_API gdouble landmark_review_get_rating(const LandmarkReview *review)
-{
- g_return_val_if_fail(review, 0);
-
- return review->rating;
-}
-
-EXPORT_API gboolean landmark_review_set_description(LandmarkReview *review, const gchar *description)
-{
- g_return_val_if_fail(review, FALSE);
-
- if (review->description) {
- g_free(review->description);
- review->description = NULL;
- }
-
- if (description) {
- review->description = g_strdup (description);
- }
-
- return TRUE;
-}
-
-EXPORT_API gchar *landmark_review_get_description(const LandmarkReview *review)
-{
- g_return_val_if_fail(review, NULL);
-
- return review->description;
-}
-
-EXPORT_API gboolean landmark_review_set_language(LandmarkReview *review, const gchar *language)
-{
- g_return_val_if_fail(review, FALSE);
-
- if (review->language) {
- g_free(review->language);
- review->language = NULL;
- }
-
- if (language) {
- review->language = g_strdup (language);
- }
-
- return TRUE;
-}
-
-EXPORT_API gchar *landmark_review_get_language(const LandmarkReview *review)
-{
- g_return_val_if_fail(review, NULL);
-
- return review->language;
-}
-
-EXPORT_API gboolean landmark_review_set_review_user(LandmarkReview *review, const LandmarkLinkObject *reviewUser)
-{
- g_return_val_if_fail(review, FALSE);
-
- if (review->reviewUser) {
- landmark_linkobject_free(review->reviewUser);
- review->reviewUser = NULL;
- }
-
- if (reviewUser) {
- review->reviewUser = landmark_linkobject_copy(reviewUser);
- }
-
- return TRUE;
-}
-
-EXPORT_API LandmarkLinkObject *landmark_review_get_review_user(const LandmarkReview *review)
-{
- g_return_val_if_fail(review, NULL);
-
- return review->reviewUser;
-}
-
-EXPORT_API void landmark_review_free (LandmarkReview *review)
-{
- g_return_if_fail (review);
-
- landmark_review_set_media(review, NULL);
- landmark_review_set_date(review, NULL);
- landmark_review_set_title(review, NULL);
- landmark_review_set_rating(review, 0);
- landmark_review_set_description(review, NULL);
- landmark_review_set_language(review, NULL);
- landmark_review_set_review_user(review, NULL);
-
- g_slice_free(LandmarkReview, review);
-}
-
-
-static void landmark_review_foreach_free (gpointer data)
-{
- g_return_if_fail(data);
- LandmarkReview *review = (LandmarkReview *)data;
-
- landmark_review_free (review);
-}
-
-EXPORT_API LandmarkReview *landmark_review_new (void)
-{
- LandmarkReview *review = g_slice_new0 (LandmarkReview);
- g_return_val_if_fail(review, NULL);
-
- return review;
-}
-
-EXPORT_API LandmarkReview *landmark_review_copy (const LandmarkReview *review)
-{
- g_return_val_if_fail(review, NULL);
-
- LandmarkReview *new_reviews = landmark_review_new();
- g_return_val_if_fail(new_reviews, NULL);
-
- landmark_review_set_media(new_reviews, landmark_review_get_media(review));
- landmark_review_set_date(new_reviews, landmark_review_get_date(review));
- landmark_review_set_title(new_reviews, landmark_review_get_title(review));
- landmark_review_set_rating(new_reviews, landmark_review_get_rating(review));
- landmark_review_set_description(new_reviews, landmark_review_get_description(review));
- landmark_review_set_language(new_reviews, landmark_review_get_language(review));
- landmark_review_set_review_user(new_reviews, landmark_review_get_review_user(review));
-
- return new_reviews;
-}
-
-static void landmark_review_foreach_copy (gpointer data, gpointer user_data)
-{
- g_return_if_fail (data);
- g_return_if_fail (user_data);
-
- LandmarkReview *review = (LandmarkReview *)data;
- LocationLandmark *landmark = (LocationLandmark *)user_data;
-
- landmark->review = g_list_append (landmark->review, landmark_review_copy(review));
-}
-
-
-EXPORT_API gboolean location_landmark_set_review(LocationLandmark *landmark, GList *review)
-{
- g_return_val_if_fail(landmark, FALSE);
-
- if (landmark->review) {
- g_list_free_full(landmark->review, landmark_review_foreach_free);
- landmark->review = NULL;
- }
-
- if (review) {
- g_list_foreach (review, landmark_review_foreach_copy, landmark);
- }
-
- return TRUE;
-}
-EXPORT_API gboolean location_landmark_set_related(LocationLandmark *landmark, const LandmarkLinkObject *related)
-{
- g_return_val_if_fail (landmark, FALSE);
-
- if (landmark->related) {
- landmark_linkobject_free(landmark->related);
- landmark->related = NULL;
- }
-
- if (related) {
- landmark->related = landmark_linkobject_copy(related);
- }
-
- return TRUE;
-}
-
-EXPORT_API LandmarkLinkObject *location_landmark_get_related(const LocationLandmark *landmark)
-{
- g_return_val_if_fail(landmark, NULL);
-
- return landmark->related;
-}
-
-EXPORT_API LocationLandmark *
-location_landmark_copy (const LocationLandmark *landmark)
-{
- g_return_val_if_fail (landmark, NULL);
-
- LocationLandmark *new_landmark = location_landmark_new();
- if (!new_landmark) return NULL;
-
- location_landmark_set_id(new_landmark, location_landmark_get_id(landmark));
- location_landmark_set_name (new_landmark, location_landmark_get_name (landmark));
- location_landmark_set_position (new_landmark, location_landmark_get_position(landmark));
- location_landmark_set_address (new_landmark, location_landmark_get_address (landmark));
- location_landmark_set_description (new_landmark, location_landmark_get_description(landmark));
- location_landmark_set_timestamp (new_landmark, location_landmark_get_timestamp(landmark));
- location_landmark_set_priority (new_landmark, location_landmark_get_priority(landmark));
- location_landmark_set_bounding_box (new_landmark, location_landmark_get_bounding_box(landmark));
- location_landmark_set_author (new_landmark, location_landmark_get_author(landmark));
- location_landmark_set_url(new_landmark, location_landmark_get_url(landmark));
-
- location_landmark_set_rating(new_landmark,location_landmark_get_rating(landmark));
- location_landmark_set_attribute(new_landmark, location_landmark_get_attribute(landmark));
- location_landmark_set_contact(new_landmark, location_landmark_get_contact(landmark));
- location_landmark_set_supplier(new_landmark, location_landmark_get_supplier(landmark));
- location_landmark_set_editorial(new_landmark, location_landmark_get_editorial(landmark));
- location_landmark_set_image(new_landmark, location_landmark_get_image(landmark));
- location_landmark_set_review(new_landmark, location_landmark_get_review(landmark));
- location_landmark_set_related(new_landmark, location_landmark_get_related(landmark));
-
- return new_landmark;
-}
-
-EXPORT_API void
-location_landmark_free (LocationLandmark *landmark)
-{
- g_return_if_fail (landmark);
-
- location_landmark_set_id(landmark, 0);
- location_landmark_set_name (landmark, NULL);
- location_landmark_set_position (landmark, NULL);
- location_landmark_set_address (landmark, NULL);
- location_landmark_set_description (landmark, NULL);
- location_landmark_set_timestamp (landmark, 0);
- location_landmark_set_priority (landmark, 0);
- location_landmark_set_bounding_box (landmark, NULL);
- location_landmark_set_author (landmark, NULL);
- location_landmark_set_url(landmark, NULL);
-
- location_landmark_set_rating(landmark, NULL);
- location_landmark_set_attribute(landmark, NULL);
- location_landmark_set_contact(landmark, NULL);
- location_landmark_set_supplier(landmark, NULL);
- location_landmark_set_editorial(landmark, NULL);
- location_landmark_set_image(landmark, NULL);
- location_landmark_set_review(landmark, NULL);
- location_landmark_set_related(landmark, NULL);
-
- g_slice_free (LocationLandmark, landmark);
-}
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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 __LOCATION_LANDMARK_H__
-#define __LOCATION_LANDMARK_H__
-
-#include <location-map-types.h>
-
-G_BEGIN_DECLS
-
-/**
- * @file location-landmark.h
- * @brief This file contains the internal definitions and structures related to Landmark.
- */
-
-/**
- * @addtogroup LocationMapServicePOI
- * @{
- * @defgroup LocationMapServiceLandmark Location Landmark
- * @brief This provides structure, enumeration and APIs for Landmark
- * @addtogroup LocationMapServiceLandmark
- * @{
- */
-
-/**
- * @brief Create a new Landmark
- */
-LocationLandmark *location_landmark_new (void);
-
-/**
- * @brief Copy the given Landmark
- */
-LocationLandmark *location_landmark_copy (const LocationLandmark *landmark);
-
-/**
- * @brief Free the given Landmark
- */
-void location_landmark_free (LocationLandmark *landmark);
-
-/**
- * @brief Get the ID of the given landmark
- */
-guint location_landmark_get_id (const LocationLandmark *landmark);
-
-/**
- * @brief Get the name of the given landmark
- */
-gchar *location_landmark_get_name (const LocationLandmark *landmark);
-/**
- * @brief Get the position in the given landmark
- */
-LocationPosition *location_landmark_get_position (const LocationLandmark *landmark);
-/**
- * @brief Get the address of the given landmark
- */
-LocationAddress *location_landmark_get_address (const LocationLandmark *landmark);
-/**
- * @brief Get the description of the given landmark
- */
-gchar *location_landmark_get_description (const LocationLandmark *landmark);
-/**
- * @brief Get the timestamp of the given landmark
- */
-guint location_landmark_get_timestamp (const LocationLandmark *landmark);
-/**
- * @brief Get the priority of the given landmark
- */
-guint location_landmark_get_priority (const LocationLandmark *landmark);
-/**
- * @brief Get the bounding box of the given landmark
- */
-LocationBoundary *location_landmark_get_bounding_box (const LocationLandmark *landmark);
-/**
- * @brief Get the author of the given landmark
- */
-gchar *location_landmark_get_author (const LocationLandmark *landmark);
-/**
- * @brief Get the list of urls of the given landmark
- */
-GList *location_landmark_get_url (const LocationLandmark *landmark);
-/**
- * @brief Get the categories of the given landmark
- */
-GList *location_landmark_get_category (const LocationLandmark *landmark);
-/**
- * @brief Get the phone number of the given landmark
- */
-gchar *location_landmark_get_phone_number (const LocationLandmark *landmark);
-/**
- * @brief Get the property keys of the given landmark
- */
-GList *location_landmark_get_property_key (const LocationLandmark *landmark);
-
-/**
- * @brief Get the property data of the given landmark
- */
-gconstpointer location_landmark_get_property (const LocationLandmark *landmark, gconstpointer key);
-
-/**
- * @brief Create a new #LocationLandmarkUrl
- */
-LocationLandmarkUrl * location_landmark_url_new (void);
-
-/**
- * @brief Free a #LocationLandmarkUrl
- */
-void location_landmark_url_free (LocationLandmarkUrl *url);
-
-/**
- * @brief Copy a #LocationLandmarkUrl
- */
-LocationLandmarkUrl *location_landmark_url_copy (const LocationLandmarkUrl *url);
-
-/**
- * @brief Get the url path of the given #LocationLandmarkUrl
- */
-gchar *location_landmark_url_get_url_path (const LocationLandmarkUrl *url);
-/**
- * @brief Get the url's description of the given #LocationLandmarkUrl
- */
-gchar *location_landmark_url_get_description (const LocationLandmarkUrl *url);
-
-/**
- * @brief Get the rating of the given #LocationLandmark
- */
-LandmarkRating *location_landmark_get_rating(const LocationLandmark *landmark);
-
-
-/**
- * @brief Get the rating' count of the given #LocationLandmark
- */
-gint landmark_rating_get_count(const LandmarkRating *rating);
-
-/**
- * @brief Get the rating' average of the given #LocationLandmark
- */
-gdouble landmark_rating_get_average(const LandmarkRating *rating);
-
-/**
- * @brief Create a new LandmarkRating
- */
-LandmarkRating *landmark_rating_new (void);
-
-/**
- * @brief Copy the given LandmarkRating
- */
-LandmarkRating *landmark_rating_copy(const LandmarkRating *rating);
-
-/**
- * @brief Free the given rating
- */
-void landmark_rating_free (LandmarkRating *rating);
-
-/**
- * @brief Free the given media
- */
-void landmark_media_free (LandmarkMedia *media);
-
-/**
- * @brief Create a new media
- */
-LandmarkMedia *landmark_media_new (void);
-
-/**
- * @brief Get the attribute label of the given #LandmarkAttribute
- */
-gchar *landmark_attribute_get_label(const LandmarkAttribute *attribute);
-
-/**
- * @brief Get the attribute text of the given #LandmarkAttribute
- */
-gchar *landmark_attribute_get_text(const LandmarkAttribute *attribute);
-
-/**
- * @brief Get the attribute id of the given #LandmarkAttribute
- */
-gchar *landmark_attribute_get_identifier(const LandmarkAttribute *attribute);
-
-/**
- * @brief Create a new #LandmarkAttribute
- */
-LandmarkAttribute *landmark_attribute_new (void);
-
-/**
- * @brief Free the given attribute
- */
-void landmark_attribute_free (LandmarkAttribute *attribute);
-
-/**
- * @brief Copy the given attribute
- */
-LandmarkAttribute *landmark_attribute_copy(const LandmarkAttribute *attribute);
-
-/**
- * @brief Get the attribute list of the given #LocationLandmark
- */
-GList *location_landmark_get_attribute(const LocationLandmark *landmark);
-
-/**
- * @brief Free the given contact
- */
-void landmark_contact_free (LandmarkContact *contact);
-
-/**
- * @brief Create a new #LandmarkContact
- */
-LandmarkContact *landmark_contact_new (void);
-
-/**
- * @brief Copy the given contact
- */
-LandmarkContact *landmark_contact_copy (const LandmarkContact *contact);
-
-/**
- * @brief Get the contact list of the given #LocationLandmark
- */
-GList *location_landmark_get_contact(const LocationLandmark *landmark);
-
-/**
- * @brief Create a new #LandmarkLinkObject
- */
-LandmarkLinkObject *landmark_linkobject_new (void);
-
-/**
- * @brief Copy the given link
- */
-LandmarkLinkObject *landmark_linkobject_copy (const LandmarkLinkObject *link);
-
-/**
- * @brief Free the given linkObject
- */
-void landmark_linkobject_free (LandmarkLinkObject *linkObject);
-
-
-/**
- * @brief Get the link of the given #LandmarkLinkObject
- */
-gchar *landmark_linkobject_get_link_string(const LandmarkLinkObject *link);
-
-
-/**
- * @brief Get the type of the given #LandmarkLinkObject
- */
-gchar *landmark_linkobject_get_type(const LandmarkLinkObject *link);
-
-/**
- * @brief Get the name of the given #LandmarkLinkObject
- */
-gchar *landmark_linkobject_get_name(const LandmarkLinkObject *link);
-
-/**
- * @brief Get the id of the given #LandmarkLinkObject
- */
-gchar *landmark_linkobject_get_id(const LandmarkLinkObject *link);
-
-/**
- * @brief Get the contact detail type of the given #LandmarkContact
- */
-gchar *landmark_contact_get_type(const LandmarkContact *contact);
-
-/**
- * @brief Get the contact detail label of the given #LandmarkContact
- */
-gchar *landmark_contact_get_label(const LandmarkContact *contact);
-
-/**
- * @brief Get the contact detail value of the given #LandmarkContact
- */
-gchar *landmark_contact_get_value(const LandmarkContact *contact);
-
-/**
- * @brief Get the supplier link of the given #LocationLandmark
- */
-LandmarkLinkObject *location_landmark_get_supplier(const LocationLandmark *landmark);
-
-/**
- * @brief Get the attribution text of the given #LandmarkMedia
- */
-gchar *landmark_media_get_attribution(const LandmarkMedia *media);
-
-/**
- * @brief Get the supplier link of the given #LandmarkMedia
- */
-LandmarkLinkObject *landmark_media_get_media_supplier(const LandmarkMedia *media);
-
-/**
- * @brief Get the via link of the given #LandmarkMedia
- */
-LandmarkLinkObject *landmark_media_get_via(const LandmarkMedia *media);
-
-/**
- * @brief Get the attribution text of the given #LandmarkEditorial
- */
-LandmarkMedia *landmark_editorial_get_media(const LandmarkEditorial *editorial);
-
-/**
- * @brief Get the description of the given #LandmarkEditorial
- */
-gchar *landmark_editorial_get_description(const LandmarkEditorial *editorial);
-
-/**
- * @brief Get the language of the given #LandmarkEditorial
- */
-gchar *landmark_editorial_get_language(const LandmarkEditorial *editorial);
-
-/**
- * @brief Free the given editorial
- */
-void landmark_editorial_free (LandmarkEditorial *editorial);
-
-/**
- * @brief Create a new #LandmarkEditorial
- */
-LandmarkEditorial *landmark_editorial_new (void);
-
-/**
- * @brief Copy the given editorial
- */
-LandmarkEditorial *landmark_editorial_copy (const LandmarkEditorial *editorial);
-
-/**
- * @brief Get the media of the given #LandmarkImage
- */
-LandmarkMedia *landmark_image_get_media(const LandmarkImage *image);
-
-/**
- * @brief Get the url of the given #LandmarkImage
- */
-gchar *landmark_image_get_url(const LandmarkImage *image);
-
-/**
- * @brief Get the id of the given #LandmarkImage
- */
-gchar *landmark_image_get_id(const LandmarkImage *image);
-
-/**
- * @brief Get the width of the given #LandmarkImage
- */
-guint landmark_image_get_width(const LandmarkImage *image);
-
-/**
- * @brief Get the height of the given #LandmarkImage
- */
-guint landmark_image_get_height(const LandmarkImage *image);
-
-/**
- * @brief Get the user of the given #LandmarkImage
- */
-LandmarkLinkObject *landmark_image_get_image_user(const LandmarkImage *image);
-
-/**
- * @brief Free the given image
- */
-void landmark_image_free (LandmarkImage *image);
-
-/**
- * @brief Create a new #LandmarkLinkObject
- */
-LandmarkImage *landmark_image_new (void);
-
-/**
- * @brief Copy the given image
- */
-LandmarkImage *landmark_image_copy (const LandmarkImage *image);
-
-
-/**
- * @brief Get the editorial list of the given #LocationLandmark
- */
-GList *location_landmark_get_editorial(const LocationLandmark *landmark);
-
-/**
- * @brief Get the image list of the given #LocationLandmark
- */
-GList *location_landmark_get_image(const LocationLandmark *landmark);
-
-/**
- * @brief Get the media of the given #LandmarkReview
- */
-LandmarkMedia *landmark_review_get_media(const LandmarkReview *review);
-
-/**
- * @brief Get the date of the given #LandmarkReview
- */
-gchar *landmark_review_get_date(const LandmarkReview *review);
-
-/**
- * @brief Get the title of the given #LandmarkReview
- */
-gchar *landmark_review_get_title(const LandmarkReview *review);
-
-/**
- * @brief Get the rating of the given #LandmarkReview
- */
-gdouble landmark_review_get_rating(const LandmarkReview *review);
-
-/**
- * @brief Get the description of the given #LandmarkReview
- */
-gchar *landmark_review_get_description(const LandmarkReview *review);
-
-/**
- * @brief Get the language of the given #LandmarkReview
- */
-gchar *landmark_review_get_language(const LandmarkReview *review);
-
-/**
- * @brief Get the user of the given #LandmarkReview
- */
-LandmarkLinkObject *landmark_review_get_review_user(const LandmarkReview *review);
-
-/**
- * @brief Free the given editorial
- */
-void landmark_review_free (LandmarkReview *review);
-
-/**
- * @brief Create a new #LandmarkReview
- */
-LandmarkReview *landmark_review_new (void);
-
-/**
- * @brief Copy the given review
- */
-LandmarkReview *landmark_review_copy (const LandmarkReview *review);
-
-/**
- * @brief Get the review list of the given #LocationLandmark
- */
-GList *location_landmark_get_review(const LocationLandmark *landmark);
-
-/**
- * @brief Get the related link of the given #LocationLandmark
- */
-LandmarkLinkObject *location_landmark_get_related(const LocationLandmark *landmark);
-
-/**
- * @brief Create a new #LandmarkCategory
- */
-LandmarkCategory *landmark_category_new (void);
-
-/**
- * @brief Copy the given category
- */
-LandmarkCategory *landmark_category_copy (const LandmarkCategory *category);
-
-/**
- * @brief Free the given category
- */
-void landmark_category_free (LandmarkCategory *category);
-
-/**
- * @brief Get the id of the given #LandmarkCategory
- */
-gchar *landmark_category_get_id (const LandmarkCategory *category);
-
-/**
- * @brief Get the name of the given #LandmarkCategory
- */
-gchar *landmark_category_get_name (const LandmarkCategory *category);
-
-/**
- * @brief Get the url of the given #LandmarkCategory
- */
-gchar *landmark_category_get_url (const LandmarkCategory *category);
-
-/**
- * @brief Get the subcategories list of the given #LandmarkCategory
- */
-GList *landmark_category_get_subcategories (const LandmarkCategory *category);
-
-/**
- * @} @}
- */
-
-G_END_DECLS
-
-#endif
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "location-log.h"
-#include "location-map-ielement.h"
-
-static void
-location_map_ielement_base_init (gpointer g_class)
-{
- static gboolean is_initialized = FALSE;
-
- if (is_initialized){
- /* add properties and signals to the interface here */
-
- is_initialized = TRUE;
- }
-}
-
-GType
-location_map_ielement_get_type (void)
-{
- static GType iface_type = 0;
-
- if (iface_type == 0) {
- static const GTypeInfo info = {
- sizeof (LocationMapIElementInterface),
- location_map_ielement_base_init, /* base_init */
- NULL /* base_finalize */
- };
-
- iface_type = g_type_register_static (G_TYPE_INTERFACE, "LocationMapIElement",
- &info, 0);
- }
-
- return iface_type;
-}
-
-int
-location_map_ielement_get_geocode (LocationMapIElement *self,
- const LocationAddress *address,
- const LocationMapPref *svc_pref,
- GList **position_list,
- GList **accuracy_list)
-{
- g_return_val_if_fail (LOCATION_MAP_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (address, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (LOCATION_MAP_IELEMENT_GET_INTERFACE (self)->get_geocode, LOCATION_ERROR_NOT_AVAILABLE);
- return LOCATION_MAP_IELEMENT_GET_INTERFACE (self)->get_geocode (self, address, svc_pref, position_list, accuracy_list);
-}
-
-int
-location_map_ielement_get_geocode_freeform (LocationMapIElement *self,
- const gchar *address,
- const LocationMapPref *svc_pref,
- GList **position_list,
- GList **accuracy_list)
-{
- g_return_val_if_fail (LOCATION_MAP_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (address, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (LOCATION_MAP_IELEMENT_GET_INTERFACE (self)->get_geocode_freeform, LOCATION_ERROR_NOT_AVAILABLE);
- return LOCATION_MAP_IELEMENT_GET_INTERFACE (self)->get_geocode_freeform (self, address, svc_pref, position_list, accuracy_list);
-}
-
-int
-location_map_ielement_get_reversegeocode (LocationMapIElement *self,
- const LocationPosition *position,
- const LocationMapPref *svc_pref,
- LocationAddress **address,
- LocationAccuracy **accuracy)
-{
- g_return_val_if_fail (LOCATION_MAP_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (position, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (address, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (accuracy, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (LOCATION_MAP_IELEMENT_GET_INTERFACE (self)->get_reversegeocode, LOCATION_ERROR_NOT_AVAILABLE);
- return LOCATION_MAP_IELEMENT_GET_INTERFACE (self)->get_reversegeocode (self, position, svc_pref, address, accuracy);
-}
-
-int
-location_map_ielement_get_geocode_async (LocationMapIElement *self,
- const LocationAddress *address,
- const LocationMapPref *svc_pref,
- const LocationGeocodePreference *pref,
- LocationPositionCB callback,
- gpointer userdata,
- guint * req_id)
-{
- g_return_val_if_fail (LOCATION_MAP_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (address, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (callback, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (pref, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (req_id, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (LOCATION_MAP_IELEMENT_GET_INTERFACE (self)->get_geocode_async, LOCATION_ERROR_NOT_AVAILABLE);
- return LOCATION_MAP_IELEMENT_GET_INTERFACE (self)->get_geocode_async (self, address, svc_pref, pref, callback, userdata,req_id);
-}
-
-int
-location_map_ielement_get_geocode_freeform_async (LocationMapIElement *self,
- const gchar *address,
- const LocationMapPref *svc_pref,
- const LocationGeocodePreference *pref,
- LocationPositionCB callback,
- gpointer userdata,
- guint * req_id)
-{
- g_return_val_if_fail (LOCATION_MAP_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (address, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (callback, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (pref, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (req_id, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (LOCATION_MAP_IELEMENT_GET_INTERFACE (self)->get_geocode_freeform_async, LOCATION_ERROR_NOT_AVAILABLE);
-
- return LOCATION_MAP_IELEMENT_GET_INTERFACE (self)->get_geocode_freeform_async (self, address, svc_pref,pref, callback, userdata,req_id);
-}
-
-int
-location_map_ielement_cancel_geocode_request (LocationMapIElement *self, guint req_id)
-{
- g_return_val_if_fail (LOCATION_MAP_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (LOCATION_MAP_IELEMENT_GET_INTERFACE (self)->cancel_geocode_request, LOCATION_ERROR_NOT_AVAILABLE);
-
- return LOCATION_MAP_IELEMENT_GET_INTERFACE (self)->cancel_geocode_request (self, req_id);
-}
-
-int
-location_map_ielement_get_reversegeocode_async (LocationMapIElement *self,
- const LocationPosition *position,
- const LocationMapPref *svc_pref,
- LocationAddressCB callback,
- gpointer userdata,
- guint * req_id)
-{
- g_return_val_if_fail (LOCATION_MAP_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (position, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (callback, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (req_id, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (LOCATION_MAP_IELEMENT_GET_INTERFACE (self)->get_reversegeocode_async, LOCATION_ERROR_NOT_AVAILABLE);
-
- return LOCATION_MAP_IELEMENT_GET_INTERFACE (self)->get_reversegeocode_async (self, position, svc_pref, callback, userdata,req_id);
-}
-
-int
-location_map_ielement_search_poi (LocationMapIElement *self,
- const LocationPOIFilter * filter, const LocationPosition *position,
- const LocationMapPref *svc_pref, const LocationPOIPreference * pref,
- LocationPOICB cb, const gpointer user_data, guint * req_id)
-{
- g_return_val_if_fail (LOCATION_MAP_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (filter, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (position, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (pref, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (cb, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (req_id, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (LOCATION_MAP_IELEMENT_GET_INTERFACE (self)->search_poi, LOCATION_ERROR_NOT_AVAILABLE);
-
- return LOCATION_MAP_IELEMENT_GET_INTERFACE (self)->search_poi(self,
- filter, position, svc_pref, pref, cb, user_data, req_id);
-}
-
-int
-location_map_ielement_search_poi_by_area (LocationMapIElement *self,
- const LocationPOIFilter * filter, const LocationBoundary * boundary,
- const LocationMapPref *svc_pref, const LocationPOIPreference * pref,
- LocationPOICB cb, const gpointer user_data, guint * req_id)
-{
- g_return_val_if_fail (LOCATION_MAP_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (filter, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (boundary, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (pref, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (cb, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (req_id, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (LOCATION_MAP_IELEMENT_GET_INTERFACE (self)->search_poi_by_area, LOCATION_ERROR_NOT_AVAILABLE);
-
- return LOCATION_MAP_IELEMENT_GET_INTERFACE (self)->search_poi_by_area (self,
- filter, boundary, svc_pref, pref, cb, user_data, req_id);
-}
-
-int
-location_map_ielement_search_poi_by_address (LocationMapIElement *self,
- const LocationPOIFilter * filter, const LocationAddress * address,
- const LocationMapPref *svc_pref, const LocationPOIPreference * pref,
- LocationPOICB cb, const gpointer user_data, guint * req_id)
-{
- g_return_val_if_fail (LOCATION_MAP_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (filter, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (address, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (pref, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (cb, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (req_id, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (LOCATION_MAP_IELEMENT_GET_INTERFACE (self)->search_poi_by_address, LOCATION_ERROR_NOT_AVAILABLE);
-
- return LOCATION_MAP_IELEMENT_GET_INTERFACE (self)->search_poi_by_address (self,
- filter, address, svc_pref, pref, cb, user_data, req_id);
-}
-
-int
-location_map_ielement_search_poi_by_freeform (LocationMapIElement *self, const LocationPOIFilter * filter,
- const gchar *freeform, const LocationMapPref *svc_pref, const LocationPOIPreference *pref, LocationPOICB cb,
- const gpointer user_data, guint * req_id)
-{
- g_return_val_if_fail (LOCATION_MAP_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (filter, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (freeform, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (pref, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (cb, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (req_id, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (LOCATION_MAP_IELEMENT_GET_INTERFACE (self)->search_poi_by_freeform, LOCATION_ERROR_NOT_AVAILABLE);
-
- return LOCATION_MAP_IELEMENT_GET_INTERFACE (self)->search_poi_by_freeform (self,
- filter, freeform, svc_pref, pref, cb, user_data, req_id);
-}
-
-int
-location_map_ielement_cancel_poi_request (LocationMapIElement *self, guint req_id)
-{
- g_return_val_if_fail (LOCATION_MAP_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (LOCATION_MAP_IELEMENT_GET_INTERFACE (self)->cancel_poi_request, LOCATION_ERROR_NOT_AVAILABLE);
-
- return LOCATION_MAP_IELEMENT_GET_INTERFACE (self)->cancel_poi_request (self, req_id);
-}
-
-int
-location_map_ielement_request_route (LocationMapIElement *self, const LocationPosition *origin,
- const LocationPosition *destination, GList *waypoint,
- const LocationMapPref *svc_pref, const LocationRoutePreference *pref, LocationRouteCB cb, const gpointer user_data, guint *req_id)
-{
- g_return_val_if_fail (LOCATION_MAP_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (origin, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (destination, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (pref, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (cb, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (req_id, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (LOCATION_MAP_IELEMENT_GET_INTERFACE (self)->request_route, LOCATION_ERROR_NOT_AVAILABLE);
-
- return LOCATION_MAP_IELEMENT_GET_INTERFACE (self)->request_route (self,
- origin, destination, waypoint, svc_pref, pref, cb, user_data, req_id);
-}
-
-int
-location_map_ielement_cancel_route_request (LocationMapIElement *self, guint req_id)
-{
- g_return_val_if_fail (LOCATION_MAP_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (LOCATION_MAP_IELEMENT_GET_INTERFACE (self)->cancel_route_request, LOCATION_ERROR_NOT_AVAILABLE);
-
- return LOCATION_MAP_IELEMENT_GET_INTERFACE (self)->cancel_route_request (self, req_id);
-}
-
-gboolean
-location_map_ielement_is_supported_provider_capability (LocationMapIElement *self, LocationMapServiceType type)
-{
- g_return_val_if_fail (LOCATION_MAP_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (LOCATION_MAP_IELEMENT_GET_INTERFACE (self)->is_supported_provider_capability, LOCATION_ERROR_NOT_AVAILABLE);
-
- return LOCATION_MAP_IELEMENT_GET_INTERFACE (self)->is_supported_provider_capability (self, type);
-}
-
-int
-location_map_ielement_get_provider_capability_key (LocationMapIElement *self, LocationMapServiceType type, GList **key)
-{
- g_return_val_if_fail (LOCATION_MAP_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (LOCATION_MAP_IELEMENT_GET_INTERFACE (self)->get_provider_capability_key, LOCATION_ERROR_NOT_AVAILABLE);
-
- return LOCATION_MAP_IELEMENT_GET_INTERFACE (self)->get_provider_capability_key (self, type, key);
-}
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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 __LOCATION_MAP_IELEMENT_H__
-#define __LOCATION_MAP_IELEMENT_H__
-
-#include <glib-object.h>
-#include <location-map-types.h>
-#include <location.h>
-
-/**
- * @file location-map-ielement.h
- * @brief This file contains the internal definitions and structures related to location interface.
- */
-
-G_BEGIN_DECLS
-
-#define LOCATION_MAP_TYPE_IELEMENT (location_map_ielement_get_type ())
-#define LOCATION_MAP_IELEMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LOCATION_MAP_TYPE_IELEMENT, LocationMapIElement))
-#define LOCATION_MAP_IS_IELEMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LOCATION_MAP_TYPE_IELEMENT))
-#define LOCATION_MAP_IELEMENT_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), LOCATION_MAP_TYPE_IELEMENT, LocationMapIElementInterface))
-
-typedef struct _LocationMapIElement LocationMapIElement;
-typedef struct _LocationMapIElementInterface LocationMapIElementInterface;
-
-typedef int (*TYPE_GET_GEOCODE)(LocationMapIElement *self, const LocationAddress *address, const LocationMapPref *svc_pref, GList **position_list, GList **accuracy_list);
-typedef int (*TYPE_GET_GEOCODE_FREEFORM)(LocationMapIElement *self, const gchar *address, const LocationMapPref *svc_pref, GList **position_list, GList **accuracy_list);
-typedef int (*TYPE_GET_REVERSEGEOCODE)(LocationMapIElement *self, const LocationPosition *position, const LocationMapPref *svc_pref, LocationAddress **address, LocationAccuracy **accuracy);
-typedef int (*TYPE_GET_GEOCODE_ASYNC)(LocationMapIElement *self, const LocationAddress *address, const LocationMapPref *svc_pref, const LocationGeocodePreference * pref, LocationPositionCB callback, gpointer userdata, guint *req_id);
-typedef int (*TYPE_GET_GEOCODE_FREEFORM_ASYNC)(LocationMapIElement *self, const gchar *address, const LocationMapPref *svc_pref, const LocationGeocodePreference * pref, LocationPositionCB callback, gpointer userdata, guint *req_id);
-typedef int (*TYPE_CANCEL_GEOCODE_REQUEST) (LocationMapIElement *self, guint req_id);
-typedef int (*TYPE_GET_REVERSEGEOCODE_ASYNC)(LocationMapIElement *self, const LocationPosition *position, const LocationMapPref *svc_pref, LocationAddressCB callback, gpointer userdata, guint *req_id);
-typedef int (*TYPE_SEARCH_POI) (LocationMapIElement *self, const LocationPOIFilter * filter, const LocationPosition *position, const LocationMapPref *svc_pref, const LocationPOIPreference * pref, LocationPOICB cb, const gpointer user_data, guint *req_id);
-typedef int (*TYPE_SEARCH_POI_BY_AREA) (LocationMapIElement *self, const LocationPOIFilter *filter, const LocationBoundary * boundary, const LocationMapPref *svc_pref, const LocationPOIPreference * pref, LocationPOICB cb, const gpointer user_data, guint *req_id);
-typedef int (*TYPE_SEARCH_POI_BY_ADDR) (LocationMapIElement *self, const LocationPOIFilter *filter, const LocationAddress * address, const LocationMapPref *svc_pref, const LocationPOIPreference * pref, LocationPOICB cb, const gpointer user_data, guint *req_id);
-typedef int (*TYPE_SEARCH_POI_BY_FREEFORM) (LocationMapIElement *self, const LocationPOIFilter *filter, const gchar *freeform, const LocationMapPref *svc_pref, const LocationPOIPreference * pref, LocationPOICB cb, const gpointer user_data, guint *req_id);
-typedef int (*TYPE_CANCEL_POI_REQUEST) (LocationMapIElement *self, guint req_id);
-typedef int (*TYPE_REQUEST_ROUTE) (LocationMapIElement *self, const LocationPosition *origin, const LocationPosition *destination, GList *waypoint, const LocationMapPref *svc_pref, const LocationRoutePreference *pref, LocationRouteCB cb, const gpointer user_data, guint *req_id);
-typedef int (*TYPE_CANCEL_ROUTE_REQUEST) (LocationMapIElement *self, guint req_id);
-typedef gboolean (*TYPE_IS_SUPPORTED_PROVIDER_CAPABILITY) (LocationMapIElement *self, LocationMapServiceType type);
-typedef int (*TYPE_GET_PROVIDER_CAPABILITY_KEY)(LocationMapIElement *self, LocationMapServiceType type, GList **key);
-
-struct _LocationMapIElementInterface
-{
- GTypeInterface parent_iface;
-
- TYPE_GET_GEOCODE get_geocode;
- TYPE_GET_GEOCODE_FREEFORM get_geocode_freeform;
- TYPE_GET_REVERSEGEOCODE get_reversegeocode;
- TYPE_GET_GEOCODE_ASYNC get_geocode_async;
- TYPE_GET_GEOCODE_FREEFORM_ASYNC get_geocode_freeform_async;
- TYPE_CANCEL_GEOCODE_REQUEST cancel_geocode_request;
- TYPE_GET_REVERSEGEOCODE_ASYNC get_reversegeocode_async;
- TYPE_SEARCH_POI search_poi;
- TYPE_SEARCH_POI_BY_AREA search_poi_by_area;
- TYPE_SEARCH_POI_BY_ADDR search_poi_by_address;
- TYPE_SEARCH_POI_BY_FREEFORM search_poi_by_freeform;
- TYPE_CANCEL_POI_REQUEST cancel_poi_request;
- TYPE_REQUEST_ROUTE request_route;
- TYPE_CANCEL_ROUTE_REQUEST cancel_route_request;
- TYPE_IS_SUPPORTED_PROVIDER_CAPABILITY is_supported_provider_capability;
- TYPE_GET_PROVIDER_CAPABILITY_KEY get_provider_capability_key;
-};
-
-GType location_map_ielement_get_type (void);
-
-int location_map_ielement_get_geocode (LocationMapIElement *self, const LocationAddress *address, const LocationMapPref *svc_pref, GList **position_list, GList **accuracy_list);
-int location_map_ielement_get_geocode_freeform (LocationMapIElement *self, const gchar *address, const LocationMapPref *svc_pref, GList **position_list, GList **accuracy_list);
-int location_map_ielement_get_reversegeocode (LocationMapIElement *self, const LocationPosition *position, const LocationMapPref *svc_pref, LocationAddress **address, LocationAccuracy **accuracy);
-int location_map_ielement_get_geocode_async (LocationMapIElement *self, const LocationAddress *address, const LocationMapPref *svc_pref,const LocationGeocodePreference *pref, LocationPositionCB callback, gpointer userdata, guint * req_id);
-int location_map_ielement_get_geocode_freeform_async (LocationMapIElement *self, const gchar *address, const LocationMapPref *svc_pref,const LocationGeocodePreference *pref, LocationPositionCB callback, gpointer userdata, guint * req_id);
-int location_map_ielement_cancel_geocode_request (LocationMapIElement *self, guint req_id);
-int location_map_ielement_get_reversegeocode_async (LocationMapIElement *self, const LocationPosition *position, const LocationMapPref *svc_pref, LocationAddressCB callback, gpointer userdata, guint * req_id);
-int location_map_ielement_search_poi (LocationMapIElement *self, const LocationPOIFilter * filter, const LocationPosition *position, const LocationMapPref *svc_pref, const LocationPOIPreference * pref, LocationPOICB cb, const gpointer user_data, guint * req_id);
-int location_map_ielement_search_poi_by_area (LocationMapIElement *self, const LocationPOIFilter * filter, const LocationBoundary * boundary, const LocationMapPref *svc_pref, const LocationPOIPreference * pref, LocationPOICB cb, const gpointer user_data, guint * req_id);
-int location_map_ielement_search_poi_by_address (LocationMapIElement *self, const LocationPOIFilter * filter, const LocationAddress * address, const LocationMapPref *svc_pref, const LocationPOIPreference * pref, LocationPOICB cb, const gpointer user_data, guint * req_id);
-int location_map_ielement_search_poi_by_freeform (LocationMapIElement *self, const LocationPOIFilter * filter, const gchar * freeform, const LocationMapPref *svc_pref, const LocationPOIPreference * pref, LocationPOICB cb, const gpointer user_data, guint * req_id);
-int location_map_ielement_cancel_poi_request (LocationMapIElement *self, guint req_id);
-int location_map_ielement_request_route (LocationMapIElement *self, const LocationPosition *origin, const LocationPosition *destination, GList *waypoint, const LocationMapPref *svc_pref, const LocationRoutePreference * pref, LocationRouteCB cb, const gpointer user_data, guint * req_id);
-int location_map_ielement_cancel_route_request (LocationMapIElement *self, guint req_id);
-gboolean location_map_ielement_is_supported_provider_capability (LocationMapIElement *self, LocationMapServiceType type);
-int location_map_ielement_get_provider_capability_key (LocationMapIElement *self, LocationMapServiceType type, GList **key);
-
-G_END_DECLS
-
-#endif
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <glib.h>
-#include "location-map-types.h"
-#include "map-service.h"
-#include "location-map-pref.h"
-
-struct _LocationMapPref {
- gchar *provider_name; ///< Name of the service provier
- gchar *language; ///< Language of the service preference.
- gchar *country; ///< Country of the service preference.
- gchar *distance_unit; ///< Distance unit of the service preference.
- gchar* maps_key; ///< Maps Key of the service preference.
- GHashTable *properties; ///< properties of the service preference.
-
- ConnectivityMode connectivity_mode; ///<Connection mode tells whether to search online, offline or both.
-};
-
-EXPORT_API GList *
-location_map_pref_get_property_key (const LocationMapPref *pref)
-{
- g_return_val_if_fail (pref, NULL);
-
- if (!pref->properties) return NULL;
-
- return g_hash_table_get_keys (pref->properties);
-}
-
-EXPORT_API gchar *
-location_map_pref_get_language (const LocationMapPref *pref)
-{
- g_return_val_if_fail (pref, NULL);
-
- return pref->language;
-}
-
-EXPORT_API gchar *
-location_map_pref_get_country (const LocationMapPref *pref)
-{
- g_return_val_if_fail (pref, NULL);
-
- return pref->country;
-}
-
-EXPORT_API gchar *
-location_map_pref_get_distance_unit (const LocationMapPref *pref)
-{
- g_return_val_if_fail (pref, NULL);
-
- return pref->distance_unit;
-}
-
-EXPORT_API gconstpointer
-location_map_pref_get_property (const LocationMapPref *pref, gconstpointer key)
-{
- g_return_val_if_fail (pref, NULL);
- g_return_val_if_fail (key, NULL);
- if (!pref->properties) return NULL;
-
- return (gconstpointer) g_hash_table_lookup (pref->properties, key);
-}
-
-EXPORT_API gchar *
-location_map_pref_get_provider_name (const LocationMapPref *pref)
-{
- g_return_val_if_fail (pref, NULL);
-
- return pref->provider_name;
-}
-
-EXPORT_API gboolean
-location_map_pref_set_provider_name (LocationMapPref *pref, const gchar *name)
-{
- g_return_val_if_fail (pref, FALSE);
-
- if (pref->provider_name) {
- g_free (pref->provider_name);
- pref->provider_name = NULL;
- }
-
- if (name) pref->provider_name = g_strdup ((gchar *)name);
-
- return TRUE;
-}
-
-EXPORT_API gboolean
-location_map_pref_set_language (LocationMapPref *pref, const gchar * language)
-{
- g_return_val_if_fail (pref, FALSE);
-
- if (pref->language) {
- g_free (pref->language);
- pref->language = NULL;
- }
-
- if (language) pref->language = g_strdup(language);
-
- return TRUE;
-}
-
-EXPORT_API gboolean
-location_map_pref_set_country (LocationMapPref *pref, const gchar *country)
-{
- g_return_val_if_fail (pref, FALSE);
-
- if (pref->country) {
- g_free (pref->country);
- pref->country = NULL;
- }
-
- if (country) pref->country = g_strdup(country);
-
- return TRUE;
-}
-
-
-EXPORT_API gboolean
-location_map_pref_set_distance_unit (LocationMapPref *pref, const gchar * unit)
-{
- g_return_val_if_fail (pref, FALSE);
-
- if (pref->distance_unit) {
- g_free (pref->distance_unit);
- pref->distance_unit = NULL;
- }
-
- if (unit) pref->distance_unit = g_strdup (unit);
-
- return TRUE;
-}
-
-EXPORT_API gboolean
-location_map_pref_set_property (LocationMapPref *pref, gconstpointer key, gconstpointer value)
-{
- g_return_val_if_fail (pref, FALSE);
- g_return_val_if_fail (key, FALSE);
- if (!pref->properties) return FALSE;
-
- if (value) {
- gchar *re_key = g_strdup (key);
- gchar *re_val = g_strdup (value);
- g_hash_table_insert (pref->properties, re_key, re_val);
- } else g_hash_table_remove (pref->properties, key);
-
- return TRUE;
-}
-
-/**
- * @brief Set maps key to be used in the service request.
- */
-EXPORT_API gboolean
-location_map_pref_set_maps_key(LocationMapPref *pref, const char* maps_key)
-{
- g_return_val_if_fail (pref, FALSE);
- g_return_val_if_fail (maps_key, FALSE);
-
- if (pref->maps_key) {
- g_free (pref->maps_key);
- pref->maps_key = NULL;
- }
-
- if (maps_key) pref->maps_key = g_strdup(maps_key);
-
- return TRUE;
-}
-
-/**
- * @brief Get maps key to be used in the service request.
- */
-EXPORT_API gchar *
-location_map_pref_get_maps_key(const LocationMapPref *pref)
-{
- g_return_val_if_fail (pref, NULL);
-
- return pref->maps_key;
-}
-
-EXPORT_API LocationMapPref *
-location_map_pref_new (void)
-{
- LocationMapPref *pref = g_slice_new0(LocationMapPref);
- if (!pref) return NULL;
-
- pref->properties = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
-
- return pref;
-}
-
-static void property_copy (gpointer key, gpointer value, gpointer user_data)
-{
- g_return_if_fail (key);
- g_return_if_fail (value);
- g_return_if_fail (user_data);
-
- GHashTable *properties = (GHashTable *) user_data;
-
- gchar *re_key = g_strdup (key);
- gchar *re_val = g_strdup (value);
- g_hash_table_insert (properties, re_key, re_val);
-}
-
-EXPORT_API LocationMapPref *
-location_map_pref_copy (LocationMapPref *pref)
-{
- g_return_val_if_fail (pref, NULL);
-
- LocationMapPref *new_pref = location_map_pref_new();
- if (!new_pref) return NULL;
-
- location_map_pref_set_provider_name (new_pref, location_map_pref_get_provider_name(pref));
- location_map_pref_set_language (new_pref, location_map_pref_get_language(pref));
- location_map_pref_set_distance_unit (new_pref, location_map_pref_get_distance_unit(pref));
-
-
- g_hash_table_foreach (pref->properties, property_copy, new_pref->properties);
-
- return new_pref;
-}
-
-EXPORT_API void
-location_map_pref_free (LocationMapPref * pref)
-{
- g_return_if_fail(pref);
-
- location_map_pref_set_provider_name (pref, NULL);
- location_map_pref_set_language (pref, NULL);
- location_map_pref_set_distance_unit (pref, NULL);
- g_hash_table_destroy (pref->properties);
-
- g_slice_free (LocationMapPref, pref);
- pref = NULL;
-}
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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 __LOCATION_MAP_PREF_H__
-#define __LOCATION_MAP_PREF_H__
-
-#include <location-map-types.h>
-
-G_BEGIN_DECLS
-
-/**
- * @file location-map-pref.h
- * @brief This file contains the internal definitions and structures related to a service provider.
- * @addtogroup LocationMapService
- * @{
- * @defgroup LocationMapServiceProvider Service Provider
- * @brief This represents preference and capability of Service providers
- * @addtogroup LocationMapServiceProvider
- * @{
- */
-
-/**
- * @brief Get provider name to be used in the service request
- */
-gchar *location_map_pref_get_provider_name (const LocationMapPref *pref);
-
-/**
- * @brief Get language to be used in the service request.
- */
-gchar *location_map_pref_get_language (const LocationMapPref *pref);
-
-/**
- * @brief Get country to be used in the service request.
- */
-gchar *location_map_pref_get_country (const LocationMapPref *pref);
-
-/**
- * @brief Get the preferred length unit to be used in the service request.
- */
-gchar *location_map_pref_get_distance_unit (const LocationMapPref *pref);
-
-/**
- * @brief Get available service of the service provider.
- */
-GList *location_map_pref_get_property_key (const LocationMapPref *pref);
-
-/**
- * @brief Get property to be used in the service request.
- */
-gconstpointer location_map_pref_get_property (const LocationMapPref *pref, gconstpointer key);
-
-/**
- * @brief Set provider's name to be used in the service request.
- */
-gboolean location_map_pref_set_provider_name (LocationMapPref *pref, const gchar *name);
-
-/**
- * @brief Set language to be used in the service request.
- */
-gboolean location_map_pref_set_language (LocationMapPref *pref, const gchar *language);
-
-/**
- * @brief Set country to be used in the service request.
- */
-gboolean location_map_pref_set_country (LocationMapPref *pref, const gchar *country);
-
-/**
- * @brief Get the preferred length unit to be used in the service request.
- */
-gboolean location_map_pref_set_distance_unit (LocationMapPref *pref, const gchar * unit);
-
-/**
- * @brief Set property to be used in the service request.
- */
-gboolean location_map_pref_set_property (LocationMapPref *pref, gconstpointer key, gconstpointer value);
-
-/**
- * @brief Create a new LocationMapPref.
- */
-LocationMapPref * location_map_pref_new (void);
-
-/**
- * @brief Copy a new LocationMapPref.
- */
-LocationMapPref * location_map_pref_copy (LocationMapPref *pref);
-
-/**
- * @brief Free a LocationMapPref.
- */
-void location_map_pref_free (LocationMapPref *pref);
-
-/**
- * @brief Set maps key to be used in the service request.
- */
-gboolean location_map_pref_set_maps_key(LocationMapPref *pref, const char* maps_key);
-
-/**
- * @brief Get maps key to be used in the service request.
- */
-gchar *location_map_pref_get_maps_key(const LocationMapPref *pref);
-
-/**
- * @} @}
- */
-
-G_END_DECLS
-
-#endif /* __LOCATION_MAP_PREF_H__ */
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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 __LOCATION_MAP_SERVICE_EXT_H__
-#define __LOCATION_MAP_SERVICE_EXT_H__
-
-
-#include <location-map-types.h>
-#include <location-route-ext.h>
-#include <location-landmark-ext.h>
-
-G_BEGIN_DECLS
-
-/**
- * @file location-map-service-ext.h
- * @brief This file contains the extensional headers.
- */
-
-G_END_DECLS
-
-#endif /* __LOCATION_MAP_SERVICE_EXT_H__ */
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdio.h>
-
-#include "location.h"
-#include "location-log.h"
-#include "location-setting.h"
-#include "location-map-ielement.h"
-#include "location-map-pref.h"
-#include "location-map-service.h"
-#include "map-service.h"
-
-EXPORT_API LocationMapObject *
-location_map_new (const char * provider)
-{
-
- LocationMapObject *self = NULL;
- self = g_object_new (MAP_TYPE_SERVICE, "provider", provider, NULL);
- return self;
-}
-
-EXPORT_API int
-location_map_free (LocationMapObject *obj)
-{
- g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
-
- g_object_unref (obj);
-
- return LOCATION_ERROR_NONE;
-}
-
-static gboolean
-is_connected_network()
-{
- gboolean is_connected = TRUE;
- int net_state = 0;
-
- net_state = location_setting_get_int(VCONFKEY_NETWORK_STATUS);
-
- LOCATION_LOGW("net_state[%d]", net_state);
- if(net_state == VCONFKEY_NETWORK_OFF) {
- is_connected = FALSE;
- }
-
- return is_connected;
-
-}
-
-EXPORT_API int
-location_map_get_position_from_address (LocationMapObject *obj,
- const LocationAddress *address,
- GList **position_list,
- GList **accuracy_list)
-{
- g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (G_OBJECT_TYPE(obj) == MAP_TYPE_SERVICE, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (is_connected_network(), LOCATION_ERROR_NETWORK_NOT_CONNECTED);
-
- int ret = LOCATION_ERROR_NONE;
- LocationMapPref *svc_pref = location_map_get_service_pref (obj);
-
- ret = location_map_ielement_get_geocode (LOCATION_MAP_IELEMENT(obj), address, svc_pref, position_list, accuracy_list);
- location_map_pref_free(svc_pref);
-
- return ret;
-}
-
-EXPORT_API int
-location_map_get_position_from_freeformed_address (LocationMapObject *obj,
- const gchar *address,
- GList **position_list,
- GList **accuracy_list)
-{
- g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (G_OBJECT_TYPE(obj) == MAP_TYPE_SERVICE, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (is_connected_network(), LOCATION_ERROR_NETWORK_NOT_CONNECTED);
-
- int ret = LOCATION_ERROR_NONE;
- LocationMapPref *svc_pref = location_map_get_service_pref (obj);
-
- ret = location_map_ielement_get_geocode_freeform (LOCATION_MAP_IELEMENT(obj), address, svc_pref, position_list, accuracy_list);
- location_map_pref_free(svc_pref);
-
- return ret;
-}
-
-EXPORT_API int
-location_map_get_address (LocationMapObject *obj,
- LocationAddress **address,
- LocationAccuracy **accuracy)
-{
- return LOCATION_ERROR_NOT_SUPPORTED;
-}
-
-EXPORT_API int
-location_map_get_address_from_position (LocationMapObject *obj,
- const LocationPosition *position,
- LocationAddress **address,
- LocationAccuracy **accuracy)
-{
- g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (G_OBJECT_TYPE(obj) == MAP_TYPE_SERVICE, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (is_connected_network(), LOCATION_ERROR_NETWORK_NOT_CONNECTED);
-
- int ret = LOCATION_ERROR_NONE;
- LocationMapPref *svc_pref = location_map_get_service_pref (obj);
-
- ret = location_map_ielement_get_reversegeocode (LOCATION_MAP_IELEMENT(obj), position, svc_pref, address, accuracy);
- location_map_pref_free(svc_pref);
-
- return ret;
-}
-
-EXPORT_API int
-location_map_get_position_from_address_async (LocationMapObject *obj,
- const LocationAddress *address,
- const LocationGeocodePreference *pref,
- LocationPositionCB callback,
- gpointer userdata,
- guint * req_id)
-{
- g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (G_OBJECT_TYPE(obj) == MAP_TYPE_SERVICE, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (is_connected_network(), LOCATION_ERROR_NETWORK_NOT_CONNECTED);
- g_return_val_if_fail (req_id, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (pref, LOCATION_ERROR_PARAMETER);
-
- int ret = LOCATION_ERROR_NONE;
- LocationMapPref *svc_pref = location_map_get_service_pref (obj);
-
- ret = location_map_ielement_get_geocode_async (LOCATION_MAP_IELEMENT(obj), address, svc_pref,pref, callback, userdata,req_id);
- location_map_pref_free(svc_pref);
-
- return ret;
-}
-
-
-EXPORT_API int
-location_map_get_position_from_freeformed_address_async (LocationMapObject *obj,
- const gchar *address,
- const LocationGeocodePreference *pref,
- LocationPositionCB callback,
- gpointer userdata,
- guint * req_id)
-{
- g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (G_OBJECT_TYPE(obj) == MAP_TYPE_SERVICE, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (is_connected_network(), LOCATION_ERROR_NETWORK_NOT_CONNECTED);
- g_return_val_if_fail (req_id, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (pref, LOCATION_ERROR_PARAMETER);
-
- int ret = LOCATION_ERROR_NONE;
- LocationMapPref *svc_pref = location_map_get_service_pref (obj);
-
- ret = location_map_ielement_get_geocode_freeform_async (LOCATION_MAP_IELEMENT(obj), address, svc_pref,pref, callback, userdata,req_id);
- location_map_pref_free(svc_pref);
-
- return ret;
-}
-
-EXPORT_API int
-location_map_cancel_geocode_request (LocationMapObject *obj, guint req_id)
-{
- g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (G_OBJECT_TYPE(obj) == MAP_TYPE_SERVICE, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (req_id, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (is_connected_network(), LOCATION_ERROR_NETWORK_NOT_CONNECTED);
-
- return location_map_ielement_cancel_geocode_request (LOCATION_MAP_IELEMENT(obj), req_id);
-}
-
-EXPORT_API int
-location_map_get_address_from_position_async (LocationMapObject *obj,
- const LocationPosition *position,
- LocationAddressCB callback,
- gpointer userdata,
- guint * req_id)
-{
- g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (G_OBJECT_TYPE(obj) == MAP_TYPE_SERVICE, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (is_connected_network(), LOCATION_ERROR_NETWORK_NOT_CONNECTED);
- g_return_val_if_fail (req_id, LOCATION_ERROR_PARAMETER);
-
- int ret = LOCATION_ERROR_NONE;
- LocationMapPref *svc_pref = location_map_get_service_pref (obj);
-
- ret = location_map_ielement_get_reversegeocode_async (LOCATION_MAP_IELEMENT(obj), position, svc_pref, callback, userdata,req_id);
- location_map_pref_free(svc_pref);
-
- return ret;
-}
-
-EXPORT_API int
-location_map_search_poi (LocationMapObject *obj,
- const LocationPOIFilter *filter,
- const LocationPosition *position,
- const LocationPOIPreference *pref,
- LocationPOICB cb, gpointer user_data, guint * req_id)
-{
- g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (G_OBJECT_TYPE(obj) == MAP_TYPE_SERVICE, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (filter, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (position, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (pref, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (cb, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (req_id, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (is_connected_network(), LOCATION_ERROR_NETWORK_NOT_CONNECTED);
-
- LocationMapPref *svc_pref = location_map_get_service_pref (obj);
-
- return location_map_ielement_search_poi (LOCATION_MAP_IELEMENT(obj), filter, position, svc_pref, pref, cb, user_data, req_id);
-}
-
-EXPORT_API int
-location_map_search_poi_by_area (LocationMapObject *obj,
- const LocationPOIFilter *filter,
- const LocationBoundary *boundary,
- const LocationPOIPreference *pref,
- LocationPOICB cb, gpointer user_data, guint * req_id)
-{
- g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (G_OBJECT_TYPE(obj) == MAP_TYPE_SERVICE, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (filter, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (boundary, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (pref, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (cb, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (req_id, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (is_connected_network(), LOCATION_ERROR_NETWORK_NOT_CONNECTED);
-
- LocationMapPref *svc_pref = location_map_get_service_pref (obj);
-
- return location_map_ielement_search_poi_by_area (LOCATION_MAP_IELEMENT(obj), filter, boundary, svc_pref, pref, cb, user_data, req_id);
-}
-
-EXPORT_API int
-location_map_search_poi_by_address (LocationMapObject *obj, const LocationPOIFilter * filter,
- const LocationAddress * address, const LocationPOIPreference * pref,
- LocationPOICB cb, gpointer user_data, guint * req_id)
-{
- g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (G_OBJECT_TYPE(obj) == MAP_TYPE_SERVICE, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (filter, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (address, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (pref, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (cb, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (req_id, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (is_connected_network(), LOCATION_ERROR_NETWORK_NOT_CONNECTED);
-
- LocationMapPref *svc_pref = location_map_get_service_pref (obj);
-
- return location_map_ielement_search_poi_by_address (LOCATION_MAP_IELEMENT(obj), filter, address, svc_pref, pref, cb, user_data, req_id);
-}
-
-EXPORT_API int
-location_map_search_poi_by_freeformed_address (LocationMapObject *obj,
- const LocationPOIFilter *filter,
- const gchar *address,
- const LocationPOIPreference *pref,
- LocationPOICB cb, gpointer user_data, guint *req_id)
-{
- g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (G_OBJECT_TYPE(obj) == MAP_TYPE_SERVICE, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (filter, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (address, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (pref, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (cb, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (req_id, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (is_connected_network(), LOCATION_ERROR_NETWORK_NOT_CONNECTED);
-
- LocationMapPref *svc_pref = location_map_get_service_pref (obj);
-
- return location_map_ielement_search_poi_by_freeform (LOCATION_MAP_IELEMENT(obj), filter, address, svc_pref, pref, cb, user_data, req_id);
-}
-
-EXPORT_API int
-location_map_cancel_poi_request (LocationMapObject *obj, guint req_id)
-{
- g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (G_OBJECT_TYPE(obj) == MAP_TYPE_SERVICE, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (req_id, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (is_connected_network(), LOCATION_ERROR_NETWORK_NOT_CONNECTED);
-
- return location_map_ielement_cancel_poi_request (LOCATION_MAP_IELEMENT(obj), req_id);
-}
-
-EXPORT_API int
-location_map_request_route (LocationMapObject *obj, LocationPosition *origin, LocationPosition *destination,
- GList *waypoint, const LocationRoutePreference * pref,
- LocationRouteCB cb, gpointer user_data, guint * req_id)
-{
- g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (G_OBJECT_TYPE(obj) == MAP_TYPE_SERVICE, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (origin, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (destination, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (pref, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (cb, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (req_id, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (is_connected_network(), LOCATION_ERROR_NETWORK_NOT_CONNECTED);
-
- LocationMapPref *svc_pref = location_map_get_service_pref (obj);
-
- return location_map_ielement_request_route (LOCATION_MAP_IELEMENT(obj), origin, destination,
- waypoint, svc_pref, pref, cb, user_data, req_id);
-}
-
-EXPORT_API int
-location_map_cancel_route_request (LocationMapObject *obj, guint req_id)
-{
- g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (G_OBJECT_TYPE(obj) == MAP_TYPE_SERVICE, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (is_connected_network(), LOCATION_ERROR_NETWORK_NOT_CONNECTED);
-
- return location_map_ielement_cancel_route_request (LOCATION_MAP_IELEMENT(obj), req_id);
-}
-
-EXPORT_API gboolean
-location_map_is_supported_provider_capability (LocationMapObject *obj, LocationMapServiceType type)
-{
- g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (G_OBJECT_TYPE(obj) == MAP_TYPE_SERVICE, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (is_connected_network(), LOCATION_ERROR_NETWORK_NOT_CONNECTED);
-
- return location_map_ielement_is_supported_provider_capability (LOCATION_MAP_IELEMENT(obj), type);
-}
-
-EXPORT_API int
-location_map_get_provider_capability_key (LocationMapObject *obj, LocationMapServiceType type, GList **key)
-{
- g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (G_OBJECT_TYPE(obj) == MAP_TYPE_SERVICE, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (key, LOCATION_ERROR_PARAMETER);
- g_return_val_if_fail (is_connected_network(), LOCATION_ERROR_NETWORK_NOT_CONNECTED);
-
- return location_map_ielement_get_provider_capability_key (LOCATION_MAP_IELEMENT(obj), type, key);
-}
-
-EXPORT_API LocationMapPref *
-location_map_get_service_pref (LocationMapObject *obj)
-{
- g_return_val_if_fail (obj, NULL);
- g_return_val_if_fail (G_OBJECT_TYPE(obj) == MAP_TYPE_SERVICE, NULL);
-
- return map_service_get_pref (obj);
-}
-
-EXPORT_API gboolean
-location_map_set_service_pref (LocationMapObject *obj, LocationMapPref *pref)
-{
- g_return_val_if_fail (obj, FALSE);
- g_return_val_if_fail (G_OBJECT_TYPE(obj) == MAP_TYPE_SERVICE, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (pref, FALSE);
-
- return map_service_set_pref (obj, pref);
-}
-
-EXPORT_API GList *
-location_map_get_supported_providers (LocationMapObject *obj)
-{
- g_return_val_if_fail (obj, NULL);
- g_return_val_if_fail (G_OBJECT_TYPE(obj) == MAP_TYPE_SERVICE, LOCATION_ERROR_NOT_AVAILABLE);
-
- return map_service_get_supported_providers (obj);
-}
-
-EXPORT_API gchar *
-location_map_get_default_provider (LocationMapObject *obj)
-{
- g_return_val_if_fail (obj, NULL);
- g_return_val_if_fail (G_OBJECT_TYPE(obj) == MAP_TYPE_SERVICE, LOCATION_ERROR_NOT_AVAILABLE);
-
- return map_service_get_default_provider(obj);
-}
-
-EXPORT_API gboolean
-location_map_set_provider (LocationMapObject *obj, gchar *provider)
-{
- g_return_val_if_fail (obj, NULL);
- g_return_val_if_fail (G_OBJECT_TYPE(obj) == MAP_TYPE_SERVICE, LOCATION_ERROR_NOT_AVAILABLE);
-
- return map_service_set_provider (obj, provider);
-}
-
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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 __LOCATION_MAP_SERVICE_H__
-#define __LOCATION_MAP_SERVICE_H__
-
-
-#include <glib.h>
-#include <location-map-pref.h>
-#include <location-map-types.h>
-#include <location-address.h>
-#include <location-poi.h>
-#include <location-route.h>
-#include <location-landmark.h>
-
-G_BEGIN_DECLS
-
-/**
- * @file location-map-service.h
- * @brief This file contains the Location API and related structure and enumeration.
- */
-/**
- * @addtogroup LocationFW
- * @{
- * @defgroup LocationMapService Location Map Service API
- * @brief This sub module provides the Location Map Service API.
- * @addtogroup LocationMapService
- * @{
- */
-
-/**
-* @brief
-* Create Map Object.
-* @remarks location_init should be called before.
-* @pre None.
-* @post None.
-* @param [in]
-* provider - map provider. A default provider will be provided if NULL.
-*/
-LocationMapObject *location_map_new (const char *provider);
-
-/**
-* @brief
-* Free Map Object.
-* @remarks location_map_new should be called before.
-*/
-int location_map_free (LocationMapObject *obj);
-
-/**
- * @brief
- * Get current position information with estimate of the accuracy by using given address information.
- * @remarks Out parameters are should be freed.
- * @pre
- * #location_init should be called before.\n
- * Calling application must have an active data connection.
- * @post None.
- * @param [in]
- * obj - a #LocationMapObject created by #location_map_new
- * @param [in]
- * address - a #LocationAddress
- * @param [out]
- * position_list - a list of #LocationPosition
- * @param [out]
- * accuracy_list - a list of #LocationAccuracy
- * @return int
- * @retval 0 Success.
- *
- * Please refer #LocationError for more information.
- * @see
- * location_map_get_position_from_address_async\n
- * @par Example
- * @code
-#include <location.h>
-#include <location-map-service.h>
-
-static void PrintPos (gpointer data, gpointer user_data)
-{
- LocationPosition *pos = (LocationPosition *)data;
-
- if (pos) {
- g_debug("time: [%d], latitude: [%f], longitude: [%f], altitude: [%f]\n", pos->timestamp, pos->latitude, pos->longitude, pos->altitude);
- location_position_free (pos);
- }
-}
-
-static void PrintAcc (gpointer data, gpointer user_data)
-{
- LocationAccuracy *acc = (LocationAccuracy *)data;
-
- if (acc) {
- g_debug("level: [%d], horizontal_accuracy: [%f], vertical_accuracy: [%f]\n", acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
- location_accuracy_free (acc);
- }
-
-}
-
-static void PrintPos (gpointer data, gpointer user_data)
-{
- LocationPosition *pos = (LocationPosition *)data;
-
- if (pos) {
- g_debug("time: [%d], latitude: [%f], longitude: [%f], altitude: [%f]\n", pos->timestamp, pos->latitude, pos->longitude, pos->altitude);
- location_position_free (pos);
- }
-}
-
-static void PrintAcc (gpointer data, gpointer user_data)
-{
- LocationAccuracy *acc = (LocationAccuracy *)data;
-
- if (acc) {
- g_debug("level: [%d], horizontal_accuracy: [%f], vertical_accuracy: [%f]\n", acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
- location_accuracy_free (acc);
- }
-}
-
-int main (int argc, char *argv[])
-{
- LocationMapObject *loc = NULL;
- int ret = LOCATION_ERROR_NONE;
-
- location_init ();
- loc = location_map_new (NULL);
- if(!loc){
- g_debug("location_map_new failed");
- return -1;
- }
-
- GList *pos_list = NULL;
- GList *acc_list = NULL;
- LocationAddress *addr = NULL;
-
- addr = location_address_new ("1", "Post Street", NULL, "san jose", "ca", NULL, "95113");
- if (LOCATION_ERROR_NONE == location_map_get_position_from_address(loc, addr, &pos_list, &acc_list)) {
-
- } else g_warning ("SYNC>> position from address> failed");
- location_address_free (addr);
- g_list_foreach (pos_list, PrintPos, NULL);
- g_list_foreach (acc_list, PrintAcc, NULL);
- g_list_free (pos_list);
- g_list_free (acc_list);
- location_map_free (loc);
- return 0;
-}
- * @endcode
- */
-int location_map_get_position_from_address (LocationMapObject *obj, const LocationAddress *address, GList **position_list, GList **accuracy_list);
-
-/**
- * @brief
- * Get current position information asynchronously with estimate of the accuracy by using given address information.
- * @remarks None.
- * @pre
- * #location_init should be called before.\n
- * Calling application must have glib or ecore main loop.\n
- * Calling application must have an active data connection.
- * @post None.
- * @param [in]
- * obj - a #LocationMapObject created by #location_map_new
- * @param [in]
- * address - a #LocationAddress
- * @param [in]
- * callback - A pointer of function which will be called after position is gained or when an error occurs.
- * @param [in]
- * userdata - data to pass to function
- * @return int
- * @retval 0 Success.
- *
- * Please refer #LocationError for more information.
- * @see
- * location_map_get_position_from_address\n
- * @par Example
- * @code
-#include <location-map-service.h>
-
-static void PrintPos (gpointer data, gpointer user_data)
-{
- LocationPosition *pos = (LocationPosition *)data;
-
- if (pos) {
- g_debug("time: [%d], latitude: [%f], longitude: [%f], altitude: [%f]\n", pos->timestamp, pos->latitude, pos->longitude, pos->altitude);
- }
-}
-
-static void PrintAcc (gpointer data, gpointer user_data)
-{
- LocationAccuracy *acc = (LocationAccuracy *)data;
-
- if (acc) {
- g_debug("level: [%d], horizontal_accuracy: [%f], vertical_accuracy: [%f]\n", acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
- }
-}
-static void
-cb_position_from_address (LocationError error, GList *position_list, GList *accuracy_list, gpointer userdata)
-{
- if (position_list && accuracy_list) {
- g_list_foreach (position_list, PrintPos);
- g_list_foreach (accuracy_list, PrintAcc);
- }
-}
-
-void get_position_from_address(LocationMapObject* loc)
-{
- LocationAddress *addr = location_address_new ("1", "Post Street", NULL, "san jose", "ca", NULL, "95113");
- //Calling application must have an active data connection before using this function.
- if (LOCATION_ERROR_NONE == location_map_get_position_from_address_async(loc, addr, cb_position_from_address, loc))
- g_debug("location_map_get_position_from_address_async() success");
- else g_warning ("location_map_get_position_from_address_async() failed");
- location_address_free (addr);
-}
- * @endcode
- */
- int location_map_get_position_from_address_async (LocationMapObject *obj, const LocationAddress *address,const LocationGeocodePreference *pref,LocationPositionCB callback,gpointer userdata,guint * req_id);
-
-/**
- * @brief
- * Get current position information with estimate of the accuracy by using given free-formed address string.
- * @remarks Out parameters are should be freed.
- * @pre
- * #location_init should be called before.\n
- * Calling application must have an active data connection.
- * @post None.
- * @param [in]
- * obj - a #LocationMapObject created by #location_map_new
- * @param [in]
- * address - Free-formed address string to be used
- * @param [out]
- * position_list - a list of #LocationPosition
- * @param [out]
- * accuracy_list - a list of #LocationAccuracy
- * @return int
- * @retval 0 Success
- *
- * Please refer #LocationError for more information.
- * @see
- * location_map_get_position_from_freeformed_address_async\n
- * @par Example
- * @code
-#include <location.h>
-#include <location-map-service.h>
-
-static void PrintPos (gpointer data, gpointer user_data)
-{
- LocationPosition *pos = (LocationPosition *)data;
-
- if (pos) {
- g_debug("time: [%d], latitude: [%f], longitude: [%f], altitude: [%f]\n", pos->timestamp, pos->latitude, pos->longitude, pos->altitude);
- location_position_free (pos);
- }
-}
-
-static void PrintAcc (gpointer data, gpointer user_data)
-{
- LocationAccuracy *acc = (LocationAccuracy *)data;
-
- if (acc) {
- g_debug("level: [%d], horizontal_accuracy: [%f], vertical_accuracy: [%f]\n", acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
- location_accuracy_free (acc);
- }
-}
-
-static void PrintPos (gpointer data, gpointer user_data)
-{
- LocationPosition *pos = (LocationPosition *)data;
-
- if (pos) {
- g_debug("time: [%d], latitude: [%f], longitude: [%f], altitude: [%f]\n", pos->timestamp, pos->latitude, pos->longitude, pos->altitude);
- location_position_free (pos);
- }
-}
-
-static void PrintAcc (gpointer data, gpointer user_data)
-{
- LocationAccuracy *acc = (LocationAccuracy *)data;
-
- if (acc) {
- g_debug("level: [%d], horizontal_accuracy: [%f], vertical_accuracy: [%f]\n", acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
- location_accuracy_free (acc);
- }
-}
-
-int main (int argc, char *argv[])
-{
- LocationMapObject *loc = NULL;
- int ret = LOCATION_ERROR_NONE;
-
- location_init ();
- loc = location_map_new (NULL);
- if(!loc){
- g_debug("location_map_new failed");
- return -1;
- }
-
- GList *pos_list = NULL;
- GList *acc_list = NULL;
- char* addr_str = g_strdup("4 N 2nd Street 95113");
-
- //Calling application must have an active data connection before using this function.
- if (LOCATION_ERROR_NONE == location_map_get_position_from_freeformed_address(loc, addr_str, &pos_list, &acc_list)) {
- g_list_foreach (pos_list, PrintPos, NULL);
- g_list_foreach (acc_list, PrintAcc, NULL);
- g_list_free (pos_list);
- g_list_free (acc_list);
- } else g_warning ("SYNC>> position from freeformed address> failed");
- g_free(addr_str);
-
- location_free (loc);
- return 0;
-}
- * @endcode
- */
-int location_map_get_position_from_freeformed_address (LocationMapObject *obj, const gchar *address, GList **position_list, GList **accuracy_list);
-
-/**
- * @brief
- * Get current position information asynchronously with estimate of the accuracy by using given free-formed address string.
- * @remarks None.
- * @pre
- * #location_init should be called before.\n
- * Calling application must have glib or ecore main loop.\n
- * Calling application must have an active data connection.
- * @post None.
- * @param [in]
- * obj - a #LocationMapObject created by #location_map_new
- * @param [in]
- * address - Free-formed address string to be used
- * @param [in]
- * callback - A pointer of function which will be called after position is gained or when an error occurs.
- * @param [in]
- * userdata - data to pass to function
- * @return int
- * @retval 0 Success
- *
- * Please refer #LocationError for more information.
- * @see
- * location_map_get_position_from_freeformed_address\n
- * @par Example
- * @code
-#include <location.h>
-#include <location-map-service.h>
-
-static void PrintPos (gpointer data, gpointer user_data)
-{
- LocationPosition *pos = (LocationPosition *)data;
-
- if (pos) {
- g_debug("time: [%d], latitude: [%f], longitude: [%f], altitude: [%f]\n", pos->timestamp, pos->latitude, pos->longitude, pos->altitude);
- }
-}
-
-static void PrintAcc (gpointer data, gpointer user_data)
-{
- LocationAccuracy *acc = (LocationAccuracy *)data;
-
- if (acc) {
- g_debug("level: [%d], horizontal_accuracy: [%f], vertical_accuracy: [%f]\n", acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
- }
-}
-
-static void
-cb_position_from_freeformed_address (LocationError error, GList *position_list, GList *accuracy_list, gpointer userdata)
-{
- if (position_list && accuracy_list) {
- g_list_foreach (position_list, PrintPos);
- g_list_foreach (accuracy_list, PrintAcc);
- }
-}
-
-void get_position_from_address(LocationMapObject* loc)
-{
- gchar *addr_str = g_strdup("4 N 2nd Street 95113");
- //Calling application must have an active data connection before using this function.
- if (LOCATION_ERROR_NONE == location_map_get_position_from_freeformed_address_async(loc, addr_str, cb_position_from_freeformed_address, loc))
- g_debug("location_map_get_position_from_freeformed_address_async() success");
- else g_warning ("location_map_get_position_from_freeformed_address_async() failed");
- g_free(addr_str);
-
-}
- * @endcode
- */
- int location_map_cancel_geocode_request (LocationMapObject *obj, guint req_id);
-int location_map_get_position_from_freeformed_address_async (LocationMapObject *obj, const gchar *address,const LocationGeocodePreference *pref, LocationPositionCB callback,gpointer userdata, guint * req_id);
-
-/**
- * @brief
- * Get current address information with estimate of the accuracy by using given position information.
- * @remarks Out parameters are should be freed.
- * @pre
- * #location_init should be called before.\n
- * Calling application must have an active data connection.
- * @post None.
- * @param [in]
- * obj - a #LocationMapObject created by #location_map_new
- * @param [in]
- * position - a #LocationPosition
- * @param [out]
- * address - a new #LocationAddress
- * @param [out]
- * accuracy - a new #LocationAccuracy
- * @return int
- * @retval 0 Success
- *
- * Please refer #LocationError for more information.
- * @see
- * location_map_get_address_from_position_async\n
- * @par Example
- * @code
-#include <location.h>
-#include <location-map-service.h>
-static GMainLoop *loop = NULL;
-
-int
-main (int argc, char *argv[])
-{
- LocationMapObject *loc = NULL;
- int ret = LOCATION_ERROR_NONE;
-
- location_init ();
-
- loop = g_main_loop_new (NULL, TRUE);
-
- loc = location_map_new (NULL);
- if(!loc){
- g_debug("location_map_new failed");
- return -1;
- }
-
- LocationPosition *pos = NULL;
- LocationAccuracy *acc = NULL;
- LocationAddress *addr = NULL;
-
- //Calling application must have an active data connection before using this function.
- pos = location_position_new (0, 37.257809, 127.056383, 0, LOCATION_STATUS_2D_FIX);
- if (LOCATION_ERROR_NONE == location_map_get_address_from_position(loc, pos, &addr, &acc)) {
- g_debug ("SYNC>> address from position> %s %s %s %s %s %s %s",
- addr->building_number, addr->street, addr->district, addr->city, addr->state, addr->postal_code, addr->country_code);
- g_debug ("\tAccuracy level %d (%.0f meters %.0f meters)", acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
- location_address_free(addr);
- location_accuracy_free(acc);
- } else g_warning ("SYNC>> address from position> failed");
- location_position_free (pos);
- location_map_free (loc);
-}
- * @endcode
- */
-int location_map_get_address_from_position (LocationMapObject *obj, const LocationPosition *position, LocationAddress **address, LocationAccuracy **accuracy);
-
-/**
- * @brief
- * Get current address information asynchronously with estimate of the accuracy by using given position information.
- * @remarks None.
- * @pre
- * #location_init should be called before.\n
- * Calling application must have glib or ecore main loop.\n
- * Calling application must have an active data connection.
- * @post None.
- * @param [in]
- * obj - a #LocationMapObject created by #location_map_new
- * @param [in]
- * position - a #LocationPosition
- * @param [in]
- * callback - A pointer of function which will be called after address is gained or when an error occurs.
- * @param [in]
- * userdata - data to pass to function
- * @return int
- * @retval 0 Success
- *
- * Please refer #LocationError for more information.
- * @see
- * location_map_get_address_from_position\n
- * @par Example
- * @code
-#include <location.h>
-#include <location-map-service.h>
-static GMainLoop *loop = NULL;
-
-static void
-cb_address_from_position (LocationError error, LocationAddress *addr, LocationAccuracy *acc, gpointer userdata)
-{
- g_debug ("ASYNC>> location_map_get_address_from_position_async> %s %s %s %s %s %s %s",
- addr->building_number, addr->street, addr->district, addr->city, addr->state, addr->postal_code, addr->country_code);
- g_debug ("\tAccuracy level %d (%.0f meters %.0f meters)", acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
-}
-
-void get_address_from_position(LocationMapObject* loc)
-{
- LocationPosition *pos = location_position_new (0, 37.257809, 127.056383, 0, LOCATION_STATUS_2D_FIX);
- //Calling application must have an active data connection before using this function.
- if (LOCATION_ERROR_NONE == location_map_get_address_from_position_async(loc, pos, cb_address_from_position, loc))
- g_debug("location_map_get_address_from_position_async() success");
- else g_warning ("location_map_get_address_from_position_async() failed");
- location_position_free (pos);
-}
- * @endcode
- */
-int location_map_get_address_from_position_async (LocationMapObject *obj, const LocationPosition *position, LocationAddressCB callback, gpointer userdata, guint * req_id);
-
-/**
- * @brief Request a search service from service provider.
- * @remarks refer #LocationLandmark
- * @pre #location_init should be called before.\n
- * #location_poi_pref_new should be set before.
- * @post None.
- * @param [in] obj - a #LocationMapObject created by #location_map_new
- * @param [in] filter - a #LocaitonPOIFilter created by #location_poi_filter_new
- * @param [in] position - a #LocationPosition
- * @param [in] pref - a #LocationPOIPreference created by #location_poi_pref_new
- * @param [in] cb - #LocationPOICB
- * @param [in] user_data - data to pass to function
- * @param [out] req_id - a guint
- * @return int
- * @retval 0 Success
- * Please refer #LocationError for more information.
- * @par Example
- * @code
-#include <location.h>
-#include <location-map-service.h>
-
-static GMainLoop *loop = NULL;
-
-void PrintLandmarkCb (gpointer data, gpointer user_data)
-{
- g_return_if_fail (data);
-
- LocationLandmark *landmark = (LocationLandmark *)data;
-
- g_debug ("id[%d], Priority[%d], Name:[%s], Author[%s], Phone[%s], Category[%s]\n", location_landmark_get_id (landmark),
- location_landmark_get_priority(landmark),
- location_landmark_get_name(landmark),
- location_landmark_get_author(landmark),
- location_landmark_get_phone_number(landmark),
- location_landmark_get_category(landmark));
-}
-
-static void poi_cb(LocationError error, guint req_id, GList * landmark_list, gchar * error_code, gchar * error_msg, gpointer userdata)
-{
- if (error != LOCATION_ERROR_NONE || landmark_list == NULL) {
- g_debug ("Fail to get poi. Error[%d], ErrCode[%s], ErrMsg[%s]", error, error_code, error_msg);
- return;
- }
- g_list_foreach (landmark_list, PrintLandmarkCb, NULL);
-}
-
-void search_poi(LocationMapObject* loc)
-{
- int ret = 0;
- guint req_id = 0;
- LocationPosition *pos = location_position_new (0, 37.257809, 127.056383, 0, LOCATION_STATUS_2D_FIX);
- LocationPOIFilter *filter = location_poi_filter_new();
- LocationPOIPreference *pref = location_poi_pref_new();
-
- location_poi_filter_set(filter, "CATEGORY", "restaurant");
-
- location_poi_pref_set_max_result(pref, 5);
- location_poi_pref_set_sort_by(pref, "name");
- location_poi_pref_set_sort_order(pref, LOCATION_POI_PREF_SO_ASC);
-
- ret = location_map_search_poi (loc, filter, pos, pref, poi_cb, loc, &req_id);
- if (ret != LOCATION_ERROR_NONE) {
- g_debug("Fail to get poi. Error[%d]", ret);
- }
-
- location_poi_filter_free(filter);
- location_poi_pref_free(pref);
- location_position_free(pos);
-
-}
- * @endcode
- */
-int location_map_search_poi (LocationMapObject *obj, const LocationPOIFilter * filter, const LocationPosition *position, const LocationPOIPreference * pref, LocationPOICB cb, gpointer user_data, guint * req_id);
-
-/**
- * @brief Request a search service with area filter from service provider.
- * @remarks refer #LocationLandmark
- * @pre #location_init should be called before.\n
- * #location_poi_pref_new should be set before.
- * @post None.
- * @param [in] obj - a #LocationMapObject created by #location_map_new
- * @param [in] filter - a #LocaitonPOIFilter created by #location_poi_filter_new
- * @param [in] boundary - a #LocationBoundary
- * @param [in] pref - a #LocationPOIPreference created by #location_poi_pref_new
- * @param [in] cb - #LocationPOICB
- * @param [in] user_data - data to pass to function
- * @param [out] req_id - a guint
- * @return int
- * @retval 0 Success
- * Please refer #LocationError for more information.
- * @par Example
- * @code
-#include <location.h>
-#include <location-map-service.h>
-
-static GMainLoop *loop = NULL;
-
-void PrintLandmarkCb (gpointer data, gpointer user_data)
-{
- g_return_if_fail (data);
-
- LocationLandmark *landmark = (LocationLandmark *)data;
-
- g_debug ("id[%d], Priority[%d], Name:[%s], Author[%s], Phone[%s], Category[%s]\n", location_landmark_get_id (landmark),
- location_landmark_get_priority(landmark),
- location_landmark_get_name(landmark),
- location_landmark_get_author(landmark),
- location_landmark_get_phone_number(landmark),
- location_landmark_get_category(landmark));
-}
-
-static void poi_cb(LocationError error, guint req_id, GList * landmark_list, gchar * error_code, gchar * error_msg, gpointer userdata)
-{
- if (error != LOCATION_ERROR_NONE || landmark_list == NULL) {
- g_debug ("Fail to get poi. Error[%d], ErrCode[%s], ErrMsg[%s]", error, error_code, error_msg);
- return;
- }
- g_list_foreach (landmark_list, PrintLandmarkCb, NULL);
-}
-
-void search_poi(LocationMapObject* loc)
-{
- int ret = 0;
- guint req_id = 0;
-
- LocationPosition* rb = location_position_new (0, 37.300, -121.86, 0, LOCATION_STATUS_2D_FIX);
- LocationPosition* lt = location_position_new (0, 37.360, -121.92, 0, LOCATION_STATUS_2D_FIX);
- LocationBoundary *bbox = location_boundary_new_for_rect (lt, rb);
- LocationPOIFilter *filter = location_poi_filter_new();
- LocationPOIPreference *pref = location_poi_pref_new();
-
- location_poi_filter_set(filter, "CATEGORY", "restaurant");
-
- location_poi_pref_set_max_result(pref, 5);
- location_poi_pref_set_sort_by(pref, "name");
- location_poi_pref_set_sort_order(pref, LOCATION_POI_PREF_SO_ASC);
-
- ret = location_map_search_poi_by_area (loc, filter, bbox, pref, poi_cb, loc, &req_id);
- if (ret != LOCATION_ERROR_NONE) {
- g_debug("Fail to get poi. Error[%d]", ret);
- }
-
- location_poi_filter_free(filter);
- location_poi_pref_free(pref);
- location_boundary_free (bbox);
-}
- * @endcode
- */
-int location_map_search_poi_by_area (LocationMapObject *obj, const LocationPOIFilter * filter, const LocationBoundary * boundary, const LocationPOIPreference * pref, LocationPOICB cb, gpointer user_data, guint * req_id);
-
-/**
- * @brief Request a search service with address filter from service provider.
- * @remarks refer #LocationLandmark
- * @pre #location_init should be called before.\n
- * #location_poi_pref_new should be set before.
- * @post None.
- * @param [in] obj - a #LocationMapObject created by #location_map_new
- * @param [in] filter - a #LocaitonPOIFilter created by #location_poi_filter_new
- * @param [in] address - a #LocationAddress
- * @param [in] pref - a #LocationPOIPreference created by #location_poi_pref_new
- * @param [in] cb - #LocationPOICB
- * @param [in] user_data - data to pass to function
- * @param [out] req_id - a guint
- * @return int
- * @retval 0 Success
- * Please refer #LocationError for more information.
- * @par Example
- * @code
-#include <location.h>
-#include <location-map-service.h>
-
-static GMainLoop *loop = NULL;
-
-void PrintLandmarkCb (gpointer data, gpointer user_data)
-{
- g_return_if_fail (data);
-
- LocationLandmark *landmark = (LocationLandmark *)data;
-
- g_debug ("id[%d], Priority[%d], Name:[%s], Author[%s], Phone[%s], Category[%s]\n", location_landmark_get_id (landmark),
- location_landmark_get_priority(landmark),
- location_landmark_get_name(landmark),
- location_landmark_get_author(landmark),
- location_landmark_get_phone_number(landmark),
- location_landmark_get_category(landmark));
-}
-
-static void poi_cb(LocationError error, guint req_id, GList * landmark_list, gchar * error_code, gchar * error_msg, gpointer userdata)
-{
- if (error != LOCATION_ERROR_NONE || landmark_list == NULL) {
- g_debug ("Fail to get poi. Error[%d], ErrCode[%s], ErrMsg[%s]", error, error_code, error_msg);
- return;
- }
- g_list_foreach (landmark_list, PrintLandmarkCb, NULL);
-}
-
-void search_poi(LocationMapObject* loc)
-{
- int ret = 0;
- guint req_id = 0;
-
- LocationAddress *addr = location_address_new ("1", "Post Street", NULL, "san jose", "ca", NULL, "95113");
- LocationPOIFilter *filter = location_poi_filter_new();
- LocationPOIPreference *pref = location_poi_pref_new();
-
- location_poi_filter_set(filter, "CATEGORY", "restaurant");
-
- location_poi_pref_set_max_result(pref, 5);
- location_poi_pref_set_sort_by(pref, "name");
- location_poi_pref_set_sort_order(pref, LOCATION_POI_PREF_SO_ASC);
-
- ret = location_map_search_poi_by_address (loc, filter, addr, pref, poi_cb, loc, &req_id);
- if (ret != LOCATION_ERROR_NONE) {
- g_debug("Fail to get poi. Error[%d]", ret);
- }
-
- location_poi_filter_free(filter);
- location_poi_pref_free(pref);
- location_address_free (addr);
-}
- * @endcode
- */
-int location_map_search_poi_by_address (LocationMapObject *obj, const LocationPOIFilter * filter, const LocationAddress * addr, const LocationPOIPreference * pref, LocationPOICB cb, gpointer user_data, guint * req_id);
-
-/**
- * @brief Request a search service with area filter from service provider.
- * @remarks refer #LocationLandmark
- * @pre #location_init should be called before.\n
- * #location_poi_pref_new should be set before.
- * @post None.
- * @param [in] obj - a #LocationMapObject created by #location_map_new
- * @param [in] filter - a #LocaitonPOIFilter created by #location_poi_filter_new
- * @param [in] address - a freeformed address
- * @param [in] pref - a #LocationPOIPreference created by #location_poi_pref_new
- * @param [in] cb - #LocationPOICB
- * @param [in] user_data - data to pass to function
- * @param [out] req_id - a guint
- * @return int
- * @retval 0 Success
- * Please refer #LocationError for more information.
- * @par Example
- * @code
-#include <location.h>
-#include <location-map-service.h>
-
-static GMainLoop *loop = NULL;
-
-void PrintLandmarkCb (gpointer data, gpointer user_data)
-{
- g_return_if_fail (data);
-
- LocationLandmark *landmark = (LocationLandmark *)data;
-
- g_debug ("id[%d], Priority[%d], Name:[%s], Author[%s], Phone[%s], Category[%s]\n", location_landmark_get_id (landmark),
- location_landmark_get_priority(landmark),
- location_landmark_get_name(landmark),
- location_landmark_get_author(landmark),
- location_landmark_get_phone_number(landmark),
- location_landmark_get_category(landmark));
-}
-
-static void poi_cb(LocationError error, guint req_id, GList * landmark_list, gchar * error_code, gchar * error_msg, gpointer userdata)
-{
- if (error != LOCATION_ERROR_NONE || landmark_list == NULL) {
- g_debug ("Fail to get poi. Error[%d], ErrCode[%s], ErrMsg[%s]", error, error_code, error_msg);
- return;
- }
- g_list_foreach (landmark_list, PrintLandmarkCb, NULL);
-}
-
-void search_poi(LocationMapObject* loc)
-{
- int ret = 0;
- guint req_id = 0;
-
- gchar *addr = g_strdup("4 N 2nd Street 95113");
- LocationPOIFilter *filter = location_poi_filter_new();
- LocationPOIPreference *pref = location_poi_pref_new();
-
- location_poi_filter_set(filter, "CATEGORY", "restaurant");
-
- location_poi_pref_set_max_result(pref, 5);
- location_poi_pref_set_sort_by(pref, "name");
- location_poi_pref_set_sort_order(pref, LOCATION_POI_PREF_SO_ASC);
-
- ret = location_map_search_poi_by_freeformed_address (loc, filter, addr, pref, poi_cb, loc, &req_id);
- if (ret != LOCATION_ERROR_NONE) {
- g_debug("Fail to get poi. Error[%d]", ret);
- }
-
- location_poi_filter_free(filter);
- location_poi_pref_free(pref);
- g_free (addr);
-}
- * @endcode
- */
-int location_map_search_poi_by_freeformed_address (LocationMapObject *obj, const LocationPOIFilter * filter, const gchar * address, const LocationPOIPreference * pref, LocationPOICB cb, gpointer user_data, guint * req_id);
-
-/**
- * @brief Cancel the previous poi search.
- * @remarks refer #LocationLandmark
- * @pre #location_map_search_poi should be called before.
- * @post None.
- * @param [in] obj - a #LocationMapObject created by #location_map_new
- * @param [in] req_id - a poi request id returned by location_map_search_poi
- * @return int
- * @retval 0 Success
- * Please refer #LocationError for more information.
- * @par Example
- * @code
-#include <location.h>
-#include <location-map-service.h>
-
-static GMainLoop *loop = NULL;
-
-void PrintLandmarkCb (gpointer data, gpointer user_data)
-{
- g_return_if_fail (data);
-
- LocationLandmark *landmark = (LocationLandmark *)data;
-
- g_debug ("id[%d], Priority[%d], Name:[%s], Author[%s], Phone[%s], Category[%s]\n", location_landmark_get_id (landmark),
- location_landmark_get_priority(landmark),
- location_landmark_get_name(landmark),
- location_landmark_get_author(landmark),
- location_landmark_get_phone_number(landmark),
- location_landmark_get_category(landmark));
-}
-
-static void poi_cb(LocationError error, guint req_id, GList * landmark_list, gchar * error_code, gchar * error_msg, gpointer userdata)
-{
- if (error != LOCATION_ERROR_NONE || landmark_list == NULL) {
- g_debug ("Fail to get poi. Error[%d], ErrCode[%s], ErrMsg[%s]", error, error_code, error_msg);
- return;
- }
- g_list_foreach (landmark_list, PrintLandmarkCb, NULL);
-}
-
-void search_poi(LocationMapObject* loc)
-{
- int ret = 0;
- guint req_id = 0;
-
- gchar *addr = g_strdup("4 N 2nd Street 95113");
- LocationPOIFilter *filter = location_poi_filter_new();
- LocationPOIPreference *pref = location_poi_pref_new();
-
- location_poi_filter_set(filter, "CATEGORY", "restaurant");
-
- location_poi_pref_set_max_result(pref, 5);
- location_poi_pref_set_sort_by(pref, "name");
- location_poi_pref_set_sort_order(pref, LOCATION_POI_PREF_SO_ASC);
-
- ret = location_map_search_poi (loc, filter, addr, pref, poi_cb, loc, &req_id);
- if (ret != LOCATION_ERROR_NONE) {
- g_debug("Fail to get poi. Error[%d]", ret);
- }
-
- ret = location_map_cancel_poi_request (loc, req_id);
- if (ret != LOCATION_ERROR_NONE) {
- g_debug("Fail to cancel poi request. Err[%d]", ret);
- }
-
- location_poi_filter_free(filter);
- location_poi_pref_free(pref);
- g_free (addr);
-}
- * @endcode
- */
-int location_map_cancel_poi_request (LocationMapObject *obj, guint req_id);
-
-/**
- * @brief Request a route service from service provider.
- * @remarks refer #LocationRoute, #LocationRouteSegment and #LocationRouteStep
- * @pre #location_map_new should be called before.
- * @post None.
- * @param [in] obj - a #LocationMapObject created by #location_map_new
- * @param [in] origin - a #LocationPosition
- * @param [in] destination - a #LocationPosition
- * @param [in] waypoint - a list of #LocationPosition
- * const LocationRoutePreference * pref, LocationRouteCB cb, gpointer user_data, guint * req_id);
- * @param [in] pref - a #LocationRoutePreference created by #location_route_pref_new
- * @param [in] cb - a #LocationRouteCB
- * @param [in] user_data - a gpointer
- * @param [out] req_id - a guint
- * @return int
- * @retval 0 Success
- * Please refer #LocationError for more information.
- * @par Example
- * @code
-#include <location.h>
-#include <location-map-service.h>
-
-static void free_waypoint (gpointer data)
-{
- LocationPosition *pos = (LocationPosition *)data;
-
- if (pos) location_position_free(pos);
-}
-
-static void __print_route_step (gpointer data, gpointer user_data)
-{
- g_printf("+++Step begin\n");
- LocationRouteStep *step = (LocationRouteStep *)data;
-
- const LocationPosition *start = location_route_step_get_start_point(step);
- gdouble start_lat = 0;
- gdouble start_lon = 0;
- if (start) {
- start_lat = start->latitude;
- start_lon = start->longitude;
- } else {
- g_printf("Step start position NULL\n");
- }
- const LocationPosition *end = location_route_step_get_end_point(step);
- gdouble end_lat = 0;
- gdouble end_lon = 0;
- if (end) {
- end_lat = end->latitude;
- end_lon = end->longitude;
- } else {
- g_printf("Step end postion NULL\n");
- }
- const gchar *inst = location_route_step_get_instruction(step);
-
- g_printf("Step: start(%f/%f), end(%f/%f), instruction(%s)\n", start_lat, start_lon, end_lat, end_lon, inst);
-
- g_printf("---Step end\n");
-}
-
-static void print_route_segment (gpointer data, gpointer user_data)
-{
- g_printf("++Segment begin\n");
- LocationRouteSegment *seg = (LocationRouteSegment *)data;
- gdouble seg_dist = location_route_segment_get_distance(seg);
- glong seg_duration = location_route_segment_get_duration(seg);
- const LocationPosition *start = location_route_segment_get_start_point(seg);
- gdouble start_lat = 0;
- gdouble start_lon = 0;
- if (start) {
- start_lat = start->latitude;
- start_lon = start->longitude;
- } else {
- g_printf("Segment start postion NULL\n");
- }
- const LocationPosition *end = location_route_segment_get_end_point(seg);
- gdouble end_lat = 0;
- gdouble end_lon = 0;
- if (end) {
- end_lat = end->latitude;
- end_lon = end->longitude;
- } else {
- g_printf("Segment end postion NULL\n");
- }
- g_printf("Segment info: Distance[%f], Duration[%ld], start(%f/%f), end(%f/%f)\n", seg_dist, seg_duration,
- start_lat, start_lon, end_lat, end_lon);
-
- GList *step_list = location_route_segment_get_route_step(seg);
- GList *tmp_list = (GList *)step_list;
- if (tmp_list) {
- g_list_foreach(tmp_list, print_route_step, NULL);
- }
- g_printf("--Segment end\n");
-}
-
-
-static void print_route_list (gpointer data, gpointer user_data)
-{
- g_printf("+Route begin\n");
- LocationRoute *route = (LocationRoute *)data;
-
- const LocationPosition *start = location_route_get_origin(route);
- gdouble start_lat = 0;
- gdouble start_lon = 0;
- if (start) {
- start_lat = start->latitude;
- start_lon = start->longitude;
- } else {
- g_printf("Route start position NULL\n");
- }
- const LocationPosition *end = location_route_get_destination(route);
- gdouble end_lat = 0;
- gdouble end_lon = 0;
- if (end) {
- end_lat = end->latitude;
- end_lon = end->longitude;
- } else {
- g_printf("Route end position NULL\n");
- }
- g_printf("Route: start(%f/%f), end(%f/%f)\n", start_lat, start_lon, end_lat, end_lon);
-
- gdouble distance = location_route_get_total_distance(route);
- const gchar *dis_unit = location_route_get_distance_unit(route);
- glong duration = location_route_get_total_duration(route);
- const LocationBoundary *bound = location_route_get_bounding_box(route);
- if (bound && bound->type == LOCATION_BOUNDARY_RECT) {
- g_printf("RECT left top[%f-%f], right bottom[%f-%f]\n", bound->rect.left_top->latitude, bound->rect.left_top->longitude,
- bound->rect.right_bottom->latitude, bound->rect.right_bottom->longitude);
- } else {
- g_printf("route boundary not exist, or not RECT\n");
- }
- g_printf ("Distance[%f], Distance unit[%s], Duration[%ld]\n", distance, dis_unit, duration);
-
- GList *seg_list = location_route_get_route_segment(route);
- if (seg_list) {
- g_list_foreach(seg_list, print_route_segment, NULL);
- }
-
- g_printf("-Route end\n");
-}
-
-static void cb_route(LocationError error, guint req_id, GList * route_list, gchar * error_code, gchar * error_msg, gpointer userdata)
-{
- if (error != LOCATION_ERROR_NONE) {
- g_printf("Failed :%d\n", error);
- return;
- }
-
- g_printf("Success, poi_list[0x%x] user_data[0x%x] req_id[%d]\n", (unsigned int)route_list, (unsigned int)userdata, req_id);
- g_list_foreach (route_list, print_route_list, NULL);
-
- if (error_code && error_msg) {
- g_printf("cb_route: error_code[%s], error_msg[%s]\n", error_code, error_msg);
- }
-}
-
-int request_route(LocationMapObject *loc)
-{
- int ret = 0;
- LocationPosition *origin = location_position_new(0, 37.564263, 126.974676, 0, LOCATION_STATUS_2D_FIX); // Seoul city hall
- LocationPosition *destination = location_position_new(0, 37.557120, 126.992410, 0, LOCATION_STATUS_2D_FIX); // NamSan
-
- GList *waypoint = NULL;
- LocationPosition *via_pos = location_position_new(0, 37.560950, 126.986240, 0, LOCATION_STATUS_2D_FIX); // Wangsimli
- waypoint = g_list_append (waypoint, (gpointer)via_pos);
-
- LocationRoutePreference *pref = location_route_pref_new();
- gchar *type = g_strdup("FASTEST");
- location_route_pref_set_route_type(pref, type);
-
- ret = location_request_route(loc, origin, destination, waypoint, pref, cb_route, NULL, &req_id);
- if (ret != LOCATION_ERROR_NONE) {
- g_printf("Fail to search route by address. Error[%d]\n", ret);
- } else {
- g_printf("Search Route successfully, req_id %d\n", req_id);
- }
-
- g_free(type);
- g_list_free_full (waypoint, free_waypoint);
- location_position_free(origin);
- location_position_free(destination);
- location_route_pref_free(pref);
-
- return ret;
- }
- * @endcode
- */
-int location_map_request_route (LocationMapObject *obj, LocationPosition *origin, LocationPosition *destination, GList *waypoint, const LocationRoutePreference * pref, LocationRouteCB cb, gpointer user_data, guint * req_id);
-
-/**
- * @brief Cancel the previous route request.
- * @remarks None
- * @pre #location_map_request_route should be called before.
- * @post None.
- * @param [in] obj - a #LocationMapObject created by #location_map_new
- * @param [in] req_id - a route request id returned by location_map_search_route
- * @return int
- * @retval 0 Success
- * Please refer #LocationError for more information.
- * @par Example
- * @code
-#include <location.h>
-#include <location-map-service.h>
-
-int cancel_route_request (LocationMapObject *loc, guint req_id)
-{
- g_printf("cancel_route_request\n");
-
- int ret = LOCATION_ERROR_NONE;
-
- ret = location_map_cancel_route_request(loc, req_id);
- if (ret != LOCATION_ERROR_NONE) {
- g_printf("Fail to cancel route request. Error[%d]\n", ret);
- }
- else {
- g_printf("location_map_cancel_route_request, req_id %d\n", req_id);
- }
-}
- * @endcode
- */
-int location_map_cancel_route_request (LocationMapObject *obj, guint req_id);
-
-/**
- * @brief Check wheither a map service is available on a service provider
- * @remarks None
- * @pre #location_map_new should be called before.
- * @post None.
- * @param [in] obj - a #LocationMapObject created by #location_map_new
- * @param [in] type - a #LocationMapService
- * @return gboolean
- * @retval TRUE if supported
- * @par Example
- * @code
-#include <location.h>
-#include <location-map-service.h>
-
-int check_map_service (LocationMapObject *loc)
-{
- g_printf("check_map_service\n");
-
- gboolean is_supported = FALSE;
-
- is_supported = location_map_is_supported_provider_capability(loc, MAP_SERVICE_ROUTE_REQUEST_FEATURE_TO_AVOID);
- if (is_supported == TRUE) {
- g_printf("Map Service(MAP_SERVICE_ROUTE_REQUEST_FEATURE_TO_AVOID) is supported.\n");
- }
- else {
- g_printf("Map Service(MAP_SERVICE_ROUTE_REQUEST_FEATURE_TO_AVOID) is not supported.\n");
- }
-}
- * @endcode
- */
-gboolean location_map_is_supported_provider_capability (LocationMapObject *obj, LocationMapServiceType type);
-
-/**
- * @brief Get Map service key on a service provider
- * @remarks None
- * @pre #location_map_new should be called before.
- * @post None.
- * @param [in] obj - a #LocationMapObject created by #location_map_new
- * @param [in] type - a #LocationMapService
- * @return GList
- * @retval a list of keys
- * @par Example
- * @code
-#include <location.h>
-#include <location-map-service.h>
-
-static void _print_keys(gpointer data)
-{
- g_return_if_fail(data);
- gchar *key = (gchar *)data;
-
- g_printf("Key[%s] is available now\n", key);
-}
-
-int get_map_service_key (LocationMapObject *loc)
-{
- g_printf("check_map_service\n");
-
- GList *keys = NULL;
-
- keys = location_map_get_provider_capability_key(loc, MAP_SERVICE_ROUTE_REQUEST_FEATURE_TO_AVOID);
- if (keys) {
- g_list_foreach (keys, _print_keys, NULL);
- g_list_free_full (keys, g_free);
- }
- else {
- g_printf("Map Service(MAP_SERVICE_ROUTE_REQUEST_FEATURE_TO_AVOID) does not have keys. Need to check whether its service is supported.\n");
- }
-}
- * @endcode
- */
-int location_map_get_provider_capability_key (LocationMapObject *obj, LocationMapServiceType type, GList **key);
-
-/**
- * @brief Get Map service Preference on a service provider
- * @remarks None
- * @pre #location_map_new should be called before.
- * @post None.
- * @param [in] obj - a #LocationMapObject created by #location_map_new
- * @return #LocationMapPref
- * @retval a preference
- * @par Example
- * @code
-#include <location.h>
-#include <location-map-service.h>
- int get_map_service_pref (LocationMapObject loc)
- {
- if (!loc) return -1;
-
- LocationMapPref *svc_pref = location_map_get_service_pref (loc);
- if (!svc_pref) return -1;
-
- gchar *name = location_map_pref_get_provider (svc_pref);
- gchar *unit = location_map_pref_get_distance_unit (svc_pref);
- gchar *language = location_map_pref_get_language (svc_pref);
-
- g_printf("provider [%s]: distance unit [%s], languange [%s]\n", name, unit, language);
-
- return 0;
- }
-
- * @endcode
- */
-LocationMapPref *location_map_get_service_pref (LocationMapObject *obj);
-
-/**
- * @brief Set Map service preference on a service provider
- * @remarks None
- * @pre #location_map_new should be called before.
- * @post None.
- * @param [in] obj - a #LocationMapObject created by #location_map_new
- * @param [in] pref = a #LocationMapPref
- * @return gboolean
- * @retval TRUE if success
- * @par Example
- * @code
-#include <location.h>
-#include <location-map-service.h>
-
-int set_map_service_pref (LocationMapObject *loc)
-{
- if (!loc) return -1;
-
- LocationMapPref *svc_pref = location_map_pref_new();
- location_map_pref_set_language (svc_pref, "en");
- location_map_pref_set_distance_unit (svc_pref, "MI");
-
- gboolean ret = location_map_set_service_pref (loc, svc_pref);
- if (!ret) {
- location_map_pref_pref (svc_pref);
- return -1;
- }
- location_map_pref_pref (svc_pref);
- return 0;
-}
- * @endcode
- */
-gboolean location_map_set_service_pref (LocationMapObject *obj, LocationMapPref *pref);
-
-/**
- * @brief Get supported map providers
- * @remarks LocationMapObject should be created before.
- * @pre None.
- * @post None.
- * @param [in] obj - #LocationMapObject
- * @return Glist
- * @retval a list of providers
-*/
-GList *location_map_get_supported_providers (LocationMapObject *obj);
-
-/**
- * @brief Get current default provider
- * @remarks LocationMapObject should be created before.
- * @pre None.
- * @post None.
- * @param [in] obj - LocationMapObject
- * @return gchar
- * @retval provider name
- */
-gchar *location_map_get_default_provider (LocationMapObject *obj);
-
-/**
- * @brief Set current provider
- * @remarks LocationMapObject should be created before.
- * @pre None.
- * @post None.
- * @param [in] obj - LocationMapObject
- * @param [in] provider - gchar
- * @return gboolean
- * @retval TRUE if success
- */
-gboolean location_map_set_provider (LocationMapObject *obj, gchar *provider);
-
-/**
- * @} @}
- */
-
-G_END_DECLS
-
-#endif /* __LOCATION_MAP_SERVICE_H__ */
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "location-log.h"
-#include "location-types.h"
-#include "location-map-pref.h"
-
-#include "map-service.h"
-
-#include "location-poi.h"
-
-struct _LocationPOIPreference {
- guint max_result_cnt; ///< Maximum number of results
- LocationPOIPrefSortOrder sort_order; ///< Sort order
- gchar* item; ///< Sory by item
- GHashTable *properties;
-};
-
-struct _LocationPOIFilter {
- // "CATEGORY", "KEYWORD", "POINAME"
- GHashTable *properties;
-};
-
-EXPORT_API guint
-location_poi_pref_get_max_result (const LocationPOIPreference *pref)
-{
- g_return_val_if_fail(pref, 0);
-
- return pref->max_result_cnt;
-}
-
-EXPORT_API gchar *
-location_poi_pref_get_sort_by (const LocationPOIPreference *pref)
-{
- g_return_val_if_fail(pref, NULL);
-
- return pref->item;
-}
-
-EXPORT_API LocationPOIPrefSortOrder
-location_poi_pref_get_sort_order (const LocationPOIPreference *pref)
-{
- g_return_val_if_fail(pref, LOCATION_POI_PRE_SO_NONE);
-
- return pref->sort_order;
-}
-
-EXPORT_API GList *
-location_poi_pref_get_property_key (const LocationPOIPreference *pref)
-{
- g_return_val_if_fail (pref, NULL);
- if (!pref->properties) return NULL;
-
- return g_hash_table_get_keys (pref->properties);
-}
-
-EXPORT_API gpointer
-location_poi_pref_get_property (const LocationPOIPreference *pref, gconstpointer key)
-{
- g_return_val_if_fail (pref, NULL);
- g_return_val_if_fail (key, NULL);
-
- if (!pref->properties) return NULL;
-
- return g_hash_table_lookup (pref->properties, key);
-}
-
-
-EXPORT_API gboolean
-location_poi_pref_set_max_result (LocationPOIPreference *pref, guint max_num)
-{
- g_return_val_if_fail(pref, FALSE);
- g_return_val_if_fail(max_num > 0, FALSE);
-
- pref->max_result_cnt = max_num;
-
- return TRUE;
-}
-
-EXPORT_API gboolean
-location_poi_pref_set_sort_by(LocationPOIPreference * pref, const gchar * item)
-{
- g_return_val_if_fail(pref, FALSE);
-
- if (pref->item) {
- g_free(pref->item);
- pref->item = NULL;
- }
-
- if (item) pref->item = g_strdup(item);
-
- return TRUE;
-}
-
-EXPORT_API gboolean
-location_poi_pref_set_sort_order (LocationPOIPreference *pref, LocationPOIPrefSortOrder sort_order)
-{
- g_return_val_if_fail(pref, FALSE);
-
- if (sort_order < LOCATION_POI_PREF_SO_ASC || sort_order > LOCATION_POI_PREF_SO_DESC) return FALSE;
-
- pref->sort_order = sort_order;
-
- return TRUE;
-}
-
-EXPORT_API gboolean
-location_poi_pref_set_property (LocationPOIPreference *pref, gconstpointer key, gconstpointer value)
-{
- g_return_val_if_fail(pref, FALSE);
- g_return_val_if_fail(key, FALSE);
- g_return_val_if_fail(pref->properties, FALSE);
-
- if (value) {
- gchar *re_key = g_strdup (key);
- gchar *re_val = g_strdup (value);
- g_hash_table_insert (pref->properties, re_key, re_val);
- } else g_hash_table_remove (pref->properties, key);
-
- return TRUE;
-}
-
-EXPORT_API LocationPOIPreference *
-location_poi_pref_new (void)
-{
- LocationPOIPreference *pref = g_slice_new0 (LocationPOIPreference);
- g_return_val_if_fail(pref, NULL);
-
- pref->sort_order = LOCATION_POI_PREF_SO_ASC;
- pref->max_result_cnt = 25;
- pref->properties = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
-
- return pref;
-}
-
-static void poi_pref_property_copy_cb (gpointer key, gpointer value, gpointer user_data)
-{
- g_return_if_fail (key);
- g_return_if_fail (value);
- g_return_if_fail (user_data);
-
- LocationPOIPreference *pref = (LocationPOIPreference *) user_data;
- if (pref->properties) {
- gchar *re_key = g_strdup (key);
- gchar *re_val = g_strdup (value);
- g_hash_table_insert (pref->properties, re_key, re_val);
- }
-}
-
-EXPORT_API LocationPOIPreference *
-location_poi_pref_copy (LocationPOIPreference *pref)
-{
- LocationPOIPreference *new_pref = location_poi_pref_new();
- g_return_val_if_fail (new_pref, NULL);
-
- location_poi_pref_set_sort_by(new_pref, location_poi_pref_get_sort_by(pref));
- location_poi_pref_set_sort_order(new_pref, location_poi_pref_get_sort_order(pref));
- location_poi_pref_set_max_result(new_pref, location_poi_pref_get_max_result(pref));
-
- g_hash_table_foreach (pref->properties, poi_pref_property_copy_cb ,new_pref);
-
- return new_pref;
-}
-
-EXPORT_API void
-location_poi_pref_free (LocationPOIPreference * pref)
-{
- g_return_if_fail(pref);
-
- location_poi_pref_set_sort_by(pref, NULL);
- if (pref->properties) g_hash_table_destroy (pref->properties);
-
- g_slice_free(LocationPOIPreference, pref);
-}
-
-EXPORT_API gboolean
-location_poi_filter_set (const LocationPOIFilter *filter, gconstpointer key, gconstpointer value)
-{
- g_return_val_if_fail(filter, FALSE);
- g_return_val_if_fail(key, FALSE);
-
- if (filter->properties) {
- if (value) {
- gchar *re_key = g_strdup (key);
- gchar *re_val = g_strdup (value);
- g_hash_table_insert (filter->properties, re_key, re_val);
- } else g_hash_table_remove (filter->properties, key);
- }
- else
- return FALSE;
-
- return TRUE;
-}
-
-EXPORT_API gpointer
-location_poi_filter_get (const LocationPOIFilter *filter, gconstpointer key)
-{
- g_return_val_if_fail(filter, NULL);
- g_return_val_if_fail(key, NULL);
-
- if (filter->properties) {
- return g_hash_table_lookup (filter->properties, key);
- }
- return NULL;
-}
-
-EXPORT_API GList *
-location_poi_filter_get_key (const LocationPOIFilter *filter)
-{
- g_return_val_if_fail(filter, NULL);
-
- if (filter->properties) {
- return g_hash_table_get_keys (filter->properties);
- }
-
- return NULL;
-}
-
-EXPORT_API LocationPOIFilter *
-location_poi_filter_new (void)
-{
- LocationPOIFilter *filter = g_slice_new0(LocationPOIFilter);
- g_return_val_if_fail (filter, NULL);
-
- filter->properties = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
-
- return filter;
-}
-
-static void poi_filter_copy_cb (gpointer key, gpointer value, gpointer user_data)
-{
- g_return_if_fail (key);
- g_return_if_fail (value);
- g_return_if_fail (user_data);
-
- LocationPOIFilter *filter = (LocationPOIFilter *) user_data;
- if (filter->properties) {
- gchar *re_key = g_strdup (key);
- gchar *re_val = g_strdup (value);
- g_hash_table_insert (filter->properties, re_key, re_val);
- }
-}
-
-EXPORT_API LocationPOIFilter *
-location_poi_filter_copy (LocationPOIFilter *filter)
-{
- g_return_val_if_fail (filter, NULL);
-
- LocationPOIFilter * new_filter = location_poi_filter_new();
- g_return_val_if_fail (new_filter, NULL);
-
- if (new_filter->properties) g_hash_table_foreach (filter->properties, poi_filter_copy_cb, new_filter);
-
- return new_filter;
-}
-
-EXPORT_API void
-location_poi_filter_free (LocationPOIFilter *filter)
-{
- g_return_if_fail(filter);
-
- if (filter->properties) {
- g_hash_table_destroy (filter->properties);
- filter->properties = NULL;
- }
- g_slice_free(LocationPOIFilter, filter);
-}
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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 __LOCATION_POI_H__
-#define __LOCATION_POI_H__
-
-#include <location-map-types.h>
-
-G_BEGIN_DECLS
-
-/**
- * @file location-poi.h
- * @brief This file contains the internal definitions and structures related to POI.
- */
-
-/**
- * @addtogroup LocationMapService
- * @{
- * @defgroup LocationMapServicePOI Location POI
- * @brief This is a location POI for providing location map services.
- * @addtogroup LocationMapServicePOI
- * @{
- */
-
-typedef enum {
- LOCATION_POI_PRE_SO_NONE, ///< None of sorting the results in order.
- LOCATION_POI_PREF_SO_ASC, ///< A constant for sorting the results in ascending order
- LOCATION_POI_PREF_SO_DESC ///< A constant for sorting the results in descending order
-} LocationPOIPrefSortOrder;
-
-/**
- * @brief Retrive LocationPreperence that the given LocationPOIPreference inherits.
- */
-
-/**
- * @brief Create a new LocationPOIPreference
- * @remarks None.
- * @pre None
- * @post None.
- * @return #LocationPOIPreference
- * @retval NULL if error occured
- * @see location_location_poi_pref_free
- *
- */
-LocationPOIPreference *location_poi_pref_new (void);
-
-/**
- * @brief Copy a LocationPOIPreference
- * @remarks None.
- * @pre None
- * @post None.
- * @return #LocationPOIPreference
- * @retval NULL if error occured
- * @see location_location_poi_pref_free
- *
- */
-LocationPOIPreference *location_poi_pref_copy (LocationPOIPreference *pref);
-
-/**
- * @brief Free a LocationPOIPreference
- * @remarks None.
- * @pre #location_poi_pref_new should be called before.
- * @post None.
- * @param [in] pref - #LocationPOIPreference
- * @return void
- * @retval NULL if error occured
- * @see location_location_poi_pref_set_pref
- */
-void location_poi_pref_free (LocationPOIPreference * pref);
-
-/**
- * @brief Get the maximum number of results for poi service.
- * @remarks None.
- * @pre #location_poi_pref_new should be called before.
- * @post None.
- * @param [in] pref - #LocationPOIPreference
- * @return guint
- * @retval 0 if error occured
- * @see location_poi_pref_set_max_result
- */
-guint location_poi_pref_get_max_result (const LocationPOIPreference * pref);
-
-/**
- * @brief Get the sort criterion for poi service.
- * @remarks None.
- * @pre #location_poi_pref_new should be called before.
- * @post None.
- * @param [in] pref - #LocationPOIPreference
- * @return gchar
- * @retval sorting item
- * @see location_poi_pref_set_sort_by
- */
-gchar *location_poi_pref_get_sort_by (const LocationPOIPreference * pref);
-
-/**
- * @brief Get the sort order for poi service.
- * @remarks None.
- * @pre #location_poi_pref_new should be called before.
- * @post None.
- * @param [in] pref - #LocationPOIPreference
- * @return LocationPOIPrefSortOrder
- * @retval sort order
- * @see location_poi_pref_set_sort_order
- */
-LocationPOIPrefSortOrder location_poi_pref_get_sort_order (const LocationPOIPreference * pref);
-
-/**
- * @brief Get the property keys of poi preference
- * @remarks None.
- * @pre #location_poi_pref_new should be called before.
- * @post None.
- * @param [in] pref - #LocationPOIPreference
- * @return GList
- * @retval list of property key
- * @see location_poi_pref_set_property
- */
-GList *location_poi_pref_get_property_key (const LocationPOIPreference *pref);
-
-/**
- * @brief Get the property of poi preference
- * @remarks None.
- * @pre #location_poi_pref_new should be called before.
- * @post None.
- * @param [in] pref - #LocationPOIPreference
- * @param [in] key - gconstpointer
- * @return gconstpointer
- * @retval property value
- * @see location_poi_pref_set_property
- */
-gpointer location_poi_pref_get_property (const LocationPOIPreference *pref, gconstpointer key);
-
-
-/**
- * @brief Set the maximum number of results for poi service.
- * @remarks None.
- * @pre #location_poi_pref_new should be called before.
- * @post None.
- * @param [in] pref - #LocationPOIPreference
- * @return gboolean
- * @retval TRUE if success
- * @see location_poi_pref_get_max_result
- */
-gboolean location_poi_pref_set_max_result (LocationPOIPreference * pref, guint max_num);
-
-/**
- * @brief Set the sort criterion for poi service.
- * @remarks The previous item of the #LocationPOIPreference will be removed if an item is NULL.
- * @pre #location_poi_pref_new should be called before.
- * @post None.
- * @param [in] pref - #LocationPOIPreference
- * @param [in] item - gchar or NULL if reset
- * @return gboolean
- * @retval TRUE if success
- * @see location_poi_pref_get_sort_by
- */
-gboolean location_poi_pref_set_sort_by (LocationPOIPreference * pref, const gchar * item);
-
-/**
- * @brief Set the sort order for poi service.
- * @remarks None.
- * @pre #location_poi_pref_new should be called before.
- * @post None.
- * @param [in] pref - #LocationPOIPreference
- * @param [in] sort_order - #LocationPOIPrefSortOrder
- * @return gboolean
- * @retval TRUE if success
- * @see location_poi_pref_get_sort_order
- */
-gboolean location_poi_pref_set_sort_order (LocationPOIPreference *pref, LocationPOIPrefSortOrder sort_order);
-
-/**
- * @brief Set property of poi preference.
- * @remarks The previous value of the #LocationPOIPreference matching to key will be removed if an value is NULL.
- * @pre #location_poi_pref_new should be called before.
- * @post None.
- * @param [in] pref - #LocationPOIPreference
- * @param [in] key - gconstpoiner
- * @param [in] value - gconstpointer or NULL if reset
- * @return gboolean
- * @retval TRUE if success
- * @see location_poi_pref_get_property
- */
-gboolean location_poi_pref_set_property (LocationPOIPreference *pref, gconstpointer key, gconstpointer value);
-
-/**
- * @brief Create a new LocationPOIFilter
- * @remarks None
- * @pre #location_init should be called before.
- * @post None.
- * @return a new #LocationPOIFilter
- * @retval NULL if error occured
- * @see location_poi_filter_free
- */
-LocationPOIFilter *location_poi_filter_new (void);
-
-/**
- * @brief Copy a LocationPOIFilter
- * @remarks None
- * @pre #location_init should be called before.
- * @post None.
- * @return a #LocationPOIFilter
- * @retval NULL if error occured
- * @see location_poi_filter_new
- */
-LocationPOIFilter *location_poi_filter_copy (LocationPOIFilter *filter);
-
-/**
- * @brief Free a LocationPOIFilter
- * @remarks None
- * @pre #location_new should be called before.
- * @post None.
- * @param [in] filter - #LocationPOIFilter
- * @return None
- * @see location_poi_filter_new
- */
-void location_poi_filter_free (LocationPOIFilter *filter);
-
-/**
- * @brief Set filter for poi service
- * @remarks The previous value of the #LocationPOIFilter matching to key will be removed if an value is NULL.
- * @pre #location_poi_filter_new should be called before.
- * @post None.
- * @param [in] filter - #LocationPOIFilter
- * @param [in] key - gconstpointer
- * @param [in] value - gconstpointer or NULL if reset
- * @return gboolean
- * @retval TRUE if success
- * @see location_poi_filter_get
- */
-gboolean location_poi_filter_set (const LocationPOIFilter *filter, gconstpointer key, gconstpointer value);
-
-/**
- * @brief Get filter for poi service
- * @remarks None
- * @pre #location_poi_filter_new should be called before.
- * @post None.
- * @param [in] filter - #LocationPOIFilter
- * @param [in] key - gconstpointer
- * @return gconstpointer
- * @retval Filter property key
- * @see location_poi_filter_set
- */
-gpointer location_poi_filter_get (const LocationPOIFilter *filter, gconstpointer key);
-
-/**
- * @brief Get keys in the given filter
- * @remarks The content of returned list is owned by the poi filter and should not be modified or freed. \n
- * Use g_list_free when done using the returned.
- * @pre #location_poi_filter_new should be called before.
- * @post None.
- * @param [in] filter - #LocationPOIFilter
- * @return GList
- * @retval Filter key
- * @see None
- */
-GList *location_poi_filter_get_key (const LocationPOIFilter *filter);
-
-/**
- * @} @}
- */
-
-G_END_DECLS
-
-#endif
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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 __LOCATION_ROUTE_EXT_H__
-#define __LOCATION_ROUTE_EXT_H__
-
-#include <location-map-types.h>
-
-G_BEGIN_DECLS
-
-/**
- * @file location-route-ext.h
- * @brief This file contains the extensional definitions and structures related to Route.
- */
-/**
- * @addtogroup LocationMapServiceRoute
- * @{
- * @defgroup LocationMapServiceRouteExt Location Route Ext
- * @brief This provides Location Route Ext APIs.
- * @addtogroup LocationMapServiceRouteExt
- * @{
- */
-
-/**
- * @brief Set the origin #LocationPosition of #LocationRoute
- * @remarks The service provider should support route service.\n
- * The previous origin of the #LocationRoute will be removed if an origin is NULL.
- * @pre None.
- * @post None.
- * @param [in] route - a #LocationRoute
- * @param [in] origin - a #LocationPosition
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_get_origin
- */
-gboolean location_route_set_origin (LocationRoute *route, const LocationPosition* origin);
-
-/**
- * @brief Set the destication #LocationPosition of #LocationRoute
- * @remarks The service provider should support route service.\n
- * The previous destination of the #LocationRoute will be removed if an destination is NULL.
- * @pre None.
- * @post None.
- * @param [in] route - a #LocationRoute
- * @param [in] destination - a #LocationPosition
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_get_destination
- */
-gboolean location_route_set_destination (LocationRoute *route, const LocationPosition* destination);
-
-/**
- * @brief Set the bounding box #LocationBoundary of #LocationRoute
- * @remarks The service provider should support route service.\n
- * The previous bbox of the #LocationRoute will be removed if an bbox is NULL.
- * @pre None.
- * @post None.
- * @param [in] route - a #LocationRoute
- * @param [in] bbox - a #LocationBoundary
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_get_bounding_box
- */
-gboolean location_route_set_bounding_box (LocationRoute *route, const LocationBoundary* bbox);
-/**
- * @brief Set the distance of #LocationRoute
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] route - a #LocationRoute
- * @param [in] total_distance - gdouble
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_get_total_distance
- */
-gboolean location_route_set_total_distance (LocationRoute *route, gdouble total_distance);
-
-/**
- * @brief Set the distance unit of #LocationRoute
- * @remarks The service provider should support route service.\n
- * The previous distance unit of the #LocationRoute will be removed if an distance_unit is NULL.
- * @pre None.
- * @post None.
- * @param [in] route - a #LocationRoute
- * @param [in] distance_unit - gchar
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_get_distance_unit
- */
-gboolean location_route_set_distance_unit (LocationRoute *route, const gchar* distance_unit);
-
-/**
- * @brief Set the duration of #LocationRoute
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] route - a #LocationRoute
- * @param [in] total_duration - glong
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_get_total_duration
- */
-gboolean location_route_set_total_duration (LocationRoute *route, glong total_duration);
-
-/**
- * @brief Set the propery value of #LocationRoute
- * @remarks The service provider should support route service.\n
- * The previous value of the #LocationRoute matching to key will be removed if an value is NULL.
- * @pre None.
- * @post None.
- * @param [in] route - a #LocationRoute
- * @param [in] key - gconstpointer
- * @param [in] value - gconstpointer
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_get_property
- */
-gboolean location_route_set_property (LocationRoute *route, gconstpointer key, gconstpointer value);
-
-/**
- * @brief Set the list of segments #LocationRouteSegment of #LocationRoute
- * @remarks The service provider should support route service.\n
- * The previous route segment of the #LocationRoute will be removed if an segment is NULL.
- * @pre None.
- * @post None.
- * @param [in] route - a #LocationRoute
- * @param [in] segment - a list of #LocationRouteSegment
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_get_route_segment
- */
-gboolean location_route_set_route_segment (LocationRoute *route, GList* segment);
-
-/**
- * @brief Set the start point #LocationPosition of #LocationRouteSegment
- * @remarks The service provider should support route service.\n
- * The previous start point of the #LocationRouteSegment will be removed if a start is NULL.
- * @pre None.
- * @post None.
- * @param [in] segment - a #LocationRouteSegment
- * @param [in] start - a #LocationPosition
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_segment_get_start_point
- */
-gboolean location_route_segment_set_start_point (LocationRouteSegment *segment, const LocationPosition *start);
-
-/**
- * @brief Set the end point #LocationPosition of #LocationRouteSegment
- * @remarks The service provider should support route service.\n
- * The previous end point of the #LocationRouteSegment will be removed if an end is NULL.
- * @pre None.
- * @post None.
- * @param [in] segment - a #LocationRouteSegment
- * @param [in] end - a #LocationPosition
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_segment_get_end_point
- */
-gboolean location_route_segment_set_end_point (LocationRouteSegment *segment, const LocationPosition *end);
-
-/**
- * @brief Set the bounding box #LocationBoundary of #LocationRouteSegment
- * @remarks The service provider should support route service.\n
- * The previous bbox of the #LocationRouteSegment will be removed if a bbox is NULL.
- * @pre None.
- * @post None.
- * @param [in] segment - a #LocationRouteSegment
- * @param [in] bbox - a #LocationBoundary
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_segment_get_bounding_box
- */
-gboolean location_route_segment_set_bounding_box (LocationRouteSegment *segment, const LocationBoundary *bbox);
-
-/**
- * @brief Set the distance of #LocationRouteSegment
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] segment - a #LocationRouteSegment
- * @param [in] distance - gdouble
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_segment_get_distance
- */
-gboolean location_route_segment_set_distance (LocationRouteSegment *segment, gdouble distance);
-
-/**
- * @brief Set the duration of #LocationRouteSegment
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] segment - a #LocationRouteSegment
- * @param [in] duration - glong
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_segment_get_duration
- */
-gboolean location_route_segment_set_duration (LocationRouteSegment *segment, glong duration);
-
-/**
- * @brief Set the property value of #LocationRouteSegment
- * @remarks The service provider should support route service.\n
- * The previous value of the LocationRouteSegment matching to key will be removed if a value is NULL.
- * @pre None.
- * @post None.
- * @param [in] segment - a #LocationRouteSegment
- * @param [in] key - gconstpointer
- * @param [in] value - gconstpointer
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_segment_get_property
- */
-gboolean location_route_segment_set_property (LocationRouteSegment *segment, gconstpointer key, gconstpointer value);
-
-/**
- * @brief Set the list of route steps #LocationRouteStep in #LocationRouteSegment
- * @remarks The service provider should support route service.\n
- * The previous route step of the #LocationRouteSegment will be removed if a step is NULL.
- * @pre None.
- * @post None.
- * @param [in] segment - a #LocationRouteSegment
- * @param [in] step - a list of #locationRouteStep
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_segment_get_route_step
- */
-gboolean location_route_segment_set_route_step (LocationRouteSegment *segment, GList* step);
-
-/**
- * @brief Set the start point #LocationPosition of #LocationRouteStep
- * @remarks The service provider should support route service.\n
- * The previous start point of the #LocationRouteStep will be removed if a start is NULL.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRouteStep
- * @param [in] start - a #LocationPosition
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_step_get_start_point
- */
-gboolean location_route_step_set_start_point (LocationRouteStep *step, const LocationPosition *start);
-
-/**
- * @brief Set the end point #LocationPosition of #LocationRouteStep
- * @remarks The service provider should support route service.\n
- * The previous end point of the #LocationRouteStep will be removed if an end is NULL.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRouteStep
- * @param [in] end - a #LocationPosition
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_step_get_end_point
- */
-gboolean location_route_step_set_end_point (LocationRouteStep *step, const LocationPosition *end);
-
-/**
- * @brief Set the bounding box #LocationBoundary of #LocationRouteStep
- * @remarks The service provider should support route service.\n
- * The previous bbox of the #LocationRouteStep will be removed if a bbox is NULL.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRouteStep
- * @param [in] bbox - a #LocationBoundary
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_step_get_bounding_box
- */
-gboolean location_route_step_set_bounding_box (LocationRouteStep *step, const LocationBoundary *bbox);
-
-/**
- * @brief Set the distance of #LocationRouteStep
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRouteStep
- * @param [in] distance - gdouble
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_step_get_distance
- */
-gboolean location_route_step_set_distance (LocationRouteStep *step, gdouble distance);
-
-/**
- * @brief Set the duration of #LocationRouteStep
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRouteStep
- * @param [in] duration - glong
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_step_get_duration
- */
-gboolean location_route_step_set_duration (LocationRouteStep *step, glong duration);
-
-/**
- * @brief Set the transport mode of #LocationRouteStep
- * @remarks The service provider should support route service.\n
- * The previous transport mode of the #LocationRouteStep will be removed if a transport_mode is NULL.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRouteStep
- * @param [in] transport_mode - gchar
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_step_get_transport_mode
- */
-gboolean location_route_step_set_transport_mode (LocationRouteStep *step, const gchar *transport_mode);
-
-/**
- * @brief Set the instruction of #LocationRouteStep
- * @remarks The service provider should support route service.\n
- * The previous instruction of the #LocationRouteStep will be removed if an instruction is NULL.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRouteStep
- * @param [in] instruction - gchar
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_step_get_instruction
- */
-gboolean location_route_step_set_instruction (LocationRouteStep *step, const gchar *instruction);
-
-/**
- * @brief Set the list of geometry #LocationPosition in #LocationRouteStep
- * @remarks The service provider should support route service.\n
- * The previous geometry of the #LocationRouteStep will be removed if a geometry is NULL.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRouteStep
- * @param [in] geometry - a list of #LocationPosition
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_step_get_geometry
- */
-gboolean location_route_step_set_geometry (LocationRouteStep *step, GList *geometry);
-
-/**
- * @brief Set the property value of #LocationRouteStep
- * @remarks The service provider should support route service.\n
- * The previous value of the #LocationRouteStep will be removed if a value is NULL.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRouteStep
- * @param [in] key - gconstpointer
- * @param [in] value - gconstpointer
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_step_get_property
- */
-gboolean location_route_step_set_property (LocationRouteStep *step, gconstpointer key, gconstpointer value);
-
-/**
- * @brief Set the distance from start of the route to the maneuver#LocationRouteManeuver
- * @remarks The service provider should support route service.
- * @pre #location_route_maneuver_new should be called before.
- * @post None.
- * @param [in] distance - a #guint
- * @param [in] maneuver - a #LocationRouteManeuver
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_maneuver_get_distance_from_start
- */
-gboolean location_route_maneuver_set_distance_from_start(LocationRouteManeuver *maneuver, guint distance);
-
-/**
- * @brief Set the distance from previous_maneuver
- * @remarks The service provider should support route service.
- * @pre #location_route_maneuver_new should be called before.
- * @post None.
- * @param [in] distance - a #guint
- * @param [in] maneuver - a #LocationRouteManeuver
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_maneuver_get_distance_from_prev_maneuver
- */
-gboolean location_route_maneuver_set_distance_from_prev_maneuver(LocationRouteManeuver *maneuver, guint distance);
-
-/**
- * @brief Set Name of the road this maneuver leads to.
- * @remarks The service provider should support route service.
- * @pre #location_route_maneuver_new should be called before.
- * @post None.
- * @param [in] road_name - a #road name
- * @param [in] maneuver - a #LocationRouteManeuver
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_maneuver_get_next_road_name
- */
-gboolean location_route_maneuver_set_next_road_name(LocationRouteManeuver *maneuver, const gchar *road_name);
-
-/**
- * @brief Set action to take on the maneuver.
- * @remarks The service provider should support route service.
- * @pre #location_route_maneuver_new should be called before.
- * @post None.
- * @param [in] action - a #action
- * @param [in] maneuver - a #LocationRouteManeuver
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_maneuver_get_action
- */
-gboolean location_route_maneuver_set_action(LocationRouteManeuver *maneuver, const gchar *action);
-
-/**
- * @brief Set turn to make on the maneuver.
- * @remarks The service provider should support route service.
- * @pre #location_route_maneuver_new should be called before.
- * @post None.
- * @param [in] turn - a #turn to
- * @param [in] maneuver - a #LocationRouteManeuver
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_maneuver_get_turn
- */
-gboolean location_route_maneuver_set_turn(LocationRouteManeuver *maneuver, const gchar *turn);
-
-/**
- * @brief Set traffic direction on the maneuver.
- * @remarks The service provider should support route service.
- * @pre #location_route_maneuver_new should be called before.
- * @post None.
- * @param [in] direction - a #TrafficDirection
- * @param [in] maneuver - a #LocationRouteManeuver
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_maneuver_get_traffic_direction
- */
-gboolean location_route_maneuver_set_traffic_direction(LocationRouteManeuver *maneuver, TrafficDirection direction);
-
-/**
- * @brief Set the angle of the maneuver.
- * @remarks The service provider should support route service.
- * @pre #location_route_maneuver_new should be called before.
- * @post None.
- * @param [in] angle - a #angle
- * @param [in] maneuver - a #LocationRouteManeuver
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_maneuver_get_angle
- */
-gboolean location_route_maneuver_set_angle(LocationRouteManeuver *maneuver, guint angle);
-
-/**
- * @brief Set the angle at the start of the maneuver.
- * @remarks The service provider should support route service.
- * @pre #location_route_maneuver_new should be called before.
- * @post None.
- * @param [in] start_angle - a #start angle
- * @param [in] maneuver - a #LocationRouteManeuver
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_maneuver_get_start_angle
- */
-gboolean location_route_maneuver_set_start_angle(LocationRouteManeuver *maneuver, guint start_angle);
-
-/**
- * @brief Set the time at which the maneuver started.
- * @remarks The service provider should support route service.
- * @pre #location_route_maneuver_new should be called before.
- * @post None.
- * @param [in] time - a #time
- * @param [in] maneuver - a #LocationRouteManeuver
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_maneuver_get_start_time
- */
-gboolean location_route_maneuver_set_start_time(LocationRouteManeuver *maneuver, guint time);
-
-/**
- * @brief set if maneuver starts on a sliproad.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] maneuver - a #LocationRouteManeuver
- * @param [in] starts_from_sliproad - a #gboolean
- * @return gboolean
- * @retval TRUE if success
- * @see
- */
-gboolean location_route_maneuver_set_starts_from_sliproad(LocationRouteManeuver *maneuver, gboolean starts_from_sliproad);
-
-/**
- * @brief set if maneuver leads to a slip road. Sliproad is a road connecting highways to
- * normal roads.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] maneuver - a #LocationRouteManeuver
- * @param [in] next_is_sliproad - a #gboolean
- * @return gboolean
- * @retval TRUE if success
- * @see
- */
-gboolean location_route_maneuver_set_next_is_sliproad(LocationRouteManeuver *maneuver, gboolean next_is_sliproad);
-
-/**
- * @brief set if this maneuver is a roundabout taken in the direction opposite to the
- * normal vehicle traffic.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] maneuver - a #LocationRouteManeuver
- * @param [in] counter_roundabout - a #gboolean
- * @return gboolean
- * @retval TRUE if success
- * @see
- */
-gboolean location_route_maneuver_set_counter_roundabout(LocationRouteManeuver *maneuver, gboolean counter_roundabout);
-
-/**
- * @brief Set the station name in location route Maneuver.
- * @remarks The service provider should support route service.
- * @pre #location_route_transit_stop_new should be called before.
- * @post None.
- * @param [in] station_name - a #station name
- * @param [in] stop - a #LocationRouteTransitStop
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_transit_get_station_name
- */
-gboolean location_route_transit_set_station_name(LocationRouteTransitStop *stop, const gchar *station_name);
-
-/**
- * @brief Set the platform level in Location Route TransitStop.
- * @remarks The service provider should support route service.
- * @pre #location_route_transit_stop_new should be called before.
- * @post None.
- * @param [in] level - a #platform level
- * @param [in] stop - a #LocationRouteTransitStop
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_transit_get_platform_level
- */
-gboolean location_route_transit_set_platform_level(LocationRouteTransitStop *stop, gint level);
-
-/**
- * @brief Set the coordinates of the platform.
- * @remarks The service provider should support route service.
- * @pre #location_route_transit_stop_new should be called before.
- * @post None.
- * @param [in] coordinates - a #LocationPosition
- * @param [in] stop - a #LocationRouteTransitStop
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_transit_get_platform_coordinates
- */
-gboolean location_route_transit_set_platform_coordinates(LocationRouteTransitStop *stop, const LocationPosition *coordinates);
-
-/**
- * @brief Set the coordinates of the station entry/exit.
- * @remarks The service provider should support route service.
- * @pre #location_route_transit_stop_new should be called before.
- * @post None.
- * @param [in] eg_coordinates - a #LocationPosition
- * @param [in] stop - a #LocationRouteTransitStop
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_transit_get_egress_coordinates
- */
-gboolean location_route_transit_set_egress_coordinates(LocationRouteTransitStop *stop, const LocationPosition *eg_coordinates);
-
-/**
- * @brief Set the a member of the enumeration form of way .
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] form - a #FormOfWay
- * @param [in] step - a #LocationRoadElement
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_element_get_form_of_way
- */
-gboolean location_route_element_set_form_of_way(LocationRoadElement *step, FormOfWay form);
-
-/**
- * @brief Set if the road element is plural, otherwise.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRoadElement
- * @param [in] plural - a #gboolean
- * @return gboolean
- * @retval TRUE if success
- * @see None
- */
-gboolean location_route_element_set_plural(LocationRoadElement *element, gboolean plural);
-
-/**
- * @brief Set the name of the road .
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] road_name - a road name
- * @param [in] step - a #LocationRoadElement
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_element_get_road_name
- */
-gboolean location_route_element_set_road_name(LocationRoadElement *step, const gchar *road_name);
-
-/**
- * @brief Set the name of the route to which the given road element belongs.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] road_name - a road name
- * @param [in] step - a #LocationRoadElement
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_element_get_route_name
- */
-gboolean location_route_element_set_route_name(LocationRoadElement *step, const gchar *route_name);
-
-/**
- * @brief Set the name of the route to which the given road element belongs.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] speed_limit - speed limit
- * @param [in] step - a #LocationRoadElement
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_element_get_speed_limit
- */
-gboolean location_route_element_set_speed_limit(LocationRoadElement *step, gfloat speed_limit);
-
-/**
- * @brief Set the average speed in m/s.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] average_speed - average speed
- * @param [in] step - a #LocationRoadElement
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_element_get_average_speed_m_s
- */
-gboolean location_route_element_set_average_speed_m_s(LocationRoadElement *step, guint average_speed);
-
-/**
- * @brief Set the value indicating the number of lanes in the given road element.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] num_of_lanes - num of lanes
- * @param [in] step - a #LocationRoadElement
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_element_get_number_of_lanes
- */
-gboolean location_route_element_set_number_of_lanes(LocationRoadElement *step, const guint num_of_lanes);
-
-/**
- * @brief Set the value indicating the estimated time of arrival (ETA) and suggested departure time for the route
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] eta_validity - estimated time of arrival (ETA)
- * @param [in] element- a #LocationRoadElement
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_element_get_number_of_lanes
- */
-gboolean location_route_element_set_eta_validity(LocationRoadElement *element, RouteETAValidity eta_validity);
-
-/**
- * @brief set if the road is allowed only for pedestrians.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRoadElement
- * @param [in] pedestrian - a #gboolean
- * @return gboolean
- * @retval
- * @see None
- */
-gboolean location_route_element_road_element_set_pedestrian(LocationRoadElement *element, gboolean pedestrian);
-
-/**
- * @brief Set if this road element is valid.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRoadElement
- * @param [in] valid - a #gboolean
- * @return gboolean
- * @retval
- * @see None
- */
-gboolean location_route_element_road_element_set_valid(LocationRoadElement *element, gboolean valid);
-
-/**
- * @brief Set the start time of the road element.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] start_time - start time
- * @param [in] step - a #LocationRoadElement
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_element_get_element_start_time
- */
-gboolean location_route_element_set_element_start_time(LocationRoadElement *step, guint start_time);
-
-/**
- * @brief Set the start time of the road element.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] travel_time -travel time
- * @param [in] step - a #LocationRoadElement
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_element_get_element_travel_time
- */
-gboolean location_route_element_set_element_travel_time(LocationRoadElement *step, guint travel_time);
-
-/**
- * @brief Set the destination of this run.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] transit_dest -transit dest
- * @param [in] step - a #LocationRoadElement
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_element_get_transit_destination
- */
-gboolean location_route_element_set_transit_destination(LocationRoadElement *step, const gchar *transit_dest);
-
-/**
- * @brief Set the line name.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] line_name -line name
- * @param [in] step - a #LocationRoadElement
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_element_get_transit_line_name
- */
-gboolean location_route_element_set_transit_line_name(LocationRoadElement *step, const gchar *line_name);
-
-/**
- * @brief Set name of the operator.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] official_name -official name
- * @param [in] step - a #LocationRoadElement
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_element_get_system_official_name
- */
-gboolean location_route_element_set_system_official_name(LocationRoadElement *step, const gchar *official_name);
-
-/**
- * @brief Set the name of the operator in a shorter or abbreviated version.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] short_name
- * @param [in] step - a #LocationRoadElement
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_element_get_system_short_name
- */
-gboolean location_route_element_set_system_short_name(LocationRoadElement *step, const gchar *short_name);
-
-/**
- * @brief Set the type of the line.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] type - a #TransitType
- * @param [in] step - a #LocationRoadElement
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_element_get_transit_type
- */
-gboolean location_route_element_set_transit_type(LocationRoadElement *step, TransitType type);
-
-/**
- * @brief Set the type of the line as a string in the public transit
- * operator's vocabulary.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] type_name - a #TransitType
- * @param [in] step - a #LocationRoadElement
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_element_get_transit_type_name
- */
-gboolean location_route_element_set_transit_type_name(LocationRoadElement *step, const gchar *type_name);
-
-/**
- * @brief Set the absolute departure time from the station.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] departure_time - departure time
- * @param [in] step - a #LocationRoadElement
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_element_get_transit_departure_time
- */
-gboolean location_route_element_set_transit_departure_time(LocationRoadElement *step, guint departure_time);
-
-/**
- * @brief Set the absolute arrival time at the destination.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] arrival_time - arrival time
- * @param [in] step - a #LocationRoadElement
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_element_get_transit_arrival_time
- */
-gboolean location_route_element_set_transit_arrival_time(LocationRoadElement *step, guint arrival_time);
-
-/**
- * @brief Set departure station.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] departure_stop - a #LocationRouteTransitStop
- * @param [in] step - a #LocationRoadElement
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_element_get_transit_departure_station
- */
-gboolean location_route_element_set_transit_departure_station(LocationRoadElement *step, const LocationRouteTransitStop *departure_stop);
-
-/**
- * @brief Set departure station.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] arrival_stop - a #LocationRouteTransitStop
- * @param [in] step - a #LocationRoadElement
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_element_get_transit_arrival_station
- */
-gboolean location_route_element_set_transit_arrival_station(LocationRoadElement *step, const LocationRouteTransitStop *arrival_stop);
-
-/**
- * @brief Set this lane if the lane is on the route.
- * @remarks None.
- * @pre #location_init should be called before.\n
- * @post None.
- * @param [in] lane - a #LocationRouteLaneInfo
- * @param [in] pref - a boolean #on_route
- * @see None.
- * @return None
- * @retval None
- */
-gboolean location_route_lane_set_is_on_route(LocationRouteLaneInfo *lane, gboolean on_route);
-
-/**
- * @} @}
- */
-
-G_END_DECLS
-
-#endif
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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 <string.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "location-types.h"
-#include "location-route.h"
-#include "location-route-ext.h"
-#include "location-boundary.h"
-#include "map-service.h"
-
-
-struct _LocationRoute {
-// gint req_id; //< Request id : for expandability
- LocationPosition *origin; //< Coordinate StartCoord
- LocationPosition *destination; //< Coordinates destCoord
- LocationBoundary *bbox; //< a rectangular geographical area
- gdouble total_distance; //< Total distance
- gchar *distance_unit; //< Distance Unit
- glong total_duration; //< Total duration
- GHashTable *properties; //<Key/Value>
- GList *segment;
-};
-
-// lane-related infomation, used for instruction(maneuver)
-struct _LocationRouteLaneInfo {
- gboolean is_on_route; ///< is the lane is on the route
- DIRECTION travel_direction; ///< enum <DIRECTION> indicators applicable to the given lane
-};
-
-struct _LocationRouteManeuver {
- guint distance_from_start; ///< the distance from start of the route to the maneuver(segment)
- guint distance_from_prev_maneuver; ///< distance from previous maneuver on the route to the maneuver(segment)
- gchar *next_road_name; ///< Name of the road this maneuver(segment) leads to
- gchar *action_string; ///< Action to take on the maneuver(segment)
- gchar *turn_string; ///< Turn to make on the maneuver(segment)
- TrafficDirection traffic_direction; ///< traffic direction
- guint angle; ///< The angle of the maneuve(segment)
- guint start_angle; ///< The angle at the start of the maneuver(segment)
- guint start_time; ///< Time at which the maneuver(segment) started
- gboolean starts_from_sliproad; ///< True if maneuver(segment) starts on a sliproad.
- gboolean next_is_sliproad; ///< True if maneuver(segment) leads to a slip road.
- gboolean is_counter_roundabout; ///< True if this maneuver(segment) is a roundabout
-
- GList *lanes_info; ///< lanes info <LocationRouteLaneInfo> list on this maneuver
-};
-
-//Waypoints
-struct _LocationRouteSegment {
- LocationPosition *start; //< Coordinate StartCoord;
- LocationPosition *end; //< Coordinates destCoord;
- LocationBoundary *bbox; //< a rectangular geographical area
- gdouble distance;
- glong duration;
- GHashTable *properties; //<Key/Value>
- GList *step;
-};
-
-struct _LocationRouteTransitStop {
- gchar *station_name; ///< the stations names.
- gint platform_level; ///< the platform level. 0 is ground level -1 the first underground level and 1 the first
- LocationPosition *platform_coordinates; ///< the coordinates of the platform.
- LocationPosition *egress_coordinates; ///< the coordinates of the station entry/exit.
-};
-
-struct _LocationRoadElement {
- FormOfWay form_of_way; ///< the form of way
- gboolean is_plural; ///< checks if the road element is plural
- gchar *road_name; ///< the name of the given road element.
- gchar *route_name; ///< the name of the route
- gfloat speed_limit; ///< the speed limit in meters per second
- guint average_speed; ///< the average speed of the road element, m/s
- guint number_of_lanes; ///< number of lanes in the given step (road element)
- gboolean is_pedestrian; ///< if the road is allowed only for pedestrians.
- gboolean is_valid; ///< if this road element is valid.
- guint start_time; ///< the start time of the road element.
- guint travel_time; ///< the travel time along the element, default speed is used.
- RouteETAValidity ETA_validity; ///< the estimated time of arrival (ETA) and suggested departure time for the route
-
- gchar *transit_destination; ///< the destination of this public transit
- gchar *transit_line_name; ///< the public transit line name
- gchar *system_official_name; ///< the name of the operator
- gchar *system_short_name; ///< the name of the operator in a shorter or abbreviated version
- TransitType transit_type; ///< the type of the line.
- gchar *transit_type_name; ///< the type of the line as a string in the public transit operator's vocabulary
- guint transit_departure_time; ///< the absolute departure time from the station, if available
- guint transit_arrival_time; ///< the absolute arrival time at the destination, if available
- LocationRouteTransitStop *transit_departure_station; ///< the departure station.
- LocationRouteTransitStop *transit_arrival_station; ///< the arrival station.
-};
-
-// Each instruction
-struct _LocationRouteStep {
- LocationPosition *start; //< Coordinate StartCoord;
- LocationPosition *end; //< Coordinates destCoord;
- LocationBoundary *bbox; //< a rectangular geographical area
- gdouble distance;
- glong duration;
- gchar *transport_mode;
- gchar *instruction;
- GList *geometry;
-
- GHashTable *properties;
-
- LocationRoadElement *road_element; ///< route road or public transit element, only one element for each step
- LocationRouteManeuver *maneuver; ///< location route maneuver infomation
-};
-
-struct _LocationRoadElementPenalty {
- gint id; ///< road element penalty's id
- DrivingDirection direction; ///< road direction
- guint penalty; ///< road element penalty
- guint speed; ///< the limit speed in kilometers per hour
- guint validity_start_time; ///< validity start time
- guint validity_end_time; ///< validity end time
-};
-
-struct _LocationRouteOptions {
- GList *road_element_penalty_list; ///< a list of struct LocationRoadElementPenalty indicators the traffic penalty for the route
-
- // route type: FASTEST, SHORTEST, ECONOMIC
- // RoutingMode: CAR, PEDESTRIAN, PEDESTRIAN_WITH_TRANSIT, TRACK,
- // FeatureType: HIGHWAY, TOLL_ROAD, FERRY, TUNNEL, DIRT_ROAD, RAIL_FERRY, PARK,
- guint start_direction; ///< The direction routing should start in degrees
- gfloat walk_time_multiplier; ///< Sets a multiplier to use for walking times, a higher number means a slower walking speed
- guint minimum_change_time; ///< Sets the minimum connection time, in minutes.
- int transit_type_allowed[TRANSIT_TYPE_COUNT]; ///< Sets whether a transit type is allowed. 1-allowed, 0-not
- guint maximum_changes; ///< the maximum number of vehicle changes allowed during the trip
- guint departure_time; ///< time of departure
- guint arrival_time; ///< time of arrival
-};
-
-struct _LocationRoutePreference {
- GList* addr_to_avoid;
- GList* area_to_avoid;
- GList* feature_to_avoid;
- GList* freeformed_addr_to_avoid;
- LocationBoundary* bbox;
- guint max_matches_count;
- gchar *distance_unit;
-
- gchar *route_type;
- gchar *transport_mode;
- gboolean is_geometry_used;
- gboolean is_instruction_bounding_box_used;
- gboolean is_instruction_geometry_used;
- gboolean is_instruction_used;
- gboolean is_traffic_data_used;
-
- // AvoidFreeways, Easy, Fastest, MoreFreeways, NoFreeways, Pedestrian, Shortest
- GHashTable *properties;
-
- LocationRouteOptions *options;
-
-};
-
-static void route_pref_addr_to_avoid_copy_cb (gpointer data, gpointer user_data)
-{
- g_return_if_fail(data);
- g_return_if_fail(user_data);
-
- LocationAddress *address = (LocationAddress *)data;
- LocationRoutePreference *pref = (LocationRoutePreference *)user_data;
-
- pref->addr_to_avoid = g_list_append (pref->addr_to_avoid, location_address_copy(address));
-}
-
-static void addr_to_avoid_free_cb (gpointer data)
-{
- g_return_if_fail (data);
-
- LocationAddress *addr = (LocationAddress *)data;
-
- location_address_free (addr);
-}
-
-EXPORT_API gboolean
-location_route_pref_set_addr_to_avoid (LocationRoutePreference *pref, GList *addr)
-{
- g_return_val_if_fail(pref, FALSE);
-
- if (pref->addr_to_avoid) {
- g_list_free_full (pref->addr_to_avoid, addr_to_avoid_free_cb);
- pref->addr_to_avoid = NULL;
- }
-
- if (addr) g_list_foreach (addr, route_pref_addr_to_avoid_copy_cb, pref);
-
- return TRUE;
-}
-
-static void route_pref_area_to_avoid_copy_cb (gpointer data, gpointer user_data)
-{
- g_return_if_fail(data);
- g_return_if_fail(user_data);
-
- LocationBoundary *area = (LocationBoundary *)data;
- LocationRoutePreference *pref = (LocationRoutePreference *)user_data;
-
- pref->area_to_avoid = g_list_append (pref->area_to_avoid, location_boundary_copy((const LocationBoundary *)area));
-}
-
-static void route_pref_area_to_avoid_free_cb (gpointer data)
-{
- g_return_if_fail (data);
-
- LocationBoundary *boundary = (LocationBoundary *)data;
-
- location_boundary_free (boundary);
-}
-
-EXPORT_API gboolean
-location_route_pref_set_area_to_avoid (LocationRoutePreference *pref, GList *area)
-{
- g_return_val_if_fail(pref, FALSE);
-
- if (pref->area_to_avoid) {
- g_list_free_full (pref->area_to_avoid, route_pref_area_to_avoid_free_cb);
- pref->area_to_avoid = NULL;
- }
-
- if (area) g_list_foreach (area, route_pref_area_to_avoid_copy_cb, pref);
-
- return TRUE;
-}
-
-static void route_pref_feature_to_avoid_copy_cb (gpointer data, gpointer user_data)
-{
- g_return_if_fail (data);
- g_return_if_fail (user_data);
-
- gchar *feature = (gchar *)data;
- LocationRoutePreference *pref = (LocationRoutePreference *) user_data;
-
- pref->feature_to_avoid = g_list_append (pref->feature_to_avoid, g_strdup (feature));
-}
-
-EXPORT_API gboolean
-location_route_pref_set_feature_to_avoid (LocationRoutePreference *pref, GList * feature)
-{
- g_return_val_if_fail(pref, FALSE);
-
- if (pref->feature_to_avoid) {
- g_list_free_full (pref->feature_to_avoid, g_free);
- pref->feature_to_avoid = NULL;
- }
-
- g_list_foreach (feature, route_pref_feature_to_avoid_copy_cb, pref);
-
- return TRUE;
-}
-
-static void route_pref_freeforemd_addr_to_avoid_foreach_copy (gpointer data, gpointer user_data)
-{
- g_return_if_fail(data);
- g_return_if_fail(user_data);
-
- gchar *freeformed_addr = (gchar *)data;
- LocationRoutePreference *pref = (LocationRoutePreference *)user_data;
-
- pref->freeformed_addr_to_avoid = g_list_append (pref->freeformed_addr_to_avoid, g_strdup(freeformed_addr));
-}
-
-EXPORT_API gboolean
-location_route_pref_set_freeformed_addr_to_avoid (LocationRoutePreference *pref, GList *freeformed_addr)
-{
- g_return_val_if_fail(pref, FALSE);
-
- if (pref->freeformed_addr_to_avoid) {
- g_list_free_full (pref->freeformed_addr_to_avoid, g_free);
- pref->freeformed_addr_to_avoid = NULL;
- }
-
- if (freeformed_addr) g_list_foreach (freeformed_addr, route_pref_freeforemd_addr_to_avoid_foreach_copy, pref);
-
- return TRUE;
-}
-
-EXPORT_API gboolean
-location_route_pref_set_bounding_box (LocationRoutePreference *pref, const LocationBoundary *bbox)
-{
- g_return_val_if_fail(pref, FALSE);
-
- if (pref->bbox) {
- location_boundary_free (pref->bbox);
- pref->bbox = NULL;
- }
-
- if (bbox) pref->bbox = location_boundary_copy (bbox);
-
- return TRUE;
-}
-
-EXPORT_API gboolean
-location_route_pref_set_max_result (LocationRoutePreference *pref, guint max_num)
-{
- g_return_val_if_fail(pref, FALSE);
- g_return_val_if_fail(max_num > 0, FALSE);
-
- pref->max_matches_count = max_num;
-
- return TRUE;
-}
-
-EXPORT_API gboolean
-location_route_pref_set_route_type (LocationRoutePreference *pref, const gchar *type)
-{
- g_return_val_if_fail(pref, FALSE);
-
- if (pref->route_type) {
- g_free(pref->route_type);
- pref->route_type = NULL;
- }
-
- if (type) pref->route_type = g_strdup (type);
-
- return TRUE;
-}
-
-EXPORT_API gboolean
-location_route_pref_set_transport_mode (LocationRoutePreference *pref, const gchar *mode)
-{
- g_return_val_if_fail(pref, FALSE);
-
- if (pref->transport_mode) {
- g_free(pref->transport_mode);
- pref->transport_mode = NULL;
- }
-
- if (mode) pref->transport_mode = g_strdup (mode);
-
- return TRUE;
-}
-
-EXPORT_API gboolean
-location_route_pref_set_geometry_used (LocationRoutePreference *pref, gboolean is_used)
-{
- g_return_val_if_fail(pref, FALSE);
-
- pref->is_geometry_used = is_used;
-
- return TRUE;
-}
-
-EXPORT_API gboolean
-location_route_pref_set_instruction_bounding_box_used (LocationRoutePreference *pref, gboolean is_used)
-{
- g_return_val_if_fail(pref, FALSE);
-
- pref->is_instruction_bounding_box_used = is_used;
-
- return TRUE;
-}
-
-EXPORT_API gboolean
-location_route_pref_set_instruction_geometry_used (LocationRoutePreference *pref, gboolean is_used)
-{
- g_return_val_if_fail(pref, FALSE);
-
- pref->is_instruction_geometry_used = is_used;
-
- return TRUE;
-}
-
-EXPORT_API gboolean
-location_route_pref_set_instruction_used (LocationRoutePreference *pref, gboolean is_used)
-{
- g_return_val_if_fail(pref, FALSE);
-
- pref->is_instruction_used = is_used;
-
- return TRUE;
-}
-
-EXPORT_API gboolean
-location_route_pref_set_traffic_data_used (LocationRoutePreference *pref, gboolean is_used)
-{
- g_return_val_if_fail(pref, FALSE);
-
- pref->is_traffic_data_used = is_used;
-
- return TRUE;
-}
-
-EXPORT_API gboolean
-location_route_pref_set_property (LocationRoutePreference *pref, gconstpointer key, gconstpointer value)
-{
- g_return_val_if_fail(pref, FALSE);
- g_return_val_if_fail(key, FALSE);
-
- if (value) {
- gchar *re_key = g_strdup(key);
- gchar *re_val = g_strdup(value);
- g_hash_table_insert (pref->properties, re_key, re_val);
- } else g_hash_table_remove (pref->properties, key);
-
- return TRUE;
-}
-
-EXPORT_API GList *
-location_route_pref_get_addr_to_avoid (const LocationRoutePreference *pref)
-{
- g_return_val_if_fail(pref, NULL);
-
- return pref->addr_to_avoid;
-}
-
-EXPORT_API GList *
-location_route_pref_get_area_to_avoid (const LocationRoutePreference *pref)
-{
- g_return_val_if_fail(pref, NULL);
-
- return pref->area_to_avoid;
-}
-
-EXPORT_API GList *
-location_route_pref_get_feature_to_avoid (const LocationRoutePreference *pref)
-{
- g_return_val_if_fail(pref, NULL);
-
- return pref->feature_to_avoid;
-}
-
-EXPORT_API GList *
-location_route_pref_get_freeformed_addr_to_avoid (const LocationRoutePreference *pref)
-{
- g_return_val_if_fail(pref, NULL);
-
- return pref->freeformed_addr_to_avoid;
-}
-
-EXPORT_API LocationBoundary *
-location_route_pref_get_bounding_box (const LocationRoutePreference *pref)
-{
- g_return_val_if_fail(pref, NULL);
-
- return pref->bbox;
-}
-
-EXPORT_API guint
-location_route_pref_get_max_result (const LocationRoutePreference *pref)
-{
- g_return_val_if_fail(pref, 0);
-
- return pref->max_matches_count;
-}
-
-EXPORT_API gchar *
-location_route_pref_get_route_type (const LocationRoutePreference *pref)
-{
- g_return_val_if_fail(pref, NULL);
-
- return pref->route_type;
-}
-
-EXPORT_API gchar *
-location_route_pref_get_transport_mode (const LocationRoutePreference *pref)
-{
- g_return_val_if_fail(pref, NULL);
-
- return pref->transport_mode;
-}
-
-EXPORT_API gboolean
-location_route_pref_get_geometry_used (const LocationRoutePreference *pref)
-{
- g_return_val_if_fail(pref, FALSE);
-
- return pref->is_geometry_used;
-}
-
-EXPORT_API gboolean
-location_route_pref_get_instruction_bounding_box_used (const LocationRoutePreference *pref)
-{
- g_return_val_if_fail(pref, FALSE);
-
- return pref->is_instruction_bounding_box_used;
-}
-
-EXPORT_API gboolean
-location_route_pref_get_instruction_geometry_used (const LocationRoutePreference *pref)
-{
- g_return_val_if_fail(pref, FALSE);
-
- return pref->is_instruction_geometry_used;
-}
-
-EXPORT_API gboolean
-location_route_pref_get_instruction_used (const LocationRoutePreference *pref)
-{
- g_return_val_if_fail(pref, FALSE);
-
- return pref->is_instruction_used;
-}
-
-EXPORT_API gboolean
-location_route_pref_get_traffic_data_used (const LocationRoutePreference *pref)
-{
- g_return_val_if_fail(pref, FALSE);
-
- return pref->is_traffic_data_used;
-}
-
-EXPORT_API GList*
-location_route_pref_get_property_key (const LocationRoutePreference *pref)
-{
- g_return_val_if_fail(pref, NULL);
-
- return g_hash_table_get_keys(pref->properties);
-}
-
-EXPORT_API gpointer
-location_route_pref_get_property (const LocationRoutePreference *pref, gconstpointer key)
-{
- g_return_val_if_fail(pref, NULL);
- g_return_val_if_fail(key, NULL);
-
- return g_hash_table_lookup(pref->properties, key);
-}
-
-EXPORT_API LocationRoutePreference *
-location_route_pref_new (void)
-{
- LocationRoutePreference *pref = g_slice_new0(LocationRoutePreference);
- g_return_val_if_fail (pref, NULL);
-
- pref->properties = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
- return pref;
-}
-
-static void route_pref_property_copy_cb (gpointer key, gpointer value, gpointer user_data)
-{
- g_return_if_fail(key);
- g_return_if_fail(value);
- g_return_if_fail(user_data);
-
- LocationRoutePreference *pref = (LocationRoutePreference *)user_data;
-
- if (pref->properties) {
- gchar *re_key = g_strdup (key);
- gchar *re_val = g_strdup (value);
- g_hash_table_insert (pref->properties, re_key, re_val);
- }
-}
-
-EXPORT_API LocationRoutePreference *
-location_route_pref_copy (const LocationRoutePreference *pref)
-{
- g_return_val_if_fail(pref, NULL);
-
- LocationRoutePreference *new_pref = location_route_pref_new();
- g_return_val_if_fail (new_pref, NULL);
-
- location_route_pref_set_addr_to_avoid(new_pref, location_route_pref_get_addr_to_avoid (pref));
- location_route_pref_set_area_to_avoid(new_pref, location_route_pref_get_area_to_avoid (pref));
- location_route_pref_set_feature_to_avoid(new_pref, location_route_pref_get_feature_to_avoid (pref));
- location_route_pref_set_freeformed_addr_to_avoid(new_pref, location_route_pref_get_freeformed_addr_to_avoid (pref));
- location_route_pref_set_bounding_box(new_pref, location_route_pref_get_bounding_box (pref));
- location_route_pref_set_max_result(new_pref, location_route_pref_get_max_result (pref));
- location_route_pref_set_route_type(new_pref, location_route_pref_get_route_type (pref));
- location_route_pref_set_transport_mode(new_pref, location_route_pref_get_transport_mode (pref));
- location_route_pref_set_geometry_used(new_pref, location_route_pref_get_geometry_used (pref));
- location_route_pref_set_instruction_bounding_box_used(new_pref, location_route_pref_get_instruction_bounding_box_used (pref));
- location_route_pref_set_instruction_geometry_used(new_pref, location_route_pref_get_instruction_geometry_used (pref));
- location_route_pref_set_instruction_used(new_pref, location_route_pref_get_instruction_used (pref));
- location_route_pref_set_traffic_data_used(new_pref, location_route_pref_get_traffic_data_used (pref));
- location_route_pref_set_traffic_data_used(new_pref, location_route_pref_get_traffic_data_used (pref));
-
- location_route_pref_set_options(new_pref, location_route_pref_get_options(pref));
-
- if (new_pref->properties) g_hash_table_foreach (pref->properties, route_pref_property_copy_cb, new_pref);
-
- return new_pref;
-}
-
-
-EXPORT_API void
-location_route_pref_free (LocationRoutePreference *pref)
-{
- g_return_if_fail(pref);
-
- location_route_pref_set_addr_to_avoid(pref, NULL);
- location_route_pref_set_area_to_avoid(pref, NULL);
- location_route_pref_set_feature_to_avoid(pref, NULL);
- location_route_pref_set_freeformed_addr_to_avoid(pref, NULL);
- location_route_pref_set_bounding_box(pref, NULL);
- location_route_pref_set_route_type(pref, NULL);
- location_route_pref_set_transport_mode(pref, NULL);
-
- location_route_pref_set_options(pref, NULL);
-
- if (pref->properties) {
- g_hash_table_destroy (pref->properties);
- pref->properties = NULL;
- }
-
- g_slice_free (LocationRoutePreference, pref);
-}
-
-/* for expandability
-EXPORT_API gint
-location_route_get_req_id (const LocationRoute *route)
-{
- g_return_val_if_fail(route, 0);
-
- return route->req_id;
-}
-*/
-
-EXPORT_API LocationPosition *
-location_route_get_origin (const LocationRoute *route)
-{
- g_return_val_if_fail(route, NULL);
-
- return route->origin;
-}
-
-EXPORT_API LocationPosition *
-location_route_get_destination (const LocationRoute *route)
-{
- g_return_val_if_fail(route, NULL);
-
- return route->destination;
-}
-
-EXPORT_API LocationBoundary *
-location_route_get_bounding_box (const LocationRoute *route)
-{
- g_return_val_if_fail(route, NULL);
-
- return route->bbox;
-}
-
-EXPORT_API gdouble
-location_route_get_total_distance (const LocationRoute *route)
-{
- g_return_val_if_fail(route, 0.0);
-
- return route->total_distance;
-}
-
-EXPORT_API gchar *
-location_route_get_distance_unit (const LocationRoute *route)
-{
- g_return_val_if_fail(route, NULL);
-
- return route->distance_unit;
-}
-
-EXPORT_API glong
-location_route_get_total_duration (const LocationRoute *route)
-{
- g_return_val_if_fail(route, 0);
-
- return route->total_duration;
-}
-
-EXPORT_API GList *
-location_route_get_property_key (const LocationRoute *route)
-{
- g_return_val_if_fail(route, NULL);
-
- return g_hash_table_get_keys(route->properties);
-}
-
-EXPORT_API gpointer
-location_route_get_property (const LocationRoute *route, gconstpointer key)
-{
- g_return_val_if_fail(route, NULL);
- g_return_val_if_fail(key, NULL);
-
- return g_hash_table_lookup(route->properties, key);
-}
-
-EXPORT_API GList *
-location_route_get_route_segment (const LocationRoute *route)
-{
- g_return_val_if_fail(route, NULL);
-
- return route->segment;
-}
-
-/* for expandability
-EXPORT_API gboolean
-location_route_set_req_id (LocationRoute *route, gint req_id)
-{
- g_return_val_if_fail(route, FALSE);
-
- route->req_id = req_id;
-
- return TRUE;
-}
-*/
-
-EXPORT_API gboolean
-location_route_set_origin (LocationRoute *route, const LocationPosition* origin)
-{
- g_return_val_if_fail(route, FALSE);
-
- if (route->origin) {
- location_position_free(route->origin);
- route->origin = NULL;
- }
-
- if (origin) {
- route->origin = location_position_copy(origin);
- }
-
- return TRUE;
-}
-
-EXPORT_API gboolean
-location_route_set_destination (LocationRoute *route, const LocationPosition* destination)
-{
- g_return_val_if_fail(route, FALSE);
-
- if (route->destination) {
- location_position_free(route->destination);
- route->destination = NULL;
- }
-
- if (destination) route->destination = location_position_copy(destination);
-
- return TRUE;
-}
-
-EXPORT_API gboolean
-location_route_set_bounding_box (LocationRoute *route, const LocationBoundary* bbox)
-{
- g_return_val_if_fail(route, FALSE);
-
- if (route->bbox) {
- location_boundary_free(route->bbox);
- route->bbox = NULL;
- }
-
- if (bbox) route->bbox = location_boundary_copy(bbox);
-
- return TRUE;
-}
-
-EXPORT_API
-gboolean location_route_set_total_distance (LocationRoute *route, gdouble total_distance)
-{
- g_return_val_if_fail(route, FALSE);
-
- route->total_distance = total_distance;
-
- return TRUE;
-}
-
-EXPORT_API
-gboolean location_route_set_distance_unit (LocationRoute *route, const gchar* distance_unit)
-{
- g_return_val_if_fail(route, FALSE);
-
- if (route->distance_unit) {
- g_free(route->distance_unit);
- route->distance_unit = NULL;
- }
-
- if (distance_unit) route->distance_unit = g_strdup(distance_unit);
-
- return TRUE;
-}
-
-EXPORT_API gboolean
-location_route_set_total_duration (LocationRoute *route, glong total_duration)
-{
- g_return_val_if_fail(route, FALSE);
-
- route->total_duration = total_duration;
-
- return TRUE;
-}
-
-EXPORT_API gboolean
-location_route_set_property (LocationRoute *route, gconstpointer key, gconstpointer value)
-{
- g_return_val_if_fail(route, FALSE);
- g_return_val_if_fail(key, FALSE);
- if (!route->properties) return FALSE;
-
- if (value) {
- gchar *re_key = g_strdup (key);
- gchar *re_val = g_strdup (value);
- g_hash_table_insert(route->properties, re_key, re_val);
- } else g_hash_table_remove (route->properties, key);
-
- return TRUE;
-}
-
-static void route_segment_foreach_copy (gpointer data, gpointer user_data)
-{
- g_return_if_fail (data);
-
- LocationRouteSegment *segment = (LocationRouteSegment *) data;
- LocationRoute *route = (LocationRoute *) user_data;
-
- route->segment = g_list_append (route->segment, location_route_segment_copy (segment));
-}
-
-static void route_segment_foreach_free (gpointer data)
-{
- g_return_if_fail (data);
-
- LocationRouteSegment *segment = (LocationRouteSegment *)data;
-
- location_route_segment_free(segment);
-}
-
-
-EXPORT_API gboolean
-location_route_set_route_segment (LocationRoute *route, GList* segment)
-{
- g_return_val_if_fail(route, FALSE);
-
- if (route->segment) {
- g_list_free_full (route->segment, route_segment_foreach_free);
- route->segment = NULL;
- }
-
- if (segment) g_list_foreach (segment, route_segment_foreach_copy, route);
-
- return TRUE;
-}
-
-EXPORT_API LocationRoute *
-location_route_new (void)
-{
- LocationRoute *route = g_slice_new0(LocationRoute);
- g_return_val_if_fail (route, NULL);
-
- route->properties = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
-
- return route;
-}
-
-static void route_property_copy_cb (gpointer key, gpointer value, gpointer user_data)
-{
- g_return_if_fail (key);
- g_return_if_fail (value);
- g_return_if_fail (user_data);
-
- LocationRoute *route = (LocationRoute *)user_data;
-
- if (route->properties) {
- gchar *re_key = g_strdup (key);
- gchar *re_val = g_strdup (value);
- g_hash_table_insert (route->properties, re_key, re_val);
- }
-}
-
-EXPORT_API LocationRoute *
-location_route_copy (const LocationRoute *route)
-{
- g_return_val_if_fail(route, NULL);
- LocationRoute *new_route = location_route_new();
- g_return_val_if_fail(new_route, NULL);
-
- location_route_set_origin (new_route, location_route_get_origin(route));
- location_route_set_destination (new_route, location_route_get_destination(route));
- location_route_set_bounding_box (new_route, location_route_get_bounding_box(route));
- location_route_set_total_distance (new_route, location_route_get_total_distance(route));
- location_route_set_distance_unit (new_route, location_route_get_distance_unit(route));
- location_route_set_total_duration (new_route, location_route_get_total_duration(route));
-
- g_list_foreach(route->segment, route_segment_foreach_copy, new_route);
-
- if (route->properties) {
- g_hash_table_foreach (route->properties, route_property_copy_cb, new_route);
- }
-
- return new_route;
-}
-
-EXPORT_API void
-location_route_free (LocationRoute *route)
-{
- g_return_if_fail (route);
-
- location_route_set_origin (route, NULL);
- location_route_set_destination (route, NULL);
- location_route_set_bounding_box (route, NULL);
- location_route_set_distance_unit (route, NULL);
- location_route_set_route_segment (route, NULL);
-
- if (route->properties) {
- g_hash_table_destroy (route->properties);
- route->properties = NULL;
- }
-
- g_slice_free (LocationRoute, route);
-}
-
-EXPORT_API LocationPosition *
-location_route_segment_get_start_point (const LocationRouteSegment *segment)
-{
- g_return_val_if_fail(segment, NULL);
-
- return segment->start;
-}
-
-EXPORT_API LocationPosition *
-location_route_segment_get_end_point (const LocationRouteSegment *segment)
-{
- g_return_val_if_fail(segment, NULL);
-
- return segment->end;
-}
-
-EXPORT_API LocationBoundary *
-location_route_segment_get_bounding_box (const LocationRouteSegment *segment)
-{
- g_return_val_if_fail(segment, NULL);
-
- return segment->bbox;
-}
-
-EXPORT_API gdouble
-location_route_segment_get_distance (const LocationRouteSegment *segment)
-{
- g_return_val_if_fail(segment, 0.0);
-
- return segment->distance;
-}
-
-EXPORT_API glong
-location_route_segment_get_duration (const LocationRouteSegment *segment)
-{
- g_return_val_if_fail(segment, 0);
-
- return segment->duration;
-}
-
-EXPORT_API GList*
-location_route_segment_get_property_key (const LocationRouteSegment *segment)
-{
- g_return_val_if_fail(segment, NULL);
-
- return g_hash_table_get_keys(segment->properties);
-}
-
-EXPORT_API gpointer
-location_route_segment_get_property (const LocationRouteSegment *segment, gconstpointer key)
-{
- g_return_val_if_fail(segment, NULL);
- g_return_val_if_fail(key, NULL);
-
- return g_hash_table_lookup(segment->properties, (gpointer) key);
-}
-
-EXPORT_API GList*
-location_route_segment_get_route_step (const LocationRouteSegment *segment)
-{
- g_return_val_if_fail(segment, NULL);
-
- return segment->step;
-}
-
-EXPORT_API gboolean
-location_route_segment_set_start_point (LocationRouteSegment *segment, const LocationPosition *start)
-{
- g_return_val_if_fail (segment, FALSE);
-
- if (segment->start) {
- location_position_free(segment->start);
- segment->start = NULL;
- }
-
- if (start) segment->start = location_position_copy (start);
-
- return TRUE;
-}
-
-EXPORT_API gboolean
-location_route_segment_set_end_point (LocationRouteSegment *segment, const LocationPosition *end)
-{
- g_return_val_if_fail (segment, FALSE);
-
- if (segment->end) {
- location_position_free(segment->end);
- segment->end = NULL;
- }
-
- if (end) segment->end = location_position_copy (end);
-
- return TRUE;
-
-}
-
-EXPORT_API gboolean
-location_route_segment_set_bounding_box (LocationRouteSegment *segment, const LocationBoundary *bbox)
-{
- g_return_val_if_fail (segment, FALSE);
-
- if (segment->bbox) {
- location_boundary_free(segment->bbox);
- segment->bbox = NULL;
- }
-
- if (bbox) segment->bbox = location_boundary_copy (bbox);
-
- return TRUE;
-}
-
-EXPORT_API gboolean
-location_route_segment_set_distance (LocationRouteSegment *segment, gdouble distance)
-{
- g_return_val_if_fail (segment, FALSE);
-
- segment->distance = distance;
-
- return TRUE;
-}
-
-EXPORT_API gboolean
-location_route_segment_set_duration (LocationRouteSegment *segment, glong duration)
-{
- g_return_val_if_fail (segment, FALSE);
-
- segment->duration = duration;
-
- return TRUE;
-}
-
-EXPORT_API gboolean
-location_route_segment_set_property (LocationRouteSegment *segment, gconstpointer key, gconstpointer value)
-{
- g_return_val_if_fail (segment, FALSE);
- g_return_val_if_fail (key, FALSE);
- if (!segment->properties) return FALSE;
-
- if (value) {
- gchar *re_key = g_strdup (key);
- gchar *re_val = g_strdup (value);
- g_hash_table_insert(segment->properties, re_key, re_val);
- } else g_hash_table_remove (segment->properties, key);
-
- return TRUE;
-}
-
-static void route_step_foreach_free (gpointer data)
-{
- g_return_if_fail (data);
-
- LocationRouteStep *step = (LocationRouteStep *) data;
-
- location_route_step_free(step);
-}
-
-static void route_step_foreach_copy (gpointer data, gpointer user_data)
-{
- g_return_if_fail (data);
- g_return_if_fail (user_data);
-
- LocationRouteStep *step = (LocationRouteStep *) data;
- LocationRouteSegment *segment = (LocationRouteSegment *) user_data;
-
- LocationRouteStep *step_new = location_route_step_copy(step);
- segment->step = g_list_append(segment->step, step_new);
-
-}
-
-EXPORT_API gboolean
-location_route_segment_set_route_step (LocationRouteSegment *segment, GList* step)
-{
- g_return_val_if_fail (segment, FALSE);
-
- if (segment->step) {
- g_list_free_full (segment->step, route_step_foreach_free);
- segment->step = NULL;
- }
-
- if (step) g_list_foreach (step, route_step_foreach_copy, segment);
-
- return TRUE;
-
-}
-
-EXPORT_API LocationRouteSegment *
-location_route_segment_new (void)
-{
- LocationRouteSegment *segment = g_slice_new0 (LocationRouteSegment);
- g_return_val_if_fail (segment, NULL);
-
- segment->properties = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
-
- return segment;
-}
-
-static void segment_property_copy_cb (gpointer key, gpointer value, gpointer user_data)
-{
- g_return_if_fail (key);
- g_return_if_fail (value);
- g_return_if_fail (user_data);
-
- LocationRouteSegment *segment = (LocationRouteSegment *)user_data;
-
- if (segment->properties) {
- gchar *re_key = g_strdup (key);
- gchar *re_val = g_strdup (value);
- g_hash_table_insert (segment->properties, re_key, re_val);
- }
-}
-
-EXPORT_API LocationRouteSegment *
-location_route_segment_copy (LocationRouteSegment *segment)
-{
- g_return_val_if_fail(segment, NULL);
-
- LocationRouteSegment *new_segment = location_route_segment_new();
- g_return_val_if_fail(new_segment, NULL);
-
- location_route_segment_set_start_point(new_segment, location_route_segment_get_start_point(segment));
- location_route_segment_set_end_point(new_segment, location_route_segment_get_end_point(segment));
- location_route_segment_set_bounding_box(new_segment, location_route_segment_get_bounding_box(segment));
- location_route_segment_set_distance(new_segment, location_route_segment_get_distance(segment));
- location_route_segment_set_duration(new_segment, location_route_segment_get_duration(segment));
- location_route_segment_set_route_step(new_segment, location_route_segment_get_route_step(segment));
-
- if (segment->properties) g_hash_table_foreach (segment->properties, segment_property_copy_cb, new_segment);
-
- return new_segment;
-}
-
-EXPORT_API void
-location_route_segment_free (LocationRouteSegment *segment)
-{
- g_return_if_fail(segment);
-
- location_route_segment_set_start_point(segment, NULL);
- location_route_segment_set_end_point(segment, NULL);
- location_route_segment_set_bounding_box(segment, NULL);
- location_route_segment_set_distance(segment, 0.0);
- location_route_segment_set_duration(segment, 0);
- location_route_segment_set_route_step(segment, NULL);
-
- if (segment->properties) {
- g_hash_table_destroy (segment->properties);
- segment->properties = NULL;
- }
-
- g_slice_free(LocationRouteSegment, segment);
-}
-
-EXPORT_API LocationPosition*
-location_route_step_get_start_point (const LocationRouteStep *step)
-{
- g_return_val_if_fail(step, NULL);
-
- return step->start;
-}
-
-EXPORT_API LocationPosition*
-location_route_step_get_end_point (const LocationRouteStep *step)
-{
- g_return_val_if_fail(step, NULL);
-
- return step->end;
-}
-
-EXPORT_API LocationBoundary*
-location_route_step_get_bounding_box (const LocationRouteStep *step)
-{
- g_return_val_if_fail(step, NULL);
-
- return step->bbox;
-}
-
-EXPORT_API gdouble
-location_route_step_get_distance (const LocationRouteStep *step)
-{
- g_return_val_if_fail(step, 0.0);
-
- return step->distance;
-}
-
-EXPORT_API glong
-location_route_step_get_duration (const LocationRouteStep *step)
-{
- g_return_val_if_fail(step, 0);
-
- return step->duration;
-}
-
-EXPORT_API gchar*
-location_route_step_get_transport_mode (const LocationRouteStep *step)
-{
- g_return_val_if_fail(step, NULL);
-
- return step->transport_mode;
-}
-
-EXPORT_API gchar*
-location_route_step_get_instruction (const LocationRouteStep *step)
-{
- g_return_val_if_fail(step, NULL);
-
- return step->instruction;
-}
-
-EXPORT_API GList *
-location_route_step_get_geometry (const LocationRouteStep *step)
-{
- g_return_val_if_fail(step, NULL);
-
- return step->geometry;
-}
-
-EXPORT_API GList*
-location_route_step_get_property_key (const LocationRouteStep *step)
-{
- g_return_val_if_fail(step, NULL);
-
- return g_hash_table_get_keys (step->properties);
-}
-
-EXPORT_API gpointer
-location_route_step_get_property (const LocationRouteStep *step, gconstpointer key)
-{
- g_return_val_if_fail(step, NULL);
- g_return_val_if_fail(key, NULL);
-
- return g_hash_table_lookup (step->properties, key);
-}
-
-EXPORT_API gboolean
-location_route_step_set_start_point (LocationRouteStep *step, const LocationPosition *start)
-{
- g_return_val_if_fail (step, FALSE);
-
- if (step->start) {
- location_position_free (step->start);
- step->start = NULL;
- }
-
- if (start) step->start = location_position_copy (start);
-
- return TRUE;
-}
-
-EXPORT_API gboolean
-location_route_step_set_end_point (LocationRouteStep *step, const LocationPosition *end)
-{
- g_return_val_if_fail (step, FALSE);
-
- if (step->end) {
- location_position_free (step->end);
- step->end = NULL;
- }
-
- if (end) step->end = location_position_copy (end);
-
- return TRUE;
-}
-
-EXPORT_API gboolean
-location_route_step_set_bounding_box (LocationRouteStep *step, const LocationBoundary *bbox)
-{
- g_return_val_if_fail (step, FALSE);
-
- if (step->bbox) {
- location_boundary_free (step->bbox);
- step->bbox = NULL;
- }
-
- if (bbox) step->bbox = location_boundary_copy (bbox);
-
- return TRUE;
-}
-
-EXPORT_API gboolean
-location_route_step_set_distance (LocationRouteStep *step, gdouble distance)
-{
- g_return_val_if_fail (step, FALSE);
-
- step->distance = distance;
-
- return TRUE;
-
-}
-
-EXPORT_API gboolean
-location_route_step_set_duration (LocationRouteStep *step, glong duration)
-{
- g_return_val_if_fail (step, FALSE);
-
- step->duration = duration;
-
- return TRUE;
-}
-
-EXPORT_API gboolean
-location_route_step_set_transport_mode (LocationRouteStep *step, const gchar *transport_mode)
-{
- g_return_val_if_fail (step, FALSE);
-
- if (step->transport_mode) {
- g_free(step->transport_mode);
- step->transport_mode = NULL;
- }
-
- if (transport_mode) step->transport_mode = g_strdup(transport_mode);
-
- return TRUE;
-
-}
-
-EXPORT_API gboolean
-location_route_step_set_instruction (LocationRouteStep *step, const gchar *instruction)
-{
- g_return_val_if_fail (step, FALSE);
-
- if (step->instruction) {
- g_free(step->instruction);
- step->instruction = NULL;
- }
-
- if (instruction) step->instruction = g_strdup(instruction);
-
- return TRUE;
-
-}
-
-static void route_step_geometry_foreach_copy (gpointer data, gpointer user_data)
-{
- g_return_if_fail (data);
- g_return_if_fail (user_data);
-
- LocationPosition *pos = (LocationPosition *)data;
- LocationRouteStep *step = (LocationRouteStep *)user_data;
-
- step->geometry = g_list_append (step->geometry, location_position_copy (pos));
-}
-
-static void route_step_geometry_free (gpointer data)
-{
- g_return_if_fail (data);
-
- LocationPosition *pos = (LocationPosition *)data;
-
- location_position_free(pos);
-}
-
-EXPORT_API gboolean
-location_route_step_set_geometry (LocationRouteStep *step, GList *geometry)
-{
- g_return_val_if_fail (step, FALSE);
-
- if (step->geometry) {
- g_list_free_full (step->geometry, route_step_geometry_free);
- step->geometry = NULL;
- }
-
- if (geometry) g_list_foreach (geometry, route_step_geometry_foreach_copy, step);
-
- return TRUE;
-
-}
-
-EXPORT_API gboolean
-location_route_step_set_property (LocationRouteStep *step, gconstpointer key, gconstpointer value)
-{
- g_return_val_if_fail(step, FALSE);
- g_return_val_if_fail(key, FALSE);
-
- if (!step->properties) return FALSE;
-
- if (value) {
- gchar *re_key = g_strdup (key);
- gchar *re_val = g_strdup (value);
- g_hash_table_insert (step->properties, re_key, re_val);
- }
- else g_hash_table_remove (step->properties, key);
-
- return TRUE;
-}
-
-EXPORT_API LocationRouteStep *
-location_route_step_new (void)
-{
- LocationRouteStep *step = g_slice_new0 (LocationRouteStep);
- g_return_val_if_fail(step, NULL);
-
- step->properties = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
-
- return step;
-}
-
-static void step_property_copy_cb (gpointer key, gpointer value, gpointer user_data)
-{
- g_return_if_fail (key);
- g_return_if_fail (value);
- g_return_if_fail (user_data);
-
- LocationRouteStep *step = (LocationRouteStep *) user_data;
-
- if (step->properties) {
- gchar *re_key = g_strdup (key);
- gchar *re_val = g_strdup (value);
- g_hash_table_insert (step->properties, re_key, re_val);
- }
-}
-
-
-EXPORT_API LocationRouteStep *
-location_route_step_copy (LocationRouteStep *step)
-{
- g_return_val_if_fail(step, NULL);
-
- LocationRouteStep *new_step = location_route_step_new ();
- g_return_val_if_fail (new_step, NULL);
-
- location_route_step_set_start_point (new_step, location_route_step_get_start_point(step));
- location_route_step_set_end_point (new_step, location_route_step_get_end_point(step));
- location_route_step_set_bounding_box (new_step, location_route_step_get_bounding_box(step));
- location_route_step_set_distance (new_step, location_route_step_get_distance(step));
- location_route_step_set_duration (new_step, location_route_step_get_duration(step));
- location_route_step_set_instruction (new_step, location_route_step_get_instruction(step));
- location_route_step_set_geometry (new_step, location_route_step_get_geometry(step));
- location_route_step_set_road_element(new_step, location_route_step_get_road_element(step));
- location_route_step_set_maneuver(new_step, location_route_step_get_maneuver(step));
-
- if (step->properties) g_hash_table_foreach (step->properties, step_property_copy_cb, new_step);
- return new_step;
-}
-
-EXPORT_API void
-location_route_step_free (LocationRouteStep *step)
-{
- g_return_if_fail(step);
-
- location_route_step_set_start_point (step, NULL);
- location_route_step_set_end_point (step, NULL);
- location_route_step_set_bounding_box (step, NULL);
- location_route_step_set_distance (step, 0.0);
- location_route_step_set_duration (step, 0);
- location_route_step_set_instruction (step, NULL);
- location_route_step_set_geometry (step, NULL);
- location_route_step_set_road_element(step, NULL);
- location_route_step_set_maneuver(step, NULL);
-
- if (step->properties) {
- g_hash_table_destroy (step->properties);
- step->properties = NULL;
- }
- g_slice_free(LocationRouteStep, step);
-}
-
-EXPORT_API LocationRouteLaneInfo *location_route_lane_info_new (void)
-{
- LocationRouteLaneInfo *lane = g_slice_new0(LocationRouteLaneInfo);
- g_return_val_if_fail (lane, NULL);
-
- return lane;
-}
-
-EXPORT_API LocationRouteLaneInfo *location_route_lane_info_copy (const LocationRouteLaneInfo *lane)
-{
- g_return_val_if_fail(lane, NULL);
-
- LocationRouteLaneInfo *new_lane = location_route_lane_info_new();
- g_return_val_if_fail (new_lane, NULL);
-
- new_lane->is_on_route = lane->is_on_route;
- location_route_lane_set_directions(new_lane, location_route_lane_get_directions(lane));
-
- return new_lane;
-}
-
-EXPORT_API void location_route_lane_info_free (LocationRouteLaneInfo *lane)
-{
- g_return_if_fail(lane);
-
- g_slice_free (LocationRouteLaneInfo, lane);
-}
-
-EXPORT_API LocationRouteManeuver *location_route_maneuver_new (void)
-{
- LocationRouteManeuver *maneuver = g_slice_new0(LocationRouteManeuver);
- g_return_val_if_fail (maneuver, NULL);
-
- return maneuver;
-}
-
-EXPORT_API LocationRouteManeuver *location_route_maneuver_copy (const LocationRouteManeuver *maneuver)
-{
- g_return_val_if_fail(maneuver, NULL);
-
- LocationRouteManeuver *new_maneuver = location_route_maneuver_new();
- g_return_val_if_fail (new_maneuver, NULL);
-
- new_maneuver->distance_from_start = maneuver->distance_from_start;
- new_maneuver->distance_from_prev_maneuver = maneuver->distance_from_prev_maneuver;
- new_maneuver->next_road_name = g_strdup(maneuver->next_road_name);
- new_maneuver->action_string = g_strdup(maneuver->action_string);
- new_maneuver->turn_string = g_strdup(maneuver->turn_string);
- new_maneuver->traffic_direction = maneuver->traffic_direction;
- new_maneuver->angle = maneuver->angle;
- new_maneuver->start_angle = maneuver->start_angle;
- new_maneuver->start_time = maneuver->start_time;
- new_maneuver->starts_from_sliproad = maneuver->starts_from_sliproad;
- new_maneuver->next_is_sliproad = maneuver->next_is_sliproad;
- new_maneuver->is_counter_roundabout = maneuver->is_counter_roundabout;
- location_route_maneuver_set_lanes(new_maneuver, location_route_maneuver_get_lanes(maneuver));
-
- return new_maneuver;
-}
-
-
-EXPORT_API void location_route_maneuver_free (LocationRouteManeuver *maneuver)
-{
- g_return_if_fail(maneuver);
-
- if (maneuver->next_road_name) {
- g_free(maneuver->next_road_name);
- maneuver->next_road_name = NULL;
- }
- if (maneuver->action_string) {
- g_free(maneuver->action_string);
- maneuver->action_string = NULL;
- }
- if (maneuver->turn_string) {
- g_free(maneuver->turn_string);
- maneuver->turn_string = NULL;
- }
-
- location_route_maneuver_set_lanes(maneuver, NULL);
-
- g_slice_free (LocationRouteManeuver, maneuver);
-}
-
-EXPORT_API LocationRouteTransitStop *location_route_transit_stop_new (void)
-{
- LocationRouteTransitStop *stop = g_slice_new0(LocationRouteTransitStop);
- g_return_val_if_fail (stop, NULL);
-
- return stop;
-}
-
-EXPORT_API LocationRouteTransitStop *location_route_transit_stop_copy (const LocationRouteTransitStop *stop)
-{
- g_return_val_if_fail(stop, NULL);
-
- LocationRouteTransitStop *new_stop = location_route_transit_stop_new();
- g_return_val_if_fail(new_stop, NULL);
-
- new_stop->station_name = g_strdup(stop->station_name);
- new_stop->platform_level = stop->platform_level;
- new_stop->platform_coordinates = location_position_copy(stop->platform_coordinates);
- new_stop->egress_coordinates = location_position_copy(stop->egress_coordinates);
-
- return new_stop;
-}
-
-
-EXPORT_API void location_route_transit_stop_free (LocationRouteTransitStop *stop)
-{
- g_return_if_fail(stop);
-
- if (stop->station_name) {
- g_free(stop->station_name);
- stop->station_name = NULL;
- }
- if (stop->platform_coordinates) {
- location_position_free(stop->platform_coordinates);
- }
- if (stop->egress_coordinates) {
- location_position_free(stop->egress_coordinates);
- }
-
- g_slice_free (LocationRouteTransitStop, stop);
-}
-
-EXPORT_API LocationRoadElement *location_route_road_element_new (void)
-{
- LocationRoadElement *road = g_slice_new0(LocationRoadElement);
- g_return_val_if_fail(road, NULL);
-
- return road;
-}
-
-EXPORT_API LocationRoadElement *location_route_road_element_copy (const LocationRoadElement *road)
-{
- g_return_val_if_fail(road, NULL);
-
- LocationRoadElement *new_road = location_route_road_element_new();
- g_return_val_if_fail(new_road, NULL);
-
- new_road->form_of_way = road->form_of_way;
- new_road->is_plural = road->is_plural;
- new_road->road_name = g_strdup(road->road_name);
- new_road->route_name = g_strdup(road->route_name);
- new_road->speed_limit = road->speed_limit;
- new_road->average_speed = road->average_speed;
- new_road->number_of_lanes = road->number_of_lanes;
- new_road->is_pedestrian = road->is_pedestrian;
- new_road->is_valid = road->is_valid;
- new_road->start_time = road->start_time;
- new_road->travel_time = road->travel_time;
- new_road->ETA_validity = road->ETA_validity;
-
- new_road->transit_destination = g_strdup(road->transit_destination);
- new_road->transit_line_name = g_strdup(road->transit_line_name);
- new_road->system_official_name = g_strdup(road->system_official_name);
- new_road->system_short_name = g_strdup(road->system_short_name);
- new_road->transit_type = road->transit_type;
- new_road->transit_type_name = g_strdup(road->transit_type_name);
- new_road->transit_departure_time = road->transit_departure_time;
- new_road->transit_arrival_time = road->transit_arrival_time;
- new_road->transit_departure_station = location_route_transit_stop_copy(road->transit_departure_station);
- new_road->transit_arrival_station = location_route_transit_stop_copy(road->transit_arrival_station);
-
- return new_road;
-}
-
-
-EXPORT_API void location_route_road_element_free (LocationRoadElement *road)
-{
- g_return_if_fail(road);
-
- if (road->road_name) {
- g_free(road->road_name);
- road->road_name = NULL;
- }
- if (road->route_name) {
- g_free(road->route_name);
- road->route_name = NULL;
- }
- if (road->transit_destination) {
- g_free(road->transit_destination);
- road->transit_destination = NULL;
- }
- if (road->transit_line_name) {
- g_free(road->transit_line_name);
- road->transit_line_name = NULL;
- }
- if (road->system_official_name) {
- g_free(road->system_official_name);
- road->system_official_name = NULL;
- }
- if (road->system_short_name) {
- g_free(road->system_short_name);
- road->system_short_name = NULL;
- }
- if (road->transit_type_name) {
- g_free(road->transit_type_name);
- road->transit_type_name = NULL;
- }
- if (road->transit_departure_station) {
- location_route_transit_stop_free(road->transit_departure_station);
- }
- if (road->transit_arrival_station) {
- location_route_transit_stop_free(road->transit_arrival_station);
- }
-
- g_slice_free (LocationRoadElement, road);
-}
-
-EXPORT_API LocationRoadElementPenalty *location_route_element_penalty_new (void)
-{
- LocationRoadElementPenalty *penalty = g_slice_new0(LocationRoadElementPenalty);
- g_return_val_if_fail (penalty, NULL);
-
- return penalty;
-}
-
-
-EXPORT_API LocationRoadElementPenalty *location_route_element_penalty_copy (const LocationRoadElementPenalty *penalty)
-{
- g_return_val_if_fail(penalty, NULL);
-
- LocationRoadElementPenalty *new_penalty = location_route_element_penalty_new();
- g_return_val_if_fail (penalty, NULL);
-
- new_penalty->id = penalty->id;
- new_penalty->direction = penalty->direction;
- new_penalty->penalty = penalty->penalty;
- new_penalty->speed = penalty->speed;
- new_penalty->validity_start_time = penalty->validity_start_time;
- new_penalty->validity_end_time = penalty->validity_end_time;
-
- return new_penalty;
-}
-
-
-EXPORT_API void location_route_element_penalty_free (LocationRoadElementPenalty *penalty)
-{
- g_return_if_fail(penalty);
-
- g_slice_free (LocationRoadElementPenalty, penalty);
-}
-
-EXPORT_API LocationRouteOptions *location_route_options_new (void)
-{
-
- LocationRouteOptions *options = g_slice_new0(LocationRouteOptions);
- g_return_val_if_fail (options, NULL);
-
- memset(options->transit_type_allowed, 0x00, TRANSIT_TYPE_COUNT * sizeof(int));
-
- return options;
-}
-
-EXPORT_API LocationRouteOptions *location_route_options_copy (const LocationRouteOptions *options)
-{
- g_return_val_if_fail(options, NULL);
-
- LocationRouteOptions *new_options = location_route_options_new();
- g_return_val_if_fail (new_options, NULL);
-
- new_options->start_direction = options->start_direction;
- new_options->walk_time_multiplier = options->walk_time_multiplier;
- new_options->minimum_change_time = options->minimum_change_time;
- new_options->maximum_changes = options->maximum_changes;
- new_options->departure_time = options->departure_time;
- new_options->arrival_time = options->arrival_time;
-
- location_route_options_set_road_element_penalty(new_options, location_route_options_get_road_element_penalty(options));
- memmove(new_options->transit_type_allowed, options->transit_type_allowed, TRANSIT_TYPE_COUNT*sizeof(int));
-
- return new_options;
-}
-
-EXPORT_API void location_route_options_free (LocationRouteOptions *options)
-{
- g_return_if_fail(options);
-
- location_route_options_set_road_element_penalty(options, NULL);
-
- g_slice_free (LocationRouteOptions, options);
-}
-
-EXPORT_API LocationRouteManeuver *location_route_step_get_maneuver (const LocationRouteStep *step)
-{
- g_return_val_if_fail(step, NULL);
-
- return step->maneuver;
-}
-
-EXPORT_API gboolean location_route_step_set_maneuver (LocationRouteStep *step, const LocationRouteManeuver *maneuver)
-{
- g_return_val_if_fail(step, FALSE);
-
- if (step->maneuver) {
- location_route_maneuver_free(step->maneuver);
- step->maneuver = NULL;
- }
-
- if (maneuver) {
- step->maneuver = location_route_maneuver_copy(maneuver);
- }
-
- return TRUE;
-}
-
-EXPORT_API guint location_route_maneuver_get_distance_from_start(const LocationRouteManeuver *maneuver)
-{
- g_return_val_if_fail (maneuver, 0);
-
- return maneuver->distance_from_start ;
-}
-
-EXPORT_API gboolean location_route_maneuver_set_distance_from_start(LocationRouteManeuver *maneuver, guint distance)
-{
- g_return_val_if_fail (maneuver, FALSE);
-
- maneuver->distance_from_start = distance;
-
- return TRUE;
-}
-
-EXPORT_API guint location_route_maneuver_get_distance_from_previous_maneuver(const LocationRouteManeuver *maneuver)
-{
- g_return_val_if_fail(maneuver, 0);
-
- return maneuver->distance_from_prev_maneuver;
-}
-
-EXPORT_API gboolean location_route_maneuver_set_distance_from_prev_maneuver(LocationRouteManeuver *maneuver, guint distance)
-{
- g_return_val_if_fail (maneuver, FALSE);
-
- maneuver->distance_from_prev_maneuver = distance;
-
- return TRUE;
-}
-
-EXPORT_API gchar *location_route_maneuver_get_next_road_name(const LocationRouteManeuver *maneuver)
-{
- g_return_val_if_fail (maneuver, NULL);
-
- return maneuver->next_road_name;
-}
-
-EXPORT_API gboolean location_route_maneuver_set_next_road_name(LocationRouteManeuver *maneuver, const gchar *road_name)
-{
- g_return_val_if_fail (maneuver, FALSE);
-
- if (maneuver->next_road_name) {
- g_free(maneuver->next_road_name);
- maneuver->next_road_name = NULL;
- }
-
- if(road_name) {
- maneuver->next_road_name = g_strdup(road_name);
- }
-
- return TRUE;
-}
-
-EXPORT_API gchar *location_route_maneuver_get_action(const LocationRouteManeuver *maneuver)
-{
- g_return_val_if_fail (maneuver, NULL);
-
- return maneuver->action_string;
-
-}
-
-EXPORT_API gboolean location_route_maneuver_set_action(LocationRouteManeuver *maneuver, const gchar *action)
-{
- g_return_val_if_fail (maneuver, FALSE);
-
- if (maneuver->action_string) {
- g_free(maneuver->action_string);
- maneuver->action_string = NULL;
- }
-
- if(action) {
- maneuver->action_string = g_strdup(action);
- }
-
- return TRUE;
-}
-
-EXPORT_API gchar *location_route_maneuver_get_turn(const LocationRouteManeuver *maneuver)
-{
- g_return_val_if_fail (maneuver, NULL);
-
- return maneuver->turn_string;
-}
-
-EXPORT_API gboolean location_route_maneuver_set_turn(LocationRouteManeuver *maneuver, const gchar *turn)
-{
- g_return_val_if_fail (maneuver, FALSE);
-
- if (maneuver->turn_string) {
- g_free(maneuver->turn_string);
- maneuver->turn_string = NULL;
- }
-
- if(turn) {
- maneuver->turn_string = g_strdup(turn);
- }
-
- return TRUE;
-}
-
-EXPORT_API TrafficDirection location_route_maneuver_get_traffic_direction(const LocationRouteManeuver *maneuver)
-{
- g_return_val_if_fail (maneuver, 0);
-
- return maneuver->traffic_direction;
-}
-
-EXPORT_API gboolean location_route_maneuver_set_traffic_direction(LocationRouteManeuver *maneuver, TrafficDirection direction)
-{
- g_return_val_if_fail (maneuver, FALSE);
-
- maneuver->traffic_direction = direction;
-
- return TRUE;
-}
-
-EXPORT_API guint location_route_maneuver_get_angle(const LocationRouteManeuver *maneuver)
-{
- g_return_val_if_fail (maneuver, 0);
-
- return maneuver->angle;
-}
-
-EXPORT_API gboolean location_route_maneuver_set_angle(LocationRouteManeuver *maneuver, guint angle)
-{
- g_return_val_if_fail (maneuver, FALSE);
- g_return_val_if_fail ((angle >= 0 && angle <= 360), FALSE);
-
- maneuver->angle = angle;
-
- return TRUE;
-}
-
-EXPORT_API guint location_route_maneuver_get_start_angle(const LocationRouteManeuver *maneuver)
-{
- g_return_val_if_fail (maneuver, 0);
-
- return maneuver->start_angle;
-}
-
-EXPORT_API gboolean location_route_maneuver_set_start_angle(LocationRouteManeuver *maneuver, guint start_angle)
-{
- g_return_val_if_fail (maneuver, FALSE);
- g_return_val_if_fail ((start_angle >= 0 && start_angle <= 360), FALSE);
-
- maneuver->start_angle = start_angle;
-
- return TRUE;
-}
-
-EXPORT_API guint location_route_maneuver_get_start_time(const LocationRouteManeuver *maneuver)
-{
- g_return_val_if_fail (maneuver, 0);
-
- return maneuver->start_time;
-}
-
-EXPORT_API gboolean location_route_maneuver_set_start_time(LocationRouteManeuver *maneuver, guint time)
-{
- g_return_val_if_fail (maneuver, FALSE);
- g_return_val_if_fail (time >= 0, FALSE);
-
- maneuver->start_time = time;
-
- return TRUE;
-}
-
-EXPORT_API gboolean location_route_maneuver_is_starts_from_sliproad(const LocationRouteManeuver *maneuver)
-{
- g_return_val_if_fail (maneuver, FALSE);
-
- return maneuver->starts_from_sliproad;
-}
-
-EXPORT_API gboolean location_route_maneuver_set_starts_from_sliproad(LocationRouteManeuver *maneuver, gboolean starts_from_sliproad)
-{
- g_return_val_if_fail (maneuver, FALSE);
-
- maneuver->starts_from_sliproad = starts_from_sliproad;
- return TRUE;
-}
-
-EXPORT_API gboolean location_route_maneuver_is_next_is_sliproad(const LocationRouteManeuver *maneuver)
-{
- g_return_val_if_fail (maneuver, FALSE);
-
- return maneuver->next_is_sliproad;
-}
-
-EXPORT_API gboolean location_route_maneuver_set_next_is_sliproad(LocationRouteManeuver *maneuver, gboolean next_is_sliproad)
-{
- g_return_val_if_fail (maneuver, FALSE);
-
- maneuver->next_is_sliproad = next_is_sliproad;
- return TRUE;
-}
-
-
-EXPORT_API gboolean location_route_maneuver_is_counter_roundabout(const LocationRouteManeuver *maneuver)
-{
- g_return_val_if_fail (maneuver, FALSE);
-
- return maneuver->is_counter_roundabout;
-}
-
-EXPORT_API gboolean location_route_maneuver_set_counter_roundabout(LocationRouteManeuver *maneuver, gboolean counter_roundabout)
-{
- g_return_val_if_fail (maneuver, FALSE);
-
- maneuver->is_counter_roundabout = counter_roundabout;
- return TRUE;
-}
-
-
-EXPORT_API GList *location_route_maneuver_get_lanes(const LocationRouteManeuver *maneuver)
-{
- g_return_val_if_fail (maneuver, NULL);
-
- return maneuver->lanes_info;
-}
-
-static void route_maneuver_lanes_foreach_copy (gpointer data, gpointer user_data)
-{
- g_return_if_fail (data);
- g_return_if_fail (user_data);
-
- LocationRouteLaneInfo *laneinfo = (LocationRouteLaneInfo *)data;
- LocationRouteManeuver *maneuver = (LocationRouteManeuver *)user_data;
-
- maneuver->lanes_info = g_list_append (maneuver->lanes_info, location_route_lane_info_copy(laneinfo));
-}
-
-static void route_maneuver_lanes_free (gpointer data)
-{
- g_return_if_fail (data);
-
- LocationRouteLaneInfo *laneinfo = (LocationRouteLaneInfo *)data;
-
- location_route_lane_info_free(laneinfo);
-}
-
-
-EXPORT_API gboolean location_route_maneuver_set_lanes(LocationRouteManeuver *maneuver, GList *lanes)
-{
- g_return_val_if_fail (maneuver, FALSE);
-
- if (maneuver->lanes_info) {
- g_list_free_full (maneuver->lanes_info, route_maneuver_lanes_free);
- maneuver->lanes_info = NULL;
- }
-
- if (lanes) {
- g_list_foreach (lanes, route_maneuver_lanes_foreach_copy, maneuver);
- }
-
- return TRUE;
-}
-
-EXPORT_API gchar *location_route_transit_get_station_name(const LocationRouteTransitStop *stop)
-{
- g_return_val_if_fail (stop, NULL);
-
- return stop->station_name;
-}
-
-EXPORT_API gboolean location_route_transit_set_station_name(LocationRouteTransitStop *stop, const gchar *station_name)
-{
- g_return_val_if_fail (stop, FALSE);
-
- if (stop->station_name) {
- g_free(stop->station_name);
- stop->station_name = NULL;
- }
-
- if (station_name) {
- stop->station_name = g_strdup(station_name);
- }
-
- return TRUE;
-}
-
-EXPORT_API gint location_route_transit_get_platform_level(const LocationRouteTransitStop *stop)
-{
- g_return_val_if_fail (stop, 0);
-
- return stop->platform_level;
-}
-
-EXPORT_API gboolean location_route_transit_set_platform_level(LocationRouteTransitStop *stop, gint level)
-{
- g_return_val_if_fail (stop, FALSE);
-
- stop->platform_level = level;
-
- return TRUE;
-}
-
-EXPORT_API LocationPosition *location_route_transit_get_platform_coordinates(const LocationRouteTransitStop *stop)
-{
- g_return_val_if_fail (stop, NULL);
-
- return stop->platform_coordinates;
-}
-
-EXPORT_API gboolean location_route_transit_set_platform_coordinates(LocationRouteTransitStop *stop, const LocationPosition *coordinates)
-{
- g_return_val_if_fail (stop, FALSE);
-
- if (stop->platform_coordinates) {
- location_position_free(stop->platform_coordinates);
- }
-
- if (coordinates) {
- stop->platform_coordinates = location_position_copy(coordinates);
- }
-
- return TRUE;
-}
-
-EXPORT_API LocationPosition *location_route_transit_get_egress_coordinates(const LocationRouteTransitStop *stop)
-{
- g_return_val_if_fail (stop, NULL);
-
- return stop->egress_coordinates;
-}
-
-EXPORT_API gboolean location_route_transit_set_egress_coordinates(LocationRouteTransitStop *stop, const LocationPosition *eg_coordinates)
-{
- g_return_val_if_fail (stop, FALSE);
-
- if (stop->egress_coordinates) {
- location_position_free(stop->egress_coordinates);
- }
-
- if (eg_coordinates) {
- stop->egress_coordinates = location_position_copy(eg_coordinates);
- }
-
- return TRUE;
-}
-
-EXPORT_API LocationRoadElement* location_route_step_get_road_element (const LocationRouteStep *step)
-{
- g_return_val_if_fail(step, NULL);
-
- return step->road_element;
-}
-
-EXPORT_API gboolean location_route_step_set_road_element (LocationRouteStep *step, const LocationRoadElement *element)
-{
- g_return_val_if_fail(step, FALSE);
-
- if (step->road_element) {
- location_route_road_element_free(step->road_element);
- step->road_element = NULL;
- }
-
- if (element) {
- step->road_element = location_route_road_element_copy(element);
- }
-
- return TRUE;
-}
-
-EXPORT_API FormOfWay location_route_element_get_form_of_way(const LocationRoadElement *element)
-{
- g_return_val_if_fail(element, 0);
-
- return element->form_of_way;
-}
-
-EXPORT_API gboolean location_route_element_set_form_of_way(LocationRoadElement *element, FormOfWay form)
-{
- g_return_val_if_fail(element, FALSE);
-
- element->form_of_way = form;
-
- return TRUE;
-}
-
-EXPORT_API gboolean location_route_element_is_plural(const LocationRoadElement *element)
-{
- g_return_val_if_fail(element, FALSE);
-
- return element->is_plural;
-}
-
-EXPORT_API gboolean location_route_element_set_plural(LocationRoadElement *element, gboolean plural)
-{
- g_return_val_if_fail(element, FALSE);
-
- element->is_plural = plural;
- return TRUE;
-}
-
-EXPORT_API gchar *location_route_element_get_road_name(const LocationRoadElement *element)
-{
- g_return_val_if_fail(element, NULL);
-
- return element->road_name;
-}
-
-EXPORT_API gboolean location_route_element_set_road_name(LocationRoadElement *element, const gchar *road_name)
-{
- g_return_val_if_fail (element, FALSE);
-
- if (element->road_name) {
- g_free(element->road_name);
- element->road_name = NULL;
- }
-
- if (road_name) {
- element->road_name = g_strdup (road_name);
- }
-
- return TRUE;
-}
-
-EXPORT_API gchar *location_route_element_get_route_name(const LocationRoadElement *element)
-{
- g_return_val_if_fail(element, NULL);
-
- return element->route_name;
-}
-
-EXPORT_API gboolean location_route_element_set_route_name(LocationRoadElement *element, const gchar *route_name)
-{
- g_return_val_if_fail (element, FALSE);
-
- if (element->route_name) {
- g_free(element->route_name);
- element->route_name = NULL;
- }
-
- if (route_name) {
- element->route_name = g_strdup(route_name);
- }
-
- return TRUE;
-}
-
-EXPORT_API gfloat location_route_element_get_speed_limit(const LocationRoadElement *element)
-{
- g_return_val_if_fail (element, 0.0);
-
- return element->speed_limit;
-}
-
-EXPORT_API gboolean location_route_element_set_speed_limit(LocationRoadElement *element, gfloat speed_limit)
-{
- g_return_val_if_fail (element, FALSE);
-
- element->speed_limit = speed_limit;
-
- return TRUE;
-}
-
-EXPORT_API guint location_route_element_get_average_speed_m_s(const LocationRoadElement *element)
-{
- g_return_val_if_fail (element, 0);
-
- return element->average_speed;
-}
-
-EXPORT_API gboolean location_route_element_set_average_speed_m_s(LocationRoadElement *element, guint average_speed)
-{
- g_return_val_if_fail (element, FALSE);
-
- element->average_speed = average_speed;
-
- return TRUE;
-}
-
-EXPORT_API guint location_route_element_get_number_of_lanes(const LocationRoadElement *element)
-{
- g_return_val_if_fail (element, 0);
-
- return element->number_of_lanes;
-}
-
-EXPORT_API gboolean location_route_element_set_number_of_lanes(LocationRoadElement *element, const guint num_of_lanes)
-{
- g_return_val_if_fail (element, FALSE);
-
- element->number_of_lanes = num_of_lanes;
-
- return TRUE;
-}
-
-EXPORT_API gboolean location_route_element_road_element_is_pedestrian(const LocationRoadElement *element)
-{
- g_return_val_if_fail (element, FALSE);
-
- return element->is_pedestrian;
-}
-
-EXPORT_API gboolean location_route_element_road_element_set_pedestrian(LocationRoadElement *element, gboolean pedestrian)
-{
- g_return_val_if_fail (element, FALSE);
-
- element->is_pedestrian = pedestrian;
- return TRUE;
-}
-
-EXPORT_API gboolean location_route_element_road_element_is_valid(const LocationRoadElement *element)
-{
- g_return_val_if_fail (element, FALSE);
-
- return element->is_valid;
-}
-
-EXPORT_API gboolean location_route_element_road_element_set_valid(LocationRoadElement *element, gboolean valid)
-{
- g_return_val_if_fail (element, FALSE);
-
- element->is_valid = valid;
- return TRUE;
-}
-
-EXPORT_API guint location_route_element_get_element_start_time(const LocationRoadElement *element)
-{
- g_return_val_if_fail (element, 0);
-
- return element->start_time;
-}
-
-EXPORT_API gboolean location_route_element_set_element_start_time(LocationRoadElement *element, guint start_time)
-{
- g_return_val_if_fail (element, FALSE);
-
- element->start_time = start_time;
-
- return TRUE;
-}
-
-EXPORT_API guint location_route_element_get_element_travel_time(const LocationRoadElement *element)
-{
- g_return_val_if_fail (element, 0);
-
- return element->travel_time;
-}
-
-EXPORT_API gboolean location_route_element_set_element_travel_time(LocationRoadElement *element, guint travel_time)
-{
- g_return_val_if_fail (element, FALSE);
-
- element->travel_time = travel_time;
- return TRUE;
-}
-
-EXPORT_API gboolean location_route_element_set_eta_validity(LocationRoadElement *element, RouteETAValidity eta_validity)
-{
- g_return_val_if_fail (element, FALSE);
-
- element->ETA_validity = eta_validity;
- return TRUE;
-}
-
-EXPORT_API RouteETAValidity location_route_element_get_eta_validity(const LocationRoadElement *element)
-{
- g_return_val_if_fail (element, FALSE);
-
- return element->ETA_validity;
-}
-
-EXPORT_API gchar *location_route_element_get_transit_destination(const LocationRoadElement *element)
-{
- g_return_val_if_fail (element, NULL);
-
- return element->transit_destination;
-}
-
-EXPORT_API gboolean location_route_element_set_transit_destination(LocationRoadElement *element, const gchar *transit_dest)
-{
- g_return_val_if_fail (element, FALSE);
-
- if (element->transit_destination) {
- g_free(element->transit_destination);
- element->transit_destination = NULL;
- }
-
- if (transit_dest) {
- element->transit_destination = g_strdup(transit_dest);
- }
-
- return TRUE;
-}
-
-EXPORT_API gchar *location_route_element_get_transit_line_name(const LocationRoadElement *element)
-{
- g_return_val_if_fail (element, NULL);
-
- return element->transit_line_name;
-}
-
-EXPORT_API gboolean location_route_element_set_transit_line_name(LocationRoadElement *element, const gchar *line_name)
-{
- g_return_val_if_fail (element, FALSE);
-
- if (element->transit_line_name) {
- g_free(element->transit_line_name);
- element->transit_line_name = NULL;
- }
-
- if (line_name) {
- element->transit_line_name = g_strdup(line_name);
- }
-
- return TRUE;
-}
-
-EXPORT_API gchar *location_route_element_get_system_official_name(const LocationRoadElement *element)
-{
- g_return_val_if_fail (element, NULL);
-
- return element->system_official_name;
-}
-
-EXPORT_API gboolean location_route_element_set_system_official_name(LocationRoadElement *element, const gchar *official_name)
-{
- g_return_val_if_fail (element, FALSE);
-
- if (element->system_official_name) {
- g_free(element->system_official_name);
- element->system_official_name = NULL;
- }
-
- if (official_name) {
- element->system_official_name = g_strdup(official_name);
- }
-
- return TRUE;
-}
-
-EXPORT_API gchar *location_route_element_get_system_short_name(const LocationRoadElement *element)
-{
- g_return_val_if_fail (element, NULL);
-
- return element->system_short_name;
-}
-
-EXPORT_API gboolean location_route_element_set_system_short_name(LocationRoadElement *element, const gchar *short_name)
-{
- g_return_val_if_fail (element, FALSE);
-
- if (element->system_short_name) {
- g_free(element->system_short_name);
- element->system_short_name = NULL;
- }
-
- if (short_name) {
- element->system_short_name = g_strdup(short_name);
- }
-
- return TRUE;
-}
-
-EXPORT_API TransitType location_route_element_get_transit_type(const LocationRoadElement *element)
-{
- g_return_val_if_fail (element, 0);
-
- return element->transit_type;
-}
-
-EXPORT_API gboolean location_route_element_set_transit_type(LocationRoadElement *element, TransitType type)
-{
- g_return_val_if_fail (element, FALSE);
-
- element->transit_type = type;
-
- return TRUE;
-}
-
-EXPORT_API gchar *location_route_element_get_transit_type_name(const LocationRoadElement *element)
-{
- g_return_val_if_fail (element, NULL);
-
- return element->transit_type_name;
-}
-
-EXPORT_API gboolean location_route_element_set_transit_type_name(LocationRoadElement *element, const gchar *type_name)
-{
- g_return_val_if_fail (element, FALSE);
-
- if (element->transit_type_name) {
- g_free(element->transit_type_name);
- element->transit_type_name = NULL;
- }
-
- if (type_name) {
- element->transit_type_name = g_strdup(type_name);
- }
-
- return TRUE;
-}
-
-EXPORT_API guint location_route_element_get_transit_departure_time(const LocationRoadElement *element)
-{
- g_return_val_if_fail (element, 0);
-
- return element->transit_departure_time;
-}
-
-EXPORT_API gboolean location_route_element_set_transit_departure_time(LocationRoadElement *element, guint departure_time)
-{
- g_return_val_if_fail (element, FALSE);
- g_return_val_if_fail (departure_time >= 0, FALSE);
-
- element->transit_departure_time = departure_time;
-
- return TRUE;
-}
-
-EXPORT_API guint location_route_element_get_transit_arrival_time(const LocationRoadElement *element)
-{
- g_return_val_if_fail (element, 0);
-
- return element->transit_arrival_time;
-}
-
-EXPORT_API gboolean location_route_element_set_transit_arrival_time(LocationRoadElement *element, guint arrival_time)
-{
- g_return_val_if_fail (element, FALSE);
- g_return_val_if_fail (arrival_time >= 0, FALSE);
-
- element->transit_arrival_time = arrival_time;
-
- return TRUE;
-}
-
-EXPORT_API LocationRouteTransitStop *location_route_element_get_transit_departure_station(const LocationRoadElement *element)
-{
- g_return_val_if_fail (element, NULL);
-
- return element->transit_departure_station;
-}
-
-EXPORT_API gboolean location_route_element_set_transit_departure_station(LocationRoadElement *element, const LocationRouteTransitStop *departure_stop)
-{
- g_return_val_if_fail (element, FALSE);
-
- if (element->transit_departure_station) {
- location_route_transit_stop_free(element->transit_departure_station);
- }
-
- if (departure_stop) {
- element->transit_departure_station = location_route_transit_stop_copy(departure_stop);
- }
-
- return TRUE;
-}
-
-EXPORT_API LocationRouteTransitStop *location_route_element_get_transit_arrival_station(const LocationRoadElement *element)
-{
- g_return_val_if_fail (element, NULL);
-
- return element->transit_arrival_station;
-}
-
-EXPORT_API gboolean location_route_element_set_transit_arrival_station(LocationRoadElement *element, const LocationRouteTransitStop *arrival_stop)
-{
- g_return_val_if_fail (element, FALSE);
-
- if (element->transit_arrival_station) {
- location_route_transit_stop_free(element->transit_arrival_station);
- }
-
- if (arrival_stop) {
- element->transit_arrival_station = location_route_transit_stop_copy(arrival_stop);
- }
-
- return TRUE;
-}
-
-EXPORT_API gint location_route_element_penalty_get_id(const LocationRoadElementPenalty *penalty)
-{
- g_return_val_if_fail(penalty, 0);
-
- return penalty->id;
-}
-
-EXPORT_API gboolean location_route_element_penalty_set_id(LocationRoadElementPenalty *penalty, gint id)
-{
- g_return_val_if_fail(penalty, FALSE);
-
- penalty->id = id;
- return TRUE;
-}
-
-EXPORT_API DrivingDirection location_route_element_penalty_get_direction(const LocationRoadElementPenalty *penalty)
-{
- g_return_val_if_fail(penalty, 0);
-
- return penalty->direction;
-}
-
-EXPORT_API gboolean location_route_element_penalty_set_direction(LocationRoadElementPenalty *penalty, DrivingDirection direction)
-{
- g_return_val_if_fail(penalty, FALSE);
-
- penalty->direction = direction;
- return TRUE;
-}
-
-EXPORT_API guint location_route_element_penalty_get_penalty(const LocationRoadElementPenalty *penalty)
-{
- g_return_val_if_fail(penalty, 0);
-
- return penalty->penalty;
-}
-
-EXPORT_API gboolean location_route_element_penalty_set_penalty(LocationRoadElementPenalty *penalty, guint penalty_value)
-{
- g_return_val_if_fail(penalty, FALSE);
-
- penalty->penalty = penalty_value;
- return TRUE;
-}
-
-EXPORT_API guint location_route_element_penalty_get_speed(const LocationRoadElementPenalty *penalty)
-{
- g_return_val_if_fail(penalty, 0);
-
- return penalty->speed;
-}
-
-EXPORT_API gboolean location_route_element_penalty_set_speed(LocationRoadElementPenalty *penalty, guint speed)
-{
- g_return_val_if_fail(penalty, FALSE);
-
- penalty->speed = speed;
- return TRUE;
-}
-
-EXPORT_API guint location_route_element_penalty_get_validity_start_time(const LocationRoadElementPenalty *penalty)
-{
- g_return_val_if_fail(penalty, -1);
-
- return penalty->validity_start_time;
-}
-
-EXPORT_API gboolean location_route_element_penalty_set_validity_start_time(LocationRoadElementPenalty *penalty, guint validity_start_time)
-{
- g_return_val_if_fail(penalty, FALSE);
-
- penalty->validity_start_time = validity_start_time;
- return TRUE;
-}
-
-EXPORT_API guint location_route_element_penalty_get_validity_end_time(const LocationRoadElementPenalty *penalty)
-{
- g_return_val_if_fail(penalty, -1);
-
- return penalty->validity_end_time;
-}
-
-EXPORT_API gboolean location_route_element_penalty_set_validity_end_time(LocationRoadElementPenalty *penalty, guint validity_end_time)
-{
- g_return_val_if_fail(penalty, FALSE);
-
- penalty->validity_end_time = validity_end_time;
- return TRUE;
-}
-
-EXPORT_API gboolean location_route_lane_is_on_route(const LocationRouteLaneInfo *lane)
-{
- g_return_val_if_fail(lane, FALSE);
-
- return lane->is_on_route;
-}
-
-EXPORT_API gboolean location_route_lane_set_is_on_route(LocationRouteLaneInfo *lane, gboolean on_route)
-{
- g_return_val_if_fail(lane, FALSE);
-
- lane->is_on_route = on_route;
- return TRUE;
-}
-
-EXPORT_API DIRECTION location_route_lane_get_directions(const LocationRouteLaneInfo *lane)
-{
- g_return_val_if_fail(lane, DIRECTION_UNKNOWN);
-
- return lane->travel_direction;
-}
-
-EXPORT_API gboolean location_route_lane_set_directions(LocationRouteLaneInfo *lane, DIRECTION direction)
-{
- g_return_val_if_fail(lane, FALSE);
-
- lane->travel_direction = direction;
- return TRUE;
-}
-
-EXPORT_API LocationRouteOptions *location_route_pref_get_options (const LocationRoutePreference *pref)
-{
- g_return_val_if_fail(pref, NULL);
-
- return pref->options;
-}
-
-EXPORT_API gboolean location_route_pref_set_options (LocationRoutePreference *pref, const LocationRouteOptions *options)
-{
- g_return_val_if_fail(pref, FALSE);
-
- if (pref->options) {
- location_route_options_free(pref->options);
- pref->options = NULL;
- }
-
- if (options) {
- pref->options = location_route_options_copy(options);
- }
-
- return TRUE;
-}
-
-EXPORT_API GList *location_route_options_get_road_element_penalty(const LocationRouteOptions *options)
-{
- g_return_val_if_fail(options, NULL);
-
- return options->road_element_penalty_list;
-}
-static void route_options_road_element_penalty_copy_cb(gpointer data, gpointer user_data)
-{
- g_return_if_fail (data);
- g_return_if_fail (user_data);
-
- LocationRoadElementPenalty *penalty = (LocationRoadElementPenalty *)data;
- LocationRouteOptions *options = (LocationRouteOptions *) user_data;
-
- LocationRoadElementPenalty *penalty_copy = location_route_element_penalty_copy(penalty);
- options->road_element_penalty_list = g_list_append (options->road_element_penalty_list, penalty_copy);
-}
-
-EXPORT_API gboolean location_route_options_set_road_element_penalty(LocationRouteOptions *options, GList *penalty)
-{
- g_return_val_if_fail(options, FALSE);
-
- if (options->road_element_penalty_list) {
- g_list_free_full (options->road_element_penalty_list, (GDestroyNotify)location_route_element_penalty_free);
- options->road_element_penalty_list = NULL;
- }
-
- if (penalty) {
- g_list_foreach (penalty, route_options_road_element_penalty_copy_cb, options);
- }
-
- return TRUE;
-}
-
-EXPORT_API gboolean location_route_options_set_start_direction(LocationRouteOptions *options, guint dirInDegrees)
-{
- g_return_val_if_fail(options, FALSE);
-
- options->start_direction = dirInDegrees;
- return TRUE;
-}
-
-EXPORT_API guint location_route_options_get_start_direction(const LocationRouteOptions *options)
-{
- g_return_val_if_fail(options, 0);
-
- return options->start_direction;
-}
-
-EXPORT_API gboolean location_route_options_set_walk_time_multiplier(LocationRouteOptions *options, gfloat val)
-{
- g_return_val_if_fail(options, FALSE);
-
- options->walk_time_multiplier = val;
- return TRUE;
-}
-
-EXPORT_API gfloat location_route_options_get_walk_time_multiplier(const LocationRouteOptions *options)
-{
- g_return_val_if_fail(options, 0);
-
- return options->walk_time_multiplier;
-}
-
-EXPORT_API gboolean location_route_options_set_minimum_change_time(LocationRouteOptions *options, guint minutes)
-{
- g_return_val_if_fail(options, FALSE);
-
- options->minimum_change_time = minutes;
- return TRUE;
-}
-
-EXPORT_API guint location_route_options_get_minimum_change_time(const LocationRouteOptions *options)
-{
- g_return_val_if_fail(options, 0);
-
- return options->minimum_change_time;
-}
-
-EXPORT_API gboolean location_route_options_set_transit_type_allowed(LocationRouteOptions *options, TransitType type, gboolean allow)
-{
- g_return_val_if_fail(options, FALSE);
-
- if (allow == TRUE) {
- options->transit_type_allowed[type] = 1;
- } else {
- options->transit_type_allowed[type] = 0;
- }
-
- return TRUE;
-}
-
-EXPORT_API gboolean location_route_options_is_transit_type_allowed(const LocationRouteOptions *options, TransitType type)
-{
- g_return_val_if_fail(options, FALSE);
-
- return options->transit_type_allowed[type];
-}
-
-EXPORT_API gboolean location_route_options_set_maximum_changes(LocationRouteOptions *options, guint changes)
-{
- g_return_val_if_fail(options, FALSE);
-
- options->maximum_changes = changes;
- return TRUE;
-}
-
-EXPORT_API guint location_route_options_get_maximum_changes(const LocationRouteOptions *options)
-{
- g_return_val_if_fail(options, 0);
-
- return options->maximum_changes;
-}
-
-EXPORT_API gboolean location_route_options_set_departure_time(LocationRouteOptions *options, guint departure_time)
-{
- g_return_val_if_fail(options, FALSE);
-
- options->departure_time = departure_time;
- return TRUE;
-}
-
-EXPORT_API guint location_route_options_get_departure_time(LocationRouteOptions *options)
-{
- g_return_val_if_fail(options, 0);
-
- return options->departure_time;
-}
-
-EXPORT_API gboolean location_route_options_set_arrival_time(LocationRouteOptions *options, guint arrival_time)
-{
- g_return_val_if_fail(options, FALSE);
-
- options->arrival_time = arrival_time;
- return TRUE;
-}
-
-EXPORT_API guint location_route_options_get_arrival_time(LocationRouteOptions *options)
-{
- g_return_val_if_fail(options, 0);
-
- return options->arrival_time;
-}
-
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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 __LOCATION_ROUTE_H__
-#define __LOCATION_ROUTE_H__
-
-#include <location-map-types.h>
-
-G_BEGIN_DECLS
-
-/**
- * @file location-route.h
- * @brief This file contains the internal definitions and structures related to Route.
- */
-
-/**
- * @addtogroup LocationMapService
- * @{
- * @defgroup LocationMapServiceRoute Location Route
- * @brief This is a Location Route for providing location map services.
- * @addtogroup LocationMapServiceRoute
- * @{
- */
-
-/**
- * @brief Create a new Location route preference
- * @remarks None.
- * @pre #location_init should be called before.\n
- * @post None.
- * @return a #LocationRoutePreference
- * @retval NULL if error occured
- * @see location_route_pref_free
- */
-LocationRoutePreference *location_route_pref_new (void);
-
-/**
- * @brief Copy Location route preference
- * @remarks None.
- * @pre #location_init should be called before.\n
- * @post None.
- * @param [in] pref - a #LocationRoutePreference
- * @return a new #LocationRoutePreference
- * @retval NULL if error occured
- */
-LocationRoutePreference *location_route_pref_copy (const LocationRoutePreference *pref);
-
-/**
- * @brief Free Location route preference
- * @remarks None.
- * @pre #location_init should be called before.\n
- * @post None.
- * @param [in] pref - a #LocationRoutePreference
- * @see location_route_pref_new
- * @return None
- * @retval None
- */
-void location_route_pref_free (LocationRoutePreference * pref);
-
-/**
- * @brief Get a list of address structures to be avoided in Location route preference
- * @remarks The service provider should support route service.
- * @pre #location_route_pref_new should be called before.
- * @post None.
- * @param [in] pref - a #LocationRoutePreference
- * @return GList
- * @retval list of #LocationAddress
- * @see location_route_pref_set_addr_to_avoid
- */
-GList *location_route_pref_get_addr_to_avoid (const LocationRoutePreference *pref);
-
-/**
- * @brief Get a list of area to be avoided in Location route preference
- * @remarks The service provider should support route service.
- * @pre #location_route_pref_new should be called before.
- * @post None.
- * @param [in] pref - a #LocationRoutePreference
- * @return GList
- * @retval list of #LocationBoundary
- * @see location_route_pref_set_area_to_avoid
- */
-GList *location_route_pref_get_area_to_avoid (const LocationRoutePreference *pref);
-
-/**
- * @brief Get a list of features to be avoided in Location route preference
- * @remarks The service provider should support route service.
- * @pre #location_route_pref_new should be called before.
- * @post None.
- * @param [in] pref - a #LocationRoutePreference
- * @return GList
- * @retval list of gchar
- * @see location_route_pref_set_feature_to_avoid
- */
-GList *location_route_pref_get_feature_to_avoid (const LocationRoutePreference *pref);
-
-/**
- * @brief Get a list of freeformed address to be avoided in Location route preference
- * @remarks The service provider should support route service.
- * @pre #location_route_pref_new should be called before.
- * @post None.
- * @param [in] pref - a #LocationRoutePreference
- * @return GList
- * @retval list of gchar
- * @see location_route_pref_set_freeformed_to_avoid
- */
-GList *location_route_pref_get_freeformed_addr_to_avoid (const LocationRoutePreference *pref);
-
-/**
- * @brief Get a list of bounding box to be avoided in Location route preference
- * @remarks The service provider should support route service.
- * @pre #location_route_pref_new should be called before.
- * @post None.
- * @param [in] pref - a #LocationRoutePreference
- * @return #LocationBoundary
- * @retval bounding box
- * @see location_route_pref_set_addr_to_avoid
- */
-LocationBoundary *location_route_pref_get_bounding_box (const LocationRoutePreference *pref);
-
-/**
- * @brief Get a maximum number of matches returned from route service provider
- * @remarks The service provider should support route service.
- * @pre #location_route_pref_new should be called before.
- * @post None.
- * @param [in] pref - a #LocationRoutePreference
- * @return guint
- * @retval maximum number of matches
- * @see location_route_pref_set_max_result
- */
-guint location_route_pref_get_max_result (const LocationRoutePreference *pref);
-
-/**
- * @brief Get a route type to be used in route service
- * @remarks The service provider should support route service.
- * @pre #location_route_pref_new should be called before.
- * @post None.
- * @param [in] pref - a #LocationRoutePreference
- * @return gchar
- * @retval route type
- * @see location_route_pref_set_route_type
- */
-gchar *location_route_pref_get_route_type (const LocationRoutePreference *pref);
-
-/**
- * @brief Get a transport mode to be used in route service
- * @remarks The service provider should support route service.
- * @pre #location_route_pref_new should be called before.
- * @post None.
- * @param [in] pref - a #LocationRoutePreference
- * @return gchar
- * @retval transport mode
- * @see location_route_pref_set_transport_mode
- */
-gchar *location_route_pref_get_transport_mode (const LocationRoutePreference *pref);
-
-/**
- * @brief Get whether the route service provider must provide the route geometry in the service requests
- * @remarks The service provider should support route service.
- * @pre #location_route_pref_new should be called before.
- * @post None.
- * @param [in] pref - a #LocationRoutePreference
- * @return gboolean
- * @retval TRUE if used
- * @see location_route_pref_set_geometry_used
- */
-gboolean location_route_pref_get_geometry_used (const LocationRoutePreference *pref);
-/**
- * @brief Get whether the route service provider must provide the route instruction bounding box in the service requests
- * @remarks The service provider should support route service.
- * @pre #location_route_pref_new should be called before.
- * @post None.
- * @param [in] pref - a #LocationRoutePreference
- * @return gboolean
- * @retval TRUE if used
- * @see location_route_pref_set_instruction_bounding_box_used
- */
-gboolean location_route_pref_get_instruction_bounding_box_used (const LocationRoutePreference *pref);
-/**
- * @brief Get whether the route service provider must provide the route geometry in the service requests
- * @remarks The service provider should support route service.
- * @pre #location_route_pref_new should be called before.
- * @post None.
- * @param [in] pref - a #LocationRoutePreference
- * @return gboolean
- * @retval TRUE if used
- * @see location_route_pref_set_instruction_geometry_used
- */
-gboolean location_route_pref_get_instruction_geometry_used (const LocationRoutePreference *pref);
-
-/**
- * @brief Get whether the route service provider must provide the route instruction in the service requests
- * @remarks The service provider should support route service.
- * @pre #location_route_pref_new should be called before.
- * @post None.
- * @param [in] pref - a #LocationRoutePreference
- * @return gboolean
- * @retval TRUE if used
- * @see location_route_pref_set_instruction_used
- */
-gboolean location_route_pref_get_instruction_used (const LocationRoutePreference *pref);
-/**
- * @brief Get whether the route service provider must provide traffic data in the service requests
- * @remarks The service provider should support route service.
- * @pre #location_route_pref_new should be called before.
- * @post None.
- * @param [in] pref - a #LocationRoutePreference
- * @return gboolean
- * @retval TRUE if used
- * @see location_route_pref_set_traffic_data_used
- */
-gboolean location_route_pref_get_traffic_data_used (const LocationRoutePreference *pref);
-/**
- * @brief Get a list of Property Keys in #LocationRoutePreference
- * @remarks The service provider should support route service.
- * @pre #location_route_pref_new should be called before.
- * @post None.
- * @param [in] pref - a #LocationRoutePreference
- * @return GList
- * @retval list of property key
- */
-GList *location_route_pref_get_property_key (const LocationRoutePreference *pref);
-/**
- * @brief Get Property value in #LocationRoutePreference
- * @remarks The service provider should support route service.
- * @pre #location_route_pref_new should be called before.
- * @post None.
- * @param [in] pref - a #LocationRoutePreference
- * @return GList
- * @retval property value
- * @see location_route_pref_set_property
- */
-gpointer location_route_pref_get_property (const LocationRoutePreference *pref, gconstpointer key);
-
-/**
- * @brief Set a list of address structures to be avoided in #LocationRoutePreference
- * @remarks The service provider should support route service.
- * @pre #location_route_pref_new should be called before.
- * @post None.
- * @param [in] pref - a #LocationRoutePreference
- * @param [in] addr - a list of #LocationAddress
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_pref_get_addr_to_avoid
- */
-gboolean location_route_pref_set_addr_to_avoid (LocationRoutePreference * pref, GList *addr);
-
-/**
- * @brief Set a list of area to be avoided in Location route preference
- * @remarks The service provider should support route service.
- * @pre #location_route_pref_new should be called before.
- * @post None.
- * @param [in] pref - a #LocationRoutePreference
- * @param [in] area - a list of #LocationBoundary
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_pref_get_area_to_avoid
- */
-gboolean location_route_pref_set_area_to_avoid (LocationRoutePreference * pref, GList *area);
-
-/**
- * @brief Set a list of features to be avoided in Location route preference
- * @remarks The service provider should support route service.
- * @pre #location_route_pref_new should be called before.
- * @post None.
- * @param [in] pref - a #LocationRoutePreference
- * @param [in] feature - a list of features
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_pref_get_feature_to_avoid
- */
-gboolean location_route_pref_set_feature_to_avoid (LocationRoutePreference * pref, GList * feature);
-
-/**
- * @brief Set a list of freeformed address to be avoided in Location route preference
- * @remarks The service provider should support route service.
- * @pre #location_route_pref_new should be called before.
- * @post None.
- * @param [in] pref - a #LocationRoutePreference
- * @param [in] addr - a list of #gchar
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_pref_get_freeformed_addr_to_avoid
- */
-gboolean location_route_pref_set_freeformed_addr_to_avoid (LocationRoutePreference *pref, GList * freeformed_addr);
-
-/**
- * @brief Set a bounding box #LocationBoundary in Location route preference
- * @remarks The service provider should support route service.
- * @pre #location_route_pref_new should be called before.
- * @post None.
- * @param [in] pref - a #LocationRoutePreference
- * @param [in] bbox - a #LocationBoundary
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_pref_get_bounding_box
- */
-gboolean location_route_pref_set_bounding_box (LocationRoutePreference *pref, const LocationBoundary *boundary);
-
-/**
- * @brief Set a maximum number of matches returned from route service provider
- * @remarks The service provider should support route service.
- * @pre #location_route_pref_new should be called before.
- * @post None.
- * @param [in] pref - a #LocationRoutePreference
- * @param [in] max_num - a #gint
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_pref_set_max_result
- */
-gboolean location_route_pref_set_max_result (LocationRoutePreference *pref, guint max_num);
-
-/**
- * @brief Set a route type to be used in route service
- * @remarks The service provider should support route service.
- * @pre #location_route_pref_new should be called before.
- * @post None.
- * @param [in] pref - a #LocationRoutePreference
- * @param [in] type - a #gchar
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_pref_get_route_type
- */
-gboolean location_route_pref_set_route_type (LocationRoutePreference *pref, const gchar *type);
-
-/**
- * @brief Set a transport mode to be used in route service
- * @remarks The service provider should support route service.
- * @pre #location_route_pref_new should be called before.
- * @post None.
- * @param [in] pref - a #LocationRoutePreference
- * @param [in] mode - a #gchar
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_pref_get_transport_mode
- */
-gboolean location_route_pref_set_transport_mode (LocationRoutePreference *pref, const gchar * mode);
-
-/**
- * @brief Set whether the route service provider must provide the route geometry in the service requests
- * @remarks The service provider should support route service.
- * @pre #location_route_pref_new should be called before.
- * @post None.
- * @param [in] pref - a #LocationRoutePreference
- * @param [in] is_used - a #gboolean
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_pref_get_geometry_used
- */
-gboolean location_route_pref_set_geometry_used (LocationRoutePreference *pref, gboolean is_used);
-
-/**
- * @brief Set whether the route service provider must provide the route instruction bounding box in the service requests
- * @remarks The service provider should support route service.
- * @pre #location_route_pref_new should be called before.
- * @post None.
- * @param [in] pref - a #LocationRoutePreference
- * @param [in] is_used - a #gboolean
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_pref_get_instruction_bounding_box_used
- */
-gboolean location_route_pref_set_instruction_bounding_box_used (LocationRoutePreference *pref, gboolean is_used);
-
-/**
- * @brief Set whether the route service provider must provide the route geometry in the service requests
- * @remarks The service provider should support route service.
- * @pre #location_route_pref_new should be called before.
- * @post None.
- * @param [in] pref - a #LocationRoutePreference
- * @param [in] is_used - a #gboolean
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_pref_get_instruction_geometry_used
- */
-gboolean location_route_pref_set_instruction_geometry_used (LocationRoutePreference *pref, gboolean is_used);
-
-/**
- * @brief Set whether the route service provider must provide the route instruction in the service requests
- * @remarks The service provider should support route service.
- * @pre #location_route_pref_new should be called before.
- * @post None.
- * @param [in] pref - a #LocationRoutePreference
- * @param [in] is_used - a #gboolean
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_pref_get_instruction_used
- */
-gboolean location_route_pref_set_instruction_used (LocationRoutePreference *pref, gboolean is_used);
-
-/**
- * @brief Set whether the route service provider must provide traffic data in the service requests
- * @remarks The service provider should support route service.
- * @pre #location_route_pref_new should be called before.
- * @post None.
- * @param [in] pref - a #LocationRoutePreference
- * @param [in] is_used - a #gboolean
- * @return #gboolean
- * @retval TRUE if success
- * @see location_route_pref_get_traffic_data_used
- */
-gboolean location_route_pref_set_traffic_data_used (LocationRoutePreference *pref, gboolean is_used);
-
-/**
- * @brief Set Property in Location route proference
- * @remarks The service provider should support route service.
- * @pre #location_route_pref_new should be called before.
- * @post None.
- * @param [in] pref - a #LocationRoutePreference
- * @param [in] key - a #gconstpointer
- * @param [in] value - a #gconstpointer
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_pref_get_property
- */
-gboolean location_route_pref_set_property (LocationRoutePreference *pref, gconstpointer key, gconstpointer value);
-
-/**
- * @defgroup LocationMapServiceRouteResult Location Route Result
- * @brief This provides structure, enumeration and APIs for Route Result
- * @addtogroup LocationMapServiceRouteResult
- * @{
- */
-/**
- * @brief Create a new Location route
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @return #LocationRoute
- * @retval a new location route
- * @see location_route_free
- */
-LocationRoute *location_route_new (void);
-/**
- * @brief Copy Location route
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] route - a #LocationRoute
- * @return #LocationRoute
- * @retval a copied location route
- */
-LocationRoute *location_route_copy (const LocationRoute *route);
-
-/**
- * @brief Free #LocationRoute
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] route - a #LocationRoute
- * @return void
- * @retval None
- */
-void location_route_free (LocationRoute *route);
-
-/**
- * @brief Get the origin of Location route
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] route - a #LocationRoute
- * @return #Location position
- * @retval origin
- * @see location_route_set_origin
- */
-LocationPosition *location_route_get_origin (const LocationRoute *route);
-
-/**
- * @brief Get the destination of Location route
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] route - a #LocationRoute
- * @return #LocationPosition
- * @retval destination
- * @see location_route_set_destination
- */
-LocationPosition *location_route_get_destination (const LocationRoute *route);
-
-/**
- * @brief Get the bounding box of Location route
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] route - a #LocationRoute
- * @return #LocationBoundary
- * @retval bounding box
- * @see location_route_set_bounding box
- */
-LocationBoundary *location_route_get_bounding_box (const LocationRoute *route);
-
-/**
- * @brief Get the total distance of Location route
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] route - a #LocationRoute
- * @return gdouble
- * @retval total distance
- * @see location_route_set_total_distance
- */
-gdouble location_route_get_total_distance (const LocationRoute *route);
-
-/**
- * @brief Get the distance unit of Location route
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] route - a #LocationRoute
- * @return gchar
- * @retval distance unit
- * @see location_route_set_distance_unit
- */
-gchar *location_route_get_distance_unit (const LocationRoute *route);
-
-/**
- * @brief Get the total duration of location route
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] route - a #LocationRoute
- * @return glong
- * @retval total duration
- * @see location_route_set_total_duration
- */
-glong location_route_get_total_duration (const LocationRoute *route);
-
-/**
- * @brief Get the list of property key of Location route
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] route - a #LocationRoute
- * @return GList
- * @retval list of property keys
- * @see location_route_set_property
- */
-GList *location_route_get_property_key (const LocationRoute *route);
-
-/**
- * @brief Get the property value of Location route
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] route - a #LocationRoute
- * @return gconstpointer
- * @retval property
- * @see location_route_set_property
- */
-gpointer location_route_get_property (const LocationRoute *route, gconstpointer key);
-
-/**
- * @brief Get the list of segments in Location route
- * @remarks The service provider should support route service.
- * @post None.
- * @pre None.
- * @param [in] route - a #LocationRoute
- * @return GList
- * @retval list of #LocationRouteSegment
- * @see location_route_set_route_segment
- */
-GList *location_route_get_route_segment (const LocationRoute *route);
-
-/**
- * @brief Create a new Location route segment
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @return #LocationPositionSegment
- * @retval Location route segment
- * @see location_route_segment_free
- */
-LocationRouteSegment *location_route_segment_new (void);
-
-/**
- * @brief Copy Location route segment
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] segment - a #LocationRouteSegment
- * @return #LocationRouteSegment
- * @retval copied Location route segment
- */
-LocationRouteSegment *location_route_segment_copy (LocationRouteSegment *segment);
-
-/**
- * @brief Free Location route segment
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] segment - a #LocationRouteSegment
- * @return void
- * @retval None.
- * @see location_route_segment_new
- */
-void location_route_segment_free (LocationRouteSegment *segment);
-
-/**
- * @brief Get the start point #LocationPosition of #LocationRouteSegment
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] segment - a #LocationRouteSegment
- * @return void
- * @retval None.
- * @see location_route_segment_set_start_point
- */
-LocationPosition *location_route_segment_get_start_point (const LocationRouteSegment *segment);
-
-/**
- * @brief Get the end point #LocationPosition of #LocationRouteSegment
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] segment - a #LocationRouteSegment
- * @return void
- * @retval None.
- * @see location_route_segment_set_end_point
- */
-LocationPosition *location_route_segment_get_end_point (const LocationRouteSegment *segment);
-
-/**
- * @brief Get the bounding box #LocationBoundary of #LocationRouteSegment
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] segment - a #LocationRouteSegment
- * @return void
- * @retval None.
- * @see location_route_segment_set_bounding_box
- */
-LocationBoundary *location_route_segment_get_bounding_box (const LocationRouteSegment *segment);
-
-/**
- * @brief Get the distance of #LocationRouteSegment
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] segment - a #LocationRouteSegment
- * @return void
- * @retval None.
- * @see location_route_segment_set_distance
- */
-gdouble location_route_segment_get_distance (const LocationRouteSegment *segment);
-
-/**
- * @brief Get the duration #LocationRouteSegment
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] segment - a #LocationRouteSegment
- * @return void
- * @retval None.
- * @see location_route_segment_set_duration
- */
-glong location_route_segment_get_duration (const LocationRouteSegment *segment);
-
-/**
- * @brief Get the list of property keys of #LocationRouteSegment
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] segment - a #LocationRouteSegment
- * @return void
- * @retval None.
- * @see location_route_segment_set_property_key
- */
-GList *location_route_segment_get_property_key (const LocationRouteSegment *segment);
-
-/**
- * @brief Get the property value of #LocationRouteSegment
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] segment - a #LocationRouteSegment
- * @return void
- * @retval None.
- * @see location_route_segment_set_property
- */
-gpointer location_route_segment_get_property (const LocationRouteSegment *segment, gconstpointer key);
-
-/**
- * @brief Get the list of route steps #LocationRouteStep in #LocationRouteSegment
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] segment - a #LocationRouteSegment
- * @return void
- * @retval None.
- * @see location_route_segment_set_route_step
- */
-GList *location_route_segment_get_route_step (const LocationRouteSegment *segment);
-
-/**
- * @brief Create a new #LocationRouteStep
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param None.
- * @return #LocationRouteStep
- * @retval route step
- * @see location_route_step_free
- */
-LocationRouteStep *location_route_step_new (void);
-
-/**
- * @brief Copy #LocationRouteStep
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRouteStep
- * @return #LocationRouteStep
- * @retval route step
- * @see location_route_step_new
- */
-LocationRouteStep *location_route_step_copy (LocationRouteStep *step);
-
-/**
- * @brief Free #LocationRouteStep
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRouteStep
- * @return void
- * @retval None
- * @see location_route_step_new
- */
-void location_route_step_free (LocationRouteStep *step);
-
-/**
- * @brief Get the start point #LocationPosition of #LocationRouteStep
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRouteStep
- * @return #LocationPosition
- * @retval start point
- * @see location_route_step_set_start_point
- */
-LocationPosition *location_route_step_get_start_point (const LocationRouteStep *step);
-
-/**
- * @brief Get the end point #LocationPosition of #LocationRouteStep
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRouteStep
- * @return #LocationPosition
- * @retval end point
- * @see location_route_step_set_end_point
- */
-LocationPosition *location_route_step_get_end_point (const LocationRouteStep *step);
-
-/**
- * @brief Get the bounding box #LocationBoundary of #LocationRouteStep
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRouteStep
- * @return #LocationBoundary
- * @retval bounding box
- * @see location_route_step_set_bounding_box
- */
-LocationBoundary *location_route_step_get_bounding_box (const LocationRouteStep *step);
-
-/**
- * @brief Get the distance of #LocationRouteStep
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRouteStep
- * @return gboolean
- * @retval distance
- * @see location_route_step_set_distance
- */
-gdouble location_route_step_get_distance (const LocationRouteStep *step);
-
-/**
- * @brief Get the duration of #LocationRouteStep
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRouteStep
- * @return glong
- * @retval duration
- * @see location_route_step_set_duration
- */
-glong location_route_step_get_duration (const LocationRouteStep *step);
-
-/**
- * @brief Get the transport mode of #LocationRouteStep
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRouteStep
- * @return gchar
- * @retval transport mode
- * @see location_route_step_set_transport_mode
- */
-gchar *location_route_step_get_transport_mode (const LocationRouteStep *step);
-
-/**
- * @brief Get the instruction of #LocationRouteStep
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRouteStep
- * @return gchar
- * @retval instruction
- * @see location_route_step_set_instruction
- */
-gchar *location_route_step_get_instruction (const LocationRouteStep *step);
-
-/**
- * @brief Get the list of geometry #LocationPosition of #LocationRouteStep
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRouteStep
- * @return GList
- * @retval a list of LocationPosition
- * @see location_route_step_set_geometry
- */
-GList *location_route_step_get_geometry (const LocationRouteStep *step);
-
-/**
- * @brief Get the list of property key of #LocationRouteStep
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRouteStep
- * @return GList
- * @retval a list of property key
- * @see location_route_step_set_property_key
- */
-GList *location_route_step_get_property_key (const LocationRouteStep *step);
-
-/**
- * @brief Get the property value of #LocationRouteStep
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRouteStep
- * @param [in] key - a gconstpointer
- * @return gpointer
- * @retval value
- * @see location_route_step_set_property
- */
-gpointer location_route_step_get_property (const LocationRouteStep *step, gconstpointer key);
-
-
-/**
- * @brief Create a new #LocationRouteLaneInfo
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param None.
- * @return #LocationRouteLaneInfo
- * @retval lane info
- * @see location_route_lane_info_free
- */
-LocationRouteLaneInfo *location_route_lane_info_new (void);
-
-/**
- * @brief Copy #LocationRouteLaneInfo
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] lane - a #road element lane
- * @return #LocationRouteLaneInfo
- * @retval lane info
- * @see location_route_lane_info_new
- */
-LocationRouteLaneInfo *location_route_lane_info_copy (const LocationRouteLaneInfo *lane);
-
-/**
- * @brief Free Location route lane info
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] lane - a #Location Route lone
- * @return void
- * @retval None.
- * @see location_route_lane_info_new
- */
-void location_route_lane_info_free (LocationRouteLaneInfo *lane);
-
-/**
- * @brief Create a new #LocationRouteManeuver
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param None.
- * @return #LocationRouteManeuver
- * @retval route maneuver
- * @see location_route_maneuver_free
- */
-LocationRouteManeuver *location_route_maneuver_new (void);
-
-/**
- * @brief Copy #LocationRouteManeuver
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] maneuver - a #Maneuver on a route
- * @return #LocationRouteLaneInfo
- * @retval route maneuver
- * @see location_route_maneuver_new
- */
-LocationRouteManeuver *location_route_maneuver_copy (const LocationRouteManeuver *maneuver);
-
-/**
- * @brief Free a maneuver on a route
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] maneuver - a #Maneuver on a route
- * @return void
- * @retval None.
- * @see location_route_lane_info_new
- */
-void location_route_maneuver_free (LocationRouteManeuver *maneuver);
-
-/**
- * @brief Create a new #LocationRouteTransitStop
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param None.
- * @return #LocationRouteTransitStop
- * @retval public transit
- * @see location_route_transit_stop_free
- */
-LocationRouteTransitStop *location_route_transit_stop_new (void);
-
-/**
- * @brief Copy #LocationRouteTransitStop
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] stop - a #stop public transit
- * @return #LocationRouteLaneInfo
- * @retval route maneuver
- * @see location_route_maneuver_new
- */
-LocationRouteTransitStop *location_route_transit_stop_copy (const LocationRouteTransitStop *stop);
-
-/**
- * @brief Free a stop on a public transit
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] stop - a #stop public transit
- * @return void
- * @retval None.
- * @see location_route_transit_stop_new
- */
-void location_route_transit_stop_free (LocationRouteTransitStop *stop);
-
-
-/**
- * @brief Create a new #LocationRoadElement
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param None.
- * @return #LocationRoadElement
- * @retval road element
- * @see location_route_road_element_free
- */
-LocationRoadElement *location_route_road_element_new (void);
-
-/**
- * @brief Copy #LocationRoadElement
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] road - a #road element on route
- * @return #LocationRouteLaneInfo
- * @retval road element
- * @see location_route_road_element_new
- */
-LocationRoadElement *location_route_road_element_copy (const LocationRoadElement *road);
-
-/**
- * @brief Free a stop on a road element
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] road - a #road element on route
- * @return void
- * @retval None.
- * @see location_route_road_element_new
- */
-void location_route_road_element_free (LocationRoadElement *road);
-
-/**
- * @brief Create a new #LocationRoadElementPenalty
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param None.
- * @return #LocationRoadElementPenalty
- * @retval road element penalty
- * @see location_route_element_penalty_free
- */
-LocationRoadElementPenalty *location_route_element_penalty_new (void);
-
-/**
- * @brief Copy #LocationRoadElementPenalty
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] penalty - a #penalty level about restricted roads and areas, traffic
- * information, and other data that can affect the routing calculation.
- * @return #LocationRouteLaneInfo
- * @retval road element
- * @see location_route_element_penalty_new
- */
-LocationRoadElementPenalty *location_route_element_penalty_copy (const LocationRoadElementPenalty *penalty);
-
-/**
- * @brief Free a stop on a road element
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] penalty - a #penalty level about restricted roads and areas, traffic
- * information, and other data that can affect the routing calculation
- * @return void
- * @retval None.
- * @see location_route_element_penalty_new
- */
-void location_route_element_penalty_free (LocationRoadElementPenalty *penalty);
-
-/**
- * @brief Create a new #location_route_options_new
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param None.
- * @return #LocationRouteOptions
- * @retval route options
- * @see location_route_options_free
- */
-LocationRouteOptions *location_route_options_new (void);
-
-/**
- * @brief Copy #LocationRouteOptions
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] penalty - #options on route
- * @return #LocationRouteOptions
- * @retval route options
- * @see location_route_element_penalty_new
- */
-LocationRouteOptions *location_route_options_copy (const LocationRouteOptions *options);
-
-/**
- * @brief Create a new #location_route_options_new
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param None.
- * @return #LocationRouteOptions
- * @retval route options
- * @see location_route_options_free
- */
-void location_route_options_free (LocationRouteOptions *options);
-
-/**
- * @brief Get the maneuver value of #LocationRouteManeuver
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRouteStep
- * @return gpointer
- * @retval value
- * @see location_route_step_set_maneuver
- */
-LocationRouteManeuver *location_route_step_get_maneuver (const LocationRouteStep *step);
-
-/**
- * @brief Set maneuver #LocationRouteManeuver in Location Route step
- * @remarks The service provider should support route service.
- * @pre #location_route_maneuver_new should be called before.
- * @post None.
- * @param [in] step - a #LocationRouteStep
- * @param [in] maneuver - a #LocationRouteManeuver
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_step_get_maneuver
- */
-gboolean location_route_step_set_maneuver (LocationRouteStep *step, const LocationRouteManeuver *maneuver);
-
-/**
- * @brief Get the distance from start of the route to the maneuver #LocationRouteManeuver
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] maneuver - a #LocationRouteManeuver
- * @return guint
- * @retval Distance from start in meters
- * @see location_route_maneuver_set_distance_from_start
- */
-guint location_route_maneuver_get_distance_from_start(const LocationRouteManeuver *maneuver);
-
-/**
- * @brief Get distance from previous maneuver on the route to the maneuver.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] maneuver - a #LocationRouteManeuver
- * @return guint
- * @retval Distance from previous maneuver in meters
- * @see location_route_maneuver_set_distance_from_start
- */
-guint location_route_maneuver_get_distance_from_previous_maneuver(const LocationRouteManeuver *maneuver);
-
-/**
- * @brief Get Name of the road this maneuver leads to.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] maneuver - a #LocationRouteManeuver
- * @return gchar pointer
- * @retval Name of the road
- * @see location_route_maneuver_set_next_road_name
- */
-gchar *location_route_maneuver_get_next_road_name(const LocationRouteManeuver *maneuver);
-
-/**
- * @brief Get action to take on the maneuver.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] maneuver - a #LocationRouteManeuver
- * @return gchar pointer
- * @retval Action to take on the maneuver
- * @see location_route_maneuver_set_action
- */
-gchar *location_route_maneuver_get_action(const LocationRouteManeuver *maneuver);
-
-/**
- * @brief Get turn to make on the maneuver.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] maneuver - a #LocationRouteManeuver
- * @return gchar pointer
- * @retval Turn to make on the maneuver
- * @see location_route_maneuver_set_turn
- */
-gchar *location_route_maneuver_get_turn(const LocationRouteManeuver *maneuver);
-
-/**
- * @brief Get traffic direction on the maneuver.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] maneuver - a #LocationRouteManeuver
- * @return gchar pointer
- * @retval TRAFFIC_DIR_LEFT, if left side traffic, TRAFFIC_DIR_RIGHT if right side traffic
- * @see location_route_maneuver_set_traffic_direction
- */
-TrafficDirection location_route_maneuver_get_traffic_direction(const LocationRouteManeuver *maneuver);
-
-/**
- * @brief Get the angle of the maneuver.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] maneuver - a #LocationRouteManeuver
- * @return guint
- * @retval the angle in degrees from end of the start road to the start of the end road
- * remarks angle has a value from 0, 360, north is up, clockwise
- * @see location_route_maneuver_set_angle
- */
-guint location_route_maneuver_get_angle(const LocationRouteManeuver *maneuver);
-
-/**
- * @brief Get the angle at the start of the maneuver.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] maneuver - a #LocationRouteManeuver
- * @return the angle in degrees. Zero is due north and angles increase clockwise
- * remarks angle has a value from 0, 360, north is up, clockwise
- * @retval guint
- * @see location_route_maneuver_set_start_angle
- */
-guint location_route_maneuver_get_start_angle(const LocationRouteManeuver *maneuver);
-
-/**
- * @brief Get the time at which the maneuver started.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] maneuver - a #LocationRouteManeuver
- * @return the time at which the maneuver started
- * @retval guint
- * @see location_route_maneuver_set_start_time
- */
-guint location_route_maneuver_get_start_time(const LocationRouteManeuver *maneuver);
-
-/**
- * @brief true if maneuver starts on a sliproad.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] maneuver - a #LocationRouteManeuver
- * @return true if maneuver starts on a sliproad
- * @retval TRUE if successmaneuver starts on a sliproad
- * @see
- */
-gboolean location_route_maneuver_is_starts_from_sliproad(const LocationRouteManeuver *maneuver);
-
-/**
- * @brief true if maneuver leads to a slip road. Sliproad is a road connecting highways to
- * normal roads.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] maneuver - a #LocationRouteManeuver
- * @return true if next road is sliproad
- * @retval TRUE if next road is sliproad
- * @see
- */
-gboolean location_route_maneuver_is_next_is_sliproad(const LocationRouteManeuver *maneuver);
-
-/**
- * @brief true if this maneuver is a roundabout taken in the direction opposite to the
- * normal vehicle traffic.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] maneuver - a #LocationRouteManeuver
- * @return true if this maneuver is a roundabout taken in the direction opposite to the normal vehicle traffic
- * @retval TRUE
- * @see
- */
-gboolean location_route_maneuver_is_counter_roundabout(const LocationRouteManeuver *maneuver);
-
-/**
- * @brief Get the lanes in location route Maneuver.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] maneuver - a #LocationRouteManeuver
- * @return GList
- * @retval GList
- * @see location_route_maneuver_set_lanes
- */
-GList *location_route_maneuver_get_lanes(const LocationRouteManeuver *maneuver);
-
-/**
- * @brief Set the lanes in location route Maneuver.
- * @remarks The service provider should support route service.
- * @pre #location_route_maneuver_new should be called before.
- * @post None.
- * @param [in] lanes - a #lanes list
- * @param [in] maneuver - a #LocationRouteManeuver
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_maneuver_get_lanes
- */
-gboolean location_route_maneuver_set_lanes(LocationRouteManeuver *maneuver, GList *lanes);
-
-/**
- * @brief Get the station name in location route Maneuver.
- * @remarks The service provider should support route service.
- * @pre #location_route_transit_stop_new should be called before.
- * @post None.
- * @param [in] stop - a #LocationRouteTransitStop
- * @return the stations names String e.g. "Potsdamer Platz".
- * @retval
- * @see location_route_transit_set_station_name
- */
-gchar *location_route_transit_get_station_name(const LocationRouteTransitStop *stop);
-
-/**
- * @brief Get the platform level in Location Route TransitStop.
- * @remarks The service provider should support route service.
- * @pre #location_route_transit_stop_new should be called before.
- * @post None.
- * @param [in] stop - a #LocationRouteTransitStop
- * @return the platform level
- * @retval Signed int e.g. <-1>.
- * @see location_route_transit_set_platform_level
- */
-gint location_route_transit_get_platform_level(const LocationRouteTransitStop *stop);
-
-/**
- * @brief Get the coordinates of the platform.
- * @remarks The service provider should support route service.
- * @pre #location_route_transit_stop_new should be called before.
- * @post None.
- * @param [in] stop - a #LocationRouteTransitStop
- * @return GeoCoordinates position of the platform
- * @retval
- * @see location_route_transit_set_platform_coordinates
- */
-LocationPosition *location_route_transit_get_platform_coordinates(const LocationRouteTransitStop *stop);
-
-/**
- * @brief Get the coordinates of the station entry/exit.
- * @remarks The service provider should support route service.
- * @pre #location_route_transit_stop_new should be called before.
- * @post None.
- * @param [in] stop - a #LocationRouteTransitStop
- * @return GeoCoordinates position of the entrance
- * @retval
- * @see location_route_transit_set_egress_coordinates
- */
-LocationPosition *location_route_transit_get_egress_coordinates(const LocationRouteTransitStop *stop);
-
-/**
- * @brief Get the road element location route step.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRouteStep
- * @return a #LocationRoadElement
- * @retval
- * @see location_route_step_set_road_element
- */
-LocationRoadElement *location_route_step_get_road_element (const LocationRouteStep *step);
-
-/**
- * @brief Set the road element location route step.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] element - a #LocationRoadElement
- * @param [in] step - a #LocationRouteStep
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_step_get_road_element
- */
-gboolean location_route_step_set_road_element (LocationRouteStep *step, const LocationRoadElement *element);
-
-/**
- * @brief Get the a member of the enumeration form of way .
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRoadElement
- * @return a #FormOfWay
- * @retval
- * @see location_route_element_set_form_of_way
- */
-FormOfWay location_route_element_get_form_of_way(const LocationRoadElement *step);
-
-/**
- * @brief Get the road element is plural, otherwise.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRoadElement
- * @return true if the road element is plural, otherwise
- * @retval
- * @see None
- */
-gboolean location_route_element_is_plural(const LocationRoadElement *step);
-
-/**
- * @brief Get the name of the road .
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRoadElement
- * @return name of the given road element
- * @retval
- * @see location_route_element_set_road_name
- */
-gchar *location_route_element_get_road_name(const LocationRoadElement *step);
-
-/**
- * @brief Get the name of the route to which the given road element belongs.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRoadElement
- * @return the name of the route
- * @retval
- * @see location_route_element_set_route_name
- */
-gchar *location_route_element_get_route_name(const LocationRoadElement *step);
-
-/**
- * @brief Get the value indicating the speed limit in meters per
-* second applicable to the given road element.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRoadElement
- * @return the speed limit in meters per second or 0 if the information is
- * not available.
- * @retval
- * @see location_route_element_set_speed_limit
- */
-gfloat location_route_element_get_speed_limit(const LocationRoadElement *step);
-
-/**
- * @brief Get the average speed in m/s .
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRoadElement
- * @return average speed in m/s or 0 if the information is not available
- * @retval
- * @see location_route_element_set_average_speed_m_s
- */
-guint location_route_element_get_average_speed_m_s(const LocationRoadElement *step);
-
-/**
- * @brief Get the value indicating the number of lanes in the given road element.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRoadElement
- * @return the number of lanes
- * @retval
- * @see location_route_element_set_number_of_lanes
- */
-guint location_route_element_get_number_of_lanes(const LocationRoadElement *step);
-
-/**
- * @brief checks the road is allowed only for pedestrians.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRoadElement
- * @return gboolean
- * @retval
- * @see None
- */
-gboolean location_route_element_road_element_is_pedestrian(const LocationRoadElement *step);
-
-/**
- * @brief checks if this road element is valid.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRoadElement
- * @return gboolean
- * @retval
- * @see None
- */
-gboolean location_route_element_road_element_is_valid(const LocationRoadElement *step);
-
-/**
- * @brief Get the start time of the road element.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRoadElement
- * @return start time of the road element
- * @retval
- * @see location_route_element_set_element_start_time
- */
-guint location_route_element_get_element_start_time(const LocationRoadElement *step);
-
-/**
- * @brief Get the travel time along the element.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRoadElement
- * @return travel time along the element, default speed is used.
- * @retval
- * @see location_route_element_set_element_travel_time
- */
-guint location_route_element_get_element_travel_time(const LocationRoadElement *step);
-
-/**
- * @brief Get the estimated time of arrival (ETA) and suggested departure time for the route.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRoadElement
- * @return the estimated time of arrival (ETA) and suggested departure time for the route.
- * @retval
- * @see location_route_element_set_eta_validity
- */
-RouteETAValidity location_route_element_get_eta_validity(const LocationRoadElement *step);
-
-/**
- * @brief Get the destination of this run.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRoadElement
- * @return return String e.g. "Hermannplatz".
- * @retval
- * @see location_route_element_set_transit_destination
- */
-gchar *location_route_element_get_transit_destination(const LocationRoadElement *step);
-
-/**
- * @brief Get the line name.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRoadElement
- * @return return String e.g. "U7".
- * @retval
- * @see location_route_element_set_transit_line_name
- */
-gchar *location_route_element_get_transit_line_name(const LocationRoadElement *step);
-
-/**
- * @brief Get name of the operator.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRoadElement
- * @return string e.g. "Berliner Verkehrsbetriebe"
- * @retval
- * @see location_route_element_set_system_official_name
- */
-gchar *location_route_element_get_system_official_name(const LocationRoadElement *step);
-
-/**
- * @brief Get the name of the operator in a shorter or abbreviated version
- * if available.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRoadElement
- * @return String e.g. "BVG".
- * @retval
- * @see location_route_element_set_system_short_name
- */
-gchar *location_route_element_get_system_short_name(const LocationRoadElement *step);
-
-/**
- * @brief Get the type of the line.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRoadElement
- * @return Enum e.g. <Subway>
- * @retval
- * @see location_route_element_set_transit_type
- */
-TransitType location_route_element_get_transit_type(const LocationRoadElement *step);
-
-/**
- * @brief Get the type of the line as a string in the public transit
- * operator's vocabulary.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRoadElement
- * @return String e.g. "S-Bahn"
- * @retval
- * @see location_route_element_set_transit_type_name
- */
-gchar *location_route_element_get_transit_type_name(const LocationRoadElement *step);
-
-/**
- * @brief Get the absolute departure time from the station, if available; otherwise
- * returns an invalid DateTime
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRoadElement
- * @return time
- * @retval
- * @see location_route_element_set_transit_departure_time
- */
-guint location_route_element_get_transit_departure_time(const LocationRoadElement *step);
-
-/**
- * @brief Get the absolute arrival time at the destination, if available; otherwise
- * returns an invalid DateTime.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRoadElement
- * @return time
- * @retval
- * @see location_route_element_set_transit_arrival_time
- */
-guint location_route_element_get_transit_arrival_time(const LocationRoadElement *step);
-
-/**
- * @brief Get departure station.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRoadElement
- * @return a #LocationRouteTransitStop
- * @retval
- * @see location_route_element_set_transit_departure_station
- */
-LocationRouteTransitStop *location_route_element_get_transit_departure_station(const LocationRoadElement *step);
-
-/**
- * @brief Get the arrival station.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] step - a #LocationRoadElement
- * @return a #LocationRouteTransitStop
- * @retval
- * @see location_route_element_set_transit_arrival_station
- */
-LocationRouteTransitStop *location_route_element_get_transit_arrival_station(const LocationRoadElement *step);
-
-/**
- * @brief Set departure station.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] arrival_stop - a #LocationRouteTransitStop
- * @param [in] step - a #LocationRoadElement
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_element_get_transit_arrival_station
- */
-gboolean location_route_element_set_transit_arrival_station(LocationRoadElement *step, const LocationRouteTransitStop *arrival_stop);
-
-/**
- * @brief Get the identifier of the penalty.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] penalty - a #LocationRoadElementPenalty
- * @return the identifier of the penalty
- * @retval
- * @see location_route_element_penalty_set_id
- */
-gint location_route_element_penalty_get_id(const LocationRoadElementPenalty *penalty);
-
-/**
- * @brief Set the identifier for the given penalty.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] id
- * @param [in] penalty - a #LocationRoadElementPenalty
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_element_penalty_get_id
- */
-gboolean location_route_element_penalty_set_id(LocationRoadElementPenalty *penalty, gint id);
-
-
-/**
- * @brief Get the driving direction associated with the penalty.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] penalty - a #LocationRoadElementPenalty
- * @return a #DrivingDirection
- * @retval
- * @see location_route_element_penalty_set_direction
- */
-DrivingDirection location_route_element_penalty_get_direction(const LocationRoadElementPenalty *penalty);
-
-/**
- * @brief Set the driving direction associated with the penalty.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] direction - a #DrivingDirection
- * @param [in] penalty - a #LocationRoadElementPenalty
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_element_penalty_get_direction
- */
-gboolean location_route_element_penalty_set_direction(LocationRoadElementPenalty *penalty, DrivingDirection direction);
-
-/**
- * @brief Get value of the penalty level.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] penalty - a #LocationRoadElementPenalty
- * @return an unsigned eight-bit integer value representing the penalty
- * level or INVALID_PENALTY
- * @retval
- * @see location_route_element_penalty_set_penalty
- */
-guint location_route_element_penalty_get_penalty(const LocationRoadElementPenalty *penalty);
-
-/**
- * @brief Set the value of the penalty level.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] penalty_value - a penalty value
- * @param [in] penalty - a #LocationRoadElementPenalty
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_element_penalty_get_penalty
- */
-gboolean location_route_element_penalty_set_penalty(LocationRoadElementPenalty *penalty, guint penalty_value);
-
-/**
- * @brief Get the speed.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] penalty - a #LocationRoadElementPenalty
- * @return An unsigned eight-bit integer representing the speed
- * @retval
- * @see location_route_element_penalty_set_speed
- */
-guint location_route_element_penalty_get_speed(const LocationRoadElementPenalty *penalty);
-
-/**
- * @brief Set the the speed.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] speed
- * @param [in] penalty - a #LocationRoadElementPenalty
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_element_penalty_get_speed
- */
-gboolean location_route_element_penalty_set_speed(LocationRoadElementPenalty *penalty, guint speed);
-
-/**
- * @brief Get timestamp indicating the time/date from which the penalty is in force.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] penalty - a #LocationRoadElementPenalty
- * @return timestamp indicating the time/date
- * @retval
- * @see location_route_element_penalty_set_validity_start_time
- */
-guint location_route_element_penalty_get_validity_start_time(const LocationRoadElementPenalty *penalty);
-
-/**
- * @brief Set timestamp .
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] validity_start_time -validity start time
- * @param [in] penalty - a #LocationRoadElementPenalty
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_element_penalty_get_validity_start_time
- */
-gboolean location_route_element_penalty_set_validity_start_time(LocationRoadElementPenalty *penalty, guint validity_start_time);
-
-/**
- * @brief Get value indicating the time/date on which the penalty expires.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] penalty - a #LocationRoadElementPenalty
- * @return timestamp indicating the time/date
- * @retval
- * @see location_route_element_penalty_set_validity_end_time
- */
-guint location_route_element_penalty_get_validity_end_time(const LocationRoadElementPenalty *penalty);
-
-/**
- * @brief Set value indicating the time/date on which the penalty expires.
- * @remarks The service provider should support route service.
- * @pre None.
- * @post None.
- * @param [in] validity_end_time -validity end time
- * @param [in] penalty - a #LocationRoadElementPenalty
- * @return gboolean
- * @retval TRUE if success
- * @see location_route_element_penalty_get_validity_end_time
- */
-gboolean location_route_element_penalty_set_validity_end_time(LocationRoadElementPenalty *penalty, guint validity_end_time);
-
-
-
-/**
- * @brief This method retrieves a Boolean value indicating if the lane is on the route.
- * @remarks None.
- * @pre None.
- * @post None.
- * @param [in] lane - a #LocationRouteLaneInfo
- * @see None.
- * @return true - if he lane is on the route, otherwise false
- * @retval None
- */
-gboolean location_route_lane_is_on_route(const LocationRouteLaneInfo *lane);
-
-/**
- * @brief This method retrieves a vector of elements of the enumeration DIRECTION with direction indicators applicable to the given
- * @remarks None.
- * @pre None.
- * @post None.
- * @param [in] lane - a #LocationRouteLaneInfo
- * @see DIRECTION
- * @return None
- * @retval None
- */
-DIRECTION location_route_lane_get_directions(const LocationRouteLaneInfo *lane);
-
-/**
- * @brief This method set the lane's direction
- * @remarks None.
- * @pre None.
- * @post None.
- * @param [in] lane - a #LocationRouteLaneInfo
- * @param [in] direction - a #DIRECTION
- * @see DIRECTION
- * @return gboolean
- * @retval TRUE if sucess
- */
-gboolean location_route_lane_set_directions(LocationRouteLaneInfo *lane, DIRECTION direction);
-
-/**
- * @brief This method get the route options from preference
- * @remarks None.
- * @pre None.
- * @post None.
- * @param [in] pref - a #LocationRoutePreference
- * @see None
- * @return LocationRouteOptions
- * @retval route options
- */
-LocationRouteOptions *location_route_pref_get_options (const LocationRoutePreference *pref);
-
-/**
- * @brief This method set the route options for preference
- * @remarks None.
- * @pre None.
- * @post None.
- * @param [in] pref - a #LocationRoutePreference
- * @param [in] options - a #LocationRouteOptions
- * @see None
- * @return gboolean
- * @retval TRUE if sucess
- */
-gboolean location_route_pref_set_options (LocationRoutePreference *pref, const LocationRouteOptions *options);
-
-/**
- * @brief This method get the route element penalty from options
- * @remarks None.
- * @pre None.
- * @post None.
- * @param [in] options - a #LocationRouteOptions
- * @see None
- * @return GList
- * @retval Road element penalty list
- */
-GList *location_route_options_get_road_element_penalty(const LocationRouteOptions *options);
-
-/**
- * @brief This method set the route element penalty from options
- * @remarks None.
- * @pre None.
- * @post None.
- * @param [in] options - a #LocationRouteOptions
- * @param [in] penalty - a list #LocationRoadElementPenalty
- * @see None
- * @return gboolean
- * @retval TRUE if sucess
- */
-gboolean location_route_options_set_road_element_penalty(LocationRouteOptions *options, GList *penalty);
-
-/**
- * @brief This method set the route start direction.
- * @remarks None.
- * @pre None.
- * @post None.
- * @param [in] options - a #LocationRouteOptions
- * @param [in] dirInDegrees - Start direction in degrees, values between 0-359.
- * @see None
- * @return gboolean
- * @retval TRUE if sucess
- */
-gboolean location_route_options_set_start_direction(LocationRouteOptions *options, guint dirInDegrees);
-
-
-/**
- * @brief This method returns the start direction.
- * @remarks None.
- * @pre None.
- * @post None.
- * @param [in] options - a #LocationRouteOptions
- * @see None
- * @return guint
- * @retval The start direction in degrees. Value is between 0-359.
- */
-guint location_route_options_get_start_direction(const LocationRouteOptions *options);
-
-
-/**
- * @brief Sets a multiplier to use for walking times.
- * @remarks A higher number means a slower walking speed. The default is 1.0.
- * @pre None
- * @post None.
- * @param [in] options - a #LocationRouteOptions
- * @param [in] val - a #gfloat
- * @see None
- * @return gboolean
- * @retval TRUE if sucess
- */
-gboolean location_route_options_set_walk_time_multiplier(LocationRouteOptions *options, gfloat val);
-
-/**
- * @brief Gets a multiplier to use for walking times.
- * @remarks A higher number means a slower walking speed. The default is 1.0.
- * @pre None
- * @post None.
- * @param [in] options - a #LocationRouteOptions
- * @see None
- * @return gfloat
- * @retval a multiplier to use for walking times
- */
-gfloat location_route_options_get_walk_time_multiplier(const LocationRouteOptions *options);
-
-/**
- * @brief Sets the minimum connection time, in minutes.
- * @remarks None.
- * @pre None
- * @post None.
- * @param [in] options - a #LocationRouteOptions
- * @param [in] minutes - a #guint
- * @see None
- * @return gboolean
- * @retval the minimum connection time, in minutes.
- */
-gboolean location_route_options_set_minimum_change_time(LocationRouteOptions *options, guint minutes);
-
-
-/** Gets the minimum connection time, in minutes. */
-/**
- * @brief Gets the minimum connection time, in minutes.
- * @remarks None.
- * @pre None.
- * @post None.
- * @param [in] options - a #LocationRouteOptions
- * @see None
- * @return guint
- * @retval the minimum connection time, in minutes
- */
-guint location_route_options_get_minimum_change_time(const LocationRouteOptions *options);
-
-/**
- * @brief Sets whether a transit type is allowed.
- * @remarks None.
- * @pre None
- * @post None.
- * @param [in] options - a #LocationRouteOptions
- * @param [in] type - a #TransitType
- * @param [in] allow - a #gboolean
- * @see None
- * @return gboolean
- * @retval TRUE if sucess
- */
-gboolean location_route_options_set_transit_type_allowed(LocationRouteOptions *options, TransitType type, gboolean allow);
-
-/**
- * @brief Checks whether a transit type is allowed
- * @remarks None.
- * @pre None.
- * @post None.
- * @param [in] options - a #LocationRouteOptions
- * @param [in] type - a #TransitType
- * @see None
- * @return gboolean
- * @retval TRUE if sucess
- */
-gboolean location_route_options_is_transit_type_allowed(const LocationRouteOptions *options, TransitType type);
-
-/**
- * @brief Sets the maximum number of vehicle changes allowed during the trip.
- * @remarks None.
- * @pre None.
- * @post None.
- * @param [in] options - a #LocationRouteOptions
- * @param [in] changes - a #guint
- * @see None
- * @return gboolean
- * @retval TRUE if sucess
- */
-gboolean location_route_options_set_maximum_changes(LocationRouteOptions *options, guint changes);
-
-/**
- * @brief Gets the maximum number of vehicle changes allowed during the trip.
- * @remarks None.
- * @pre None.
- * @post None.
- * @param [in] options - a #LocationRouteOptions
- * @see None.
- * @return guint
- * @retval the maximum number
- */
-guint location_route_options_get_maximum_changes(const LocationRouteOptions *options);
-
-/**
- * @brief Sets time of arrival or departure.
- * @remarks None.
- * @pre None.
- * @post None.
- * @param [in] options - a #LocationRouteOptions
- * @param [in] departure_time - a #guint
- * @see None
- * @return gboolean
- * @retval TRUE if sucess
- */
-gboolean location_route_options_set_departure_time(LocationRouteOptions *options, guint departure_time);
-
-/**
- * @brief Returns the time
- * @remarks None.
- * @pre None.
- * @post None.
- * @param [in] options - a #LocationRouteOptions
- * @see None
- * @return guint
- * @retval the time
- */
-guint location_route_options_get_departure_time(LocationRouteOptions *options);
-
-/**
- * @brief Sets time of arrival.
- * @remarks None.
- * @pre None.
- * @post None.
- * @param [in] options - a #LocationRouteOptions
- * @param [in] arrival_time - a #guint
- * @see None
- * @return gboolean
- * @retval TRUE if sucess
- */
-gboolean location_route_options_set_arrival_time(LocationRouteOptions *options, guint arrival_time);
-
-/**
- * @brief Returns the arrival time
- * @remarks None.
- * @pre None
- * @post None.
- * @param [in] options - a #LocationRouteOptions
- * @see None
- * @return None
- * @retval None
- */
-guint location_route_options_get_arrival_time(LocationRouteOptions *options);
-
-/**
- * @} @} @}
- */
-
-G_END_DECLS
-
-#endif
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "location-log.h"
-#include "location-types.h"
-#include "module-internal.h"
-#include "location-route.h"
-#include "location-map-ielement.h"
-#include "map-service.h"
-
-int
-map_service_get_geocode (LocationMapIElement *self,
- const LocationAddress *address,
- const LocationMapPref *svc_pref,
- GList **position_list,
- GList **accuracy_list)
-{
- LOCATION_LOGD("map_service_get_geocode");
- MapServicePrivate* priv = GET_PRIVATE(self);
- g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (priv->mod->ops.get_geocode, LOCATION_ERROR_NOT_AVAILABLE);
- return (priv->mod->ops.get_geocode)(priv->mod->handler, address, svc_pref, position_list, accuracy_list);
-}
-
-int
-map_service_get_geocode_freeform (LocationMapIElement *self,
- const gchar *address,
- const LocationMapPref *svc_pref,
- GList **position_list,
- GList **accuracy_list)
-{
- LOCATION_LOGD("map_service_get_geocode_freeform");
- MapServicePrivate* priv = GET_PRIVATE(self);
- g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (priv->mod->ops.get_geocode_freetext, LOCATION_ERROR_NOT_AVAILABLE);
- return (priv->mod->ops.get_geocode_freetext)(priv->mod->handler, address, svc_pref, position_list, accuracy_list);
-}
-
-int
-map_service_get_reversegeocode (LocationMapIElement *self,
- const LocationPosition *position,
- const LocationMapPref *svc_pref,
- LocationAddress **address,
- LocationAccuracy **accuracy)
-{
- LOCATION_LOGD("map_service_get_reversegeocode");
- MapServicePrivate* priv = GET_PRIVATE(self);
- g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (priv->mod->ops.get_reverse_geocode, LOCATION_ERROR_NOT_AVAILABLE);
- return (priv->mod->ops.get_reverse_geocode)(priv->mod->handler, position, svc_pref, address, accuracy);
-}
-
-int
-map_service_get_geocode_async (LocationMapIElement *self,
- const LocationAddress *address,
- const LocationMapPref *svc_pref,
- const LocationGeocodePreference *pref,
- LocationPositionCB callback,
- gpointer userdata, guint *req_id)
-{
- LOCATION_LOGD("map_service_get_geocode_async");
- MapServicePrivate* priv = GET_PRIVATE(self);
- g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (priv->mod->ops.get_geocode_async, LOCATION_ERROR_NOT_AVAILABLE);
- return (priv->mod->ops.get_geocode_async)(priv->mod->handler, address, svc_pref, pref, callback, userdata,req_id);
-}
-
-int
-map_service_get_geocode_freeform_async (LocationMapIElement *self,
- const gchar *address,
- const LocationMapPref *svc_pref,
- const LocationGeocodePreference *pref,
- LocationPositionCB callback,
- gpointer userdata, guint *req_id)
-{
- LOCATION_LOGD("map_service_get_geocode_freeform_async");
- MapServicePrivate* priv = GET_PRIVATE(self);
- g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (priv->mod->ops.get_geocode_freetext_async, LOCATION_ERROR_NOT_AVAILABLE);
- return (priv->mod->ops.get_geocode_freetext_async)(priv->mod->handler, address, svc_pref, pref, callback, userdata,req_id);
-}
-
-int
-map_service_cancel_geocode_request (LocationMapIElement *self, guint req_id)
-{
- LOCATION_LOGD("map_service_cancel_geocode_request");
- MapServicePrivate* priv = GET_PRIVATE(self);
- g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (priv->mod->ops.cancel_geocode_request, LOCATION_ERROR_NOT_AVAILABLE);
- return (priv->mod->ops.cancel_geocode_request)(priv->mod->handler, req_id);
-}
-
-int
-map_service_get_reversegeocode_async (LocationMapIElement *self,
- const LocationPosition *position,
- const LocationMapPref *svc_pref,
- LocationAddressCB callback,
- gpointer userdata, guint *req_id)
-{
- LOCATION_LOGD("map_service_get_reversegeocode_async");
- MapServicePrivate* priv = GET_PRIVATE(self);
- g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (priv->mod->ops.get_reverse_geocode_async, LOCATION_ERROR_NOT_AVAILABLE);
- return (priv->mod->ops.get_reverse_geocode_async)(priv->mod->handler, position, svc_pref, callback, userdata, req_id);
-}
-
-int
-map_service_search_poi (LocationMapIElement *self,
- const LocationPOIFilter *filter, const LocationPosition *position,
- const LocationMapPref *svc_pref, const LocationPOIPreference *pref,
- LocationPOICB cb, const gpointer user_data, guint *req_id)
-{
- LOCATION_LOGD("map_service_search_poi");
- MapServicePrivate* priv = GET_PRIVATE(self);
- g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (priv->mod->ops.search_poi, LOCATION_ERROR_NOT_AVAILABLE);
- return (priv->mod->ops.search_poi)(priv->mod->handler, filter, position, svc_pref, pref, cb, user_data, req_id);
-}
-
-int
-map_service_search_poi_by_area (LocationMapIElement *self,
- const LocationPOIFilter * filter, const LocationBoundary *boundary,
- const LocationMapPref *svc_pref, const LocationPOIPreference * pref,
- LocationPOICB cb, const gpointer user_data, guint *req_id)
-{
- LOCATION_LOGD("map_service_search_poi_by_area");
- MapServicePrivate* priv = GET_PRIVATE(self);
- g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (priv->mod->ops.search_poi_by_area, LOCATION_ERROR_NOT_AVAILABLE);
- return (priv->mod->ops.search_poi_by_area)(priv->mod->handler, filter, boundary, svc_pref, pref, cb, user_data, req_id);
-}
-
-int
-map_service_search_poi_by_address (LocationMapIElement *self,
- const LocationPOIFilter *filter, const LocationAddress *address,
- const LocationMapPref *svc_pref, const LocationPOIPreference *pref,
- LocationPOICB cb, const gpointer user_data, guint *req_id)
-{
- LOCATION_LOGD("map_service_search_poi_by_address");
- MapServicePrivate* priv = GET_PRIVATE(self);
- g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (priv->mod->ops.search_poi_by_address, LOCATION_ERROR_NOT_AVAILABLE);
- return (priv->mod->ops.search_poi_by_address)(priv->mod->handler, filter, address, svc_pref, pref, cb, user_data, req_id);
-}
-
-int
-map_service_search_poi_by_freeform (LocationMapIElement *self,
- const LocationPOIFilter *filter, const gchar *freeform,
- const LocationMapPref *svc_pref, const LocationPOIPreference *pref,
- LocationPOICB cb, const gpointer user_data, guint *req_id)
-{
- LOCATION_LOGD("map_service_search_poi_by_freeform");
- MapServicePrivate* priv = GET_PRIVATE(self);
- g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (priv->mod->ops.search_poi_by_freeform, LOCATION_ERROR_NOT_AVAILABLE);
- return (priv->mod->ops.search_poi_by_freeform)(priv->mod->handler, filter, freeform, svc_pref, pref, cb, user_data, req_id);
-}
-
-int
-map_service_cancel_poi_request (LocationMapIElement *self, guint req_id)
-{
- LOCATION_LOGD("map_service_cancel_poi_request");
- MapServicePrivate* priv = GET_PRIVATE(self);
- g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (priv->mod->ops.cancel_poi_request, LOCATION_ERROR_NOT_AVAILABLE);
- return (priv->mod->ops.cancel_poi_request)(priv->mod->handler, req_id);
-}
-
-
-int
-map_service_request_route (LocationMapIElement *self,
- const LocationPosition *origin, const LocationPosition *destination, GList *waypoint,
- const LocationMapPref *svc_pref, const LocationRoutePreference * pref,
- LocationRouteCB cb, const gpointer user_data, guint * req_id)
-{
- LOCATION_LOGD("map_service_request_route");
- MapServicePrivate* priv = GET_PRIVATE(self);
- g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (priv->mod->ops.request_route, LOCATION_ERROR_NOT_AVAILABLE);
-
- return (priv->mod->ops.request_route)(priv->mod->handler, origin, destination, waypoint, svc_pref, pref, cb, user_data, req_id);
-}
-
-int
-map_service_cancel_route_request (LocationMapIElement *self, guint req_id)
-{
- LOCATION_LOGD("map_service_cancel_route_request");
- MapServicePrivate* priv = GET_PRIVATE(self);
- g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (priv->mod->ops.cancel_route_request, LOCATION_ERROR_NOT_AVAILABLE);
-
- return (priv->mod->ops.cancel_route_request)(priv->mod->handler, req_id);
-}
-
-gboolean
-map_service_is_supported_provider_capability (LocationMapIElement *self, LocationMapServiceType type)
-{
- LOCATION_LOGD("map_service_is_supported_provider_capability");
- MapServicePrivate* priv = GET_PRIVATE(self);
- g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (priv->mod->ops.is_supported_provider_capability, LOCATION_ERROR_NOT_AVAILABLE);
-
- return (priv->mod->ops.is_supported_provider_capability)(priv->mod->handler, type);
-}
-
-int
-map_service_get_provider_capability_key (LocationMapIElement *self, LocationMapServiceType type, GList **key)
-{
- LOCATION_LOGD("map_service_get_provider_capability_key");
- MapServicePrivate* priv = GET_PRIVATE(self);
- g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
- g_return_val_if_fail (priv->mod->ops.get_provider_capability_key, LOCATION_ERROR_NOT_AVAILABLE);
-
- return (priv->mod->ops.get_provider_capability_key)(priv->mod->handler, type, key);
-}
-
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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 __MAP_INTERNAL_H__
-#define __MAP_INTERNAL_H__
-
-#include "location-map-types.h"
-#include "location-map-ielement.h"
-
-/**
- * @file map-internal.h
- * @brief This file contains the internal definitions and structures related to geocode.
- */
-
-G_BEGIN_DECLS
-
-int map_service_get_geocode (LocationMapIElement *self, const LocationAddress *address, const LocationMapPref *svc_pref, GList **position_list, GList **accuracy_list);
-
-int map_service_get_geocode_freeform (LocationMapIElement *self, const gchar *address, const LocationMapPref *svc_pref, GList **position_list, GList **accuracy_list);
-
-int map_service_get_reversegeocode (LocationMapIElement *self, const LocationPosition *position, const LocationMapPref *svc_pref, LocationAddress **address, LocationAccuracy **accuracy);
-
-int map_service_get_geocode_async (LocationMapIElement *self, const LocationAddress *address, const LocationMapPref *svc_pref, LocationPositionCB callback, gpointer userdata);
-
-int map_service_get_geocode_freeform_async (LocationMapIElement *self, const gchar *address, const LocationMapPref *svc_pref, LocationPositionCB callback, gpointer userdata);
-
-int map_service_cancel_geocode_request (LocationMapIElement *self, guint req_id);
-
-int map_service_get_reversegeocode_async (LocationMapIElement *self, const LocationPosition *position, const LocationMapPref *svc_pref, LocationAddressCB callback, gpointer userdata);
-
-int map_service_search_poi (LocationMapIElement *self,
- const LocationPOIFilter *filter, const LocationPosition *position,
- const LocationMapPref *svc_pref, const LocationPOIPreference *pref,
- LocationPOICB cb, const gpointer user_data, guint * req_id);
-
-int map_service_search_poi_by_area (LocationMapIElement *self,
- const LocationPOIFilter *filter, const LocationBoundary *boundary,
- const LocationMapPref *svc_pref, const LocationPOIPreference *pref,
- LocationPOICB cb, const gpointer user_data, guint * req_id);
-
-int map_service_search_poi_by_address (LocationMapIElement *self,
- const LocationPOIFilter *filter, const LocationAddress *address,
- const LocationMapPref *svc_pref, const LocationPOIPreference *pref,
- LocationPOICB cb, const gpointer user_data, guint * req_id);
-
-int map_service_search_poi_by_freeform (LocationMapIElement *self,
- const LocationPOIFilter * filter, const gchar *freeform,
- const LocationMapPref *svc_pref, const LocationPOIPreference *pref,
- LocationPOICB cb, const gpointer user_data, guint *req_id);
-
-int map_service_cancel_poi_request (LocationMapIElement *self, guint req_id);
-
-int map_service_request_route (LocationMapIElement *self,
- const LocationPosition *origin, const LocationPosition *destination, GList *waypoint,
- const LocationMapPref *svc_pref, const LocationRoutePreference *pref,
- LocationRouteCB cb, const gpointer user_data, guint * req_id);
-
-int map_service_cancel_route_request (LocationMapIElement *self, guint req_id);
-
-gboolean map_service_is_supported_provider_capability (LocationMapIElement *self, LocationMapServiceType type);
-
-int map_service_get_provider_capability_key (LocationMapIElement *self, LocationMapServiceType type, GList **key);
-
-G_END_DECLS
-
-#endif
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <glib-object.h>
-#include <vconf.h>
-#include <stdio.h>
-#include <string.h>
-#include "location-log.h"
-#include "location-map-pref.h"
-
-#include "module-internal.h"
-
-#include "map-internal.h"
-#include "map-service.h"
-#include "location-map-ielement.h"
-
-#define MAP_SERVICE_PREFIX "map-service"
-
-gchar *provider_list[] = {
- "decarta",
- "osm",
-};
-
-
-enum {
- PROP_0,
- PROP_PROVIDER,
- PROP_MAX
-};
-
-static GParamSpec *pspec[PROP_MAX] = {NULL, };
-
-static void map_service_ielement_interface_init (LocationMapIElementInterface *iface);
-gchar *map_service_get_default_provider (GObject *obj);
-
-G_DEFINE_TYPE_WITH_CODE (MapService, map_service, G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE (LOCATION_MAP_TYPE_IELEMENT, map_service_ielement_interface_init));
-
-static void
-_get_lang (gchar country_code[3], gchar lang_code[3])
-{
- if (!country_code || !lang_code) return;
- gchar* langset = vconf_get_str(VCONFKEY_LANGSET);
- LOCATION_LOGD("getenv: %s", langset);
-
- if(langset == NULL){
- lang_code[0] = 'E';
- lang_code[1] = 'N';
- lang_code[2] = '\0';
- country_code[0] = 'U';
- country_code[1] = 'S';
- country_code[2] = '\0';
- }else{
- gchar* langset_upper = g_ascii_strup(langset, -1);
- lang_code[0] = langset_upper[0];
- lang_code[1] = langset_upper[1];
- lang_code[2] = '\0';
- country_code[0] = langset_upper[3];
- country_code[1] = langset_upper[4];
- country_code[2] = '\0';
- g_free(langset_upper);
- }
- LOCATION_LOGD("Language: %s, Country: %s", lang_code, country_code);
-}
-
-
-static void
-map_service_dispose (GObject *gobject)
-{
- LOCATION_LOGD("map_service_dispose");
-
- G_OBJECT_CLASS (map_service_parent_class)->dispose (gobject);
-}
-
-static void
-map_service_finalize (GObject *gobject)
-{
- LOCATION_LOGD("map_service_finalize");
- MapServicePrivate* priv = GET_PRIVATE(gobject);
- module_free(priv->mod, "map-service");
- priv->mod = NULL;
- G_OBJECT_CLASS (map_service_parent_class)->finalize (gobject);
-}
-
-static void
-map_service_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
-{
- LOCATION_LOGD("Enter map_service_get_property");
- MapServicePrivate *priv = GET_PRIVATE (object);
-
- g_return_if_fail(priv->mod);
- g_return_if_fail(priv->mod->handler);
- switch (property_id){
- case PROP_PROVIDER:{
- char* service_name = NULL;
- if(priv->mod->ops.get_service_name){
- if( LOCATION_ERROR_NONE != priv->mod->ops.get_service_name(priv->mod->handler, &service_name) ){
- service_name = NULL;
- }
- }
- LOCATION_LOGD("Get prop>> Service name: %s", service_name);
- g_value_set_string(value, service_name);
- g_free(service_name);
- break;
- }
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-static void
-map_service_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- LOCATION_LOGD("map_service_set_property");
- MapServicePrivate *priv = GET_PRIVATE (object);
-
- switch (property_id) {
- case PROP_PROVIDER: {
- char buf[256] = {0, };
- gchar *service = g_value_dup_string(value);
-
- if (priv->mod && priv->pref) {
- char *cur_provider = location_map_pref_get_provider_name (priv->pref);
- if (g_strcmp0 (cur_provider, MAP_SERVICE_PREFIX) == 0) {
- snprintf(buf, 255, "%s", cur_provider);
- }
- else {
- snprintf(buf, 255, "%s-%s", MAP_SERVICE_PREFIX, cur_provider);
- }
- module_free(priv->mod, buf);
- memset (buf, 0x0, 256);
- priv->mod = NULL;
- }
-
- if (service == NULL) {
- snprintf (buf, 255, "%s", MAP_SERVICE_PREFIX);
- service = map_service_get_default_provider(object);
- } else {
- snprintf (buf, 255, "%s-%s", MAP_SERVICE_PREFIX, service);
- }
-
- priv->mod = (LocationServiceMod *)module_new (buf);
- if (priv->mod == NULL) {
- priv->mod = (LocationServiceMod *) module_new (MAP_SERVICE_PREFIX);
- service = map_service_get_default_provider(object);
- }
-
- if (priv->pref) {
- location_map_pref_set_provider_name (priv->pref, service);
- }
-
- g_free (service);
- break;
- }
- }
-}
-
-static void
-map_service_ielement_interface_init (LocationMapIElementInterface *iface)
-{
- iface->get_geocode = (TYPE_GET_GEOCODE)map_service_get_geocode;
- iface->get_geocode_freeform = (TYPE_GET_GEOCODE_FREEFORM)map_service_get_geocode_freeform;
- iface->get_reversegeocode = (TYPE_GET_REVERSEGEOCODE)map_service_get_reversegeocode;
- iface->get_geocode_async = (TYPE_GET_GEOCODE_ASYNC)map_service_get_geocode_async;
- iface->get_geocode_freeform_async = (TYPE_GET_GEOCODE_FREEFORM_ASYNC)map_service_get_geocode_freeform_async;
- iface->cancel_geocode_request = (TYPE_CANCEL_GEOCODE_REQUEST) map_service_cancel_geocode_request;
- iface->get_reversegeocode_async = (TYPE_GET_REVERSEGEOCODE_ASYNC)map_service_get_reversegeocode_async;
- iface->search_poi = (TYPE_SEARCH_POI) map_service_search_poi;
- iface->search_poi_by_area = (TYPE_SEARCH_POI_BY_AREA) map_service_search_poi_by_area;
- iface->search_poi_by_address = (TYPE_SEARCH_POI_BY_ADDR) map_service_search_poi_by_address;
- iface->search_poi_by_freeform = (TYPE_SEARCH_POI_BY_FREEFORM) map_service_search_poi_by_freeform;
- iface->cancel_poi_request = (TYPE_CANCEL_POI_REQUEST) map_service_cancel_poi_request;
- iface->request_route = (TYPE_REQUEST_ROUTE) map_service_request_route;
- iface->cancel_route_request = (TYPE_CANCEL_ROUTE_REQUEST) map_service_cancel_route_request;
- iface->is_supported_provider_capability = (TYPE_IS_SUPPORTED_PROVIDER_CAPABILITY) map_service_is_supported_provider_capability;
- iface->get_provider_capability_key = (TYPE_GET_PROVIDER_CAPABILITY_KEY) map_service_get_provider_capability_key;
-
-}
-
-static void
-map_service_init (MapService *self)
-{
- LOCATION_LOGD("map_service_init");
- MapServicePrivate* priv = GET_PRIVATE(self);
-
- priv->pref = location_map_pref_new ();
- if(!priv->pref) LOCATION_LOGW("Service preference failed");
-
- gchar country[3], lang[3];
- _get_lang (country, lang);
- location_map_pref_set_language (priv->pref, lang);
- location_map_pref_set_distance_unit (priv->pref, "MI");
- location_map_pref_set_provider_name (priv->pref, "decarta");
-}
-
-static void
-map_service_class_init (MapServiceClass *klass)
-{
- LOCATION_LOGD("map_service_class_init");
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
- gobject_class->get_property = map_service_get_property;
- gobject_class->set_property = map_service_set_property;
-
- gobject_class->dispose = map_service_dispose;
- gobject_class->finalize = map_service_finalize;
-
- g_type_class_add_private (klass, sizeof (MapServicePrivate));
-
- pspec[PROP_PROVIDER] = g_param_spec_string ("provider",
- "map service provider name prop",
- "map service provider name",
- MAP_SERVICE_PREFIX,
- G_PARAM_READWRITE);
- g_object_class_install_properties (gobject_class,
- PROP_MAX,
- pspec);
-}
-
-LocationMapPref *
-map_service_get_pref(GObject *obj)
-{
- LOCATION_LOGD("map_service_get_pref");
- MapServicePrivate* priv = GET_PRIVATE(obj);
- if (!priv) return NULL;
- if (!priv->pref) return NULL;
-
- LocationMapPref *pref = location_map_pref_copy(priv->pref);
-
- return pref;
-}
-
-gboolean
-map_service_set_pref (GObject *obj, LocationMapPref *pref)
-{
- LOCATION_LOGD("map_service_set_pref");
-
- gchar *provider = NULL;
- MapServicePrivate* priv = GET_PRIVATE(obj);
- if (!priv) return FALSE;
- if (!priv->pref) location_map_pref_free(priv->pref);
-
- priv->pref = location_map_pref_copy (pref);
- provider = location_map_pref_get_provider_name (pref);
- if (provider) {
- g_object_set (obj, "provider", provider, NULL);
- }
-
- return TRUE;
-}
-
-GList *
-map_service_get_supported_providers (GObject *obj)
-{
- LOCATION_LOGD("map_service_get_supported_providers");
-
- int idx;
- gchar buf[128] = {0, };
- GList *list = NULL;
-
- for (idx = 0; idx < sizeof(provider_list)/sizeof(gchar*); idx++) {
- memset (buf, 0x0, 128);
- snprintf(buf, 127, "%s-%s", MAP_SERVICE_PREFIX, provider_list[idx]);
- if (module_is_supported(buf) == TRUE) {
- list = g_list_append(list, g_strdup (provider_list[idx]));
- }
- }
-
- return list;
-}
-
-gchar *
-map_service_get_default_provider (GObject *obj)
-{
- LOCATION_LOGD("map_service_get_default_provider");
-
- int idx = 0;
- gchar *path = mod_get_realpath (MAP_SERVICE_PREFIX);
- if (!path) return NULL;
-
- for (idx = 0; idx < sizeof(provider_list)/sizeof(gchar*); idx++) {
- if (strstr (path, provider_list[idx]) != NULL) {
- break;
- }
- }
-
- if (idx == sizeof(provider_list)/sizeof(gchar*)) {
- return NULL;
- }
-
- g_free (path);
- return g_strdup (provider_list[idx]);
-}
-
-gboolean
-map_service_set_provider (GObject *obj, gchar *provider)
-{
- LOCATION_LOGD("map_service_get_default_provider");
- gchar *set_provider = NULL;
-
- g_object_set (obj, "provider", provider, NULL);
- g_object_get (obj, "provider", &set_provider, NULL);
-
- if (set_provider && strcmp (provider, set_provider) != 0) {
- LOCATION_LOGE("Requested [%s], but current provider [%s]", provider, set_provider);
- g_free (set_provider);
- return FALSE;
- }
-
- g_free (set_provider);
- return TRUE;
-}
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * 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 __MAP_SERVICE_H__
-#define __MAP_SERVICE_H__
-
-#include <glib-object.h>
-#include <module-internal.h>
-
-/**
- * @file map-service.h
- * @brief This file contains the internal definitions and structures related to a service provider.
- */
-
-G_BEGIN_DECLS
-
-typedef struct _MapService MapService;
-typedef struct _MapServiceClass MapServiceClass;
-typedef struct _MapServicePrivate MapServicePrivate;
-
-#define MAP_TYPE_SERVICE (map_service_get_type ())
-#define MAP_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAP_TYPE_SERVICE, MapService))
-#define MAP_IS_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAP_TYPE_SERVICE))
-#define MAP_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAP_TYPE_SERVICE, MapServiceClass))
-#define MAP_IS_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAP_TYPE_SERVICE))
-#define MAP_SERVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAP_TYPE_SERVICE, MapServiceClass))
-
-#define GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), MAP_TYPE_SERVICE, MapServicePrivate))
-
-struct _MapService
-{
- GObject parent_instance;
-};
-
-struct _MapServiceClass
-{
- GObjectClass parent_class;
-};
-
-struct _MapServicePrivate {
- LocationServiceMod* mod;
- LocationMapPref *pref;
-};
-
-GType map_service_get_type (void);
-
-LocationMapPref *map_service_get_pref(GObject *obj);
-
-gboolean map_service_set_pref (GObject *obj, LocationMapPref *pref);
-
-G_END_DECLS
-
-#endif /* __MAP_SERVICE_H__ */
+++ /dev/null
-noinst_LTLIBRARIES = liblocation-module.la\r
-\r
-COMMON_HEADER_DIR = include\r
-MANAGER_DIR = manager\r
-MAP_SERVICE_DIR = map-service\r
-MODULE_DIR = module\r
-\r
-liblocation_module_la_SOURCES = \\r
- module-internal.c\r
-\r
-liblocation_module_la_CFLAGS = \\r
- -fPIC\\r
- -I${srcdir} \\r
- -I${srcdir}/.. \\r
- -I${srcdir}/../include \\r
- -I${srcdir}/../${MANAGER_DIR} \\r
- -I${srcdir}/../${MODULE_DIR} \\r
- -I${srcdir}/../${MAP_SERVICE_DIR} \\r
- $(LOCATION_CFLAGS)\r
-\r
#include <gmodule.h>
#include <location-types.h>
-#include <location-map-types.h>
#include <location-position.h>
+#include <location-batch.h>
#include <location-velocity.h>
#include <location-accuracy.h>
-#include <location-address.h>
#include <location-satellite.h>
G_BEGIN_DECLS
* @{
*/
-/**
- * @brief This represents APIs declared in a geocode plug-in for location geocode modules.
- */
-typedef struct{
- int (*get_service_name)(gpointer handle, gchar **servicename);
- ///< This is used for getting a service name from a plug-in.
- int (*get_geocode)(gpointer handle, const LocationAddress *address, const LocationMapPref *svc_pref, GList **position_list, GList **accuracy_list);
- ///< This is used for getting a geocode from a plug-in.
- int (*get_geocode_freetext)(gpointer handle, const gchar *address, const LocationMapPref *svc_pref, GList **position_list, GList **accuracy_list);
- ///< This is used for getting a geocode by using a free-fromed address from a plug-in.
- int (*get_reverse_geocode)(gpointer handle, const LocationPosition *position, const LocationMapPref *svc_pref, LocationAddress **address, LocationAccuracy **accuracy);
- ///< This is used for getting a reverse geocode from a plug-in.
- int (*get_geocode_async)(gpointer handle, const LocationAddress *address, const LocationMapPref *svc_pref, const LocationGeocodePreference *pref, LocationPositionCB callback, gpointer userdata, guint * req_id);
- ///< This is used for getting a geocode from a plug-in asynchronously.
- int (*get_geocode_freetext_async)(gpointer handle, const gchar *address, const LocationMapPref *svc_pref, const LocationGeocodePreference *pref, LocationPositionCB callback, gpointer userdata, guint * req_id);
- ///< This is used for getting a geocode by using a free-fromed address from a plug-in asynchronously.
- int (*cancel_geocode_request) (gpointer handle, guint req_id);
- ///< This is used for cancel geocode request from a plug-in.
- int (*get_reverse_geocode_async)(gpointer handle, const LocationPosition *position, const LocationMapPref *svc_pref, LocationAddressCB callback, gpointer userdata, guint * req_id);
- ///< This is used for getting a reverse geocode from a plug-in asynchronously.
- int (*search_poi) (gpointer handle, const LocationPOIFilter *filter, const LocationPosition *position, const LocationMapPref *svc_pref, const LocationPOIPreference *pref, LocationPOICB cb, const gpointer user_data, guint * req_id);
- ///< This is used for searching poi with the position from a plug-in asynchronously.
- int (*search_poi_by_area) (gpointer handle, const LocationPOIFilter *filter, const LocationBoundary *boundary, const LocationMapPref *svc_pref, const LocationPOIPreference *pref, LocationPOICB cb, const gpointer user_data, guint * req_id);
- ///< This is used for searching poi with the boundary from a plug-in asynchronously.
- int (*search_poi_by_address) (gpointer handle, const LocationPOIFilter *filter, const LocationAddress *address, const LocationMapPref *svc_pref, const LocationPOIPreference *pref, LocationPOICB cb, const gpointer user_data, guint * req_id);
- ///< This is used for searching poi with the address from a plug-in asynchronously.
- int (*search_poi_by_freeform) (gpointer handle, const LocationPOIFilter * filter, const gchar *freeform, const LocationMapPref *svc_pref, const LocationPOIPreference *pref, LocationPOICB cb, const gpointer user_data, guint *req_id);
- ///< This is used for searching poi with the freeform address from a plug-in asynchronously.
- int (*cancel_poi_request) (gpointer handle, guint req_id);
- ///< This is used for cancel poi request from a plug-in.
- int (*request_route) (gpointer handle, const LocationPosition *origin, const LocationPosition *destination, GList *waypoint, const LocationMapPref *svc_pref, const LocationRoutePreference * pref, LocationRouteCB cb, const gpointer user_data, guint * req_id);
- ///< This is used for requesting route from a plug-in asynchronously.
- int (*cancel_route_request) (gpointer handle, guint req_id);
- ///< This is used for cancel route request from a plug-in.
- gboolean (*is_supported_provider_capability) (gpointer handle, LocationMapServiceType type);
- ///< This is used to check whether map service is supported on a plug-in.
- int (*get_provider_capability_key) (gpointer handle, LocationMapServiceType type, GList **key);
- ///< This is used to get map service keys on a plug-in.
-} LocModServiceOps;
/**
* @brief This represents a enabled/disabled callback function for a plug-in.
/**
* @brief This represents a position callback function for a plug-in.
*/
-typedef void (*LocModPositionExtCB) (gboolean enabled, LocationPosition *position, LocationVelocity *velocity, LocationAccuracy *accuracy, gpointer userdata);
+typedef void (*LocModPositionExtCB)(gboolean enabled, LocationPosition *position, LocationVelocity *velocity, LocationAccuracy *accuracy, gpointer userdata);
+
+/**
+ * @brief This represents a batch callback function for a plug-in.
+ */
+typedef void (*LocModBatchExtCB)(gboolean enabled, guint num_of_location, gpointer userdata);
/**
* @brief This represents a velocity callback function for a plug-in.
*/
-typedef void (*LocModSatelliteCB) (gboolean enabled, LocationSatellite *satellite, gpointer userdata);
+typedef void (*LocModSatelliteCB)(gboolean enabled, LocationSatellite *satellite, gpointer userdata);
/**
* @brief This represents APIs declared in a GPS plug-in for location GPS modules.
*/
-typedef struct{
- int (*start)(gpointer handle, LocModStatusCB status_cb, LocModPositionExtCB pos_ext_cb, LocModSatelliteCB sat_cb, gpointer userdata); ///< This is used for starting a GPS device from a plug-in. #LocModStatusCB, #LocModPositionExtCB are given from a location framework to a plug-in for asynchronous signaling.
- int (*stop)(gpointer handle); ///< This is used for stopping a GPS device name from a plug-in.
- int (*get_position)(gpointer handle, LocationPosition **position, LocationVelocity **velocity, LocationAccuracy **accuracy); ///< This is used for getting a position from a plug-in.
- int (*get_last_position)(gpointer handle, LocationPosition **position, LocationVelocity **velocity, LocationAccuracy **accuracy); ///< This is used for getting a last position from a plug-in.
- int (*get_nmea)(gpointer handle, gchar** nmea_data); ///< This is used for getting a nmea string from a plug-in.
- int (*get_satellite)(gpointer handle, LocationSatellite **satellite); ///< This is used for getting a satellite information from a plug-in.
- int (*get_last_satellite)(gpointer handle, LocationSatellite **satellite); ///< This is used for getting a last satellite information from a plug-in.
- int (*set_devname)(gpointer handle, const gchar *devname); ///< This is used for setting a device name from a plug-in.
- int (*get_devname)(gpointer handle, gchar **devname); ///< This is used for getting a device name from a plug-in.
+typedef struct {
+ int (*start)(gpointer handle, guint pos_update_interval, LocModStatusCB status_cb, LocModPositionExtCB pos_ext_cb, LocModSatelliteCB sat_cb, gpointer userdata); /*/< This is used for starting a GPS device from a plug-in. #LocModStatusCB, #LocModPositionExtCB are given from a location framework to a plug-in for asynchronous signaling. */
+ int (*start_batch)(gpointer handle, LocModBatchExtCB batch_ext_cb, guint batch_interval, guint batch_period, gpointer userdata); /*/< This is used for starting a GPS batch mode from a plug-in. #LocModBatchExtCB are given from a location framework to a plug-in for asynchronous signaling. */
+ int (*stop)(gpointer handle); /*/< This is used for stopping a GPS device name from a plug-in. */
+ int (*stop_batch)(gpointer handle); /*/< This is used for stopping a GPS batch mode from a plug-in. */
+ int (*get_position)(gpointer handle, LocationPosition **position, LocationVelocity **velocity, LocationAccuracy **accuracy); /*/< This is used for getting a position from a plug-in. */
+ int (*get_last_position)(gpointer handle, LocationPosition **position, LocationVelocity **velocity, LocationAccuracy **accuracy); /*/< This is used for getting a last position from a plug-in. */
+ int (*get_nmea)(gpointer handle, gchar **nmea_data); /*/< This is used for getting a nmea string from a plug-in. */
+ int (*get_satellite)(gpointer handle, LocationSatellite **satellite); /*/< This is used for getting a satellite information from a plug-in. */
+ int (*get_last_satellite)(gpointer handle, LocationSatellite **satellite); /*/< This is used for getting a last satellite information from a plug-in. */
+ int (*set_option)(gpointer handle, const char *option);
+ int (*set_position_update_interval)(gpointer handle, guint interval);
} LocModGpsOps;
/**
* @brief This represents APIs declared in a WPS plug-in for location WPS modules.
*/
-typedef struct{
- int (*start)(gpointer handle, LocModStatusCB status_cb, LocModPositionExtCB pos_ext_cb, LocModSatelliteCB sat_cb, gpointer userdata); ///< This is used for starting a WPS service from a plug-in. #LocModStatusCB, #LocModPositionExtCB and #LocModSatelliteCB(Not used) are given from a location framework to a plug-in for asynchronous signaling.
- int (*stop)(gpointer handle); ///< This is used for stopping a WPS service from a plug-in.
- int (*get_position)(gpointer handle, LocationPosition **position, LocationVelocity **velocity, LocationAccuracy **accuracy); ///< This is used for getting a position from a plug-in.
- int (*get_last_position)(gpointer handle, LocationPosition **position, LocationVelocity **velocity, LocationAccuracy **accuracy); ///< This is used for getting a last position from a plug-in.
+typedef struct {
+ int (*start)(gpointer handle, LocModStatusCB status_cb, LocModPositionExtCB pos_ext_cb, LocModSatelliteCB sat_cb, gpointer userdata); /*/< This is used for starting a WPS service from a plug-in. #LocModStatusCB, #LocModPositionExtCB and #LocModSatelliteCB(Not used) are given from a location framework to a plug-in for asynchronous signaling. */
+ int (*stop)(gpointer handle); /*/< This is used for stopping a WPS service from a plug-in. */
+ int (*get_position)(gpointer handle, LocationPosition **position, LocationVelocity **velocity, LocationAccuracy **accuracy); /*/< This is used for getting a position from a plug-in. */
+ int (*get_last_position)(gpointer handle, LocationPosition **position, LocationVelocity **velocity, LocationAccuracy **accuracy); /*/< This is used for getting a last position from a plug-in. */
+ int (*set_option)(gpointer handle, const char *option);
} LocModWpsOps;
/**
#include "module-internal.h"
#include "location-log.h"
-#define MAX_MODULE_INDEX 3
-const char* MODULE_PATH_PREFIX = LIBPATH "/location/module";
+#define MAX_MODULE_INDEX 4
+#ifdef LOG_TAG
+#undef LOG_TAG
+#define LOG_TAG TAG_LOCATION_FWK
+#endif
+
+#define MODULE_PATH_PREFIX LIBDIR"location/module"
+/* const char *MODULE_PATH_PREFIX = "/usr/lib/location/module"; */
-static GMod*
-gmod_new (const char* module_name, gboolean is_resident)
+static GMod *gmod_new(const char *module_name, gboolean is_resident)
{
- if(!module_name)
+ if (!module_name)
return NULL;
- GMod* gmod = g_new0(GMod, 1);
+ GMod *gmod = g_new0(GMod, 1);
gmod->name = g_strdup(module_name);
- if(!gmod->name) {
+ if (!gmod->name) {
g_free(gmod);
return NULL;
}
- gmod->path = g_module_build_path (MODULE_PATH_PREFIX, gmod->name);
- if(!gmod->path){
+
+ char *module_path = g_strndup(MODULE_PATH_PREFIX, strlen(MODULE_PATH_PREFIX)+1);
+ /* gmod->path = g_module_build_path(MODULE_PATH_PREFIX, gmod->name); */
+ gmod->path = g_module_build_path(module_path, gmod->name);
+ if (!gmod->path) {
g_free(gmod->name);
g_free(gmod);
return NULL;
}
+ g_free(module_path);
+
gmod->module = g_module_open(gmod->path, G_MODULE_BIND_LAZY);
- if(!gmod->module){
+ if (!gmod->module) {
g_free(gmod->name);
g_free(gmod->path);
g_free(gmod);
return NULL;
}
- if(is_resident)
+ if (is_resident)
g_module_make_resident(gmod->module);
return gmod;
}
-static void
-gmod_free (GMod* gmod)
+static void gmod_free(GMod *gmod)
{
- if(gmod->name)
+ if (gmod->name)
g_free(gmod->name);
- if(gmod->path)
+ if (gmod->path)
g_free(gmod->path);
- if(gmod->module)
+ if (gmod->module)
g_module_close(gmod->module);
g_free(gmod);
}
static gboolean
-gmod_find_sym (GMod* gmod,
- gpointer* init_func, gpointer* shutdown_func)
+gmod_find_sym(GMod *gmod, gpointer *init_func, gpointer *shutdown_func)
{
char sym[256];
g_stpcpy(sym, "init");
- if ( !g_module_symbol (gmod->module, sym, init_func) ){
+ if (!g_module_symbol(gmod->module, sym, init_func)) {
LOCATION_LOGW("symbol not found: %s", sym);
return FALSE;
}
g_stpcpy(sym, "shutdown");
- if ( !g_module_symbol (gmod->module, sym, shutdown_func) ){
+ if (!g_module_symbol(gmod->module, sym, shutdown_func)) {
LOCATION_LOGW("symbol not found: %s", sym);
return FALSE;
}
return TRUE;
}
-static gpointer
-mod_new (const char* module_name)
+static gpointer mod_new(const char *module_name)
{
gpointer ret_mod = NULL;
- if(!module_name)
+ if (!module_name)
return NULL;
- GMod* gmod = NULL;
+ GMod *gmod = NULL;
gpointer init = NULL;
gpointer shutdown = NULL;
gmod = gmod_new(module_name, TRUE);
- if(!gmod){
+ if (!gmod) {
LOCATION_LOGW("module(%s) new failed", module_name);
return NULL;
}
- if( !gmod_find_sym(gmod, &init, &shutdown) ){
+ if (!gmod_find_sym(gmod, &init, &shutdown)) {
LOCATION_LOGW("symbol (init, shutdown) finding failed");
gmod_free(gmod);
return NULL;
}
- if(!init || !shutdown){
+ if (!init || !shutdown) {
LOCATION_LOGW("init, shutdown symbol is NULL");
gmod_free(gmod);
return NULL;
}
- if(g_str_has_prefix(module_name, "map-service")){
- LocationServiceMod* _mod = g_new0(LocationServiceMod, 1);
- _mod->gmod = gmod;
- _mod->init = init;
- _mod->shutdown= shutdown;
- _mod->handler= _mod->init(&(_mod->ops));
- if(!_mod->handler){
- LOCATION_LOGW("module init failed");
- gmod_free(_mod->gmod);
- ret_mod = NULL;
- }else
- ret_mod = (gpointer)_mod;
- }else if(g_str_has_prefix(module_name, "gps")){
- LocationGpsMod* _mod = g_new0(LocationGpsMod, 1);
+ if (g_str_has_prefix(module_name, "gps")) {
+ LocationGpsMod *_mod = g_new0(LocationGpsMod, 1);
_mod->gmod = gmod;
_mod->init = init;
- _mod->shutdown= shutdown;
- _mod->handler= _mod->init(&(_mod->ops));
- if(!_mod->handler){
+ _mod->shutdown = shutdown;
+ _mod->handler = _mod->init(&(_mod->ops));
+ if (!_mod->handler) {
LOCATION_LOGW("module init failed");
gmod_free(_mod->gmod);
ret_mod = NULL;
- }else
- ret_mod = (gpointer)_mod;
- }else if(g_str_has_prefix(module_name, "wps")){
- LocationWpsMod* _mod = g_new0(LocationWpsMod, 1);
+ } else
+ ret_mod = (gpointer) _mod;
+ } else if (g_str_has_prefix(module_name, "wps")) {
+ LocationWpsMod *_mod = g_new0(LocationWpsMod, 1);
_mod->gmod = gmod;
_mod->init = init;
- _mod->shutdown= shutdown;
- _mod->handler= _mod->init(&(_mod->ops));
- if(!_mod->handler){
+ _mod->shutdown = shutdown;
+ _mod->handler = _mod->init(&(_mod->ops));
+ if (!_mod->handler) {
LOCATION_LOGW("module init failed");
gmod_free(_mod->gmod);
ret_mod = NULL;
- }else
- ret_mod = (gpointer)_mod;
- }else{
+ } else
+ ret_mod = (gpointer) _mod;
+ } else {
LOCATION_LOGW("module name (%s) is wrong", module_name);
ret_mod = NULL;
}
return ret_mod;
}
-
-static void
-mod_free (gpointer mod,
- const char* module_name)
+static void mod_free(gpointer mod, const char *module_name)
{
- if(!mod || !module_name)
+ if (!mod || !module_name)
return;
- if(g_str_has_prefix(module_name, "map-service")){
- LocationServiceMod* _mod = (LocationServiceMod*)mod;
- if(_mod->shutdown && _mod->handler){
+ if (0 == g_strcmp0(module_name, "gps")) {
+ LocationGpsMod *_mod = (LocationGpsMod *) mod;
+ if (_mod->shutdown && _mod->handler) {
_mod->shutdown(_mod->handler);
}
_mod->handler = NULL;
_mod->init = NULL;
- _mod->shutdown= NULL;
+ _mod->shutdown = NULL;
gmod_free(_mod->gmod);
_mod->gmod = NULL;
- }else if(0 == g_strcmp0(module_name, "gps")){
- LocationGpsMod* _mod = (LocationGpsMod*)mod;
- if(_mod->shutdown && _mod->handler){
+ } else if (0 == g_strcmp0(module_name, "wps")) {
+ LocationWpsMod *_mod = (LocationWpsMod *) mod;
+ if (_mod->shutdown && _mod->handler) {
_mod->shutdown(_mod->handler);
}
_mod->handler = NULL;
_mod->init = NULL;
- _mod->shutdown= NULL;
+ _mod->shutdown = NULL;
gmod_free(_mod->gmod);
_mod->gmod = NULL;
- }else if(0 == g_strcmp0(module_name, "wps")){
- LocationWpsMod* _mod = (LocationWpsMod*)mod;
- if(_mod->shutdown && _mod->handler){
- _mod->shutdown(_mod->handler);
- }
- _mod->handler = NULL;
- _mod->init = NULL;
- _mod->shutdown= NULL;
- gmod_free(_mod->gmod);
- _mod->gmod = NULL;
- }else
+ } else
LOCATION_LOGW("module name (%s) is wrong", module_name);
g_free(mod);
}
-static gboolean
-mod_is_supported(const char *module_name)
+static gboolean mod_is_supported(const char *module_name)
{
- GMod * gmod = NULL;
+ GMod *gmod = NULL;
gmod = gmod_new(module_name, FALSE);
- if(!gmod) {
+ if (!gmod) {
return FALSE;
}
gmod_free(gmod);
return TRUE;
}
-gboolean module_init (void)
+gboolean module_init(void)
{
if (!g_module_supported()) {
LOCATION_LOGW("module is not supported");
return TRUE;
}
-void module_free (gpointer mod,
- const char* module_name)
+void module_free(gpointer mod, const char *module_name)
{
- if(!mod || !module_name)
+ if (!mod || !module_name)
return;
mod_free(mod, module_name);
}
-gpointer module_new (const char* module_name)
+gpointer module_new(const char *module_name)
{
- if(!module_name)
+ if (!module_name)
return NULL;
int index = 0;
char name[256];
gpointer mod = NULL;
- for(index = -1 ; index < MAX_MODULE_INDEX ; index++){
- if(index >= 0){
- if( 0 >= g_snprintf(name, 256, "%s%d", module_name, index)){
+ for (index = -1; index < MAX_MODULE_INDEX; index++) {
+ if (index >= 0) {
+ if (0 >= g_snprintf(name, 256, "%s%d", module_name, index)) {
LOCATION_LOGW("module name(%s) is wrong", name);
continue;
}
- }else{
- if( 0 >= g_snprintf(name, 256, "%s", module_name)){
+ } else {
+ if (0 >= g_snprintf(name, 256, "%s", module_name)) {
LOCATION_LOGW("module name(%s) is wrong", name);
continue;
}
}
mod = mod_new(name);
- if(mod){
+ if (mod) {
LOCATION_LOGW("module (%s) open success", name);
break;
}
gboolean module_is_supported(const char *module_name)
{
- if(!module_name)
+ if (!module_name)
return FALSE;
int index = 0;
gboolean ret = FALSE;
gboolean found = FALSE;
- char name[256] = {0, };
+ char name[256] = { 0, };
- for(index = -1 ; index < MAX_MODULE_INDEX ; index++){
- if(index >= 0){
+ for (index = -1; index < MAX_MODULE_INDEX; index++) {
+ if (index >= 0) {
g_snprintf(name, 256, "%s%d", module_name, index);
- }else{
+ } else {
g_snprintf(name, 256, "%s", module_name);
}
ret = mod_is_supported(name);
- if(ret == TRUE) {
+ if (ret == TRUE) {
found = TRUE;
LOCATION_LOGW("module name(%s) is found", name);
break;
return found;
}
-gchar * mod_get_realpath (const gchar *module_name)
+gchar *mod_get_realpath(const gchar *module_name)
{
- gchar origin_path[PATH_MAX] = {0, };
- gchar link_path[PATH_MAX] = {0, };
+ gchar origin_path[PATH_MAX] = { 0, };
+ gchar link_path[PATH_MAX] = { 0, };
gchar *path = NULL;
- snprintf (link_path, PATH_MAX, "%s/lib%s.so", MODULE_PATH_PREFIX, module_name);
+ snprintf(link_path, PATH_MAX, "%s/lib%s.so", MODULE_PATH_PREFIX, module_name);
- realpath (link_path, origin_path);
-
- if (strlen(origin_path) == 0) {
- LOCATION_LOGE ("Fail to get real path of [%s]", module_name);
+ if (realpath(link_path, origin_path) == NULL || strlen(origin_path) == 0) {
+ LOCATION_LOGE("Fail to get real path of [%s]", module_name);
return NULL;
}
path = strrchr(origin_path, '/');
- if (!path) return NULL;
+ if (!path)
+ return NULL;
- return g_strdup (path);
+ return g_strdup(path);
}
#include <gmodule.h>
#include "location-module.h"
+G_BEGIN_DECLS
+
/**
* @file module-internal.h
* @brief This file contains the internal definitions and structures related to module.
*/
-typedef struct{
- GModule* module;
- char* name;
- char* path;
+typedef struct {
+ GModule *module;
+ char *name;
+ char *path;
} GMod;
-typedef struct{
- GMod* gmod;
+typedef struct {
+ GMod *gmod;
gpointer handler;
- gpointer (*init)(LocModServiceOps* ops);
- void (*shutdown)(gpointer handle);
- LocModServiceOps ops;
-} LocationServiceMod;
-
-typedef struct{
- GMod* gmod;
- gpointer handler;
- gpointer (*init)(LocModGpsOps* ops);
+ gpointer(*init)(LocModGpsOps *ops);
void (*shutdown)(gpointer handle);
LocModGpsOps ops;
} LocationGpsMod;
-typedef struct{
- GMod* gmod;
+typedef struct {
+ GMod *gmod;
gpointer handler;
- gpointer (*init)(LocModWpsOps* ops);
+ gpointer(*init)(LocModWpsOps *ops);
void (*shutdown)(gpointer handle);
LocModWpsOps ops;
} LocationWpsMod;
-G_BEGIN_DECLS
gboolean module_init(void);
-gpointer module_new(const char* module_name);
-void module_free(gpointer mod, const char* module_name);
+gpointer module_new(const char *module_name);
+void module_free(gpointer mod, const char *module_name);
gboolean module_is_supported(const char *module_name);
gchar *mod_get_realpath(const gchar *module_name);
-
+
G_END_DECLS
#endif
--- /dev/null
+[Version] libslp-location_0.12.0
+[Date] 10 Jun 2015
+[Changes] Code synchronization with tizen_2.4
+ The name of package was changed from libslp-location to liblbs-location.
+[Developer] Young-Ae Kang <youngae.kang@samsung.com>
+
+================================================================================
+
+
+[Version] libslp-location_0.11.0
+[Date] 29 May 2015
+[Changes] [ACR-225][2.4][location-manager][Add] Turn Location setting on or off
+ The creation of vconfkey was moved to vconf-internal-keys,
+ so vconftool command was removed in spec file except profile difference.
+[Developer] Young-Ae Kang <youngae.kang@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.10.2
+[Date] 27 Apr 2015
+[Changes] Implement event_system
+[Developer] Kyoungjun Sung <kj7.sung@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.10.1
+[Date] 19 Mar 2015
+[Changes] vconf permission changed to system for non-root daemon
+[Developer] Kyoungjun Sung <kj7.sung@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.10.0
+[Date] 12 Mar 2015
+[Changes] Signaling changed to support location_changed_cb
+ Signaling changed to support efficient callback update
+[Developer] Kyoungjun Sung <kj7.sung@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.9.0
+[Date] 26 Dec 2014
+[Changes] Interface changed to support batch API
+ Build feature changed for multi profile
+[Developer] Kyoungjun Sung <kj7.sung@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.8.4
+[date] 16 Oct 2014
+[Title] Changed some typo in route
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Minjune Kim <sena06.kim@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.8.3
+[date] 15 Sep 2014
+[Title] Changed code sequence to prevent crash.
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Youngho Jeon <ykernel.jeon@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.8.2
+[date] 17 Aug 2014
+[Title] Added module free code when companion module passed.
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Youngho Jeon <ykernel.jeon@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.8.1
+[date] 16 Aug 2014
+[Title] check object type to prevent crash
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Young-Ae Kang <youngae.kang@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.8.0
+[date] 12 Aug 2014
+[Title] add getter of location setting
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Youngho Jeon <ykernel.jeon@samsung.com>
+
+================================================================================
+[Version] libslp-location_0.7.35
+[date] 24 July 2014
+[Title] Delete Map API added
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Kartika Sharma <s.kartika@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.7.33
+[date] 18 July 2014
+[Title] Change smack lable on vconf
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Minjune Kim <sena06.kim@samsung.com>
+
+================================================================================
+
+
+[Version] libslp-location_0.7.32
+[date] 24 June 2014
+[Title] Return Error at Ultra Power Saving mode
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Minjune Kim <sena06.kim@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.7.31
+[date] 2 June 2014
+[Title] modify last parameter type of 'location_map_start_navigation' and 'location_map_start_navigation_with_location'
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Youngho Jeon <ykernel.jeon@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.7.30
+[date] 26 May 2014
+[Title] Temporary modify is_connected_network( ) logic
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Youngho Jeon <ykernel.jeon@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.7.29
+[date] 24 Apr 2014
+[Title] Add guidance apis
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Haena Kim <hena.kim@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.7.28
+[date] 16 May 2014
+[Title] remove deprecated api
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Haena Kim <hena.kim@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.7.27
+[date] 13 May 2014
+[Title] remove geofence
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Haena Kim <hena.kim@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.7.25
+[date] 21 Apr 2014
+[Title] Fix a crash in tct of wrt
+[Issue#] P140412-01617
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Minjune Kim <sena06.kim@samsung.com>
+
+================================================================================
+
+
+[Version] libslp-location_0.7.24
+[date] 17 Apr 2014
+[Title] Fix build issue when builded by c++ compiler.
+[Issue#] Na
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Youngho Jeon <ykernel.jeon@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.7.23
+[date] 17 Apr 2014
+[Title] Fix memory leak
+[Issue#] P140407-02660
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Kartika Sharma <s.kartika@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.7.22
+[date] 15 Apr 2014
+[Title] init and deinit privacy_checker
+[Issue#] P140410-03504
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Haena Kim <hena.kim@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.7.21
+[date] 31 Mar 2014
+[Title] Modify API name and parameter list to support geofence with bluetooth bssid.
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Youngho Jeon <ykernel.jeon@samsung.com>
+
+================================================================================
+[Version] libslp-location_0.7.20
+[date] 16 Jan 2014
+[Title] Add APIs to check map version
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Minjune Kim <sena06.kim@samsung.com>
+
+================================================================================
+[Version] libslp-location_0.7.19
+[date] 16 Jan 2014
+[Title] Add geofence instread of location-manager
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Kartika Sharma <s.kartika@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.7.18
+[date] 7 Jan 2014
+[Title] Add Webapp location privilege check routine
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Genie Kim <daejins.kim@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.7.17
+[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] libslp-location_0.7.16
+[date] 17 Dec 2013
+[Title] Check privilege in map service.
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Minjune Kim <sena06.kim@samsung.com>
+
+================================================================================
+
+
+[Version] libslp-location_0.7.15
+[date] 13 Dec 2013
+[Title] Fix memory leaks at location_get_privacy
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Minjune Kim <sena06.kim@samsung.com>
+
+================================================================================
+
+
+[Version] libslp-location_0.7.14
+[date] 12 Dec 2013
+[Title] Fix memory leaks at location_get_privacy
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Genie Kim <daejins.kim@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.7.13
+[date] 4 Dec 2013
+[Title] Disable MDM_PHASE2 feature
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Genie Kim <daejins.kim@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.7.12
+[date] 28 Nov 2013
+[Title] Check location privacy for admin-lbs(remove exception code)
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Genie Kim <daejins.kim@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.7.11
+[date] 28 Nov 2013
+[Title] Move location setting to CSC feature
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Genie Kim <daejins.kim@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.7.10
+[date] 19 Nov 2013
+[Title] Donot check location privilege of CPPAPP
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Genie Kim <daejins.kim@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.7.9
+[date] 18 Nov 2013
+[Title] Fix memory leak for g_mutex_lock
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Genie Kim <daejins.kim@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.7.8
+[date] 15 Nov 2013
+[Title] Change location default setting for Orange
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Genie Kim <daejins.kim@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.7.7
+[date] 12 Nov 2013
+[Title] Fix memory leak
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Genie Kim <daejins.kim@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.7.6
+[date] 11 Nov 2013
+[Title] Add location_get_privacy
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Genie Kim <daejins.kim@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.7.5
+[date] 9 Nov 2013
+[Title] fix bug when wps_start is failed
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Genie Kim <daejins.kim@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.7.4
+[date] 7 Nov 2013
+[Title] Not register vconf_notify for native apps
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Minjune Kim <sena06.kim@samsung.com>
+================================================================================
+[Version] libslp-location_0.7.3
+[date] 4 Nov 2013
+[Title] Prevent unusual case
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Minjune Kim <sena06.kim@samsung.com>
+================================================================================
+[Version] libslp-location_0.7.2
+[date] 25 Oct 2013
+[Title] Added user consent response API
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Madhu Sudhan <madhu.panga@samsung.com>
+================================================================================
+[Version] libslp-location_0.7.1
+[date] 11 Oct 2013
+[Title] Add mutex
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Minjune Kim <sena06.kim@samsung.com>
+
+================================================================================
+
+
+[Version] libslp-location_0.7.0
+[date] 30 Sep 2013
+[Title] remove set/get devname for GPS
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Genie Kim <daejins.kim@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.6.2-1
+[date] 27 Sep 2013
+[Title] add set_option in module
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Genie Kim <daejins.kim@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.6.1-1
+[date] 13 Sep 2013
+[Title] Set language as lower letters.
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Minjune Kim <sena06.kim@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.6.0-1
+[date] 22 Aug 2013
+[Title] Support geofence
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Genie Kim <daejins.kim@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.5.12-1
+[date] 16 Aug 2013
+[Title] remove gconf-2.0 pakcage
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Genie Kim <daejins.kim@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.5.11-1
+[date] 18 July 2013
+[Title] ADD Usemylocation vconf key in spec file.
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Congyi Shi <congyi.shi@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.5.10-1
+[date] 17 July 2013
+[Title] Fix memory leak in location_map_pref_free() API
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] Releasing the memory allocated for maps_key and country variables.
+[Developer] Kartika Sharma <s.kartika@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.5.9-1
+[date] 1 July 2013
+[Title] change location vconf key from db to memory & bug fix get_last_position_ext
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Genie Kim <daejins.kim@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.5.8-1
+[date] 11 June 2013
+[Title] enhance locatin hybrid method, stop wps when gps available, restart wps when gps in searching
+ add SECURE_LOg
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Ming Zhu <mingwu.zhu@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.5.7-1
+[date] 13 May 2013
+[Title] Fix bug when copying maps_key
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Minjune Kim <sena06.kim@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.5.6-1
+[date] 13 May 2013
+[Title] Fix PLM
+[Issue#] P130506-6200
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Minjune Kim <sena06.kim@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.5.5-1
+[date] 13 May 2013
+[Title] Change the DoCoMo location logs saving mechanism.
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Congyi Shi <congyi.shi@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.5.4-1
+[date] 10 May 2013
+[Title] Add smack label to vconf
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Minjune Kim <sena06.kim@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.5.3-1
+[date] 26 Apr 2013
+[Title] Fail to get position at enabled signal
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Minjune Kim <sena06.kim@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.5.2-1
+[date] 26 Apr 2013
+[Title] fix crash : hybrid method check gps/wps status
+[Issue#] P130426-0716
+[Problem] S voice application is crashed
+[Cause] hybrid donot check gps/wps setting state
+[Solution] NA
+[Developer] Genie Kim <daejins.kim@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.5.1-1
+[date] 17 Mar 2013
+[Title] Remove CPS Method
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Minjune Kim <sena06.kim@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.4.10-1
+[date] 17 Mar 2013
+[Title] Not to get current position of gps
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Minjune Kim <sena06.kim@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.4.9-1
+[date] 17 Mar 2013
+[Title] add DCM feature for logging position
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Genie Kim <daejins.kim@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.4.8-1
+[date] 20 Feb 2013
+[Title] move mdm_register_policy_receiver to gps-manager/geoclue-xps/geoclue-cps
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Genie Kim <daejins.kim@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.4.7-1
+[date] 5 Feb 2013
+[Title] Return Satellite info instead of last one.
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Minjune Kim <sena06.kim@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.4.6-1
+[date] 5 Feb 2013
+[Title] bug fixed about location_start/stop when gps/wps module is missing
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Genie Kim <daejins.kim@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.4.5-1
+[date] 30 Jan 2013
+[Title] Remove checking accessibility when apis related to location are called.
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Minjune Kim <sena06.kim@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.4.4-1
+[date] 30 Jan 2013
+[Title] fixed prevent deffect
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Genie Kim <daejins.kim@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.4.3-1
+[date] 26 Jan 2013
+[Title] fixed prevent deffect
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] NA
+[Developer] Genie Kim <daejins.kim@samsung.com>
+
+================================================================================
+
+[Version] libslp-location_0.4.2-1
+[date] 24 Jan 2013
+[Title] change boilerplate
+[Issue#] NA
+[Problem] NA
+[Cause] NA
+[Solution] change boilerplate
+[Developer] Genie Kim <daejins.kim@samsung.com>
+
+================================================================================
+
+* Mon Jul 01 2013 Anas Nashif <anas.nashif@intel.com> submit/tizen/20130517.044936@a3cd55b
+- we do not depend on gconf
+
+* Tue May 28 2013 Baptiste DURAND <baptiste.durand@eurogiciel.fr> accepted/tizen/20130520.101053@268dabb
+- Fix build for x86_64 arch
+
+libslp-location (0.4.1-1) precise; urgency=low
+
+ * Support PositionExt interface
+ * Tag: libslp-location_0.4.1-1
+
+ -- Minjune Kim <sena06.kim@samsung.com> Tue, 08 Jan 2013 23:17:22 +0900
+
+libslp-location (0.4.0-1) precise; urgency=low
+
+ * new feature : Geofence service
+ * Tag: libslp-location_0.4.0-1
+
+ -- Genie Kim <daejins.kim@samsung.com> Mon, 07 Jan 2013 22:04:56 +0900
+
+libslp-location (0.3.51-1) precise; urgency=low
+
+ * Location extension for POI
+ * Tag: libslp-location_0.3.51-1
+
+ -- Ming Zhu <mingwu.zhu@samsung.com> Mon, 7 Jan 2013 15:14:32 +0900
+
+libslp-location (0.3.50-1) precise; urgency=low
+
+ * Change Dlog Format
+ * Tag: libslp-location_0.3.50-1
+
+ -- Ming Zhu <mingwu.zhu@samsung.com> Fri, 28 Dec 2012 21:44:32 +0900
+
+libslp-location (0.3.49-1) precise; urgency=low
+
+ * Fix crash when trying to remove boundary
+ * Tag: libslp-location_0.3.49-1
+
+ -- Minjune Kim <sena06.kim@samsung.com> Fri, 28 Dec 2012 09:46:32 +0900
+
+libslp-location (0.3.48-1) precise; urgency=low
+
+ * Check validation of a pointer and fix send_command bug.
+ * Tag: libslp-location_0.3.48-1
+
+ -- Minjune Kim <sena06.kim@samsung.com> Thu, 27 Dec 2012 17:26:35 +0900
+
+libslp-location (0.3.47-1) precise; urgency=low
+
+ * add send command about accessibility
+ * Tag: libslp-location_0.3.47-1
+
+ -- Genie Kim <daejins.kim@samsung.com> Mon, 17 Dec 2012 14:23:51 +0900
+
+libslp-location (0.3.46-1) precise; urgency=low
+
+ * add private accuracy in position signaling funcation
+ * Tag: libslp-location_0.3.46-1
+
+ -- Genie Kim <daejins.kim@samsung.com> Fri, 14 Dec 2012 17:27:07 +0900
+
+libslp-location (0.3.45-1) precise; urgency=low
+
+ * Support center position of polygon
+ * Tag: libslp-location_0.3.45-1
+
+ -- Genie Kim <daejins.kim@samsung.com> Wed, 12 Dec 2012 16:28:59 +0900
+
+libslp-location (0.3.44-1) unstable; urgency=low
+
+ * Support zone in/out callback using LocationBoundary
+ * Add features for extension
+ * Tag: libslp-location_0.3.44-1
+
+ -- Genie Kim <daejins.kim@samsung.com> Wed, 28 Nov 2012 19:34:05 +0900
+
+libslp-location (0.3.43-1) unstable; urgency=low
+
+ * Do not return a position after stopped.
+ * Tag: libslp-location_0.3.43-1
+
+ -- Minjune Kim <sena06.kim@samsung.com> Mon, 26 Nov 2012 20:39:18 +0900
+
+libslp-location (0.3.42-2) unstable; urgency=low
+
+ * Add location_get_accessibility_state to header file
+ * Tag: libslp-location_0.3.42-2
+
+ -- Minjune Kim <sena06.kim@samsung.com> Wed, 21 Nov 2012 11:15:05 +0900
+
+libslp-location (0.3.42-1) unstable; urgency=low
+
+ * Fix prevent bug, Check an authority when creating location object Distinguish Error Type between SETTING_OFF and ACCESSIBILITY DENIED
+ * Tag: libslp-location_0.3.42-1
+
+ -- Minjune Kim <sena06.kim@samsung.com> Tue, 20 Nov 2012 20:45:52 +0900
+
+libslp-location (0.3.41-1) unstable; urgency=low
+
+ * Apply MDM phase II
+ * Tag: libslp-location_0.3.41-1
+
+ -- Minjune Kim <sena06.kim@samsung.com> Thu, 13 Sep 2012 21:04:15 +0900
+
+libslp-location (0.3.40-1) unstable; urgency=low
+
+ * Fix bug for check lt/rb latitude in new for rect
+ * Tag: libslp-location_0.3.40-1
+
+ -- Genie Kim <daejins.kim@samsung.com> Mon, 10 Sep 2012 17:43:20 +0900
+
+libslp-location (0.3.39-1) unstable; urgency=low
+
+ * Fix a crash after changes that velocity is updated before position.
+ * Tag: libslp-location_0.3.39-1
+
+ -- Minjune Kim <sena06.kim@samsung.com> Fri, 31 Aug 2012 19:02:39 +0900
+
+libslp-location (0.3.38-1) unstable; urgency=low
+
+ * Add the parameter, LocationMapPref in Geocoder
+ * Tag: libslp-location_0.3.38-1
+
+ -- Minjune Kim <sena06.kim@samsung.com> Mon, 13 Aug 2012 15:52:07 +0900
+
+libslp-location (0.3.37-1) unstable; urgency=low
+
+ * Support multi-provider
+ * Tag: libslp-location_0.3.37-1
+
+ -- Minjune Kim <sena06.kim@samsung.com> Tue, 07 Aug 2012 21:19:19 +0900
+
+libslp-location (0.3.36-6) unstable; urgency=low
+
+ * Fix N_SE-4475, the time difference was occured between a positon and a velocity
+ * Tag: libslp-location_0.3.36-6
+
+ -- Minjune Kim <sena06.kim@samsung.com> Fri, 03 Aug 2012 22:58:01 +0900
+
+libslp-location (0.3.36-5) unstable; urgency=low
+
+ * Seperate map service from location service.
+ * Tag: libslp-location_0.3.36-5
+
+ -- Minjune Kim <sena06.kim@samsung.com> Thu, 26 Jul 2012 14:47:16 +0900
+
+libslp-location (0.3.36-4) unstable; urgency=low
+
+ * Fix the bug that satellite_callback was periodically called even when location_start was failed
+ * Tag: libslp-location_0.3.36-4
+
+ -- Minjune Kim <sena06.kim@samsung.com> Thu, 26 Jul 2012 13:14:32 +0900
+
+libslp-location (0.3.36-3) unstable; urgency=low
+
+ * Check permission when calling location_start.
+ * Tag: libslp-location_0.3.36-3
+
+ -- Minjune Kim <sena06.kim@samsung.com> Tue, 17 Jul 2012 20:59:24 +0900
+
+libslp-location (0.3.36-2) unstable; urgency=low
+
+ * Apply new glib and add map-service-test
+ * Tag: libslp-location_0.3.36-2
+
+ -- Minjune Kim <sena06.kim@samsung.com> Tue, 10 Jul 2012 15:52:07 +0900
+
+libslp-location (0.3.36-1) unstable; urgency=low
+
+ * support location application list in setting
+ * Tag: libslp-location_0.3.36-1
+
+ -- Genie Kim <daejins.kim@samsung.com> Sat, 07 Jul 2012 19:44:10 +0900
+
+libslp-location (0.3.35-6) unstable; urgency=low
+
+ * Fix a bug when creating a boundary
+ * Tag: libslp-location_0.3.35-6
+
+ -- Minjune Kim <sena06.kim@samsung.com> Fri, 29 Jun 2012 15:15:40 +0900
+
+libslp-location (0.3.35-5) unstable; urgency=low
+
+ * Fix memory leak when finalizing an object.
+ * Tag: libslp-location_0.3.35-5
+
+ -- Minjune Kim <sena06.kim@samsung.com> Fri, 15 Jun 2012 16:05:29 +0900
+
+libslp-location (0.3.35-4) unstable; urgency=low
+
+ * Do not check returned value after calling vconf_ignore_key_changed and vconf_notify_key_changed
+ * Tag: libslp-location_0.3.35-4
+
+ -- Minjune Kim <sena06.kim@samsung.com> Thu, 14 Jun 2012 11:12:54 +0900
+
+libslp-location (0.3.35-3) unstable; urgency=low
+
+ * Fix bugs, a failure to get wps positioning and receiving satellite callback after location_stop()
+ * Tag: libslp-location_0.3.35-3
+
+ -- Minjune Kim <sena06.kim@samsung.com> Tue, 12 Jun 2012 17:00:25 +0900
+
+libslp-location (0.3.35-2) unstable; urgency=low
+
+ * Remove both LOCATION_METHOD_IPS and LOCATION_METHOD_SPS & support location_is_supported_method for LOCATION_METHOD_CPS
+ * Tag: libslp-location_0.3.35-2
+
+ -- Minjune Kim <sena06.kim@samsung.com> Tue, 29 May 2012 11:16:17 +0900
+
+libslp-location (0.3.35-1) unstable; urgency=low
+
+ * Support CPS Method
+ * Tag: libslp-location_0.3.35-1
+
+ -- Minjune Kim <sena06.kim@samsung.com> Thu, 24 May 2012 19:01:08 +0900
+
+libslp-location (0.3.34-17) unstable; urgency=low
+
+ * fix a bug when calling location_route_step_set_geometry
+ * Tag: libslp-location_0.3.34-17
+
+ -- Genie Kim <daejins.kim@samsung.com> Fri, 18 May 2012 19:20:33 +0900
+
+libslp-location (0.3.34-16) unstable; urgency=low
+
+ * Enable to set each interval of a position, a velocity and satellite
+ * change vconf keys
+ * Tag: libslp-location_0.3.34-16
+
+ -- Genie Kim <daejins.kim@samsung.com> Tue, 15 May 2012 19:49:10 +0900
+
+libslp-location (0.3.34-15) unstable; urgency=low
+
+ * Update current method whenever the callback callback, hybrid_service_updated is called in hybrid.
+ * Tag: libslp-location_0.3.34-15
+
+ -- Minjune Kim <sena06.kim@samsung.com> Thu, 10 May 2012 14:49:33 +0900
+
+libslp-location (0.3.34-14) unstable; urgency=low
+
+ * ignore notify when a method (gps, wps or sps) is disposed.
+ * Tag: libslp-location_0.3.34-14
+
+ -- Minjune Kim <sena06.kim@samsung.com> Thu, 26 Apr 2012 21:09:41 +0900
+
+libslp-location (0.3.34-13) unstable; urgency=low
+
+ * The result was wrong when location_boundary_if_inside was called
+ * Tag: libslp-location_0.3.34-13
+
+ -- Minjune Kim <sena06.kim@samsung.com> Mon, 02 Apr 2012 16:59:08 +0900
+
+libslp-location (0.3.34-12) unstable; urgency=low
+
+ * Fix the bug that get_last_position of WPS was failed on emulator.
+ * Move the fuctionality to location module
+ * Tag: libslp-location_0.3.34-12
+
+ -- Minjune Kim <sena06.kim@samsung.com> Tue, 27 Mar 2012 11:09:07 +0900
+
+libslp-location (0.3.34-11) unstable; urgency=low
+
+ * Add location_route_step_set_transport_mode / location_route_step_get_transport_mode
+ * Tag: libslp-location_0.3.34-11
+
+ -- Minjune Kim <sena06.kim@samsung.com> Mon, 26 Mar 2012 17:00:48 +0900
+
+libslp-location (0.3.34-10) unstable; urgency=low
+
+ * Check param's range in funcs.
+ * Tag: libslp-location_0.3.34-10
+
+ -- Minjune Kim <sena06.kim@samsung.com> Thu, 22 Mar 2012 13:18:42 +0900
+
+libslp-location (0.3.34-9) unstable; urgency=low
+
+ * Fix the bug that location_get_map_service_pref returned fail
+ * Tag: libslp-location_0.3.34-9
+
+ -- Minjune Kim <sena06.kim@samsung.com> Tue, 20 Mar 2012 22:15:17 +0900
+
+libslp-location (0.3.34-8) unstable; urgency=low
+
+ * modity TC script and copy satellite info with timestamp
+ * Tag: libslp-location_0.3.34-8
+
+ -- Minjune Kim <sena06.kim@samsung.com> Mon, 19 Mar 2012 20:49:24 +0900
+
+libslp-location (0.3.34-7) unstable; urgency=low
+
+ * add libgconf-dbus-dev in control
+ * Tag: libslp-location_0.3.34-7
+
+ -- Genie Kim <daejins.kim@samsung.com> Fri, 16 Mar 2012 11:33:54 +0900
+
+libslp-location (0.3.34-6) unstable; urgency=low
+
+ * Support Capability APIs
+ * Tag: libslp-location_0.3.34-6
+
+ -- Minjune Kim <sena06.kim@samsung.com> Wed, 14 Mar 2012 20:35:31 +0900
+
+libslp-location (0.3.34-5) unstable; urgency=low
+
+ * Add dbus_g_thread_init & g_thread_init to location_init
+ * Tag: libslp-location_0.3.34-5
+
+ -- Minjune Kim <sena06.kim@samsung.com> Fri, 09 Mar 2012 16:29:07 +0900
+
+libslp-location (0.3.34-4) unstable; urgency=low
+
+ * Change a wps_start to support an emulator.
+ * Tag: libslp-location_0.3.34-4
+
+ -- Minjune Kim <sena06.kim@samsung.com> Wed, 07 Mar 2012 10:59:54 +0900
+
+libslp-location (0.3.34-3) unstable; urgency=low
+
+ * Add POI func & Route prototype
+ * Implement get_last_xxx & Update satellite info
+ * Tag: libslp-location_0.3.34-3
+
+ -- Genie Kim <daejins.kim@samsung.com> Mon, 20 Feb 2012 20:23:01 +0900
+
+libslp-location (0.3.34-2) unstable; urgency=low
+
+ * Add location_get_last_XXX and location_get_satellite proto. Add timestamp on satellite info
+ * Add TC
+ * Tag: libslp-location_0.3.34-2
+
+ -- Minjune Kim <sena06.kim@samsung.com> Mon, 13 Feb 2012 21:03:22 +0900
+
+libslp-location (0.3.34-1) unstable; urgency=low
+
+ * Support to get multi positions using geocode service.
+ * Correct typo.
+ * Tag: libslp-location_0.3.34-1
+
+ -- Minjune Kim <sena06.kim@samsung.com> Fri, 03 Feb 2012 15:01:49 +0900
+
+libslp-location (0.3.33-2) unstable; urgency=low
+
+ * Remove a needless conditional code.
+ * Tag: libslp-location_0.3.33-2
+
+ -- Minjune Kim <sena06.kim@samsung.com> Sun, 29 Jan 2012 09:48:48 +0900
+
+libslp-location (0.3.33-1) unstable; urgency=low
+
+ * Enable to get last known position for each method.
+ * Tag: libslp-location_0.3.33-1
+
+ -- Minjune Kim <sena06.kim@samsung.com> Thu, 19 Jan 2012 19:44:12 +0900
+
+libslp-location (0.3.32-1) unstable; urgency=low
+
+ * Fix a bug that a module is not started when a service turns on.
+ * Tag: libslp-location_0.3.32-1
+
+ -- Minjune Kim <sena06.kim@samsung.com> Fri, 06 Jan 2012 17:10:12 +0900
+
+libslp-location (0.3.31-2) unstable; urgency=low
+
+ * check a method before creating its object.
+ * Tag: libslp-location_0.3.31-2
+
+ -- Minjune Kim <sena06.kim@samsung.com> Mon, 19 Dec 2011 21:34:46 +0900
+
+libslp-location (0.3.31-1) unstable; urgency=low
+
+ * change default value of location serverce from 'On' to 'Off'
+ * Tag: libslp-location_0.3.31-1
+
+ -- Genie Kim <daejins.kim@samsung.com> Thu, 08 Dec 2011 20:08:49 +0900
+
+libslp-location (0.3.30-1) unstable; urgency=low
+
+ * add an empty body of location_send_command & support exception case
+ * Tag: libslp-location_0.3.30-1
+
+ -- Minjune Kim <sena06.kim@samsung.com> Tue, 06 Dec 2011 17:05:16 +0900
+
+libslp-location (0.3.29-1) unstable; urgency=low
+
+ * Support multi boundaries & add new API, location_is_enabled_gps
+ * Tag: libslp-location_0.3.29-1
+
+ -- Minjune Kim <sena06.kim@samsung.com> Thu, 03 Nov 2011 22:16:21 +0900
+
+libslp-location (0.3.28-1) unstable; urgency=low
+
+ * fix the bug that the last value of logitude was truncated.
+ * Tag: libslp-location_0.3.28-1
+
+ -- Minjune Kim <sena06.kim@samsung.com> Wed, 02 Nov 2011 14:42:03 +0900
+
+libslp-location (0.3.27-1) unstable; urgency=low
+
+ * fix the bug that libslp-location returns 0,0 instead of error when a last postion(VCONF) is null
+ * Tag: libslp-location_0.3.27-1
+
+ -- Minjune Kim <sena06.kim@samsung.com> Mon, 31 Oct 2011 11:17:21 +0900
+
+libslp-location (0.3.26-1) unstable; urgency=low
+
+ * vconf key is changed and use time_t for timestamp
+ * Tag: libslp-location_0.3.26-1
+
+ -- Genie Kim <daejins.kim@samsung.com> Mon, 17 Oct 2011 13:29:19 +0900
+
+libslp-location (0.3.25-1) unstable; urgency=low
+
+ * add location_is_supported_method, location_send_command & update_interval
+ * Tag: libslp-location_0.3.25-1
+
+ -- Minjune Kim <sena06.kim@samsung.com> Wed, 12 Oct 2011 12:36:45 +0900
+
+libslp-location (0.3.24-1) unstable; urgency=low
+
+ * add location_get_last_known_position & fix prevent defect
+ * Tag: libslp-location_0.3.24-1
+
+ -- Genie Kim <daejins.kim@samsung.com> Thu, 29 Sep 2011 21:37:27 +0900
+
+libslp-location (0.3.23-2) unstable; urgency=low
+
+ * change maintainer in boilerplate
+ * Tag: libslp-location_0.3.23-2
+
+ -- Genie Kim <daejins.kim@samsung.com> Wed, 20 Jul 2011 17:56:38 +0900
+
+libslp-location (0.3.23-1) unstable; urgency=low
+
+ * Vconfkey value is changed by new UI guide
+ * Tag: libslp-location_0.3.23-1
+
+ -- Genie Kim <daejins.kim@samsung.com> Fri, 01 Jul 2011 17:42:34 +0900
+
+libslp-location (0.3.22-1) unstable; urgency=low
+
+ * Release New Location APIs
+ * Tag: libslp-location_0.3.22-1
+
+ -- Tae-Hwan Kim <the81.kim@samsung.com> Wed, 20 Apr 2011 11:07:38 +0900
+
+libslp-location (0.2.22-1) unstable; urgency=low
+
+ * Bug fix when hybrid exit
+ * Tag: libslp-location_0.2.22-1
+
+ -- Tae-Hwan Kim <the81.kim@samsung.com> Thu, 10 Mar 2011 19:44:07 +0900
+
+libslp-location (0.2.21-1) unstable; urgency=low
+
+ * Always update GPS data to PDR in hybrid mode & change some names
+ * Tag: libslp-location_0.2.21-1
+
+ -- Tae-Hwan Kim <the81.kim@samsung.com> Thu, 10 Mar 2011 14:52:09 +0900
+
+libslp-location (0.2.20-1) unstable; urgency=low
+
+ * Location eanbled by UX guide
+ * Tag: libslp-location_0.2.20-1
+
+ -- Tae-Hwan Kim <the81.kim@samsung.com> Mon, 07 Mar 2011 21:01:50 +0900
+
+libslp-location (0.2.19-2) unstable; urgency=low
+
+ * Release again for sbox i386 build
+ * Tag: libslp-location_0.2.19-1
+
+ -- sangho park <sangho.g.park@samsung.com> Tue, 22 Feb 2011 13:57:22 +0900
+
+libslp-location (0.2.18-2) unstable; urgency=low
+
+ * Fix depends for Sbox1
+ * Tag: libslp-location_0.2.18-2
+
+ -- Tae-Hwan Kim <the81.kim@samsung.com> Thu, 17 Feb 2011 20:07:52 +0900
+
+libslp-location (0.2.18-1) unstable; urgency=low
+
+ * Add SPS object/module
+ * Tag: libslp-location_0.2.18-1
+
+ -- Tae-Hwan Kim <the81.kim@samsung.com> Wed, 16 Feb 2011 16:52:43 +0900
+
+libslp-location (0.2.17-1) unstable; urgency=low
+
+ * Apply prevent & Fix PG
+ * Tag: libslp-location_0.2.17-1
+
+ -- Tae-Hwan Kim <the81.kim@samsung.com> Tue, 08 Feb 2011 13:04:34 +0900
+
+libslp-location (0.2.16-2) unstable; urgency=low
+
+ * Add prevent & Fix accuracy
+ * Tag: libslp-location_0.2.16-2
+
+ -- Tae-Hwan Kim <the81.kim@samsung.com> Tue, 25 Jan 2011 17:12:01 +0900
+
+libslp-location (0.2.16-1) unstable; urgency=low
+
+ * Add CPS/IPS & Async address API & Appy vconf security
+ * Tag: libslp-location_0.2.16-1
+
+ -- Tae-Hwan Kim <the81.kim@samsung.com> Wed, 19 Jan 2011 11:39:22 +0900
+
+libslp-location (0.2.15-1) unstable; urgency=low
+
+ * Apply TC recomm. & change default setting value to 0
+ * Tag: libslp-location_0.2.15-1
+
+ -- Tae-hwan Kim <the81.kim@samsung.com> Thu, 06 Jan 2011 10:21:04 +0900
+
+libslp-location (0.2.14-1) unstable; urgency=low
+
+ * Change plugin & guide & Fix TC
+ * Tag: libslp-location_0.2.14-1
+
+ -- Tae-hwan Kim <the81.kim@samsung.com> Mon, 20 Dec 2010 17:27:55 +0900
+
+libslp-location (0.2.13-0) unstable; urgency=low
+
+ * Fix build dependency
+ * Tag: libslp-location_0.2.13-0
+
+ -- Tae-hwan Kim <the81.kim@samsung.com> Mon, 13 Dec 2010 13:03:30 +0900
+
+libslp-location (0.2.12-0) unstable; urgency=low
+
+ * Fix plugin & guide & add setting feature
+ * Tag: libslp-location_0.2.12-0
+
+ -- Tae-hwan Kim <the81.kim@samsung.com> Mon, 13 Dec 2010 09:40:53 +0900
+
+libslp-location (0.2.11-0) unstable; urgency=low
+
+ * Add hybri mode & Fix some bugs
+ * Tag: libslp-location_0.2.11-0
+
+ -- Tae-hwan Kim <the81.kim@samsung.com> Mon, 29 Nov 2010 10:57:57 +0900
+
+libslp-location (0.2.10-0) unstable; urgency=low
+
+ * Fix minor bugs
+ * Tag: libslp-location_0.2.10-0
+
+ -- Tae-hwan Kim <the81.kim@samsung.com> Wed, 24 Nov 2010 23:26:37 +0900
+
+libslp-location (0.2.9-1) unstable; urgency=low
+
+ * Remove caching
+ * Tag: libslp-location_0.2.9-1
+
+ -- Tae-hwan Kim <the81.kim@samsung.com> Tue, 23 Nov 2010 14:29:20 +0900
+
+libslp-location (0.2.8-1) unstable; urgency=low
+
+ * Fix plugin priority & Fix sample code bug
+ * Tag: libslp-location_0.2.8-1
+
+ -- Tae-hwan Kim <the81.kim@samsung.com> Wed, 10 Nov 2010 21:46:03 +0900
+
+libslp-location (0.2.7-1) unstable; urgency=low
+
+ * Add geocode object & Enable wps object
+ * Tag: libslp-location_0.2.7-1
+
+ -- Tae-hwan Kim <the81.kim@samsung.com> Mon, 08 Nov 2010 23:03:50 +0900
+
+libslp-location (0.1.7-1) unstable; urgency=low
+
+ * Remove unnecessary dependencies(geoclue-skyhook,gpsd ..)
+ * Tag: libslp-location_0.1.7-1
+
+ -- Tae-hwan Kim <the81.kim@samsung.com> Mon, 01 Nov 2010 13:53:11 +0900
+
+libslp-location (0.1.6-1) unstable; urgency=low
+
+ * Fix dependency
+ * Tag: libslp-location_0.1.6-1
+
+ -- Tae-hwan Kim <the81.kim@samsung.com> Sun, 31 Oct 2010 16:59:48 +0900
+
+libslp-location (0.1.5-1) unstable; urgency=low
+
+ * Fix for limo
+ * Tag: libslp-location_0.1.5-1
+
+ -- Tae-hwan Kim <the81.kim@samsung.com> Fri, 29 Oct 2010 16:26:43 +0900
+
+libslp-location (0.1.4-2) unstable; urgency=low
+
+ * Remove version field for limo
+ * Tag: libslp-location_0.1.4-2
+
+ -- Tae-hwan Kim <the81.kim@samsung.com> Fri, 29 Oct 2010 14:50:42 +0900
+
+libslp-location (0.1.4-1) unstable; urgency=low
+
+ * Add version field in control
+ * Tag: libslp-location_0.1.4-1
+
+ -- Tae-hwan Kim <the81.kim@samsung.com> Fri, 29 Oct 2010 14:18:01 +0900
+
+libslp-location (0.1.3-1) unstable; urgency=low
+
+ * Fix PG & sample, Change signal emission
+ * Tag: libslp-location_0.1.3-1
+
+ -- Tae-hwan Kim <the81.kim@samsung.com> Fri, 29 Oct 2010 13:49:11 +0900
+
+libslp-location (0.1.2-1) unstable; urgency=low
+
+ * Add more bolier plate
+ * Tag: libslp-location_0.1.2-1
+
+ -- Tae-hwan Kim <the81.kim@samsung.com> Tue, 26 Oct 2010 16:40:31 +0900
+
+libslp-location (0.1.1-1) unstable; urgency=low
+
+ * Fix for PG & Doxygen & Limo Contrib.
+ * Tag: libslp-location_0.1.1-1
+
+ -- Tae-hwan Kim <the81.kim@samsung.com> Tue, 26 Oct 2010 12:22:16 +0900
+
+libslp-location (0.1.0-15) unstable; urgency=low
+
+ * Update programming guide & test case for address APIs
+ * Tag: libslp-location_0.1.0-15
+
+ -- Tae-hwan Kim <the81.kim@samsung.com> Sat, 16 Oct 2010 20:53:38 +0900
+
+libslp-location (0.1.0-14) unstable; urgency=low
+
+ * Adapt to libdecarta
+ * Tag: libslp-location_0.1.0-14
+
+ -- Tae-hwan Kim <the81.kim@samsung.com> Mon, 11 Oct 2010 22:33:14 +0900
+
+libslp-location (0.1.0-13) unstable; urgency=low
+
+ * Add input parameter error handling & Change TC
+ * Tag: libslp-location_0.1.0-13
+
+ -- Tae-hwan Kim <the81.kim@samsung.com> Mon, 27 Sep 2010 20:03:09 +0900
+
+libslp-location (0.1.0-12) unstable; urgency=low
+
+ * Fix in zone in/out & Add more test case
+ * Tag: libslp-location_0.1.0-12
+
+ -- Tae-hwan Kim <the81.kim@samsung.com> Fri, 17 Sep 2010 16:56:35 +0900
+
+libslp-location (0.1.0-11) unstable; urgency=low
+
+ * Add glib-genmarshal & Remove marshal source/header
+ * Tag: libslp-location_0.1.0-11
+
+ -- Tae-hwan Kim <the81.kim@samsung.com> Tue, 14 Sep 2010 10:18:37 +0900
+
+libslp-location (0.1.0-10) unstable; urgency=low
+
+ * Change programming guide & doxygen comments
+ * Tag: libslp-location_0.1.0-10
+
+ -- Tae-hwan Kim <the81.kim@samsung.com> Fri, 10 Sep 2010 14:52:24 +0900
+
+libslp-location (0.1.0-9) unstable; urgency=low
+
+ * Change programming guilde & Add sample codes
+ * Tag: libslp-location_0.1.0-9
+
+ -- Tae-hwan Kim <the81.kim@samsung.com> Thu, 09 Sep 2010 17:50:27 +0900
+
+libslp-location (0.1.0-8) unstable; urgency=low
+
+ * Add zone in/out & boundary feature
+ * Tag: libslp-location_0.1.0-8
+
+ -- Tae-hwan Kim <the81.kim@samsung.com> Mon, 06 Sep 2010 10:57:08 +0900
+
+libslp-location (0.1.0-7) unstable; urgency=low
+
+ * Adapt to geoclue change
+ * Tag: libslp-location_0.1.0-7
+
+ -- Tae-hwan Kim <the81.kim@samsung.com> Sat, 04 Sep 2010 19:40:16 +0900
+
+libslp-location (0.1.0-6) unstable; urgency=low
+
+ * Change programming guide & test application
+ * Tag: libslp-location_0.1.0-6
+
+ -- Tae-hwan Kim <the81.kim@samsung.com> Wed, 01 Sep 2010 20:07:34 +0900
+
+libslp-location (0.1.0-5) unstable; urgency=low
+
+ * Change fw name in doxygen & release again
+ * Tag: libslp-location_0.1.0-5
+
+ -- Tae-hwan Kim <the81.kim@samsung.com> Tue, 31 Aug 2010 23:28:12 +0900
+
+libslp-location (0.1.0-4) unstable; urgency=low
+
+ * Add doxygen & change API return value to integer
+ * Tag: libslp-location_0.1.0-4
+
+ -- Tae-hwan Kim <the81.kim@samsung.com> Tue, 31 Aug 2010 22:09:35 +0900
+
+libslp-location (0.1.0-3) unstable; urgency=low
+
+ * Change header dependency for relase
+ * Tag: libslp-location_0.1.0-3
+
+ -- Tae-hwan Kim <the81.kim@samsung.com> Mon, 30 Aug 2010 20:58:04 +0900
+
+libslp-location (0.1.0-2) unstable; urgency=low
+
+ * Fix header include & Release again
+ * Tag: libslp-location_0.1.0-2
+
+ -- Tae-hwan Kim <the81.kim@samsung.com> Mon, 30 Aug 2010 17:51:44 +0900
+
+libslp-location (0.1.0-1) unstable; urgency=low
+
+ * Initial version
+ * Tag: libslp-location_0.1.0-1
+
+ -- Tae-hwan Kim <the81.kim@samsung.com> Mon, 30 Aug 2010 12:01:05 +0900
--- /dev/null
+<manifest>
+ <request>
+ <domain name="_"/>
+ </request>
+</manifest>
--- /dev/null
+Name: liblbs-location
+Summary: Location Based Service Library
+Version: 0.12.0
+Release: 1
+Group: Location/Libraries
+License: Apache-2.0
+Source0: %{name}-%{version}.tar.gz
+Source1001: %{name}.manifest
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
+BuildRequires: cmake
+BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(gmodule-2.0)
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(vconf)
+BuildRequires: pkgconfig(capi-appfw-app-manager)
+BuildRequires: pkgconfig(capi-appfw-package-manager)
+BuildRequires: pkgconfig(pkgmgr-info)
+BuildRequires: pkgconfig(privacy-manager-client)
+BuildRequires: pkgconfig(json-glib-1.0)
+BuildRequires: pkgconfig(lbs-dbus)
+BuildRequires: pkgconfig(bundle)
+BuildRequires: pkgconfig(eventsystem)
+
+%description
+Location Based Service Library
+
+
+%package devel
+Summary: Location Based Service Library (Development files)
+Group: Location/Development
+Requires: %{name} = %{version}-%{release}
+
+%description devel
+Location Based Service Library (Development files)
+The package includes header files and pkgconfig file.
+
+
+%prep
+%setup -q -n %{name}-%{version}
+cp %{SOURCE1001} .
+
+
+%build
+export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
+export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
+export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
+
+# Call make instruction with smp support
+MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
+#cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER} \
+cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DBUILD_PKGTYPE=rpm -DLIBDIR=%{_libdir} -DINCLUDEDIR=%{_includedir} \
+-DFULLVER=%{version} -DMAJORVER=${MAJORVER} \
+%if "%{?tizen_profile_name}" == "wearable"
+ -DFEATURE_PROFILE_WEARABLE:BOOL=ON
+%else
+ -DFEATURE_PROFILE_WEARABLE:BOOL=OFF
+%endif
+
+make %{?jobs:-j%jobs}
+
+
+%install
+rm -rf %{buildroot}
+%make_install
+
+
+%clean
+rm -rf %{buildroot}
+
+
+%post
+/sbin/ldconfig
+
+
+%postun -p /sbin/ldconfig
+
+
+%files
+%manifest %{name}.manifest
+%{_libdir}/*.so.*
+
+%files devel
+%{_includedir}/location/*.h
+%{_libdir}/pkgconfig/*.pc
+%{_libdir}/*.so
+++ /dev/null
-* Mon Jul 01 2013 Anas Nashif <anas.nashif@intel.com> submit/tizen/20130517.044936@a3cd55b
-- we do not depend on gconf
-
-* Tue May 28 2013 Baptiste DURAND <baptiste.durand@eurogiciel.fr> accepted/tizen/20130520.101053@268dabb
-- Fix build for x86_64 arch
+++ /dev/null
-<manifest>
- <request>
- <domain name="_"/>
- </request>
-</manifest>
+++ /dev/null
-Name: libslp-location
-Summary: Location Based Service
-Version: 0.5.3
-Release: 0
-Group: Location/Libraries
-License: Apache-2.0
-Source0: %{name}-%{version}.tar.gz
-Source1001: libslp-location.manifest
-Requires(post): /sbin/ldconfig
-Requires(post): /usr/bin/vconftool
-Requires(postun): /sbin/ldconfig
-BuildRequires: pkgconfig(glib-2.0)
-BuildRequires: pkgconfig(dbus-glib-1)
-BuildRequires: pkgconfig(gmodule-2.0)
-BuildRequires: pkgconfig(dlog)
-BuildRequires: pkgconfig(vconf)
-BuildRequires: pkgconfig(json-glib-1.0)
-
-%description
-Location Based Service Libraries
-
-
-%package devel
-Summary: Location Based Service (Development files)
-Group: System/Libraries
-Requires: %{name} = %{version}-%{release}
-
-%description devel
-Location Based Service Development Package
-
-
-%prep
-%setup -q -n %{name}-%{version}
-cp %{SOURCE1001} .
-
-
-%build
-
-%autogen
-%reconfigure --enable-dlog --enable-debug
-
-%__make %{?_smp_mflags}
-
-
-%install
-%make_install
-
-
-%post
-/sbin/ldconfig
-vconftool set -t int db/location/last/gps/Timestamp "0" -f
-vconftool set -t double db/location/last/gps/Latitude "0.0" -f
-vconftool set -t double db/location/last/gps/Longitude "0.0" -f
-vconftool set -t double db/location/last/gps/Altitude "0.0" -f
-vconftool set -t double db/location/last/gps/HorAccuracy "0.0" -f
-vconftool set -t double db/location/last/gps/VerAccuracy "0.0" -f
-vconftool set -t double db/location/last/gps/Speed "0.0" -f
-vconftool set -t double db/location/last/gps/Direction "0.0" -f
-vconftool set -t int db/location/last/wps/Timestamp "0" -f
-vconftool set -t double db/location/last/wps/Latitude "0.0" -f
-vconftool set -t double db/location/last/wps/Longitude "0.0" -f
-vconftool set -t double db/location/last/wps/Altitude "0.0" -f
-vconftool set -t double db/location/last/wps/HorAccuracy "0.0" -f
-vconftool set -t double db/location/last/wps/Speed "0.0" -f
-vconftool set -t double db/location/last/wps/Direction "0.0" -f
-vconftool set -t int db/location/setting/GpsEnabled "0" -g 6514 -f
-vconftool set -t int db/location/setting/AgpsEnabled "0" -g 6514 -f
-vconftool set -t int db/location/setting/NetworkEnabled "0" -g 6514 -f
-
-%postun -p /sbin/ldconfig
-
-
-%files
-%manifest %{name}.manifest
-%{_libdir}/lib*.so*
-
-
-%files devel
-%manifest %{name}.manifest
-%{_includedir}/location/*.h
-%{_libdir}/pkgconfig/*.pc
+++ /dev/null
-dir_location = $(top_srcdir)/location
-noinst_PROGRAMS = location-api-test gps-test wps-test hybrid-test\
- position-sample-gps velocity-sample nmea-sample satellite-sample property-sample zone-sample address-sample map-service-test
-
-gps_test_SOURCES = gps-test.c
-wps_test_SOURCES = wps-test.c
-hybrid_test_SOURCES = hybrid-test.c
-position_sample_gps_SOURCES = position-sample-gps.c
-velocity_sample_SOURCES = velocity-sample.c
-nmea_sample_SOURCES = nmea-sample.c
-satellite_sample_SOURCES = satellite-sample.c
-property_sample_SOURCES = property-sample.c
-zone_sample_SOURCES = zone-sample.c
-address_sample_SOURCES = address-sample.c
-location_api_test_SOURCES = location-api-test.c location-api-test-util.c
-map_service_test_SOURCES = map-service-test.c
-
-LDADD = \
- $(dir_location)/libSLP-location.la\
- $(TEST_LIBS)
-AM_CFLAGS = \
- -I$(dir_location) \
- -I$(dir_location)/include \
- -I$(dir_location)/manager \
- -I$(dir_location)/map-service \
- $(TEST_CFLAGS)
-
-dir_tests = $(top_srcdir)/tests
-dir_tests_exec = $(top_srcdir)/tests/.libs
-
-install-exec-hook:
- cp $(dir_tests)/location-api-test.json $(dir_tests_exec)/location-api-test.json
- chmod 644 $(dir_tests_exec)/location-api-test.json
-
-uninstall-hook:
- rm -f $(dir_tests_exec)/location-api-test.json
* limitations under the License.
*/
-#include <gconf/gconf-client.h>
#include <location.h>
#include <location-geocode.h>
#include <location-map-service.h>
static GMainLoop *loop = NULL;
static gboolean
-exit_program (gpointer data)
+exit_program(gpointer data)
{
- g_main_loop_quit (loop);
- g_debug ("Quit g_main_loop");
+ g_main_loop_quit(loop);
+ g_debug("Quit g_main_loop");
return FALSE;
}
static void
-print_pos (gpointer data, gpointer user_data)
+print_pos(gpointer data, gpointer user_data)
{
LocationPosition *pos = (LocationPosition *)data;
if (pos) {
- g_debug ("time: %d, lat: %f, long: %f, alt: %f, status: %d",
- pos->timestamp, pos->latitude, pos->longitude, pos->altitude, pos->status);
- location_position_free (pos);
+ g_debug("time: %d, lat: %f, long: %f, alt: %f, status: %d",
+ pos->timestamp, pos->latitude, pos->longitude, pos->altitude, pos->status);
+ location_position_free(pos);
}
}
static void
-print_acc (gpointer data, gpointer user_data)
+print_acc(gpointer data, gpointer user_data)
{
LocationAccuracy *acc = (LocationAccuracy *)data;
if (acc) {
- g_debug ("\tAccuracy level %d (%.0f meters %.0f meters)", acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
- location_accuracy_free (acc);
+ g_debug("\tAccuracy level %d (%.0f meters %.0f meters)", acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
+ location_accuracy_free(acc);
}
}
static void
-cb_address (LocationError error,
- LocationAddress *addr,
- LocationAccuracy *acc,
- gpointer userdata)
+cb_address(LocationError error,
+ LocationAddress *addr,
+ LocationAccuracy *acc,
+ gpointer userdata)
{
if (error != LOCATION_ERROR_NONE) {
g_debug("cb_address failed: error=%d\n", error);
return;
}
- g_debug ("ASYNC>> location_map_get_address_async> %s %s %s %s %s %s %s",
- addr->building_number, addr->street, addr->district, addr->city, addr->state, addr->postal_code, addr->country_code);
- g_debug ("\tAccuracy level %d (%.0f meters %.0f meters)", acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
+ g_debug("ASYNC>> location_map_get_address_async> %s %s %s %s %s %s %s",
+ addr->building_number, addr->street, addr->district, addr->city, addr->state, addr->postal_code, addr->country_code);
+ g_debug("\tAccuracy level %d (%.0f meters %.0f meters)", acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
}
static void
-cb_service_disabled (GObject *self,
- guint status,
- gpointer userdata)
+cb_service_disabled(GObject *self,
+ guint status,
+ gpointer userdata)
{
g_debug("cb_service_disabled: status(%d) userdata(0x%x)", status, (unsigned int)userdata);
}
static void
-cb_position_from_address (LocationError error, GList *pos_list, GList *acc_list, gpointer userdata)
+cb_position_from_address(LocationError error, GList *pos_list, GList *acc_list, gpointer userdata)
{
if (error != LOCATION_ERROR_NONE) {
g_debug("cb_position_from_address failed: error=%d\n", error);
return;
}
- g_list_foreach (pos_list, print_pos, NULL);
- g_list_foreach (acc_list, print_acc, NULL);
+ g_list_foreach(pos_list, print_pos, NULL);
+ g_list_foreach(acc_list, print_acc, NULL);
}
static void
-cb_position_from_freeformed_address (LocationError error, GList *pos_list, GList *acc_list, gpointer userdata)
+cb_position_from_freeformed_address(LocationError error, GList *pos_list, GList *acc_list, gpointer userdata)
{
if (error != LOCATION_ERROR_NONE) {
g_debug("cb_position_from_freeformed_address failed: error=%d\n", error);
return;
}
- g_list_foreach (pos_list, print_pos, NULL);
- g_list_foreach (acc_list, print_acc, NULL);
+ g_list_foreach(pos_list, print_pos, NULL);
+ g_list_foreach(acc_list, print_acc, NULL);
}
static void
-cb_address_from_position (LocationError error, LocationAddress *addr, LocationAccuracy *acc, gpointer userdata)
+cb_address_from_position(LocationError error, LocationAddress *addr, LocationAccuracy *acc, gpointer userdata)
{
if (error != LOCATION_ERROR_NONE) {
g_debug("cb_address_from_position failed: error=%d\n", error);
return;
}
- g_debug ("ASYNC>> location_map_get_address_from_position_async> %s %s %s %s %s %s %s",
- addr->building_number, addr->street, addr->district, addr->city, addr->state, addr->postal_code, addr->country_code);
- g_debug ("\tAccuracy level %d (%.0f meters %.0f meters)", acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
+ g_debug("ASYNC>> location_map_get_address_from_position_async> %s %s %s %s %s %s %s",
+ addr->building_number, addr->street, addr->district, addr->city, addr->state, addr->postal_code, addr->country_code);
+ g_debug("\tAccuracy level %d (%.0f meters %.0f meters)", acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
}
static void
-cb_service_enabled (GObject *self,
- guint status,
- gpointer userdata)
+cb_service_enabled(GObject *self,
+ guint status,
+ gpointer userdata)
{
g_debug("cb_service_enabled: status(%d) userdata(0x%x)", status, (unsigned int)userdata);
}
static gboolean
-async_request (gpointer loc)
+async_request(gpointer loc)
{
guint req_id = 0;
- LocationGeocodePreference *pref =location_geocode_pref_new();
+ LocationGeocodePreference *pref = location_geocode_pref_new();
location_geocode_pref_set_max_result(pref, 25);
- LocationAddress *addr = location_address_new ("1", "Post Street", NULL, "san jose", "ca", NULL, "95113",NULL,NULL,NULL);
- LocationError err = location_map_get_position_from_address_async(loc, addr,pref, cb_position_from_address, loc,&req_id);
+ LocationAddress *addr = location_address_new("1", "Post Street", NULL, "san jose", "ca", NULL, "95113", NULL, NULL, NULL);
+ LocationError err = location_map_get_position_from_address_async(loc, addr, pref, cb_position_from_address, loc, &req_id);
if (LOCATION_ERROR_NONE == err)
g_debug("location_map_get_position_from_address_async() success");
- else g_warning ("location_map_get_position_from_address_async() failed> error code:%d", err);
- location_address_free (addr);
+ else g_warning("location_map_get_position_from_address_async() failed> error code:%d", err);
+ location_address_free(addr);
gchar *addr_str = g_strdup("4 N 2nd Street 95113");
- err = location_map_get_position_from_freeformed_address_async(loc, addr_str,pref, cb_position_from_freeformed_address, loc,&req_id);
+ err = location_map_get_position_from_freeformed_address_async(loc, addr_str, pref, cb_position_from_freeformed_address, loc, &req_id);
if (LOCATION_ERROR_NONE == err)
g_debug("location_map_get_position_from_freeformed_address_async() success");
- else g_warning ("location_map_get_position_from_freeformed_address_async() failed> error code:%d", err);
+ else g_warning("location_map_get_position_from_freeformed_address_async() failed> error code:%d", err);
g_free(addr_str);
- LocationPosition *pos = location_position_new (0, 37.3322, -121.8720, 0, LOCATION_STATUS_2D_FIX);
- err = location_map_get_address_from_position_async(loc, pos,cb_address_from_position, loc,&req_id);
+ LocationPosition *pos = location_position_new(0, 37.3322, -121.8720, 0, LOCATION_STATUS_2D_FIX);
+ err = location_map_get_address_from_position_async(loc, pos, cb_address_from_position, loc, &req_id);
if (LOCATION_ERROR_NONE == err)
g_debug("location_map_get_address_from_position_async() success");
- else g_warning ("location_map_get_address_from_position_async() failed> error code:%d", err);
- location_position_free (pos);
+ else g_warning("location_map_get_address_from_position_async() failed> error code:%d", err);
+ location_position_free(pos);
location_geocode_pref_free(pref);
return FALSE;
}
int
-main (int argc, char *argv[])
+main(int argc, char *argv[])
{
LocationMapObject *loc = NULL;
- // If application is executed by AUL, this is not needed.
- g_setenv("PKG_NAME", "org.tizen.address-sample", 1);
+ /* If application is executed by AUL, this is not needed. */
+ g_setenv("PKG_NAME", "com.samsung.address-sample", 1);
+#if !GLIB_CHECK_VERSION (2, 35, 0)
g_type_init();
- location_init ();
- loop = g_main_loop_new (NULL, TRUE);
+#endif
+
+ location_init();
+ loop = g_main_loop_new(NULL, TRUE);
- loc = location_map_new (NULL);
+ loc = location_map_new(NULL);
if (!loc) {
g_warning("location_map_new failed");
return -1;
GList *acc_list = NULL;
LocationAddress *addr = NULL;
- addr = location_address_new ("1", "Post Street", NULL, "san jose", "ca", NULL, "95113",NULL,NULL,NULL);
+ addr = location_address_new("1", "Post Street", NULL, "san jose", "ca", NULL, "95113", NULL, NULL, NULL);
LocationError err = location_map_get_position_from_address(loc, addr, &pos_list, &acc_list);
if (LOCATION_ERROR_NONE == err) {
- g_list_foreach (pos_list, print_pos, NULL);
- g_list_foreach (acc_list, print_acc, NULL);
- } else g_warning ("SYNC>>>location_map_get_position_from_address() failed> error code:%d", err);
- location_address_free (addr);
+ g_list_foreach(pos_list, print_pos, NULL);
+ g_list_foreach(acc_list, print_acc, NULL);
+ } else g_warning("SYNC>>>location_map_get_position_from_address() failed> error code:%d", err);
+ location_address_free(addr);
- char* addr_str = g_strdup("4 N 2nd Street 95113");
+ char *addr_str = g_strdup("4 N 2nd Street 95113");
err = location_map_get_position_from_freeformed_address(loc, addr_str, &pos_list, &acc_list);
if (LOCATION_ERROR_NONE == err) {
- g_list_foreach (pos_list, print_pos, NULL);
- g_list_foreach (acc_list, print_acc, NULL);
- } else g_warning ("SYNC>> location_map_get_position_from_freeformed_address() failed> error code:%d", err);
+ g_list_foreach(pos_list, print_pos, NULL);
+ g_list_foreach(acc_list, print_acc, NULL);
+ } else g_warning("SYNC>> location_map_get_position_from_freeformed_address() failed> error code:%d", err);
g_free(addr_str);
- pos = location_position_new (0, 37.3322, -121.8720, 0, LOCATION_STATUS_2D_FIX);
+ pos = location_position_new(0, 37.3322, -121.8720, 0, LOCATION_STATUS_2D_FIX);
err = location_map_get_address_from_position(loc, pos, &addr, &acc);
if (LOCATION_ERROR_NONE == err) {
- g_debug ("SYNC>> location_map_get_address_from_position() success> %s %s %s %s %s %s %s",
- addr->building_number, addr->street, addr->district, addr->city, addr->state, addr->postal_code, addr->country_code);
- g_debug ("\tAccuracy level %d (%.0f meters %.0f meters)", acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
+ g_debug("SYNC>> location_map_get_address_from_position() success> %s %s %s %s %s %s %s",
+ addr->building_number, addr->street, addr->district, addr->city, addr->state, addr->postal_code, addr->country_code);
+ g_debug("\tAccuracy level %d (%.0f meters %.0f meters)", acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
location_address_free(addr);
location_accuracy_free(acc);
- } else g_warning ("SYNC>> location_map_get_address_from_position() failed> error code:%d", err);
- location_position_free (pos);
+ } else g_warning("SYNC>> location_map_get_address_from_position() failed> error code:%d", err);
+ location_position_free(pos);
- g_signal_connect (loc, "service-enabled", G_CALLBACK(cb_service_enabled), loc);
- g_signal_connect (loc, "service-disabled", G_CALLBACK(cb_service_disabled), loc);
+ g_signal_connect(loc, "service-enabled", G_CALLBACK(cb_service_enabled), loc);
+ g_signal_connect(loc, "service-disabled", G_CALLBACK(cb_service_disabled), loc);
- g_timeout_add_seconds (3, async_request, loc);
+ g_timeout_add_seconds(3, async_request, loc);
- g_timeout_add_seconds (60, exit_program, NULL);
- g_main_loop_run (loop);
+ g_timeout_add_seconds(60, exit_program, NULL);
+ g_main_loop_run(loop);
- location_map_free (loc);
+ location_map_free(loc);
return 0;
}
static GMainLoop *loop = NULL;
static void
-cb_service_updated (GObject *self,
- guint type,
- gpointer data,
- gpointer accuracy,
- gpointer userdata)
+cb_service_updated(GObject *self,
+ guint type,
+ gpointer data,
+ gpointer accuracy,
+ gpointer userdata)
{
g_debug("cb_service_updated: type(%d) userdata(0x%x)", type, (unsigned int)userdata);
- LocationAccuracy *acc = (LocationAccuracy*) accuracy;
+ LocationAccuracy *acc = (LocationAccuracy *) accuracy;
switch (type) {
- case POSITION_UPDATED: {
- LocationPosition *pos = (LocationPosition*) data;
- g_debug ("ASYNC>> Current position> time: %d, lat: %f, long: %f, alt: %f, status: %d",
- pos->timestamp, pos->latitude, pos->longitude, pos->altitude, pos->status);
- g_debug ("\tAccuracy level %d (%.0f meters %.0f meters)",
- acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
- }
- break;
- case VELOCITY_UPDATED: {
- LocationVelocity *vel = (LocationVelocity*) data;
- g_debug ("ASYNC>> Current velocity> time: %d, speed: %f, direction:%f, climb:%f",
- vel->timestamp, vel->speed, vel->direction, vel->climb);
- g_debug ("\tAccuracy level %d (%.0f meters %.0f meters)",
- acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
- }
- break;
- default:
- g_warning ("ASYNC>> Undefined update type");
- break;
+ case POSITION_UPDATED: {
+ LocationPosition *pos = (LocationPosition *) data;
+ g_debug("ASYNC>> Current position> time: %d, lat: %f, long: %f, alt: %f, status: %d",
+ pos->timestamp, pos->latitude, pos->longitude, pos->altitude, pos->status);
+ g_debug("\tAccuracy level %d (%.0f meters %.0f meters)",
+ acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
+ }
+ break;
+ case VELOCITY_UPDATED: {
+ LocationVelocity *vel = (LocationVelocity *) data;
+ g_debug("ASYNC>> Current velocity> time: %d, speed: %f, direction:%f, climb:%f",
+ vel->timestamp, vel->speed, vel->direction, vel->climb);
+ g_debug("\tAccuracy level %d (%.0f meters %.0f meters)",
+ acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
+ }
+ break;
+ default:
+ g_warning("ASYNC>> Undefined update type");
+ break;
}
}
static void
-cb_service_enabled (GObject *self,
- guint status,
- gpointer userdata)
+cb_service_enabled(GObject *self,
+ guint status,
+ gpointer userdata)
{
g_debug("cb_service_enabled: status(%d) userdata(0x%x)", status, (unsigned int)userdata);
- LocationObject *loc = (LocationObject*)userdata;
+ LocationObject *loc = (LocationObject *)userdata;
LocationAccuracy *acc = NULL;
LocationPosition *pos = NULL;
LocationVelocity *vel = NULL;
gchar *nmea_data = NULL;
int idx = 0;
- if (LOCATION_ERROR_NONE == location_get_position (loc, &pos, &acc)) {
- g_debug ("SYNC>> Current position> time: %d, lat: %f, long: %f, alt: %f, status: %d",
- pos->timestamp, pos->latitude, pos->longitude, pos->altitude, pos->status);
- g_debug ("\tAccuracy level %d (%.0f meters %.0f meters)",
- acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
+ if (LOCATION_ERROR_NONE == location_get_position(loc, &pos, &acc)) {
+ g_debug("SYNC>> Current position> time: %d, lat: %f, long: %f, alt: %f, status: %d",
+ pos->timestamp, pos->latitude, pos->longitude, pos->altitude, pos->status);
+ g_debug("\tAccuracy level %d (%.0f meters %.0f meters)",
+ acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
location_position_free(pos);
location_accuracy_free(acc);
- } else g_warning ("SYNC>> Current position> failed");
- if (LOCATION_ERROR_NONE == location_get_velocity (loc, &vel, &acc)) {
- g_debug ("SYNC>> Current velocity> time: %d, speed: %f, direction:%f, climb:%f",
- vel->timestamp, vel->speed, vel->direction, vel->climb);
- g_debug ("\tAccuracy level %d (%.0f meters %.0f meters)",
- acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
+ } else g_warning("SYNC>> Current position> failed");
+ if (LOCATION_ERROR_NONE == location_get_velocity(loc, &vel, &acc)) {
+ g_debug("SYNC>> Current velocity> time: %d, speed: %f, direction:%f, climb:%f",
+ vel->timestamp, vel->speed, vel->direction, vel->climb);
+ g_debug("\tAccuracy level %d (%.0f meters %.0f meters)",
+ acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
location_velocity_free(vel);
location_accuracy_free(acc);
- } else g_warning ("SYNC>> Current velocity> failed");
+ } else g_warning("SYNC>> Current velocity> failed");
- g_object_get (loc, "satellite", &sat, NULL);
+ g_object_get(loc, "satellite", &sat, NULL);
if (sat) {
- g_debug ("SYNC>> Current Sattelite> satellite in view = %d, satellite in used = %d", sat->num_of_sat_inview, sat->num_of_sat_used);
- g_debug ("\tinview satellite information = ");
- for (idx=0; idx<sat->num_of_sat_inview; idx++) {
+ g_debug("SYNC>> Current Sattelite> satellite in view = %d, satellite in used = %d", sat->num_of_sat_inview, sat->num_of_sat_used);
+ g_debug("\tinview satellite information = ");
+ for (idx = 0; idx < sat->num_of_sat_inview; idx++) {
guint prn;
gboolean used;
guint elevation;
guint azimuth;
gint snr;
location_satellite_get_satellite_details(sat, idx, &prn, &used, &elevation, &azimuth, &snr);
- g_debug ("\t\t[%02d] used: %d, prn: %d, elevation: %d, azimuth: %d, snr: %d",
- idx, used, prn, elevation, azimuth, snr);
+ g_debug("\t\t[%02d] used: %d, prn: %d, elevation: %d, azimuth: %d, snr: %d",
+ idx, used, prn, elevation, azimuth, snr);
}
- location_satellite_free (sat);
- } else g_warning ("SYNC>> Current Sattelite> failed");
+ location_satellite_free(sat);
+ } else g_warning("SYNC>> Current Sattelite> failed");
g_object_get(loc, "nmea", &nmea_data, NULL);
if (nmea_data) {
}
static void
-cb_service_disabled (GObject *self,
- guint status,
- gpointer userdata)
+cb_service_disabled(GObject *self,
+ guint status,
+ gpointer userdata)
{
g_debug("cb_service_disabled: status(%d) userdata(0x%x)", status, (unsigned int)userdata);
}
static void
-cb_zone_in (GObject *self,
- gpointer boundary,
- gpointer position,
- gpointer accuracy)
+cb_zone_in(GObject *self,
+ gpointer boundary,
+ gpointer position,
+ gpointer accuracy)
{
- LocationPosition *pos = (LocationPosition*) position;
- LocationAccuracy *acc = (LocationAccuracy*) accuracy;
+ LocationPosition *pos = (LocationPosition *) position;
+ LocationAccuracy *acc = (LocationAccuracy *) accuracy;
- g_debug ("ASYNC>> ZoneIn> Current position: time: %d, lat: %f, long: %f, alt: %f",
- pos->timestamp, pos->latitude, pos->longitude, pos->altitude);
- g_debug ("\tAccuracy level %d (%.0f meters %.0f meters)",
- acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
+ g_debug("ASYNC>> ZoneIn> Current position: time: %d, lat: %f, long: %f, alt: %f",
+ pos->timestamp, pos->latitude, pos->longitude, pos->altitude);
+ g_debug("\tAccuracy level %d (%.0f meters %.0f meters)",
+ acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
}
static void
-cb_zone_out (GObject *self,
- gpointer boundary,
- gpointer position,
- gpointer accuracy)
+cb_zone_out(GObject *self,
+ gpointer boundary,
+ gpointer position,
+ gpointer accuracy)
{
- LocationPosition *pos = (LocationPosition*) position;
- LocationAccuracy *acc = (LocationAccuracy*) accuracy;
+ LocationPosition *pos = (LocationPosition *) position;
+ LocationAccuracy *acc = (LocationAccuracy *) accuracy;
- g_debug ("ASYNC>> ZoneOut> Current position: time: %d, lat: %f, long: %f, alt: %f",
- pos->timestamp, pos->latitude, pos->longitude, pos->altitude);
- g_debug ("\tAccuracy level %d (%.0f meters %.0f meters)",
- acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
+ g_debug("ASYNC>> ZoneOut> Current position: time: %d, lat: %f, long: %f, alt: %f",
+ pos->timestamp, pos->latitude, pos->longitude, pos->altitude);
+ g_debug("\tAccuracy level %d (%.0f meters %.0f meters)",
+ acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
}
int
-main (int argc, char *argv[])
+main(int argc, char *argv[])
{
LocationObject *loc = NULL;
- // If application is executed by AUL, this is not needed.
- g_setenv("PKG_NAME", "org.tizen.gps-test", 1);
+ /* If application is executed by AUL, this is not needed. */
+ g_setenv("PKG_NAME", "com.samsung.gps-test", 1);
- location_init ();
+ location_init();
- loop = g_main_loop_new (NULL, TRUE);
+ loop = g_main_loop_new(NULL, TRUE);
- loc = location_new (LOCATION_METHOD_GPS);
+ loc = location_new(LOCATION_METHOD_GPS);
if (!loc) {
g_debug("location_new failed");
return -1;
g_object_get(loc, "method", &method, NULL);
g_debug("Get property>> method:%d", method);
- char* devname = NULL;
- g_object_get(loc, "dev-name", &devname, NULL);
- if (devname) {
- g_debug("Get property>> dev-name: %s", devname);
- } else g_warning("failed to get property> dev-name");
-
- devname = NULL;
- g_object_set(loc, "dev-name", "/dev/test", NULL);
- g_object_get(loc, "dev-name", &devname, NULL);
- if (devname) {
- g_debug("Get property>> dev-name: %s", devname);
- g_free(devname);
- } else g_warning("failed to set property> dev-name");
-
LocationBoundary *bound = NULL;
g_object_get(loc, "boundary", &bound, NULL);
if (bound) {
LocationPosition *rb = location_position_new(0, 37.255, 127.056, 0, LOCATION_STATUS_2D_FIX);
LocationPosition *lt = location_position_new(0, 37.260, 127.050, 0, LOCATION_STATUS_2D_FIX);
bound = location_boundary_new_for_rect(lt, rb);
- location_position_free (rb);
- location_position_free (lt);
+ location_position_free(rb);
+ location_position_free(lt);
if (bound) {
g_object_set(loc, "boundary", bound, NULL);
} else g_warning("failed to location_boundary_new_for_rect()");
g_object_get(loc, "boundary", &bound, NULL);
if (bound) {
g_debug("Set property>> boundary> type: %d, (%f,%f),(%f,%f)",
- bound->type,
- bound->rect.right_bottom->latitude, bound->rect.right_bottom->longitude,
- bound->rect.left_top->latitude, bound->rect.left_top->longitude);
- location_boundary_free (bound);
- } else g_warning("failed to set property> boundary");
-
- g_signal_connect (loc, "service-enabled", G_CALLBACK(cb_service_enabled), loc);
- g_signal_connect (loc, "service-disabled", G_CALLBACK(cb_service_disabled), loc);
- g_signal_connect (loc, "service-updated", G_CALLBACK(cb_service_updated), loc);
- g_signal_connect (loc, "zone-in", G_CALLBACK(cb_zone_in), loc);
- g_signal_connect (loc, "zone-out", G_CALLBACK(cb_zone_out), loc);
-
- if( LOCATION_ERROR_NONE != location_start (loc) ){
+ bound->type,
+ bound->rect.right_bottom->latitude, bound->rect.right_bottom->longitude,
+ bound->rect.left_top->latitude, bound->rect.left_top->longitude);
+ location_boundary_free(bound);
+ } else g_warning("failed to set property> boundary");
+
+ g_signal_connect(loc, "service-enabled", G_CALLBACK(cb_service_enabled), loc);
+ g_signal_connect(loc, "service-disabled", G_CALLBACK(cb_service_disabled), loc);
+ g_signal_connect(loc, "service-updated", G_CALLBACK(cb_service_updated), loc);
+ g_signal_connect(loc, "zone-in", G_CALLBACK(cb_zone_in), loc);
+ g_signal_connect(loc, "zone-out", G_CALLBACK(cb_zone_out), loc);
+
+ if (LOCATION_ERROR_NONE != location_start(loc)) {
g_debug("location_start failed");
return -1;
}
- g_main_loop_run (loop);
+ g_main_loop_run(loop);
- location_stop (loc);
+ location_stop(loc);
LocationPosition *pos = NULL;
g_object_get(loc, "last-position", &pos, NULL);
if (pos) {
- g_debug ("Get property>> last-position> time: %d, lat: %f, long: %f, alt: %f, status: %d",
- pos->timestamp, pos->latitude, pos->longitude, pos->altitude, pos->status);
+ g_debug("Get property>> last-position> time: %d, lat: %f, long: %f, alt: %f, status: %d",
+ pos->timestamp, pos->latitude, pos->longitude, pos->altitude, pos->status);
location_position_free(pos);
- } else g_warning("failed to get property> last-position");
+ } else g_warning("failed to get property> last-position");
- location_free (loc);
+ location_free(loc);
return 0;
}
static GMainLoop *loop = NULL;
static void
-cb_service_updated (GObject *self,
- guint type,
- gpointer data,
- gpointer accuracy,
- gpointer userdata)
+cb_service_updated(GObject *self,
+ guint type,
+ gpointer data,
+ gpointer accuracy,
+ gpointer userdata)
{
g_debug("cb_service_updated: type(%d) userdata(0x%x)", type, (unsigned int)userdata);
- LocationAccuracy *acc = (LocationAccuracy*) accuracy;
+ LocationAccuracy *acc = (LocationAccuracy *) accuracy;
switch (type) {
- case POSITION_UPDATED: {
- LocationPosition *pos = (LocationPosition*) data;
- g_debug ("ASYNC>> Current position> time: %d, lat: %f, long: %f, alt: %f, status: %d",
- pos->timestamp, pos->latitude, pos->longitude, pos->altitude, pos->status);
- g_debug ("\tAccuracy level %d (%.0f meters %.0f meters)",
- acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
- }
- break;
- case VELOCITY_UPDATED: {
- LocationVelocity *vel = (LocationVelocity*) data;
- g_debug ("ASYNC>> Current velocity> time: %d, speed: %f, direction:%f, climb:%f",
- vel->timestamp, vel->speed, vel->direction, vel->climb);
- g_debug ("\tAccuracy level %d (%.0f meters %.0f meters)",
- acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
- }
- break;
- default:
- g_warning ("ASYNC>> Undefined update type");
- break;
+ case POSITION_UPDATED: {
+ LocationPosition *pos = (LocationPosition *) data;
+ g_debug("ASYNC>> Current position> time: %d, lat: %f, long: %f, alt: %f, status: %d",
+ pos->timestamp, pos->latitude, pos->longitude, pos->altitude, pos->status);
+ g_debug("\tAccuracy level %d (%.0f meters %.0f meters)",
+ acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
+ }
+ break;
+ case VELOCITY_UPDATED: {
+ LocationVelocity *vel = (LocationVelocity *) data;
+ g_debug("ASYNC>> Current velocity> time: %d, speed: %f, direction:%f, climb:%f",
+ vel->timestamp, vel->speed, vel->direction, vel->climb);
+ g_debug("\tAccuracy level %d (%.0f meters %.0f meters)",
+ acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
+ }
+ break;
+ default:
+ g_warning("ASYNC>> Undefined update type");
+ break;
}
}
static void
-cb_service_enabled (GObject *self,
- guint status,
- gpointer userdata)
+cb_service_enabled(GObject *self,
+ guint status,
+ gpointer userdata)
{
g_debug("cb_service_enabled: status(%d) userdata(0x%x)", status, (unsigned int)userdata);
- LocationObject *loc = (LocationObject*)userdata;
+ LocationObject *loc = (LocationObject *)userdata;
LocationAccuracy *acc = NULL;
LocationPosition *pos = NULL;
LocationVelocity *vel = NULL;
g_object_get(loc, "method", &method, NULL);
g_debug("Get property>> method:%d", method);
- if (LOCATION_ERROR_NONE == location_get_position (loc, &pos, &acc)) {
- g_debug ("SYNC>> Current position> time: %d, lat: %f, long: %f, alt: %f, status: %d",
- pos->timestamp, pos->latitude, pos->longitude, pos->altitude, pos->status);
- g_debug ("\tAccuracy level %d (%.0f meters %.0f meters)",
- acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
+ if (LOCATION_ERROR_NONE == location_get_position(loc, &pos, &acc)) {
+ g_debug("SYNC>> Current position> time: %d, lat: %f, long: %f, alt: %f, status: %d",
+ pos->timestamp, pos->latitude, pos->longitude, pos->altitude, pos->status);
+ g_debug("\tAccuracy level %d (%.0f meters %.0f meters)",
+ acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
location_position_free(pos);
location_accuracy_free(acc);
- } else g_warning ("SYNC>> Current position> failed");
- if (LOCATION_ERROR_NONE == location_get_velocity (loc, &vel, &acc)) {
- g_debug ("SYNC>> Current velocity> time: %d, speed: %f, direction:%f, climb:%f",
- vel->timestamp, vel->speed, vel->direction, vel->climb);
- g_debug ("\tAccuracy level %d (%.0f meters %.0f meters)",
- acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
+ } else g_warning("SYNC>> Current position> failed");
+ if (LOCATION_ERROR_NONE == location_get_velocity(loc, &vel, &acc)) {
+ g_debug("SYNC>> Current velocity> time: %d, speed: %f, direction:%f, climb:%f",
+ vel->timestamp, vel->speed, vel->direction, vel->climb);
+ g_debug("\tAccuracy level %d (%.0f meters %.0f meters)",
+ acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
location_velocity_free(vel);
location_accuracy_free(acc);
- } else g_warning ("SYNC>> Current velocity> failed");
- }
+ } else g_warning("SYNC>> Current velocity> failed");
+}
static void
-cb_service_disabled (GObject *self,
- guint status,
- gpointer userdata)
+cb_service_disabled(GObject *self,
+ guint status,
+ gpointer userdata)
{
g_debug("cb_service_disabled: status(%d) userdata(0x%x)", status, (unsigned int)userdata);
}
static void
-cb_zone_in (GObject *self,
- gpointer boundary,
- gpointer position,
- gpointer accuracy)
+cb_zone_in(GObject *self,
+ gpointer boundary,
+ gpointer position,
+ gpointer accuracy)
{
- LocationPosition *pos = (LocationPosition*) position;
- LocationAccuracy *acc = (LocationAccuracy*) accuracy;
+ LocationPosition *pos = (LocationPosition *) position;
+ LocationAccuracy *acc = (LocationAccuracy *) accuracy;
- g_debug ("ASYNC>> ZoneIn> Current position: time: %d, lat: %f, long: %f, alt: %f",
- pos->timestamp, pos->latitude, pos->longitude, pos->altitude);
- g_debug ("\tAccuracy level %d (%.0f meters %.0f meters)",
- acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
+ g_debug("ASYNC>> ZoneIn> Current position: time: %d, lat: %f, long: %f, alt: %f",
+ pos->timestamp, pos->latitude, pos->longitude, pos->altitude);
+ g_debug("\tAccuracy level %d (%.0f meters %.0f meters)",
+ acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
}
static void
-cb_zone_out (GObject *self,
- gpointer boundary,
- gpointer position,
- gpointer accuracy)
+cb_zone_out(GObject *self,
+ gpointer boundary,
+ gpointer position,
+ gpointer accuracy)
{
- LocationPosition *pos = (LocationPosition*) position;
- LocationAccuracy *acc = (LocationAccuracy*) accuracy;
+ LocationPosition *pos = (LocationPosition *) position;
+ LocationAccuracy *acc = (LocationAccuracy *) accuracy;
- g_debug ("ASYNC>> ZoneOut> Current position: time: %d, lat: %f, long: %f, alt: %f",
- pos->timestamp, pos->latitude, pos->longitude, pos->altitude);
- g_debug ("\tAccuracy level %d (%.0f meters %.0f meters)",
- acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
+ g_debug("ASYNC>> ZoneOut> Current position: time: %d, lat: %f, long: %f, alt: %f",
+ pos->timestamp, pos->latitude, pos->longitude, pos->altitude);
+ g_debug("\tAccuracy level %d (%.0f meters %.0f meters)",
+ acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
}
int
-main (int argc, char *argv[])
+main(int argc, char *argv[])
{
LocationObject *loc = NULL;
- // If application is executed by AUL, this is not needed.
- g_setenv("PKG_NAME", "org.tizen.hybrid-test", 1);
+ /* If application is executed by AUL, this is not needed. */
+ g_setenv("PKG_NAME", "com.samsung.hybrid-test", 1);
- location_init ();
+ location_init();
- loop = g_main_loop_new (NULL, TRUE);
+ loop = g_main_loop_new(NULL, TRUE);
- loc = location_new (LOCATION_METHOD_HYBRID);
+ loc = location_new(LOCATION_METHOD_HYBRID);
if (!loc) {
g_debug("location_new failed");
return -1;
g_object_get(loc, "boundary", &bound, NULL);
if (bound) {
g_debug("Get property>> boundary> type: %d", bound->type);
- location_boundary_free (bound);
+ location_boundary_free(bound);
} else g_warning("failed to get property> boundary");
LocationPosition *rb = location_position_new(0, 37.258, 127.056, 0, LOCATION_STATUS_2D_FIX);
LocationPosition *lt = location_position_new(0, 37.260, 127.054, 0, LOCATION_STATUS_2D_FIX);
bound = location_boundary_new_for_rect(lt, rb);
- location_position_free (rb);
- location_position_free (lt);
+ location_position_free(rb);
+ location_position_free(lt);
if (bound) {
g_object_set(loc, "boundary", bound, NULL);
location_boundary_free(bound);
g_object_get(loc, "boundary", &bound, NULL);
if (bound) {
g_debug("Set property>> boundary> type: %d, (%f,%f),(%f,%f)",
- bound->type,
- bound->rect.right_bottom->latitude, bound->rect.right_bottom->longitude,
- bound->rect.left_top->latitude, bound->rect.left_top->longitude);
- location_boundary_free (bound);
- } else g_warning("failed to set property> boundary");
-
- g_signal_connect (loc, "service-enabled", G_CALLBACK(cb_service_enabled), loc);
- g_signal_connect (loc, "service-disabled", G_CALLBACK(cb_service_disabled), loc);
- g_signal_connect (loc, "service-updated", G_CALLBACK(cb_service_updated), loc);
- g_signal_connect (loc, "zone-in", G_CALLBACK(cb_zone_in), loc);
- g_signal_connect (loc, "zone-out", G_CALLBACK(cb_zone_out), loc);
-
- if (LOCATION_ERROR_NONE != location_start (loc)) {
+ bound->type,
+ bound->rect.right_bottom->latitude, bound->rect.right_bottom->longitude,
+ bound->rect.left_top->latitude, bound->rect.left_top->longitude);
+ location_boundary_free(bound);
+ } else g_warning("failed to set property> boundary");
+
+ g_signal_connect(loc, "service-enabled", G_CALLBACK(cb_service_enabled), loc);
+ g_signal_connect(loc, "service-disabled", G_CALLBACK(cb_service_disabled), loc);
+ g_signal_connect(loc, "service-updated", G_CALLBACK(cb_service_updated), loc);
+ g_signal_connect(loc, "zone-in", G_CALLBACK(cb_zone_in), loc);
+ g_signal_connect(loc, "zone-out", G_CALLBACK(cb_zone_out), loc);
+
+ if (LOCATION_ERROR_NONE != location_start(loc)) {
g_debug("location_start failed");
return -1;
}
- g_main_loop_run (loop);
+ g_main_loop_run(loop);
- location_stop (loc);
+ location_stop(loc);
LocationPosition *pos = NULL;
g_object_get(loc, "last-position", &pos, NULL);
if (pos) {
- g_debug ("Get property>> last-position> time: %d, lat: %f, long: %f, alt: %f, status: %d",
- pos->timestamp, pos->latitude, pos->longitude, pos->altitude, pos->status);
+ g_debug("Get property>> last-position> time: %d, lat: %f, long: %f, alt: %f, status: %d",
+ pos->timestamp, pos->latitude, pos->longitude, pos->altitude, pos->status);
location_position_free(pos);
- } else g_warning("failed to get property> last-position");
+ } else g_warning("failed to get property> last-position");
- location_free (loc);
+ location_free(loc);
return 0;
}
{
if (parser == NULL || root == NULL) return 0;
- JsonObject* polygon_obj = json_array_get_object_element(json_node_get_array(root), polygon_index);
+ JsonObject *polygon_obj = json_array_get_object_element(json_node_get_array(root), polygon_index);
if (polygon_obj == NULL) return 0;
- JsonArray * positions = json_object_get_array_member (polygon_obj, "positions");
+ JsonArray *positions = json_object_get_array_member(polygon_obj, "positions");
if (positions == NULL) return 0;
return json_array_get_length(positions);
}
-static LocationPosition* _get_position_from_polygon(int polygon_index, int pos_index)
+static LocationPosition *_get_position_from_polygon(int polygon_index, int pos_index)
{
double latitude = 0.0;
double longitude = 0.0;
if (parser == NULL || root == NULL) return NULL;
JsonObject *polygon_obj = json_array_get_object_element(json_node_get_array(root), polygon_index);
- JsonArray * pos_array = json_object_get_array_member(polygon_obj, "positions");
- JsonObject* pos = json_array_get_object_element(pos_array, pos_index);
+ JsonArray *pos_array = json_object_get_array_member(polygon_obj, "positions");
+ JsonObject *pos = json_array_get_object_element(pos_array, pos_index);
latitude = json_object_get_double_member(pos, "latitude");
longitude = json_object_get_double_member(pos, "longitude");
return position;
}
-static LocationPosition* _get_marker_position_from_polygon(int polygon_index, int pos_index)
+static LocationPosition *_get_marker_position_from_polygon(int polygon_index, int pos_index)
{
double latitude = 0.0;
double longitude = 0.0;
if (parser == NULL || root == NULL) return NULL;
JsonObject *polygon_obj = json_array_get_object_element(json_node_get_array(root), polygon_index);
- JsonArray * pos_array = json_object_get_array_member(polygon_obj, "marker_position");
- JsonObject* pos = json_array_get_object_element(pos_array, pos_index);
+ JsonArray *pos_array = json_object_get_array_member(polygon_obj, "marker_position");
+ JsonObject *pos = json_array_get_object_element(pos_array, pos_index);
latitude = json_object_get_double_member(pos, "latitude");
longitude = json_object_get_double_member(pos, "longitude");
{
if (data == NULL) return;
- LocationPosition *position = (LocationPosition*) data;
+ LocationPosition *position = (LocationPosition *) data;
location_position_free(position);
}
-LocationBoundary* json_util_get_polygon_boundary(int polygon_index)
+LocationBoundary *json_util_get_polygon_boundary(int polygon_index)
{
if (parser == NULL || root == NULL) {
g_printf("invalid param parser[%d], root[%d]\n", parser, root);
return NULL;
}
- GList* position_list = NULL;
+ GList *position_list = NULL;
LocationBoundary *boundary = NULL;
int index = 0;
int pos_count = _get_polygon_position_count(polygon_index);
if (pos_count == 0) return NULL;
- for(index = 0; index < pos_count; index++) {
+ for (index = 0; index < pos_count; index++) {
position_list = g_list_append(position_list, _get_position_from_polygon(polygon_index, index));
}
/* Polygon boundary */
int json_util_get_polygon_count(void)
{
- JsonArray * array = json_node_get_array(root);
+ JsonArray *array = json_node_get_array(root);
return json_array_get_length(array);
}
JsonObject *polygon_obj = json_array_get_object_element(json_node_get_array(root), polygon_index);
name = (char *)json_object_get_string_member(polygon_obj, "name");
- if (name == NULL) return NULL;
+ if (name == NULL) return NULL;
return g_strdup(name);
}
/* Test Marker */
-char * json_util_get_marker_name(int polygon_index, int pos_index)
+char *json_util_get_marker_name(int polygon_index, int pos_index)
{
char *result = NULL;
if (parser == NULL || root == NULL) return NULL;
JsonObject *polygon_obj = json_array_get_object_element(json_node_get_array(root), polygon_index);
- JsonArray * pos_array = json_object_get_array_member(polygon_obj, "marker_position");
- JsonObject* pos = json_array_get_object_element(pos_array, pos_index);
+ JsonArray *pos_array = json_object_get_array_member(polygon_obj, "marker_position");
+ JsonObject *pos = json_array_get_object_element(pos_array, pos_index);
result = (char *)json_object_get_string_member(pos, "where");
if (result == NULL) return NULL;
{
if (parser == NULL || root == NULL) return 0;
- JsonObject* polygon_obj = json_array_get_object_element(json_node_get_array(root), polygon_index);
- JsonArray * marker_position = json_object_get_array_member (polygon_obj, "marker_position");
+ JsonObject *polygon_obj = json_array_get_object_element(json_node_get_array(root), polygon_index);
+ JsonArray *marker_position = json_object_get_array_member(polygon_obj, "marker_position");
return json_array_get_length(marker_position);
}
{
if (parser == NULL || root == NULL) return NULL;
- LocationPosition* position = NULL;
+ LocationPosition *position = NULL;
position = _get_marker_position_from_polygon(polygon_index, marker_index);
return position;
}
-char* json_util_result_zone_test(int polygon_index, int marker_index)
+char *json_util_result_zone_test(int polygon_index, int marker_index)
{
if (parser == NULL || root == NULL) return NULL;
char *result = NULL;
JsonObject *polygon_obj = json_array_get_object_element(json_node_get_array(root), polygon_index);
- JsonArray * pos_array = json_object_get_array_member(polygon_obj, "marker_position");
- JsonObject* pos = json_array_get_object_element(pos_array, marker_index);
+ JsonArray *pos_array = json_object_get_array_member(polygon_obj, "marker_position");
+ JsonObject *pos = json_array_get_object_element(pos_array, marker_index);
result = (char *)json_object_get_string_member(pos, "result");
if (result == NULL) return NULL;
return g_strdup(result);
}
-void json_util_init(const char * file_name)
+void json_util_init(const char *file_name)
{
g_print("Enter init_json_parser");
GError *error;
G_BEGIN_DECLS
void json_util_init(const char *file_file);
-char* json_util_result_zone_test(int polygon_index, int marker_index);
-char* json_util_get_marker_name(int polygon_index, int marker_index);
+char *json_util_result_zone_test(int polygon_index, int marker_index);
+char *json_util_get_marker_name(int polygon_index, int marker_index);
int json_util_get_marker_position_count(int polygon_index);
LocationPosition *json_util_get_marker_position(int polygon_index, int marker_index);
int json_util_get_polygon_count(void);
-char* json_util_get_polygon_name(int polygon_index);
-LocationBoundary* json_util_get_polygon_boundary(int polygon_index);
+char *json_util_get_polygon_name(int polygon_index);
+LocationBoundary *json_util_get_polygon_boundary(int polygon_index);
G_END_DECLS
#include "location-api-test-util.h"
#define STR_MAX 128
-LocationObject* location_obj = NULL;
+LocationObject *location_obj = NULL;
static GMainLoop *g_mainloop = NULL;
#define LOCATION_API_TEST_JSON_FILE "/opt/data/location-api-test.json"
static gpointer GmainThread(gpointer data)
{
- g_mainloop = g_main_loop_new (NULL, FALSE);
+ g_mainloop = g_main_loop_new(NULL, FALSE);
g_printf("\n...Entering GMain Loop to Receive Notifications....\n");
- g_main_loop_run (g_mainloop);
- g_main_loop_unref (g_mainloop);
+ g_main_loop_run(g_mainloop);
+ g_main_loop_unref(g_mainloop);
g_mainloop = NULL;
return NULL;
}
static void GetLocationError(char str[STR_MAX], int ret)
{
- switch(ret)
- {
+ switch (ret) {
case LOCATION_ERROR_NONE:
g_utf8_strncpy(str, "LOCATION_ERROR_NONE", STR_MAX);
break;
static void GetStatus(char str[STR_MAX], LocationStatus acc_level)
{
- switch(acc_level)
- {
+ switch (acc_level) {
case LOCATION_STATUS_NO_FIX:
g_utf8_strncpy(str, "LOCATION_STATUS_NO_FIX", STR_MAX);
break;
static void GetMethod(char str[STR_MAX], LocationMethod method)
{
- switch(method)
- {
+ switch (method) {
case LOCATION_METHOD_HYBRID:
g_utf8_strncpy(str, "LOCATION_METHOD_HYBRID", STR_MAX);
break;
static void GetAccuracyLevel(char str[STR_MAX], LocationAccuracyLevel acc_level)
{
- switch(acc_level)
- {
+ switch (acc_level) {
case LOCATION_ACCURACY_LEVEL_NONE:
g_utf8_strncpy(str, "LOCATION_ACCURACY_LEVEL_NONE", STR_MAX);
break;
}
-static void SelectOpt(char* buf)
+static void SelectOpt(char *buf)
{
int iLen = 0;
char *str = NULL;
str = fgets(buf, 255, stdin);
+ if (NULL == str) {
+ g_printf("fgets return NULL. \n");
+ }
iLen = g_utf8_strlen(buf, -1);
- buf[iLen-1] = '\0';
+ buf[iLen - 1] = '\0';
}
static int PromptInt()
int ret;
char *str = NULL;
str = fgets(buf, 255, stdin);
- buf[strlen(buf)-1]='\0';
+ if (NULL == str) {
+ g_printf("fgets return NULL. \n");
+ }
+ buf[strlen(buf) - 1] = '\0';
ret = g_ascii_strtoll(buf, NULL, 10);
return ret;
}
static void PrintPolygonPosition(gpointer data, gpointer user_data)
{
- LocationPosition *position = (LocationPosition*) data;
+ LocationPosition *position = (LocationPosition *) data;
g_printf("[%lf %lf %lf] ", position->latitude, position->longitude, position->altitude);
}
static void PrintBoundary(LocationBoundary *boundary, void *user_data)
{
- if(boundary == NULL) return;
+ if (boundary == NULL) return;
if (boundary->type == LOCATION_BOUNDARY_CIRCLE) {
g_printf("\n\tCIRCLE: center[%lf %lf %lf] radius[%lf]",
- boundary->circle.center->latitude, boundary->circle.center->longitude, boundary->circle.center->altitude, boundary->circle.radius);
+ boundary->circle.center->latitude, boundary->circle.center->longitude, boundary->circle.center->altitude, boundary->circle.radius);
} else if (boundary->type == LOCATION_BOUNDARY_RECT) {
g_printf("\n\tRECT: left_top[%lf %lf %lf] right_bottom[%lf %lf %lf]",
- boundary->rect.left_top->latitude, boundary->rect.left_top->longitude, boundary->rect.left_top->altitude,
- boundary->rect.right_bottom->latitude, boundary->rect.right_bottom->longitude, boundary->rect.right_bottom->altitude);
+ boundary->rect.left_top->latitude, boundary->rect.left_top->longitude, boundary->rect.left_top->altitude,
+ boundary->rect.right_bottom->latitude, boundary->rect.right_bottom->longitude, boundary->rect.right_bottom->altitude);
} else if (boundary->type == LOCATION_BOUNDARY_POLYGON) {
g_printf("\n\tPOLYGON: ");
static void RemoveBoundary(LocationBoundary *boundary, void *user_data)
{
- LocationObject * obj = (LocationObject *)user_data;
- if(obj == NULL || boundary == NULL) return;
+ LocationObject *obj = (LocationObject *)user_data;
+ if (obj == NULL || boundary == NULL) return;
location_boundary_remove(obj, boundary);
}
-static void PrintProperty (LocationObject* loc)
+static void PrintProperty(LocationObject *loc)
{
if (!loc) return;
LocationMethod method = LOCATION_METHOD_NONE;
gchar method_str[STR_MAX] = {0, };
gchar status_str[STR_MAX] = {0, };
- gchar* devname = NULL;
-
g_object_get(loc, "method", &method, NULL);
GetMethod(method_str, method);
g_printf("method[%s] ", method_str);
- if (LOCATION_METHOD_GPS == method) {
- g_object_get(loc, "dev-name", &devname, NULL);
- if (devname) {
- g_printf("dev-name[%s] ", devname);
- g_free(devname);
- }
- }
-
- int ret = location_get_last_position (loc, &pos, &acc);
+ int ret = location_get_last_position(loc, &pos, &acc);
if (ret == LOCATION_ERROR_NONE) {
GetStatus(status_str, pos->status);
g_printf("\nLast position [time(%d) lat(%f) long(%f) alt(%f) status(%s)]",
- pos->timestamp, pos->latitude, pos->longitude, pos->altitude, status_str);
- location_position_free (pos);
- location_accuracy_free (acc);
+ pos->timestamp, pos->latitude, pos->longitude, pos->altitude, status_str);
+ location_position_free(pos);
+ location_accuracy_free(acc);
}
if (method == LOCATION_METHOD_HYBRID || method == LOCATION_METHOD_GPS) {
g_object_get(loc, "pos-interval", &pos_interval, NULL);
g_object_get(loc, "vel-interval", &vel_interval, NULL);
g_object_get(loc, "sat-interval", &sat_interval, NULL);
- }
- else if (method == LOCATION_METHOD_WPS) {
+ } else if (method == LOCATION_METHOD_WPS) {
g_object_get(loc, "pos-interval", &pos_interval, NULL);
g_object_get(loc, "vel-interval", &vel_interval, NULL);
}
if (g_sig_zoneout) g_printf("[zone-out]");
}
-static void cb_service_enabled (GObject *self, guint status, gpointer userdata)
+static void cb_service_enabled(GObject *self, guint status, gpointer userdata)
{
g_printf("cb_service_enabled: status(%d) userdata(0x%x)", status, (unsigned int)userdata);
- LocationObject *loc = (LocationObject*)userdata;
+ LocationObject *loc = (LocationObject *)userdata;
LocationAccuracy *acc = NULL;
LocationPosition *pos = NULL;
LocationVelocity *vel = NULL;
g_object_get(loc, "method", &method, NULL);
g_printf("Get property>> method:%d", method);
- if (LOCATION_ERROR_NONE == location_get_position (loc, &pos, &acc)) {
- g_printf ("SYNC>> Current position> time: %d, lat: %f, long: %f, alt: %f, status: %d\n",
- pos->timestamp, pos->latitude, pos->longitude, pos->altitude, pos->status);
- g_printf ("\tAccuracy level %d (%.0f meters %.0f meters)\n",
- acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
+ if (LOCATION_ERROR_NONE == location_get_position(loc, &pos, &acc)) {
+ g_printf("SYNC>> Current position> time: %d, lat: %f, long: %f, alt: %f, status: %d\n",
+ pos->timestamp, pos->latitude, pos->longitude, pos->altitude, pos->status);
+ g_printf("\tAccuracy level %d (%.0f meters %.0f meters)\n",
+ acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
location_position_free(pos);
location_accuracy_free(acc);
- } else g_warning ("SYNC>> Current position> failed");
- if (LOCATION_ERROR_NONE == location_get_velocity (loc, &vel, &acc)) {
- g_printf ("SYNC>> Current velocity> time: %d, speed: %f, direction:%f, climb:%f\n",
- vel->timestamp, vel->speed, vel->direction, vel->climb);
- g_printf ("\tAccuracy level %d (%.0f meters %.0f meters)\n",
- acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
+ } else g_warning("SYNC>> Current position> failed");
+ if (LOCATION_ERROR_NONE == location_get_velocity(loc, &vel, &acc)) {
+ g_printf("SYNC>> Current velocity> time: %d, speed: %f, direction:%f, climb:%f\n",
+ vel->timestamp, vel->speed, vel->direction, vel->climb);
+ g_printf("\tAccuracy level %d (%.0f meters %.0f meters)\n",
+ acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
location_velocity_free(vel);
location_accuracy_free(acc);
- } else g_warning ("SYNC>> Current velocity> failed\n");
+ } else g_warning("SYNC>> Current velocity> failed\n");
}
static void
-cb_service_disabled (GObject *self,
- guint status,
- gpointer userdata)
+cb_service_disabled(GObject *self,
+ guint status,
+ gpointer userdata)
{
g_printf("cb_service_disabled: status(%d) userdata(0x%x)\n", status, (unsigned int)userdata);
}
static void
-cb_zone_in (GObject *self,
- gpointer boundary,
- gpointer position,
- gpointer accuracy)
+cb_zone_in(GObject *self,
+ gpointer boundary,
+ gpointer position,
+ gpointer accuracy)
{
- LocationPosition *pos = (LocationPosition*) position;
- LocationAccuracy *acc = (LocationAccuracy*) accuracy;
+ LocationPosition *pos = (LocationPosition *) position;
+ LocationAccuracy *acc = (LocationAccuracy *) accuracy;
- g_printf ("ASYNC>> ZoneIn> Current position: time: %d, lat: %f, long: %f, alt: %f\n",
- pos->timestamp, pos->latitude, pos->longitude, pos->altitude);
- g_printf ("\tAccuracy level %d (%.0f meters %.0f meters)\n",
- acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
+ g_printf("ASYNC>> ZoneIn> Current position: time: %d, lat: %f, long: %f, alt: %f\n",
+ pos->timestamp, pos->latitude, pos->longitude, pos->altitude);
+ g_printf("\tAccuracy level %d (%.0f meters %.0f meters)\n",
+ acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
}
static void
-cb_zone_out (GObject *self,
- gpointer boundary,
- gpointer position,
- gpointer accuracy)
+cb_zone_out(GObject *self,
+ gpointer boundary,
+ gpointer position,
+ gpointer accuracy)
{
- LocationPosition *pos = (LocationPosition*) position;
- LocationAccuracy *acc = (LocationAccuracy*) accuracy;
+ LocationPosition *pos = (LocationPosition *) position;
+ LocationAccuracy *acc = (LocationAccuracy *) accuracy;
- g_printf ("ASYNC>> ZoneOut> Current position: time: %d, lat: %f, long: %f, alt: %f\n",
- pos->timestamp, pos->latitude, pos->longitude, pos->altitude);
- g_printf ("\tAccuracy level %d (%.0f meters %.0f meters)\n",
- acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
+ g_printf("ASYNC>> ZoneOut> Current position: time: %d, lat: %f, long: %f, alt: %f\n",
+ pos->timestamp, pos->latitude, pos->longitude, pos->altitude);
+ g_printf("\tAccuracy level %d (%.0f meters %.0f meters)\n",
+ acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
}
static void
-cb_service_updated (GObject *self,
- guint type,
- gpointer data,
- gpointer accuracy,
- gpointer userdata)
+cb_service_updated(GObject *self,
+ guint type,
+ gpointer data,
+ gpointer accuracy,
+ gpointer userdata)
{
g_printf("cb_service_updated: type(%d) userdata(0x%x)", type, (unsigned int)userdata);
- LocationAccuracy *acc = (LocationAccuracy*) accuracy;
+ LocationAccuracy *acc = (LocationAccuracy *) accuracy;
switch (type) {
- case POSITION_UPDATED: {
- LocationPosition *pos = (LocationPosition*) data;
- g_printf ("ASYNC>> Current position> time: %d, lat: %f, long: %f, alt: %f, status: %d\n",
- pos->timestamp, pos->latitude, pos->longitude, pos->altitude, pos->status);
- g_printf ("\tAccuracy level %d (%.0f meters %.0f meters)\n",
- acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
- }
- break;
- case VELOCITY_UPDATED: {
- LocationVelocity *vel = (LocationVelocity*) data;
- g_printf ("ASYNC>> Current velocity> time: %d, speed: %f, direction:%f, climb:%f\n",
- vel->timestamp, vel->speed, vel->direction, vel->climb);
- g_printf ("\tAccuracy level %d (%.0f meters %.0f meters)\n",
- acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
- }
- break;
- case SATELLITE_UPDATED: {
- int idx = 0;
- guint prn;
- gboolean used;
- guint elevation;
- guint azimuth;
- gint snr;
-
- LocationSatellite *sat = (LocationSatellite *)data;
- g_printf ("SYNC>> Current Satellite> time: %d, satellite in view = %d, satellite in used = %d\n", sat->timestamp, sat->num_of_sat_inview, sat->num_of_sat_used);
- g_printf ("\tinview satellite information = ");
- for (idx=0; idx<sat->num_of_sat_inview; idx++) {
- location_satellite_get_satellite_details(sat, idx, &prn, &used, &elevation, &azimuth, &snr);
- g_printf ("\t\t[%02d] used: %d, prn: %d, elevation: %d, azimuth: %d, snr: %d\n", idx, used, prn, elevation, azimuth, snr);
- }
- }
- break;
- default:
- g_warning ("ASYNC>> Undefined update type");
- break;
+ case POSITION_UPDATED: {
+ LocationPosition *pos = (LocationPosition *) data;
+ g_printf("ASYNC>> Current position> time: %d, lat: %f, long: %f, alt: %f, status: %d\n",
+ pos->timestamp, pos->latitude, pos->longitude, pos->altitude, pos->status);
+ g_printf("\tAccuracy level %d (%.0f meters %.0f meters)\n",
+ acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
+ }
+ break;
+ case VELOCITY_UPDATED: {
+ LocationVelocity *vel = (LocationVelocity *) data;
+ g_printf("ASYNC>> Current velocity> time: %d, speed: %f, direction:%f, climb:%f\n",
+ vel->timestamp, vel->speed, vel->direction, vel->climb);
+ g_printf("\tAccuracy level %d (%.0f meters %.0f meters)\n",
+ acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
+ }
+ break;
+ case SATELLITE_UPDATED: {
+ int idx = 0;
+ guint prn;
+ gboolean used;
+ guint elevation;
+ guint azimuth;
+ gint snr;
+
+ LocationSatellite *sat = (LocationSatellite *)data;
+ g_printf("SYNC>> Current Satellite> time: %d, satellite in view = %d, satellite in used = %d\n", sat->timestamp, sat->num_of_sat_inview, sat->num_of_sat_used);
+ g_printf("\tinview satellite information = ");
+ for (idx = 0; idx < sat->num_of_sat_inview; idx++) {
+ location_satellite_get_satellite_details(sat, idx, &prn, &used, &elevation, &azimuth, &snr);
+ g_printf("\t\t[%02d] used: %d, prn: %d, elevation: %d, azimuth: %d, snr: %d\n", idx, used, prn, elevation, azimuth, snr);
+ }
+ }
+ break;
+ default:
+ g_warning("ASYNC>> Undefined update type");
+ break;
}
}
g_printf("8a. location_get_last_satellite\n");
g_printf("9. location_get_distance\n");
g_printf("10. location_is_supported_method\n");
- g_printf("11. location_is_enabled_gps\n");
g_printf("99. location_send_command\n");
+#ifndef _TIZEN_PUBLIC_
+ g_printf("99a. location_send_command(get_auth)\n");
+ g_printf("99b. location_send_command(add_to_list)\n");
+#endif
g_printf("a?. signals:(1)'service-enabled',(2)'service-disabled',(3)'service-updated',(4)'zone-in',(5)'zone-out'\n");
g_printf("b?. disconnect signals:(1)'service-enabled',(2)'service-disabled',(3)'service-updated',(4)'zone-in',(5)'zone-out'\n");
- g_printf("c?. (1)Set boundary, (2)Get boundary, (3) Remove boundary, (4) Remove all boundaries, (5)Set device name, \n");
- g_printf(" (6)Set position interval (7) Set velocity interval (8) Set satellite interval\n");
+ g_printf("c?. (1)Set boundary, (2)Get boundary, (3) Remove boundary, (4) Remove all boundaries, \n");
+ g_printf(" (5)Set position interval (6) Set velocity interval (7) Set satellite interval\n");
g_printf("==================================== Property ====================================\n");
PrintProperty(location_obj);
g_printf("\n==================================================================================\n");
}
-int main(int argc, char** argv)
+int main(int argc, char **argv)
{
char strOpt[255];
int ret;
char str[STR_MAX];
GError *gerr = NULL;
- // If application is executed by AUL, this is not needed.
- g_setenv("PKG_NAME", "org.tizen.location-api-test", 1);
+ /* If application is executed by AUL, this is not needed. */
+ g_setenv("PKG_NAME", "com.samsung.location-api-test", 1);
+#if !GLIB_CHECK_VERSION (2, 35, 0)
g_type_init();
+#endif
#if !GLIB_CHECK_VERSION (2, 31, 0)
- if( !g_thread_supported() )
- {
+ if (!g_thread_supported()) {
g_thread_init(NULL);
}
#endif
g_main = g_thread_create(GmainThread, NULL, TRUE, &gerr);
if (!g_main) {
g_printf("Error create gmain thread: Err domain[%d] Err code[%d] Err msg[%s]",
- gerr->domain, gerr->code, gerr->message);
+ gerr->domain, gerr->code, gerr->message);
g_error_free(gerr);
return 0;
}
json_util_init(LOCATION_API_TEST_JSON_FILE);
g_printf("--- Start LBS Test App ---\n");
- while(1)
- {
+ while (1) {
print_menu();
g_printf("Select option: ");
SelectOpt(strOpt);
g_printf("======================================================================================\n");
- if (0 == g_strcmp0 ("x", strOpt)) {
+ if (0 == g_strcmp0("x", strOpt)) {
- }
- else if (0 == g_strcmp0("1",strOpt)) {
+ } else if (0 == g_strcmp0("1", strOpt)) {
ret = location_init();
GetLocationError(str, ret);
g_printf("location_init: returned value [%s]\n", str);
- } else if (0 == g_strcmp0("2",strOpt)) {
+ } else if (0 == g_strcmp0("2", strOpt)) {
if (location_obj) {
g_printf("Location object already existed: [0x%x]", (unsigned int)location_obj);
continue;
g_printf("Select Location Method: ");
LocationMethod method = PromptInt();
location_obj = location_new(method);
- if(location_obj) g_printf("Success\n");
+ if (location_obj) g_printf("Success\n");
else g_printf("Failed\n");
- } else if (0 == g_strcmp0("3",strOpt)) {
- ret = location_free (location_obj);
+ } else if (0 == g_strcmp0("3", strOpt)) {
+ ret = location_free(location_obj);
location_obj = NULL;
g_sig_enable = 0;
g_sig_zoneout = 0;
GetLocationError(str, ret);
g_printf("location_free: returned value [%s]\n", str);
- } else if (0 == g_strcmp0("4",strOpt)) {
+ } else if (0 == g_strcmp0("4", strOpt)) {
ret = location_start(location_obj);
GetLocationError(str, ret);
g_printf("location_start: returned value [%s]\n", str);
- } else if (0 == g_strcmp0("5",strOpt)) {
+ } else if (0 == g_strcmp0("5", strOpt)) {
ret = location_stop(location_obj);
GetLocationError(str, ret);
g_printf("location_stop: returned value [%s]\n", str);
- } else if (0 == g_strcmp0("6",strOpt)) {
+ } else if (0 == g_strcmp0("6", strOpt)) {
LocationPosition *pos = NULL;
LocationAccuracy *acc = NULL;
ret = location_get_position(location_obj, &pos, &acc);
GetAccuracyLevel(str, acc->level);
g_printf("level: [%s], horizontal_accuracy: [%f], vertical_accuracy: [%f]\n", str, acc->horizontal_accuracy, acc->vertical_accuracy);
}
- if(pos) location_position_free(pos);
- if(acc) location_accuracy_free(acc);
- } else if (0 == g_strcmp0("6a",strOpt)) {
+ if (pos) location_position_free(pos);
+ if (acc) location_accuracy_free(acc);
+ } else if (0 == g_strcmp0("6a", strOpt)) {
LocationPosition *last_pos;
LocationAccuracy *last_acc;
int ret = 0;
- ret = location_get_last_position (location_obj, &last_pos, &last_acc);
+ ret = location_get_last_position(location_obj, &last_pos, &last_acc);
GetLocationError(str, ret);
g_printf("location_get_last_position: returned value [%s]\n", str);
if (ret == LOCATION_ERROR_NONE) {
- g_printf ("SYNC>> Last position> time: %d, lat: %f, long: %f, alt: %f, status: %d",
- last_pos->timestamp, last_pos->latitude, last_pos->longitude, last_pos->altitude, last_pos->status);
- g_printf ("\tAccuracy level %d (%.0f meters %.0f meters)",
- last_acc->level, last_acc->horizontal_accuracy, last_acc->vertical_accuracy);
+ g_printf("SYNC>> Last position> time: %d, lat: %f, long: %f, alt: %f, status: %d",
+ last_pos->timestamp, last_pos->latitude, last_pos->longitude, last_pos->altitude, last_pos->status);
+ g_printf("\tAccuracy level %d (%.0f meters %.0f meters)",
+ last_acc->level, last_acc->horizontal_accuracy, last_acc->vertical_accuracy);
location_position_free(last_pos);
location_accuracy_free(last_acc);
}
- }else if(0 == g_strcmp0("7",strOpt) ){
+ } else if (0 == g_strcmp0("7", strOpt)) {
LocationVelocity *vel = NULL;
LocationAccuracy *acc = NULL;
ret = location_get_velocity(location_obj, &vel, &acc);
GetAccuracyLevel(str, acc->level);
g_printf("level: [%s], horizontal_accuracy: [%f], vertical_accuracy: [%f]\n", str, acc->horizontal_accuracy, acc->vertical_accuracy);
}
- if(vel) location_velocity_free(vel);
- if(acc) location_accuracy_free(acc);
- }else if(0 == g_strcmp0("7a",strOpt) ){
+ if (vel) location_velocity_free(vel);
+ if (acc) location_accuracy_free(acc);
+ } else if (0 == g_strcmp0("7a", strOpt)) {
LocationVelocity *last_vel = NULL;
LocationAccuracy *last_acc = NULL;
- ret = location_get_last_velocity (location_obj, &last_vel, &last_acc);
+ ret = location_get_last_velocity(location_obj, &last_vel, &last_acc);
GetLocationError(str, ret);
g_printf("location_get_last_velocity: returned value [%s]\n", str);
if (ret == LOCATION_ERROR_NONE) {
- g_printf ("SYNC>> Last velocity> time: %d, speed: %f, direction:%f, climb:%f",
- last_vel->timestamp, last_vel->speed, last_vel->direction, last_vel->climb);
- g_printf ("\tAccuracy level %d (%.0f meters %.0f meters)",
- last_acc->level, last_acc->horizontal_accuracy, last_acc->vertical_accuracy);
+ g_printf("SYNC>> Last velocity> time: %d, speed: %f, direction:%f, climb:%f",
+ last_vel->timestamp, last_vel->speed, last_vel->direction, last_vel->climb);
+ g_printf("\tAccuracy level %d (%.0f meters %.0f meters)",
+ last_acc->level, last_acc->horizontal_accuracy, last_acc->vertical_accuracy);
location_velocity_free(last_vel);
location_accuracy_free(last_acc);
}
- }else if(0 == g_strcmp0("8",strOpt) ){
+ } else if (0 == g_strcmp0("8", strOpt)) {
int ret = 0, idx = 0;
LocationSatellite *sat = NULL;
guint prn;
guint azimuth;
gint snr;
- ret = location_get_satellite (location_obj, &sat);
+ ret = location_get_satellite(location_obj, &sat);
GetLocationError(str, ret);
g_printf("location_get_satellite: returned value [%s]\n", str);
if (ret == LOCATION_ERROR_NONE) {
- g_printf ("SYNC>> Current Sattelite> time = %d, satellite in view = %d, satellite in used = %d", sat->timestamp, sat->num_of_sat_inview, sat->num_of_sat_used);
- g_printf ("\tinview satellite information = ");
- for (idx=0; idx<sat->num_of_sat_inview; idx++) {
+ g_printf("SYNC>> Current Sattelite> time = %d, satellite in view = %d, satellite in used = %d", sat->timestamp, sat->num_of_sat_inview, sat->num_of_sat_used);
+ g_printf("\tinview satellite information = ");
+ for (idx = 0; idx < sat->num_of_sat_inview; idx++) {
location_satellite_get_satellite_details(sat, idx, &prn, &used, &elevation, &azimuth, &snr);
- g_printf ("\t\t[%02d] used: %d, prn: %d, elevation: %d, azimuth: %d, snr: %d", idx, used, prn, elevation, azimuth, snr);
+ g_printf("\t\t[%02d] used: %d, prn: %d, elevation: %d, azimuth: %d, snr: %d", idx, used, prn, elevation, azimuth, snr);
}
- location_satellite_free (sat);
+ location_satellite_free(sat);
}
- }else if(0 == g_strcmp0("8a",strOpt) ){
+ } else if (0 == g_strcmp0("8a", strOpt)) {
int ret = 0, idx = 0;
LocationSatellite *last_sat = NULL;
guint prn;
guint azimuth;
gint snr;
- ret = location_get_last_satellite (location_obj, &last_sat);
+ ret = location_get_last_satellite(location_obj, &last_sat);
GetLocationError(str, ret);
g_printf("location_get_last_satellite: returned value [%s]\n", str);
if (ret == LOCATION_ERROR_NONE) {
- g_printf ("SYNC>> Last Sattelite> time = %d, satellite in view = %d, satellite in used = %d", last_sat->timestamp, last_sat->num_of_sat_inview, last_sat->num_of_sat_used);
- g_printf ("\tinview satellite information = ");
- for (idx=0; idx<last_sat->num_of_sat_inview; idx++) {
+ g_printf("SYNC>> Last Sattelite> time = %d, satellite in view = %d, satellite in used = %d", last_sat->timestamp, last_sat->num_of_sat_inview, last_sat->num_of_sat_used);
+ g_printf("\tinview satellite information = ");
+ for (idx = 0; idx < last_sat->num_of_sat_inview; idx++) {
location_satellite_get_satellite_details(last_sat, idx, &prn, &used, &elevation, &azimuth, &snr);
- g_printf ("\t\t[%02d] used: %d, prn: %d, elevation: %d, azimuth: %d, snr: %d", idx, used, prn, elevation, azimuth, snr);
+ g_printf("\t\t[%02d] used: %d, prn: %d, elevation: %d, azimuth: %d, snr: %d", idx, used, prn, elevation, azimuth, snr);
}
- location_satellite_free (last_sat);
+ location_satellite_free(last_sat);
}
- }else if(0 == g_strcmp0("9",strOpt) ) {
+ } else if (0 == g_strcmp0("9", strOpt)) {
gulong distance;
int ret = 0;
ret = location_get_distance(&pos1, &pos2, &distance);
GetLocationError(str, ret);
- if(ret != LOCATION_ERROR_NONE) {
- g_printf("Fail to get position. Error[%s]\n", str);
- }
- else {
- g_printf("The approximate distance is [%lu]\n", distance);
- g_printf("cf.) It is approximately 969954.114 meter\n");
+ if (ret != LOCATION_ERROR_NONE) {
+ g_printf("Fail to get position. Error[%s]\n", str);
+ } else {
+ g_printf("The approximate distance is [%lu]\n", distance);
+ g_printf("cf.) It is approximately 969954.114 meter\n");
}
- }else if(0 == g_strcmp0("10", strOpt)) {
+ } else if (0 == g_strcmp0("10", strOpt)) {
int method;
char method_str[STR_MAX] = {0, };
char *str = NULL;
g_printf("Select Method :");
str = fgets(input, 8, stdin);
method = atoi(input);
- switch(method) {
+ switch (method) {
case LOCATION_METHOD_HYBRID:
is_supported = location_is_supported_method(LOCATION_METHOD_HYBRID);
break;
g_printf("Method[%s] is %s.", method_str, is_supported ? "supported" : "not supported");
- }else if(0 == g_strcmp0("11", strOpt)) {
- gboolean is_enabled = FALSE;
- is_enabled = location_is_enabled_gps(location_obj);
- if(is_enabled == TRUE) g_printf("GPS is turned on");
- else g_printf("GPS is turned off");
- }else if(0 == g_strcmp0("99", strOpt)) {
+ } else if (0 == g_strcmp0("99", strOpt)) {
int ret = 0;
const char *str = "command";
ret = location_send_command(str);
- if(ret == 0)
+ if (ret == 0)
+ g_printf("Success to send command[%s]", str);
+ else
+ g_printf("Fail to send command[%s]. Error[%d]", str, ret);
+#ifndef _TIZEN_PUBLIC_
+ } else if (0 == g_strcmp0("99a", strOpt)) {
+ int ret = 0;
+ const char *str = "GET_APP_AUTHORITY";
+ ret = location_send_command(str);
+ if (ret == 0)
g_printf("Success to send command[%s]", str);
else
g_printf("Fail to send command[%s]. Error[%d]", str, ret);
- }else if(0 == g_strcmp0("a1",strOpt)){
- if(location_obj && !g_sig_enable) {
- g_sig_enable = g_signal_connect (location_obj, "service-enabled", G_CALLBACK(cb_service_enabled), location_obj);
+ } else if (0 == g_strcmp0("99b", strOpt)) {
+ int ret = 0;
+ const char *str = "ADD_APPLIST";
+ ret = location_send_command(str);
+ if (ret == 0)
+ g_printf("Success to send command[%s]", str);
+ else
+ g_printf("Fail to send command[%s]. Error[%d]", str, ret);
+#endif
+ } else if (0 == g_strcmp0("a1", strOpt)) {
+ if (location_obj && !g_sig_enable) {
+ g_sig_enable = g_signal_connect(location_obj, "service-enabled", G_CALLBACK(cb_service_enabled), location_obj);
}
- }else if(0 == g_strcmp0("a2",strOpt)){
- if(location_obj && !g_sig_disable){
- g_sig_disable = g_signal_connect (location_obj, "service-disabled", G_CALLBACK(cb_service_disabled), location_obj);
+ } else if (0 == g_strcmp0("a2", strOpt)) {
+ if (location_obj && !g_sig_disable) {
+ g_sig_disable = g_signal_connect(location_obj, "service-disabled", G_CALLBACK(cb_service_disabled), location_obj);
}
- }else if(0 == g_strcmp0("a3",strOpt)){
- if(location_obj && !g_sig_update){
- g_sig_update = g_signal_connect (location_obj, "service-updated", G_CALLBACK(cb_service_updated), location_obj);
+ } else if (0 == g_strcmp0("a3", strOpt)) {
+ if (location_obj && !g_sig_update) {
+ g_sig_update = g_signal_connect(location_obj, "service-updated", G_CALLBACK(cb_service_updated), location_obj);
}
- }else if(0 == g_strcmp0("a4",strOpt)){
- if(location_obj && !g_sig_zonein){
- g_sig_zonein = g_signal_connect (location_obj, "zone-in", G_CALLBACK(cb_zone_in), location_obj);
+ } else if (0 == g_strcmp0("a4", strOpt)) {
+ if (location_obj && !g_sig_zonein) {
+ g_sig_zonein = g_signal_connect(location_obj, "zone-in", G_CALLBACK(cb_zone_in), location_obj);
}
- }else if(0 == g_strcmp0("a5",strOpt)){
- if(location_obj && !g_sig_zoneout){
- g_sig_zoneout = g_signal_connect (location_obj, "zone-out", G_CALLBACK(cb_zone_out), location_obj);
+ } else if (0 == g_strcmp0("a5", strOpt)) {
+ if (location_obj && !g_sig_zoneout) {
+ g_sig_zoneout = g_signal_connect(location_obj, "zone-out", G_CALLBACK(cb_zone_out), location_obj);
}
- }else if(0 == g_strcmp0("b1",strOpt)){
- if(location_obj && g_sig_enable) {
- g_signal_handler_disconnect (location_obj, g_sig_enable);
+ } else if (0 == g_strcmp0("b1", strOpt)) {
+ if (location_obj && g_sig_enable) {
+ g_signal_handler_disconnect(location_obj, g_sig_enable);
g_sig_enable = 0;
}
- }else if(0 == g_strcmp0("b2",strOpt)){
- if(location_obj && g_sig_disable){
- g_signal_handler_disconnect (location_obj, g_sig_disable);
+ } else if (0 == g_strcmp0("b2", strOpt)) {
+ if (location_obj && g_sig_disable) {
+ g_signal_handler_disconnect(location_obj, g_sig_disable);
g_sig_disable = 0;
}
- }else if(0 == g_strcmp0("b3",strOpt)){
- if(location_obj && g_sig_update){
- g_signal_handler_disconnect (location_obj, g_sig_update);
+ } else if (0 == g_strcmp0("b3", strOpt)) {
+ if (location_obj && g_sig_update) {
+ g_signal_handler_disconnect(location_obj, g_sig_update);
g_sig_update = 0;
}
- }else if(0 == g_strcmp0("b4",strOpt)){
- if(location_obj && g_sig_zonein){
- g_signal_handler_disconnect (location_obj, g_sig_zonein);
+ } else if (0 == g_strcmp0("b4", strOpt)) {
+ if (location_obj && g_sig_zonein) {
+ g_signal_handler_disconnect(location_obj, g_sig_zonein);
g_sig_zonein = 0;
}
- }else if(0 == g_strcmp0("b5",strOpt)){
- if(location_obj && g_sig_zoneout){
- g_signal_handler_disconnect (location_obj, g_sig_zoneout);
+ } else if (0 == g_strcmp0("b5", strOpt)) {
+ if (location_obj && g_sig_zoneout) {
+ g_signal_handler_disconnect(location_obj, g_sig_zoneout);
g_sig_zoneout = 0;
}
- }else if(0 == g_strcmp0("c1",strOpt)){
- LocationBoundary* bound = NULL;
+ } else if (0 == g_strcmp0("c1", strOpt)) {
+ LocationBoundary *bound = NULL;
int i = 0;
int polygon_count = json_util_get_polygon_count();
g_printf("[0].San jose(Rect) [1].Suwon HQ(Rect) [2].Seoul City(circle) ");
- for(i = 0; i < polygon_count; i++)
+ for (i = 0; i < polygon_count; i++)
g_printf("[%d].%s ", i + 3, json_util_get_polygon_name(i));
g_printf("\nSelect Boundary: ");
int opt = PromptInt();
if (opt == 0) {
- LocationPosition* rb = location_position_new (0, 37.300, -121.86, 0, LOCATION_STATUS_2D_FIX);
- LocationPosition* lt = location_position_new (0, 37.360, -121.92, 0, LOCATION_STATUS_2D_FIX);
- bound = location_boundary_new_for_rect (lt, rb);
+ LocationPosition *rb = location_position_new(0, 37.300, -121.86, 0, LOCATION_STATUS_2D_FIX);
+ LocationPosition *lt = location_position_new(0, 37.360, -121.92, 0, LOCATION_STATUS_2D_FIX);
+ bound = location_boundary_new_for_rect(lt, rb);
location_position_free(rb);
location_position_free(lt);
location_boundary_add(location_obj, bound);
- } else if(opt == 1) {
- LocationPosition* rb = location_position_new (0, 37.255, 127.058, 0, LOCATION_STATUS_2D_FIX);
- LocationPosition* lt = location_position_new (0, 37.260, 127.045, 0, LOCATION_STATUS_2D_FIX);
- bound = location_boundary_new_for_rect (lt, rb);
+ } else if (opt == 1) {
+ LocationPosition *rb = location_position_new(0, 37.255, 127.058, 0, LOCATION_STATUS_2D_FIX);
+ LocationPosition *lt = location_position_new(0, 37.260, 127.045, 0, LOCATION_STATUS_2D_FIX);
+ bound = location_boundary_new_for_rect(lt, rb);
location_position_free(rb);
location_position_free(lt);
location_boundary_add(location_obj, bound);
- } else if(opt == 2) {
+ } else if (opt == 2) {
LocationPosition *center = location_position_new(0, 37.566535, 126.977969, 0.0, LOCATION_STATUS_2D_FIX);
double radius = 10.0;
bound = location_boundary_new_for_circle(center, radius);
bound = json_util_get_polygon_boundary(polygon_index);
location_boundary_add(location_obj, bound);
- LocationPosition * check_pos = NULL;
+ LocationPosition *check_pos = NULL;
gboolean ret = FALSE;
int count = json_util_get_marker_position_count(polygon_index);
- for(index = 0; index < count; index++) {
+ for (index = 0; index < count; index++) {
check_pos = json_util_get_marker_position(polygon_index, index);
ret = location_boundary_if_inside(bound, check_pos);
- g_printf("[%s] is [%s] and the test result is [%s]\n", json_util_get_marker_name(polygon_index, index), json_util_result_zone_test(polygon_index, index), ret == TRUE? "inside": "outside");
+ g_printf("[%s] is [%s] and the test result is [%s]\n", json_util_get_marker_name(polygon_index, index), json_util_result_zone_test(polygon_index, index), ret == TRUE ? "inside" : "outside");
location_position_free(check_pos);
}
} else {
}
location_boundary_free(bound);
- }else if(0 == g_strcmp0("c2",strOpt)){
+ } else if (0 == g_strcmp0("c2", strOpt)) {
g_printf("Get Boundary\n");
location_boundary_foreach(location_obj, PrintBoundary, NULL);
- }else if(0 == g_strcmp0("c3",strOpt)){
+ } else if (0 == g_strcmp0("c3", strOpt)) {
g_printf("Remove Boundary\n");
- LocationBoundary* bound = NULL;
+ LocationBoundary *bound = NULL;
int i = 0;
int polygon_count = json_util_get_polygon_count();
g_printf("[0].San jose(Rect) [1].Suwon HQ(Rect) [2].Seoul City(circle) ");
- for(i = 0; i < polygon_count; i++)
+ for (i = 0; i < polygon_count; i++)
g_printf("[%d].%s ", i + 3, json_util_get_polygon_name(i));
g_printf("\nSelect Boundary: ");
int opt = PromptInt();
if (opt == 0) {
- LocationPosition* rb = location_position_new (0, 37.300, -121.86, 0, LOCATION_STATUS_2D_FIX);
- LocationPosition* lt = location_position_new (0, 37.360, -121.92, 0, LOCATION_STATUS_2D_FIX);
- bound = location_boundary_new_for_rect (lt, rb);
+ LocationPosition *rb = location_position_new(0, 37.300, -121.86, 0, LOCATION_STATUS_2D_FIX);
+ LocationPosition *lt = location_position_new(0, 37.360, -121.92, 0, LOCATION_STATUS_2D_FIX);
+ bound = location_boundary_new_for_rect(lt, rb);
location_position_free(rb);
location_position_free(lt);
- } else if(opt == 1) {
- LocationPosition* rb = location_position_new (0, 37.255, 127.058, 0, LOCATION_STATUS_2D_FIX);
- LocationPosition* lt = location_position_new (0, 37.260, 127.045, 0, LOCATION_STATUS_2D_FIX);
- bound = location_boundary_new_for_rect (lt, rb);
+ } else if (opt == 1) {
+ LocationPosition *rb = location_position_new(0, 37.255, 127.058, 0, LOCATION_STATUS_2D_FIX);
+ LocationPosition *lt = location_position_new(0, 37.260, 127.045, 0, LOCATION_STATUS_2D_FIX);
+ bound = location_boundary_new_for_rect(lt, rb);
location_position_free(rb);
location_position_free(lt);
- } else if(opt == 2) {
+ } else if (opt == 2) {
LocationPosition *center = location_position_new(0, 37.566535, 126.977969, 0.0, LOCATION_STATUS_2D_FIX);
double radius = 10.0;
bound = location_boundary_new_for_circle(center, radius);
g_printf("Invalid value\n");
}
- if(bound != NULL) location_boundary_remove(location_obj, bound);
+ if (bound != NULL) location_boundary_remove(location_obj, bound);
- }else if(0 == g_strcmp0("c4",strOpt)){
+ } else if (0 == g_strcmp0("c4", strOpt)) {
location_boundary_foreach(location_obj, RemoveBoundary, location_obj);
- }else if(0 == g_strcmp0("c5",strOpt)){
- char buf[255];
- char *str = NULL;
- g_printf("Input device name: ");
- str = fgets(buf, 255, stdin);
- buf[strlen(buf)-1]='\0';
- g_object_set(location_obj, "dev-name", buf, NULL);
- } else if (0 == g_strcmp0("c6", strOpt)) {
+ } else if (0 == g_strcmp0("c5", strOpt)) {
guint interval = 1;
int len = 0;
g_printf("Input interval[1~120]:");
len = scanf("%u", &interval);
g_printf("changed interval to [%u]\n", interval);
g_object_set(location_obj, "pos-interval", interval, NULL);
- } else if (0 == g_strcmp0("c7", strOpt)) {
+ } else if (0 == g_strcmp0("c6", strOpt)) {
int len = 0;
guint interval = 1;
g_printf("Input interval[1~120]:");
len = scanf("%u", &interval);
g_printf("changed interval to [%u]\n", interval);
g_object_set(location_obj, "vel-interval", interval, NULL);
- } else if (0 == g_strcmp0("c8", strOpt)) {
+ } else if (0 == g_strcmp0("c7", strOpt)) {
guint interval = 1;
int len = 0;
g_printf("Input interval[1~120]:");
len = scanf("%u", &interval);
g_printf("changed interval to [%u]\n", interval);
g_object_set(location_obj, "sat-interval", interval, NULL);
- }else if(0 == g_strcmp0("q",strOpt) ){
+ } else if (0 == g_strcmp0("q", strOpt)) {
g_main_loop_quit(g_mainloop);
break;
}
"latitude": 37.2859,\r
"longitude": 127.099457\r
}\r
- ],\r
+ ],\r
"marker_position": [\r
{\r
"where": "Youngtong ku office",\r
#include <string.h>
#include <stdio.h>
#include <glib/gprintf.h>
-#include <gconf/gconf-client.h>
#include <location-map-service.h>
#include "location-api-test-util.h"
#include "location-geocode.h"
#define STR_MAX 128
-LocationMapObject* map_obj = NULL;
+LocationMapObject *map_obj = NULL;
static GMainLoop *g_mainloop = NULL;
#define LOCATION_API_TEST_JSON_FILE "/opt/data/location-api-test.json"
static gpointer GmainThread(gpointer data)
{
- g_mainloop = g_main_loop_new (NULL, FALSE);
+ g_mainloop = g_main_loop_new(NULL, FALSE);
g_printf("\n...Entering GMain Loop to Receive Notifications....\n");
- g_main_loop_run (g_mainloop);
- g_main_loop_unref (g_mainloop);
+ g_main_loop_run(g_mainloop);
+ g_main_loop_unref(g_mainloop);
g_mainloop = NULL;
return NULL;
}
static void GetLocationError(char str[STR_MAX], int ret)
{
- switch(ret)
- {
+ switch (ret) {
case LOCATION_ERROR_NONE:
g_utf8_strncpy(str, "LOCATION_ERROR_NONE", STR_MAX);
break;
}
}
-static void SelectOpt(char* buf)
+static void SelectOpt(char *buf)
{
int iLen = 0;
char *str = NULL;
str = fgets(buf, 255, stdin);
+ if (NULL == str) {
+ g_printf(" fgets return NULL. \n");
+ }
iLen = g_utf8_strlen(buf, -1);
- buf[iLen-1] = '\0';
+ buf[iLen - 1] = '\0';
}
static int PromptInt()
int ret;
char *str = NULL;
str = fgets(buf, 255, stdin);
- buf[strlen(buf)-1]='\0';
+ buf[strlen(buf) - 1] = '\0';
ret = g_ascii_strtoll(buf, NULL, 10);
return ret;
}
double ret;
char *str = NULL;
str = fgets(buf, 255, stdin);
- buf[strlen(buf)-1]='\0';
+ if (NULL == str) {
+ g_printf(" fgets return NULL. \n");
+ }
+ buf[strlen(buf) - 1] = '\0';
ret = g_ascii_strtod(buf, NULL);
return ret;
}
-static void PrintPos (gpointer data, gpointer user_data)
+static void PrintPos(gpointer data, gpointer user_data)
{
LocationPosition *pos = (LocationPosition *)data;
if (pos) {
g_printf("time: [%d], latitude: [%f], longitude: [%f], altitude: [%f]\n", pos->timestamp, pos->latitude, pos->longitude, pos->altitude);
- location_position_free (pos);
+ location_position_free(pos);
}
}
-static void PrintAcc (gpointer data, gpointer user_data)
+static void PrintAcc(gpointer data, gpointer user_data)
{
LocationAccuracy *acc = (LocationAccuracy *)data;
if (acc) {
g_printf("level: [%d], horizontal_accuracy: [%f], vertical_accuracy: [%f]\n", acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
- location_accuracy_free (acc);
+ location_accuracy_free(acc);
}
}
-static void PrintProperty (LocationObject* loc)
+static void PrintProperty(LocationObject *loc)
{
if (!loc) return;
-#if 0
- LocationMethod method = LOCATION_METHOD_NONE;
- gchar method_str[STR_MAX] = {0, };
-
- gchar* devname = NULL;
-
- g_object_get(loc, "method", &method, NULL);
- GetMethod(method_str, method);
- g_printf("method[%s] ", method_str);
-
- if (LOCATION_METHOD_GPS == method) {
- g_object_get(loc, "dev-name", &devname, NULL);
- if (devname) {
- g_printf("dev-name[%s] ", devname);
- g_free(devname);
- }
- }
-#endif
}
-static void _print_property (gpointer data, gpointer user_data)
+static void _print_property(gpointer data, gpointer user_data)
{
LocationLandmark *landmark = (LocationLandmark *)user_data;
gpointer key = (gpointer)data;
if (key) {
value = (gpointer)location_landmark_get_property(landmark, key);
- g_printf(", [%s:%s]", (gchar*) key, (gchar*) value);
+ g_printf(", [%s:%s]", (gchar *) key, (gchar *) value);
}
}
static void
-__plugin_print_poi_list (gpointer data, gpointer user_data)
+__plugin_print_poi_list(gpointer data, gpointer user_data)
{
- int i=0;
+ int i = 0;
LocationLandmark *landmark = (LocationLandmark *)data;
- LocationPosition *pos = location_landmark_get_position (landmark);
- LocationAddress *addr = location_landmark_get_address (landmark);
-
- g_printf ("[ID:%d], [NAME:%s], phone[%s],pos[%f:%f], addr[%s:%s:%s:%s:%s]",
- location_landmark_get_id (landmark),
- location_landmark_get_name(landmark),
- location_landmark_get_phone_number (landmark),
- pos->latitude, pos->longitude,
- addr->building_number, addr->city, addr->country_code, addr->district,
- addr->postal_code);
+ LocationPosition *pos = location_landmark_get_position(landmark);
+ LocationAddress *addr = location_landmark_get_address(landmark);
+
+ g_printf("[ID:%d], [NAME:%s], phone[%s],pos[%f:%f], addr[%s:%s:%s:%s:%s]",
+ location_landmark_get_id(landmark),
+ location_landmark_get_name(landmark),
+ location_landmark_get_phone_number(landmark),
+ pos->latitude, pos->longitude,
+ addr->building_number, addr->city, addr->country_code, addr->district,
+ addr->postal_code);
g_printf("Supplier details : [NAME: %s],[LINK: %s],[ID:%s],[TYPE: %s]",
- landmark_linkobject_get_name(location_landmark_get_supplier( landmark)),
- landmark_linkobject_get_link_string(location_landmark_get_supplier( landmark)),
- landmark_linkobject_get_id(location_landmark_get_supplier( landmark)),
- landmark_linkobject_get_type(location_landmark_get_supplier( landmark)));
+ landmark_linkobject_get_name(location_landmark_get_supplier(landmark)),
+ landmark_linkobject_get_link_string(location_landmark_get_supplier(landmark)),
+ landmark_linkobject_get_id(location_landmark_get_supplier(landmark)),
+ landmark_linkobject_get_type(location_landmark_get_supplier(landmark)));
g_printf("Related details : [NAME: %s],[LINK: %s],[ID:%s],[TYPE: %s]",
- landmark_linkobject_get_name(location_landmark_get_related( landmark)),
- landmark_linkobject_get_link_string(location_landmark_get_related( landmark)),
- landmark_linkobject_get_id(location_landmark_get_related( landmark)),
- landmark_linkobject_get_type(location_landmark_get_related( landmark)));
- g_printf("Rating details : [AVG: %d],[COUNT:%d]",
- landmark_rating_get_average(location_landmark_get_rating(landmark)),
- landmark_rating_get_count(location_landmark_get_rating(landmark)));
- for(i=0;i<g_list_length(location_landmark_get_editorial(landmark));i++)
- {
- LandmarkEditorial * editorial=g_list_nth_data(location_landmark_get_editorial(landmark),i);
+ landmark_linkobject_get_name(location_landmark_get_related(landmark)),
+ landmark_linkobject_get_link_string(location_landmark_get_related(landmark)),
+ landmark_linkobject_get_id(location_landmark_get_related(landmark)),
+ landmark_linkobject_get_type(location_landmark_get_related(landmark)));
+ g_printf("Rating details : [AVG: %f],[COUNT:%d]",
+ landmark_rating_get_average(location_landmark_get_rating(landmark)),
+ landmark_rating_get_count(location_landmark_get_rating(landmark)));
+ for (i = 0; i < g_list_length(location_landmark_get_editorial(landmark)); i++) {
+ LandmarkEditorial *editorial = g_list_nth_data(location_landmark_get_editorial(landmark), i);
g_printf("Editorials : [Desc: %s] [LANG: %s]",
- landmark_editorial_get_description(editorial),landmark_editorial_get_language(editorial));
+ landmark_editorial_get_description(editorial), landmark_editorial_get_language(editorial));
}
GList *key_list = location_landmark_get_property_key(landmark);
if (key_list) {
}
-static void cb_poi(LocationError error, guint req_id, GList * landmark_list, gchar * error_code, gchar * error_msg, gpointer userdata)
+static void cb_poi(LocationError error, guint req_id, GList *landmark_list, gchar *error_code, gchar *error_msg, gpointer userdata)
{
g_printf("\n===== __location_POI_cb ======\n");
if (error != LOCATION_ERROR_NONE) {
return;
}
g_printf("Success, poi_list[0x%x] user_data[0x%x] req_id[%d]\n", (unsigned int)landmark_list, (unsigned int)userdata, req_id);
- g_list_foreach (landmark_list, __plugin_print_poi_list, NULL);
+ g_list_foreach(landmark_list, __plugin_print_poi_list, NULL);
if (error_code && error_msg) {
g_printf("__location_POI_cb: error_code[%s], error_msg[%s]\n", error_code, error_msg);
g_printf("Step: start(%f/%f), end(%f/%f), instruction(%s)\n", start_lat, start_lon, end_lat, end_lon, inst);
}
-static void Print_form_of_way (LocationRoadElement* road_element)
+static void Print_form_of_way(LocationRoadElement *road_element)
{
g_printf("+++Print form of way begin \n");
- FormOfWay form = location_route_element_get_form_of_way(road_element);
+ FormOfWay form = location_road_element_get_form_of_way(road_element);
switch (form) {
case FOW_UNDEFINED:
break;
default:
- g_warning ("ASYNC>> Undefined Form Of Way type");
+ g_warning("ASYNC>> Undefined Form Of Way type");
break;
- }
+ }
g_printf("---Print form of way end\n");
}
-static void Print_transit_type (LocationRoadElement* road_element)
+static void Print_transit_type(LocationRouteTransitElement *element)
{
g_printf("+++Print transit type begin \n");
- TransitType ttype = location_route_element_get_transit_type(road_element);
+ TransitType ttype = location_route_transit_element_get_transit_type(element);
switch (ttype) {
case TRANSIT_TYPE_BUS_PUBLIC:
g_printf("Indicates transit type is bus public\n");
break;
default:
- g_warning ("ASYNC>> Undefined Transit Type \n");
+ g_warning("ASYNC>> Undefined Transit Type \n");
break;
}
g_printf("---Print transit type end\n");
}
-static void Print_road_element(LocationRouteStep *step)
+static void _print_elem(gpointer data, gpointer user_data)
{
- g_printf("+++PrintRoadElement begin\n");
- LocationRoadElement* road_element = location_route_step_get_road_element(step);
-
- Print_transit_type(road_element);
- Print_form_of_way( road_element);
+ LocationRouteStep *step = (LocationRouteStep *) user_data;
+ LocationRouteElement *elem = (LocationRouteElement *) data;
+
+ if (location_route_element_get_is_transit_element(elem)) {
+ LocationRouteTransitElement *transit_element = location_route_element_get_route_transit_element(elem);
+
+
+ Print_transit_type(transit_element);
+ gchar *t_dest = location_route_transit_element_get_transit_destination(transit_element);
+ gchar *t_line = location_route_transit_element_get_transit_line_name(transit_element);
+ gchar *official = location_route_transit_element_get_system_official_name(transit_element);
+ gchar *short_name = location_route_transit_element_get_system_short_name(transit_element);
+
+ gchar *type_name = location_route_transit_element_get_transit_type_name(transit_element);
+ guint d_t = location_route_transit_element_get_transit_departure_time(transit_element);
+ guint a_t = location_route_transit_element_get_transit_arrival_time(transit_element);
+ LocationRouteTransitStop *d_s = location_route_transit_element_get_transit_departure_station(transit_element);
+ gchar *d_s_name = location_route_transit_get_station_name(d_s);
+ gint d_s_level = location_route_transit_get_platform_level(d_s);
+ LocationPosition *d_s_plat_pos = location_route_transit_get_platform_coordinates(d_s);
+ if (d_s_plat_pos) {
+ g_printf("d_s_plat_pos: time: %d, lat: %f, long: %f, alt: %f, status: %d\n",
+ d_s_plat_pos->timestamp, d_s_plat_pos->latitude, d_s_plat_pos->longitude, d_s_plat_pos->altitude, d_s_plat_pos->status);
+ /*location_position_free (d_s_plat_pos); */
+ }
- gboolean is_plural = location_route_element_is_plural(road_element);
- if (is_plural) {
- g_printf(" The road element is plural \n");
- }
- else {
- g_printf(" The road element is not plural \n");
- }
- gchar *road_name = location_route_element_get_road_name(road_element);
- gchar *route_name = location_route_element_get_route_name(road_element);
- gfloat speed_l = location_route_element_get_speed_limit(road_element);
- guint speed = location_route_element_get_average_speed_m_s(road_element);
- guint nums = location_route_element_get_number_of_lanes(road_element);
- guint s_time = location_route_element_get_element_start_time(road_element);
- guint t_time = location_route_element_get_element_travel_time(road_element);
-
- g_printf("RoadElement: road_name(%s), route_name(%s), speed_l(%f), speed(%d), nums(%d), s_time(%d), t_time(%d)\n",
- road_name, route_name, speed_l, speed, nums, s_time, t_time);
-
- gboolean is_pedestrain = location_route_element_road_element_is_pedestrian(road_element);
- if (is_pedestrain) {
- g_printf(" The road is allowed only for pedestrians \n");
- }
- else {
- g_printf(" The road is not only for pedestrians \n");
- }
+ LocationPosition *d_s_egr_pos = location_route_transit_get_egress_coordinates(d_s);
+ if (d_s_egr_pos) {
+ g_printf("d_s_egr_pos: time: %d, lat: %f, long: %f, alt: %f, status: %d\n",
+ d_s_egr_pos->timestamp, d_s_egr_pos->latitude, d_s_egr_pos->longitude, d_s_egr_pos->altitude, d_s_egr_pos->status);
+ /*location_position_free (d_s_egr_pos); */
+ }
- gboolean is_valid = location_route_element_road_element_is_valid(road_element);
- if (is_valid) {
- g_printf(" This road element is valid \n");
- }
- else {
- g_printf(" This road element is invalid \n");
- }
+ g_printf("Transit: d_s_name(%s), d_s_level(%d)\n", d_s_name, d_s_level);
- gchar *t_dest = location_route_element_get_transit_destination(road_element);
- gchar *t_line = location_route_element_get_transit_line_name(road_element);
- gchar *official = location_route_element_get_system_official_name(road_element);
- gchar *short_name = location_route_element_get_system_short_name(road_element);
-
- gchar *type_name = location_route_element_get_transit_type_name(road_element);
- guint d_t = location_route_element_get_transit_departure_time(road_element);
- guint a_t = location_route_element_get_transit_arrival_time(road_element);
- LocationRouteTransitStop *d_s = location_route_element_get_transit_departure_station(road_element);
- gchar *d_s_name = location_route_transit_get_station_name(d_s);
- gint d_s_level = location_route_transit_get_platform_level(d_s);
- LocationPosition *d_s_plat_pos = location_route_transit_get_platform_coordinates(d_s);
- if (d_s_plat_pos) {
- g_printf ("d_s_plat_pos: time: %d, lat: %f, long: %f, alt: %f, status: %d\n",
- d_s_plat_pos->timestamp, d_s_plat_pos->latitude, d_s_plat_pos->longitude, d_s_plat_pos->altitude, d_s_plat_pos->status);
- //location_position_free (d_s_plat_pos);
- }
+ g_printf("Transit: t_dest(%s), t_line(%s), official(%s), short(%s), type_name(%s), d_t(%lld), a_t(%lld)\n",
+ t_dest, t_line, official, short_name, type_name, d_t, a_t);
- LocationPosition *d_s_egr_pos = location_route_transit_get_egress_coordinates(d_s);
- if (d_s_egr_pos) {
- g_printf ("d_s_egr_pos: time: %d, lat: %f, long: %f, alt: %f, status: %d\n",
- d_s_egr_pos->timestamp, d_s_egr_pos->latitude, d_s_egr_pos->longitude, d_s_egr_pos->altitude, d_s_egr_pos->status);
- //location_position_free (d_s_egr_pos);
- }
+ LocationRouteTransitStop *a_s = location_route_transit_element_get_transit_arrival_station(transit_element);
+ gchar *a_s_name = location_route_transit_get_station_name(a_s);
+ gint a_s_level = location_route_transit_get_platform_level(a_s);
+ if (a_s) {
+ g_printf("Transit: a_s_name(%s), a_s_level(%d) \n", a_s_name, a_s_level);
+ }
+ } else {
+ LocationRoadElement *road_element = location_route_element_get_road_element(elem);
- g_printf("Transit: d_s_name(%s), d_s_level(%d)\n", d_s_name, d_s_level);
+ Print_form_of_way(road_element);
- g_printf("Transit: t_dest(%s), t_line(%s), official(%s), short(%s), type_name(%s), d_t(%d), a_t(%d)\n",
- t_dest, t_line, official, short_name, type_name, d_t, a_t);
+ gboolean is_plural = location_road_element_is_plural(road_element);
+ if (is_plural) {
+ g_printf(" The road element is plural \n");
+ } else {
+ g_printf(" The road element is not plural \n");
+ }
+ gchar *road_name = location_road_element_get_road_name(road_element);
+ gchar *route_name = location_road_element_get_route_name(road_element);
+ gfloat speed_l = location_road_element_get_speed_limit(road_element);
+ guint speed = location_road_element_get_average_speed_m_s(road_element);
+ guint nums = location_road_element_get_number_of_lanes(road_element);
+ guint s_time = location_road_element_get_start_time(road_element);
+ guint t_time = location_road_element_get_travel_time(road_element);
+
+ g_printf("RoadElement: road_name(%s), route_name(%s), speed_l(%f), speed(%d), nums(%d), s_time(%lld), t_time(%lld)\n",
+ road_name, route_name, speed_l, speed, nums, s_time, t_time);
+
+ gboolean is_pedestrain = location_road_element_is_pedestrian(road_element);
+ if (is_pedestrain) {
+ g_printf(" The road is allowed only for pedestrians \n");
+ } else {
+ g_printf(" The road is not only for pedestrians \n");
+ }
- LocationRouteTransitStop *a_s = location_route_element_get_transit_arrival_station(road_element);
- gchar *a_s_name = location_route_transit_get_station_name(a_s);
- gint a_s_level = location_route_transit_get_platform_level(a_s);
- if (a_s) {
- g_printf("Transit: a_s_name(%s), a_s_level(%d) \n",a_s_name, a_s_level);
+ gboolean is_valid = location_road_element_is_valid(road_element);
+ if (is_valid) {
+ g_printf(" This road element is valid \n");
+ } else {
+ g_printf(" This road element is invalid \n");
+ }
}
+}
+
+static void Print_road_element(LocationRouteStep *step)
+{
+ g_printf("+++PrintRoadElement begin\n");
+ GList *route_elem_list = location_route_step_get_route_elment_list(step);
+ if (route_elem_list) {
+ g_list_foreach(route_elem_list, _print_elem, step);
+ }
g_printf("---Print Road Element end\n");
}
gchar *next_road_name = location_route_maneuver_get_next_road_name(maneuver);
gchar *action = location_route_maneuver_get_action(maneuver);
- gchar *turn =location_route_maneuver_get_turn(maneuver);
+ gchar *turn = location_route_maneuver_get_turn(maneuver);
g_printf("maneuver: next_road_name(%s), action(%s), turn(%s)\n", next_road_name, action, turn);
dirct = location_route_maneuver_get_traffic_direction(maneuver);
if (TRAFFIC_DIR_LEFT == dirct) {
g_printf("Traffic is left sided. \n");
- }
- else if (TRAFFIC_DIR_RIGHT == dirct) {
+ } else if (TRAFFIC_DIR_RIGHT == dirct) {
g_printf("Traffic is right sided. \n");
}
g_printf("---print route maneuver end\n");
}
-static void cb_print_maneuver_lanes (gpointer data, gpointer user_data)
-{
- g_printf("+++lanes begin\n");
- LocationRouteLaneInfo *lane = (LocationRouteLaneInfo *)data;
-
- gboolean on_route = location_route_lane_is_on_route(lane);
- if (on_route) {
- g_printf("this lane is on the route\n");
- } else {
- g_printf("this lane is NOT on the route\n");
- }
- g_printf("---lanes end\n");
-}
-
-static void cb_print_route_step (gpointer data, gpointer user_data)
+static void cb_print_route_step(gpointer data, gpointer user_data)
{
g_printf("+++Step begin\n");
LocationRouteStep *step = (LocationRouteStep *)data;
Print_step_info(step);
g_printf("after Print Step Info\n");
- /*****************NLP start now *********************/
- g_printf("*****************NLP step start now *********************\n");
+ /*****************NLP start now *********************/
+ g_printf("*****************NLP step start now *********************\n");
Print_road_element(step);
LocationRouteManeuver *maneuver = location_route_step_get_maneuver(step);
print_route_maneuver(maneuver);
- GList *lanes = location_route_maneuver_get_lanes(maneuver);
- if (lanes) {
- g_list_foreach(lanes, cb_print_maneuver_lanes, NULL);
- }
g_printf("---Step end\n");
}
-static void print_pos_nokia (gpointer data, gpointer user_data)
+static void print_pos_nokia(gpointer data, gpointer user_data)
{
g_printf("+++print pos nokia begin. \n");
LocationPosition *pos = (LocationPosition *)data;
if (pos) {
- g_printf ("time: %d, lat: %f, long: %f, alt: %f, status: %d",
- pos->timestamp, pos->latitude, pos->longitude, pos->altitude, pos->status);
- //location_position_free (pos);
+ g_printf("time: %d, lat: %f, long: %f, alt: %f, status: %d",
+ pos->timestamp, pos->latitude, pos->longitude, pos->altitude, pos->status);
+ /*location_position_free (pos); */
}
g_printf("---print pos nokia end\n");
}
-static void print_acc_nokia (gpointer data, gpointer user_data)
+static void print_acc_nokia(gpointer data, gpointer user_data)
{
g_printf("+++print acc nokia begin. \n");
LocationAccuracy *acc = (LocationAccuracy *)data;
if (acc) {
- g_printf ("\tAccuracy level %d (%.0f meters %.0f meters)", acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
- //location_accuracy_free (acc);
+ g_printf("\tAccuracy level %d (%.0f meters %.0f meters)", acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
+ /*location_accuracy_free (acc); */
}
g_printf("---print acc nokia end. \n");
}
-static void cb_position_from_address_nokia (LocationError error, GList *pos_list, GList *acc_list, gpointer userdata)
+static void cb_position_from_address_nokia(LocationError error, GList *pos_list, GList *acc_list, gpointer userdata)
{
g_printf("+++cb position from address nokia. \n");
return;
}
- g_list_foreach (pos_list, print_pos_nokia, NULL);
- g_list_foreach (pos_list, print_acc_nokia, NULL);
+ g_list_foreach(pos_list, print_pos_nokia, NULL);
+ g_list_foreach(pos_list, print_acc_nokia, NULL);
g_printf("---cb position from address nokia end. \n");
}
-static void cb_print_route_segment (gpointer data, gpointer user_data)
+static void cb_print_route_segment(gpointer data, gpointer user_data)
{
g_printf("++Segment begin\n");
LocationRouteSegment *seg = (LocationRouteSegment *)data;
g_printf("Segment end postion NULL\n");
}
g_printf("Segment info: Distance[%f], Duration[%ld], start(%f/%f), end(%f/%f)\n", seg_dist, seg_duration,
- start_lat, start_lon, end_lat, end_lon);
+ start_lat, start_lon, end_lat, end_lon);
GList *step_list = location_route_segment_get_route_step(seg);
GList *tmp_list = (GList *)step_list;
}
-static void cb_print_route_list (gpointer data, gpointer user_data)
+static void cb_print_route_list(gpointer data, gpointer user_data)
{
g_printf("+Route begin\n");
LocationRoute *route = (LocationRoute *)data;
const LocationBoundary *bound = location_route_get_bounding_box(route);
if (bound && bound->type == LOCATION_BOUNDARY_RECT) {
g_printf("RECT left top[%f-%f], right bottom[%f-%f]\n", bound->rect.left_top->latitude, bound->rect.left_top->longitude,
- bound->rect.right_bottom->latitude, bound->rect.right_bottom->longitude);
+ bound->rect.right_bottom->latitude, bound->rect.right_bottom->longitude);
} else {
g_printf("route boundary not exist, or not RECT\n");
}
- g_printf ("Distance[%f], Distance unit[%s], Duration[%ld]\n", distance, dis_unit, duration);
+ g_printf("Distance[%f], Distance unit[%s], Duration[%ld]\n", distance, dis_unit, duration);
GList *seg_list = location_route_get_route_segment(route);
if (seg_list) {
g_printf("-Route end\n");
}
-static void cb_route(LocationError error, guint req_id, GList * route_list, gchar * error_code, gchar * error_msg, gpointer userdata)
+static void cb_route(LocationError error, guint req_id, GList *route_list, gchar *error_code, gchar *error_msg, gpointer userdata)
{
g_printf("\n===== cb_route ======\n");
if (error != LOCATION_ERROR_NONE) {
g_printf("Success, poi_list[0x%x] user_data[0x%x] req_id[%d]\n", (unsigned int)route_list, (unsigned int)userdata, req_id);
if (route_list)
- g_list_foreach (route_list, cb_print_route_list, NULL);
+ g_list_foreach(route_list, cb_print_route_list, NULL);
if (error_code && error_msg) {
g_printf("cb_route: error_code[%s], error_msg[%s]\n", error_code, error_msg);
}
char str[STR_MAX];
g_printf("userdata[0x%x] building number: [%s], street: [%s], state: [%s], country code: [%s], city: [%s], district: [%s], postal code: [%s]\n",
- (unsigned int)userdata, addr->building_number, addr->street, addr->state, addr->country_code, addr->city, addr->district, addr->postal_code);
+ (unsigned int)userdata, addr->building_number, addr->street, addr->state, addr->country_code, addr->city, addr->district, addr->postal_code);
GetAccuracyLevel(str, acc->level);
g_printf("level: [%s], horizontal_accuracy: [%f], vertical_accuracy: [%f]\n", str, acc->horizontal_accuracy, acc->vertical_accuracy);
}
-static void cb_position (LocationError error,
- GList *pos_list,
- GList *acc_list,
- gpointer userdata)
+static void cb_position(LocationError error,
+ GList *pos_list,
+ GList *acc_list,
+ gpointer userdata)
{
if (error != LOCATION_ERROR_NONE) {
g_printf("cb_position failed: error=%d\n", error);
return;
}
- g_list_foreach (pos_list, PrintPos, NULL);
- g_list_foreach (acc_list, PrintAcc, NULL);
+ g_list_foreach(pos_list, PrintPos, NULL);
+ g_list_foreach(acc_list, PrintAcc, NULL);
}
static gboolean idle_position_from_address_async(gpointer data)
{
- IdleData* idle_data = (IdleData*)data;
+ IdleData *idle_data = (IdleData *)data;
guint req_id = 0;
char str[STR_MAX];
LocationGeocodePreference *pref = location_geocode_pref_new();
- int ret = location_map_get_position_from_address_async(idle_data->obj, idle_data->addr,pref, idle_data->pos_cb, idle_data->user_data,&req_id);
+ int ret = location_map_get_position_from_address_async(idle_data->obj, idle_data->addr, pref, idle_data->pos_cb, idle_data->user_data, &req_id);
GetLocationError(str, ret);
- if(ret != LOCATION_ERROR_NONE) {
- g_printf("Fail location_get_position_from_address_async Error[%s]\n", str);
+ if (ret != LOCATION_ERROR_NONE) {
+ g_printf("Fail location_get_position_from_address_async Error[%s]\n", str);
} else {
- g_printf("location_get_position_from_address_async, req_id %d\n", req_id);
+ g_printf("location_get_position_from_address_async, req_id %d\n", req_id);
}
location_address_free(idle_data->addr);
g_free(idle_data);
static gboolean idle_position_from_freefromed_address_async(gpointer data)
{
- IdleData* idle_data = (IdleData*)data;
+ IdleData *idle_data = (IdleData *)data;
char str[STR_MAX];
guint req_id = 0;
LocationGeocodePreference *pref = location_geocode_pref_new();
- int ret = location_map_get_position_from_freeformed_address_async(idle_data->obj, idle_data->str_addr,pref, idle_data->pos_cb, idle_data->user_data,&req_id);
+ int ret = location_map_get_position_from_freeformed_address_async(idle_data->obj, idle_data->str_addr, pref, idle_data->pos_cb, idle_data->user_data, &req_id);
GetLocationError(str, ret);
- if(ret != LOCATION_ERROR_NONE) {
- g_printf("Fail location_get_position_from_freeformed_address_async Error[%s]\n", str);
+ if (ret != LOCATION_ERROR_NONE) {
+ g_printf("Fail location_get_position_from_freeformed_address_async Error[%s]\n", str);
} else {
- g_printf("location_get_position_from_freeformed_address_async, req_id %d\n", req_id);
+ g_printf("location_get_position_from_freeformed_address_async, req_id %d\n", req_id);
}
g_free(idle_data->str_addr);
g_free(idle_data);
static gboolean idle_address_from_position_async(gpointer data)
{
- IdleData* idle_data = (IdleData*)data;
+ IdleData *idle_data = (IdleData *)data;
char str[STR_MAX];
guint reqid = 0;
- int ret = location_map_get_address_from_position_async(idle_data->obj, idle_data->pos,idle_data->addr_cb, idle_data->user_data,&reqid);
+ int ret = location_map_get_address_from_position_async(idle_data->obj, idle_data->pos, idle_data->addr_cb, idle_data->user_data, &reqid);
GetLocationError(str, ret);
- if(ret != LOCATION_ERROR_NONE) {
- g_printf("Fail location_map_get_address_from_position_async Error[%s]\n", str);
+ if (ret != LOCATION_ERROR_NONE) {
+ g_printf("Fail location_map_get_address_from_position_async Error[%s]\n", str);
} else {
- g_printf("location_map_get_address_from_position_async, req_id %d\n", reqid);
+ g_printf("location_map_get_address_from_position_async, req_id %d\n", reqid);
}
location_position_free(idle_data->pos);
g_free(idle_data);
static gboolean idle_location_map_get_position_from_address_async(gpointer data)
{
g_printf("+++idle location map get position from address async begin\n");
- IdleData* idle_data = (IdleData*)data;
+ IdleData *idle_data = (IdleData *)data;
guint req_id = 0;
char str[STR_MAX];
LocationGeocodePreference *pref = location_geocode_pref_new();
- LocationError err = location_map_get_position_from_address_async(idle_data->obj,idle_data->addr,pref,idle_data->pos_cb,idle_data->user_data,&req_id);
+ LocationError err = location_map_get_position_from_address_async(idle_data->obj, idle_data->addr, pref, idle_data->pos_cb, idle_data->user_data, &req_id);
- if(err != LOCATION_ERROR_NONE) {
- g_printf("Fail location_get_position_from_address_async Error[%s]\n", str);
+ if (err != LOCATION_ERROR_NONE) {
+ g_printf("Fail location_get_position_from_address_async Error[%s]\n", str);
} else {
- g_printf("location_get_position_from_address_async, req_id %d\n", req_id);
+ g_printf("location_get_position_from_address_async, req_id %d\n", req_id);
}
g_free(idle_data);
location_geocode_pref_free(pref);
void _print_keys(gpointer data, gpointer user_data)
{
- g_printf(" %s ", (gchar*) data);
+ g_printf(" %s ", (gchar *) data);
}
-static void print_map_service_keys (LocationObject *obj, int type)
+static void print_map_service_keys(LocationObject *obj, int type)
{
GList *key = NULL;
- location_map_get_provider_capability_key (obj, type, &key);
+ location_map_get_provider_capability_key(obj, type, &key);
if (key) {
- g_list_foreach (key, (GFunc)_print_keys, NULL);
+ g_list_foreach(key, (GFunc)_print_keys, NULL);
}
g_list_free_full(key, g_free);
}
-void _print_provider (gpointer data, gpointer user_data)
+void _print_provider(gpointer data, gpointer user_data)
{
gchar *provider = (gchar *)data;
g_printf("17. location_map_get_default_provider \n");
g_printf("18. location_map_set_provider \n");
g_printf("19. location_map_cancel_geocode_request. \n");
+ g_printf("20. location_map_get_map_version. \n");
+ g_printf("21. location_map_updatea_map_version[TRUE]. \n");
+ g_printf("22. location_map_updatea_map_version[FALSE]. \n");
+ g_printf("23. location_map_is_latest_map_data \n");
g_printf("99. change map provider to default\n");
g_printf("99a. change map provider to decarta\n");
g_printf("99b. change map provider to osm\n");
g_printf("\n==================================================================================\n");
}
-int main(int argc, char** argv)
+int main(int argc, char **argv)
{
char strOpt[255];
int ret;
GError *gerr = NULL;
guint req_id = 0;
- // If application is executed by AUL, this is not needed.
- g_setenv("PKG_NAME", "org.tizen.map-service-test", 1);
+ /* If application is executed by AUL, this is not needed. */
+ g_setenv("PKG_NAME", "com.samsung.map-service-test", 1);
+#if !GLIB_CHECK_VERSION (2, 35, 0)
g_type_init();
+#endif
#if !GLIB_CHECK_VERSION (2, 31, 0)
- if( !g_thread_supported() )
- {
+ if (!g_thread_supported()) {
g_thread_init(NULL);
}
#endif
g_main = g_thread_create(GmainThread, NULL, TRUE, &gerr);
if (!g_main) {
g_debug("Error create gmain thread: Err domain[%d] Err code[%d] Err msg[%s]",
- gerr->domain, gerr->code, gerr->message);
+ gerr->domain, gerr->code, gerr->message);
g_error_free(gerr);
return 0;
}
g_printf("--- Start LBS Test App ---\n");
- while(1)
- {
+ while (1) {
print_menu();
g_printf("Select option: ");
SelectOpt(strOpt);
g_printf("======================================================================================\n");
- if (0 == g_strcmp0 ("x", strOpt)) {
+ if (0 == g_strcmp0("x", strOpt)) {
- }
- else if (0 == g_strcmp0("1",strOpt)) {
+ } else if (0 == g_strcmp0("1", strOpt)) {
ret = location_init();
GetLocationError(str, ret);
g_printf("location_init: returned value [%s]\n", str);
- } else if (0 == g_strcmp0("2",strOpt)) {
+ } else if (0 == g_strcmp0("2", strOpt)) {
if (map_obj) {
g_printf("Location object already existed: [0x%x]", (unsigned int)map_obj);
continue;
}
map_obj = location_map_new(NULL);
- if(map_obj) g_printf("Success\n");
+
+ LocationMapPref *mapPref = location_map_pref_new();
+ location_map_pref_set_maps_key(mapPref, "SpMLqvWrvuFmp27kV4e6/Md_LeHoPn0b4LPOxB60p4A");
+ location_map_set_service_pref(map_obj, mapPref);
+
+ if (map_obj) g_printf("Success\n");
else g_printf("Failed\n");
- } else if (0 == g_strcmp0("2a",strOpt)) {
+ } else if (0 == g_strcmp0("2a", strOpt)) {
if (map_obj) {
g_printf("Location object already existed: [0x%x]", (unsigned int)map_obj);
continue;
}
map_obj = location_map_new("decarta");
- if(map_obj) g_printf("Success\n");
+ if (map_obj) g_printf("Success\n");
else g_printf("Failed\n");
- } else if (0 == g_strcmp0("2b",strOpt)) {
+ } else if (0 == g_strcmp0("2b", strOpt)) {
if (map_obj) {
g_printf("Location object already existed: [0x%x]", (unsigned int)map_obj);
continue;
}
map_obj = location_map_new("osm");
- if(map_obj) g_printf("Success\n");
+ if (map_obj) g_printf("Success\n");
else g_printf("Failed\n");
- }
- else if (0 == g_strcmp0("2c",strOpt)) {
+ } else if (0 == g_strcmp0("2c", strOpt)) {
if (map_obj) {
g_printf("Location object already existed: [0x%x]", (unsigned int)map_obj);
continue;
}
map_obj = location_map_new("nlp");
- if(map_obj) {
+
+ LocationMapPref *mapPref = location_map_pref_new();
+ location_map_pref_set_maps_key(mapPref, "SpMLqvWrvuFmp27kV4e6/Md_LeHoPn0b4LPOxB60p4A");
+ location_map_set_service_pref(map_obj, mapPref);
+
+ if (map_obj) {
g_printf("Success\n");
- }
- else
- {
+ } else {
g_printf("Failed\n");
}
- } else if (0 == g_strcmp0("3",strOpt)) {
- ret = location_map_free (map_obj);
+ } else if (0 == g_strcmp0("3", strOpt)) {
+ ret = location_map_free(map_obj);
map_obj = NULL;
GetLocationError(str, ret);
g_printf("location_map_free: returned value [%s]\n", str);
- }else if(0 == g_strcmp0("4",strOpt) ){
- IdleData* data = g_new0(IdleData, 1);
+ } else if (0 == g_strcmp0("4", strOpt)) {
+ IdleData *data = g_new0(IdleData, 1);
data->obj = map_obj;
data->addr_cb = cb_address;
data->user_data = map_obj;
g_printf("[0].San jose [1].Suwon HQ [*].Custom\n");
g_printf("Select Position: ");
int opt = PromptInt();
- if(opt == 0) data->pos = location_position_new(0, 37.335276, -121.890059, 0, LOCATION_STATUS_2D_FIX);
+ if (opt == 0) data->pos = location_position_new(0, 37.335276, -121.890059, 0, LOCATION_STATUS_2D_FIX);
else if (opt == 1) data->pos = location_position_new(0, 37.257809, 127.056383, 0, LOCATION_STATUS_2D_FIX);
else {
g_printf("Input latitude: ");
}
g_idle_add((GSourceFunc)idle_address_from_position_async, data);
} else if (0 == g_strcmp0("5", strOpt)) {
- IdleData* data = g_new0(IdleData, 1);
+ IdleData *data = g_new0(IdleData, 1);
data->obj = map_obj;
data->pos_cb = cb_position;
data->user_data = map_obj;
g_printf("Select Address: ");
int opt = PromptInt();
char *ret_str = NULL;
- if (opt == 0) data->addr = location_address_new ("1", "Post Street", NULL, "san jose", "ca", NULL, "95113", NULL, NULL, NULL);
- else if (opt == 1) data->addr = location_address_new (NULL, "삼성전자", "매탄3동", "수원시 영>통구", "경기도", NULL, NULL, NULL, NULL, NULL);
- else if (opt == 2) data->addr = location_address_new (NULL, "Samsung Electro-Mechanics Co. LTD", "Maetan 3-dong", "Suwon Si Yeongtong-gu", "Gyeonggi-do", NULL, NULL, NULL, NULL, NULL);
+ if (opt == 0) data->addr = location_address_new("1", "Post Street", NULL, "san jose", "ca", NULL, "95113", NULL, NULL, NULL);
+ else if (opt == 1) data->addr = location_address_new(NULL, "삼성전자", "매탄3동", "수원시 영>통구", "경기도", NULL, NULL, NULL, NULL, NULL);
+ else if (opt == 2) data->addr = location_address_new(NULL, "Samsung Electro-Mechanics Co. LTD", "Maetan 3-dong", "Suwon Si Yeongtong-gu", "Gyeonggi-do", NULL, NULL, NULL, NULL, NULL);
else {
char building_number[255], street[255], state[255], country_code[255], city[255], district[255], postal_code[255];
g_printf("Input building number: ");
ret_str = fgets(building_number, 255, stdin);
- building_number[strlen(building_number)-1]='\0';
+ building_number[strlen(building_number) - 1] = '\0';
g_printf("Input street: ");
ret_str = fgets(street, 255, stdin);
- street[strlen(street)-1]='\0';
+ street[strlen(street) - 1] = '\0';
g_printf("Input state: ");
ret_str = fgets(state, 255, stdin);
- state[strlen(state)-1]='\0';
+ state[strlen(state) - 1] = '\0';
g_printf("Input country code: ");
ret_str = fgets(country_code, 255, stdin);
- country_code[strlen(country_code)-1]='\0';
+ country_code[strlen(country_code) - 1] = '\0';
g_printf("Input city: ");
ret_str = fgets(city, 255, stdin);
- city[strlen(city)-1]='\0';
+ city[strlen(city) - 1] = '\0';
g_printf("Input district: ");
ret_str = fgets(district, 255, stdin);
- district[strlen(district)-1]='\0';
+ district[strlen(district) - 1] = '\0';
g_printf("Input postal code: ");
ret_str = fgets(postal_code, 255, stdin);
- postal_code[strlen(postal_code)-1]='\0';
+ postal_code[strlen(postal_code) - 1] = '\0';
data->addr = location_address_new(building_number, street, district, city, state, country_code, postal_code, NULL, NULL, NULL);
}
g_idle_add((GSourceFunc)idle_position_from_address_async, data);
- }else if(0 == g_strcmp0("6",strOpt) ){
- IdleData* data = g_new0(IdleData, 1);
+ } else if (0 == g_strcmp0("6", strOpt)) {
+ IdleData *data = g_new0(IdleData, 1);
data->obj = map_obj;
data->pos_cb = cb_position;
data->user_data = map_obj;
g_printf("Select Address: ");
int opt = PromptInt();
char *ret_str = NULL;
- if(opt == 0){
+ if (opt == 0) {
data->str_addr = g_strdup("4 N 2nd Street 95113");
- }else if(opt == 1){
+ } else if (opt == 1) {
data->str_addr = g_strdup("경기도 수원시 영통구 매탄 3동 삼성전자");
- }else if(opt == 2){
+ } else if (opt == 2) {
data->str_addr = g_strdup("Samsung Electronics Co. LTD Maetan 3-dong, Suwon Si Yeongtong-gu, Gyeonggi-Do (Seoul 443-742 Korea), Rep of KOREA");
- }else{
+ } else {
char buf[255];
g_printf("Input freeform address: ");
ret_str = fgets(buf, 255, stdin);
- buf[strlen(buf)-1]='\0';
+ if (NULL == ret_str) {
+ g_printf(" fgets return NULL \n");
+ }
+ buf[strlen(buf) - 1] = '\0';
data->str_addr = g_strdup(buf);
}
g_idle_add((GSourceFunc)idle_position_from_freefromed_address_async, data);
- }else if(0 == g_strcmp0("7", strOpt)) {
+ } else if (0 == g_strcmp0("7", strOpt)) {
g_printf("location_map_search_poi\n");
LocationPOIFilter *filter = location_poi_filter_new();
ret = location_map_search_poi(map_obj, filter, position, pref, cb_poi, NULL, &req_id);
GetLocationError(str, ret);
- if(ret != LOCATION_ERROR_NONE) {
- g_printf("Fail to search POI. Error[%s]\n", str);
+ if (ret != LOCATION_ERROR_NONE) {
+ g_printf("Fail to search POI. Error[%s]\n", str);
} else {
- g_printf("Seach POI success, req_id %d\n", req_id);
+ g_printf("Seach POI success, req_id %d\n", req_id);
}
location_poi_filter_free(filter);
location_poi_pref_free(pref);
location_position_free(position);
- }else if(0 == g_strcmp0("7a", strOpt)) {
+ } else if (0 == g_strcmp0("7a", strOpt)) {
g_printf("location_map_search_poi_with_category\n");
LocationPOIFilter *filter = location_poi_filter_new();
location_poi_filter_set(filter, "CATEGORY", "eat_drink");
ret = location_map_search_poi(map_obj, filter, position, pref, cb_poi, NULL, &req_id);
GetLocationError(str, ret);
- if(ret != LOCATION_ERROR_NONE) {
- g_printf("Fail to search POI. Error[%s]\n", str);
+ if (ret != LOCATION_ERROR_NONE) {
+ g_printf("Fail to search POI. Error[%s]\n", str);
} else {
- g_printf("Seach POI success, req_id %d\n", req_id);
+ g_printf("Seach POI success, req_id %d\n", req_id);
}
- location_poi_filter_free(filter);g_printf("location_search_poi_by_freeformed_address_with_poi_name\n");
+ location_poi_filter_free(filter);
+ g_printf("location_search_poi_by_freeformed_address_with_poi_name\n");
location_poi_pref_free(pref);
location_position_free(position);
- }else if(0 == g_strcmp0("7b", strOpt)) {
+ } else if (0 == g_strcmp0("7b", strOpt)) {
g_printf("location_map_search_poi_with_poi_name\n");
LocationPOIFilter *filter = location_poi_filter_new();
ret = location_map_search_poi(map_obj, filter, position, pref, cb_poi, NULL, &req_id);
GetLocationError(str, ret);
- if(ret != LOCATION_ERROR_NONE) {
- g_printf("Fail to search POI. Error[%s]\n", str);
+ if (ret != LOCATION_ERROR_NONE) {
+ g_printf("Fail to search POI. Error[%s]\n", str);
} else {
- g_printf("Seach POI success, req_id %d\n", req_id);
+ g_printf("Seach POI success, req_id %d\n", req_id);
}
location_poi_filter_free(filter);
location_poi_pref_free(pref);
location_position_free(position);
- }else if(0 == g_strcmp0("8", strOpt)) {
+ } else if (0 == g_strcmp0("8", strOpt)) {
g_printf("location_map_search_poi_by_area_with_keyword\n");
- // only circle supported by decarta
+ /* only circle supported by decarta */
LocationPosition *center = location_position_new(0, 37.336723, -121.889555, 0, LOCATION_STATUS_2D_FIX);
gdouble radius = 400;
LocationBoundary *bound = location_boundary_new_for_circle(center, radius);
LocationPOIFilter *filter = location_poi_filter_new();
gchar *key = g_strdup("KEYWORD");
gchar *value = g_strdup("cafe");
- location_poi_filter_set(filter, key, value); // same with Type ? CATEGORY, KEYWORD, POIName
+ location_poi_filter_set(filter, key, value); /* same with Type ? CATEGORY, KEYWORD, POIName */
LocationPOIPreference *pref = location_poi_pref_new();
location_poi_pref_set_max_result(pref, 10);
gchar *item = g_strdup("Distance");
- location_poi_pref_set_sort_by(pref, item); // can't set const char* directly !!
- location_poi_pref_set_sort_order(pref, LOCATION_POI_PREF_SO_ASC); //LOCATION_POI_PREF_SO_ASC
+ location_poi_pref_set_sort_by(pref, item); /* can't set const char* directly !! */
+ location_poi_pref_set_sort_order(pref, LOCATION_POI_PREF_SO_ASC); /*LOCATION_POI_PREF_SO_ASC */
ret = location_map_search_poi_by_area(map_obj, filter, bound, pref, cb_poi, NULL, &req_id);
GetLocationError(str, ret);
if (ret != LOCATION_ERROR_NONE) {
- g_printf("Fail to search POI by area. Error[%s]\n", str);
+ g_printf("Fail to search POI by area. Error[%s]\n", str);
} else {
- g_printf("Seach POI by area sucess, req_id %d\n", req_id);
+ g_printf("Seach POI by area sucess, req_id %d\n", req_id);
}
g_free(key);
location_boundary_free(bound);
location_poi_filter_free(filter);
location_poi_pref_free(pref);
- }else if(0 == g_strcmp0("8a", strOpt)) {
+ } else if (0 == g_strcmp0("8a", strOpt)) {
g_printf("location_map_search_poi_by_area_with_category\n");
- // only circle supported by decarta
+ /* only circle supported by decarta */
LocationPosition *center = location_position_new(0, 37.336723, -121.889555, 0, LOCATION_STATUS_2D_FIX);
gdouble radius = 400;
LocationBoundary *bound = location_boundary_new_for_circle(center, radius);
ret = location_map_search_poi_by_area(map_obj, filter, bound, pref, cb_poi, NULL, &req_id);
GetLocationError(str, ret);
if (ret != LOCATION_ERROR_NONE) {
- g_printf("Fail to search POI by area. Error[%s]\n", str);
+ g_printf("Fail to search POI by area. Error[%s]\n", str);
} else {
- g_printf("Seach POI by area sucess, req_id %d\n", req_id);
+ g_printf("Seach POI by area sucess, req_id %d\n", req_id);
}
g_free(key);
location_poi_filter_free(filter);
location_poi_pref_free(pref);
- }else if(0 == g_strcmp0("8b", strOpt)) {
+ } else if (0 == g_strcmp0("8b", strOpt)) {
g_printf("location_map_search_poi_by_area_with_poi_name\n");
- // only circle supported by decarta
+ /* only circle supported by decarta */
LocationPosition *center = location_position_new(0, 37.336723, -121.889555, 0, LOCATION_STATUS_2D_FIX);
gdouble radius = 400;
LocationBoundary *bound = location_boundary_new_for_circle(center, radius);
LocationPOIFilter *filter = location_poi_filter_new();
gchar *key = g_strdup("POIName");
gchar *value = g_strdup("cafe");
- location_poi_filter_set(filter, key, value); // same with Type ? CATEGORY, KEYWORD, POIName
+ location_poi_filter_set(filter, key, value); /* same with Type ? CATEGORY, KEYWORD, POIName */
LocationPOIPreference *pref = location_poi_pref_new();
location_poi_pref_set_max_result(pref, 10);
gchar *item = g_strdup("Distance");
- location_poi_pref_set_sort_by(pref, item); // can't set const char* directly !!
- location_poi_pref_set_sort_order(pref, LOCATION_POI_PREF_SO_ASC); //LOCATION_POI_PREF_SO_ASC
+ location_poi_pref_set_sort_by(pref, item); /* can't set const char* directly !! */
+ location_poi_pref_set_sort_order(pref, LOCATION_POI_PREF_SO_ASC); /*LOCATION_POI_PREF_SO_ASC */
ret = location_map_search_poi_by_area(map_obj, filter, bound, pref, cb_poi, NULL, &req_id);
GetLocationError(str, ret);
if (ret != LOCATION_ERROR_NONE) {
- g_printf("Fail to search POI by area. Error[%s]\n", str);
+ g_printf("Fail to search POI by area. Error[%s]\n", str);
} else {
- g_printf("Seach POI by area sucess, req_id %d\n", req_id);
+ g_printf("Seach POI by area sucess, req_id %d\n", req_id);
}
g_free(key);
location_poi_filter_free(filter);
location_poi_pref_free(pref);
- }else if(0 == g_strcmp0("9", strOpt)) {
+ } else if (0 == g_strcmp0("9", strOpt)) {
g_printf("location_map_search_poi_by_address_with_keyword\n");
- LocationAddress *addr = location_address_new("51", "N SAN PEDRO ST", NULL, "SAN JOSE", "SANTA CLARA", "CA", "95110",NULL,NULL,NULL);
+ LocationAddress *addr = location_address_new("51", "N SAN PEDRO ST", NULL, "SAN JOSE", "SANTA CLARA", "CA", "95110", NULL, NULL, NULL);
LocationPOIFilter *filter = location_poi_filter_new();
gchar *key = g_strdup("KEYWORD");
ret = location_map_search_poi_by_address(map_obj, filter, addr, pref, cb_poi, NULL, &req_id);
GetLocationError(str, ret);
- if(ret != LOCATION_ERROR_NONE) {
- g_printf("Fail to search POI by address. Error[%s]\n", str);
+ if (ret != LOCATION_ERROR_NONE) {
+ g_printf("Fail to search POI by address. Error[%s]\n", str);
} else {
- g_printf("Seach POI by address sucess, req_id %d\n", req_id);
+ g_printf("Seach POI by address sucess, req_id %d\n", req_id);
}
g_free(key);
location_address_free(addr);
location_poi_filter_free(filter);
location_poi_pref_free(pref);
- }else if(0 == g_strcmp0("9a", strOpt)) {
+ } else if (0 == g_strcmp0("9a", strOpt)) {
g_printf("location_search_poi_by_address_with_category\n");
- LocationAddress *addr = location_address_new("51", "N SAN PEDRO ST", NULL, "SAN JOSE", "SANTA CLARA", "CA", "95110",NULL,NULL,NULL);
+ LocationAddress *addr = location_address_new("51", "N SAN PEDRO ST", NULL, "SAN JOSE", "SANTA CLARA", "CA", "95110", NULL, NULL, NULL);
LocationPOIFilter *filter = location_poi_filter_new();
location_poi_filter_set(filter, "CATEGORY", "restaurant");
ret = location_map_search_poi_by_address(map_obj, filter, addr, pref, cb_poi, NULL, &req_id);
GetLocationError(str, ret);
- if(ret != LOCATION_ERROR_NONE) {
- g_printf("Fail to search POI by address. Error[%s]\n", str);
+ if (ret != LOCATION_ERROR_NONE) {
+ g_printf("Fail to search POI by address. Error[%s]\n", str);
} else {
- g_printf("Seach POI by address sucess, req_id %d\n", req_id);
+ g_printf("Seach POI by address sucess, req_id %d\n", req_id);
}
location_address_free(addr);
location_poi_filter_free(filter);
location_poi_pref_free(pref);
- }else if(0 == g_strcmp0("9b", strOpt)) {
+ } else if (0 == g_strcmp0("9b", strOpt)) {
g_printf("location_map_search_poi_by_address_with_poi_name\n");
- LocationAddress *addr = location_address_new("51", "N SAN PEDRO ST", NULL, "SAN JOSE", "SANTA CLARA", "CA", "95110",NULL,NULL,NULL);
+ LocationAddress *addr = location_address_new("51", "N SAN PEDRO ST", NULL, "SAN JOSE", "SANTA CLARA", "CA", "95110", NULL, NULL, NULL);
LocationPOIFilter *filter = location_poi_filter_new();
gchar *key = g_strdup("POIName");
ret = location_map_search_poi_by_address(map_obj, filter, addr, pref, cb_poi, NULL, &req_id);
GetLocationError(str, ret);
- if(ret != LOCATION_ERROR_NONE) {
- g_printf("Fail to search POI by address. Error[%s]\n", str);
+ if (ret != LOCATION_ERROR_NONE) {
+ g_printf("Fail to search POI by address. Error[%s]\n", str);
} else {
- g_printf("Seach POI by address sucess, req_id %d\n", req_id);
+ g_printf("Seach POI by address sucess, req_id %d\n", req_id);
}
g_free(key);
location_poi_filter_free(filter);
location_poi_pref_free(pref);
- }else if(0 == g_strcmp0("10", strOpt)) {
+ } else if (0 == g_strcmp0("10", strOpt)) {
g_printf("location_map_search_poi_by_freeformed_address_with_keyword\n");
gchar *addr = g_strdup("North Second St.");
LocationPOIPreference *pref = location_poi_pref_new();
location_poi_pref_set_max_result(pref, 10);
gchar *item = g_strdup("Distance");
- location_poi_pref_set_sort_by(pref, item); // can't set const char* directly !!
- location_poi_pref_set_sort_order(pref, LOCATION_POI_PREF_SO_ASC); //LOCATION_POI_PREF_SO_ASC
+ location_poi_pref_set_sort_by(pref, item); /* can't set const char* directly !! */
+ location_poi_pref_set_sort_order(pref, LOCATION_POI_PREF_SO_ASC); /*LOCATION_POI_PREF_SO_ASC */
ret = location_map_search_poi_by_freeformed_address(map_obj, filter, addr, pref, cb_poi, NULL, &req_id);
GetLocationError(str, ret);
if (ret != LOCATION_ERROR_NONE) {
- g_printf("Fail to search POI by address. Error[%s]\n", str);
+ g_printf("Fail to search POI by address. Error[%s]\n", str);
} else {
- g_printf("Seach POI by address success, req_id %d\n", req_id);
- }
-
+ g_printf("Seach POI by address success, req_id %d\n", req_id);
+ }
g_free(item);
g_free(addr);
location_poi_filter_free(filter);
location_poi_pref_free(pref);
- }else if(0 == g_strcmp0("10a", strOpt)) {
+ } else if (0 == g_strcmp0("10a", strOpt)) {
g_printf("location_map_search_poi_by_freeformed_address_with_category\n");
gchar *addr = g_strdup("North Second St.");
ret = location_map_search_poi_by_freeformed_address(map_obj, filter, addr, pref, cb_poi, NULL, &req_id);
GetLocationError(str, ret);
if (ret != LOCATION_ERROR_NONE) {
- g_printf("Fail to search POI by address. Error[%s]\n", str);
+ g_printf("Fail to search POI by address. Error[%s]\n", str);
} else {
- g_printf("Seach POI by address success, req_id %d\n", req_id);
- }
+ g_printf("Seach POI by address success, req_id %d\n", req_id);
+ }
g_free(key);
g_free(value);
g_free(addr);
location_poi_filter_free(filter);
location_poi_pref_free(pref);
- }else if(0 == g_strcmp0("10b", strOpt)) {
+ } else if (0 == g_strcmp0("10b", strOpt)) {
g_printf("location_map_search_poi_by_freeformed_address_with_poi_name\n");
gchar *addr = g_strdup("North Second St.");
ret = location_map_search_poi_by_freeformed_address(map_obj, filter, addr, pref, cb_poi, NULL, &req_id);
GetLocationError(str, ret);
if (ret != LOCATION_ERROR_NONE) {
- g_printf("Fail to search POI by address. Error[%s]\n", str);
+ g_printf("Fail to search POI by address. Error[%s]\n", str);
} else {
- g_printf("Seach POI by address success, req_id %d\n", req_id);
+ g_printf("Seach POI by address success, req_id %d\n", req_id);
}
g_free(addr);
location_poi_filter_free(filter);
location_poi_pref_free(pref);
- }else if(0 == g_strcmp0("11", strOpt)) {
+ } else if (0 == g_strcmp0("11", strOpt)) {
int req_id;
int len = 0;
GetLocationError(str, ret);
if (ret != LOCATION_ERROR_NONE) {
g_printf("Fail to cancel POI request. Error[%s]\n", str);
- }
- else
+ } else
g_printf("location_map_cancel_poi_request, req_id %d\n", req_id);
- }else if(0 == g_strcmp0("12", strOpt)) {
+ } else if (0 == g_strcmp0("12", strOpt)) {
g_printf("location_map_request_route\n\n");
- LocationPosition *origin = location_position_new(0, 37.564263, 126.974676, 0, LOCATION_STATUS_2D_FIX); // Seoul city hall
- LocationPosition *destination = location_position_new(0, 37.557120, 126.992410, 0, LOCATION_STATUS_2D_FIX); // NamSan
+ LocationPosition *origin = location_position_new(0, 37.564263, 126.974676, 0, LOCATION_STATUS_2D_FIX); /* Seoul city hall */
+ LocationPosition *destination = location_position_new(0, 37.557120, 126.992410, 0, LOCATION_STATUS_2D_FIX); /* NamSan */
GList *waypoint = NULL;
- LocationPosition *via_pos = location_position_new(0, 37.560950, 126.986240, 0, LOCATION_STATUS_2D_FIX); // Wangsimli
- waypoint = g_list_append (waypoint, (gpointer)via_pos);
+ LocationPosition *via_pos = location_position_new(0, 37.560950, 126.986240, 0, LOCATION_STATUS_2D_FIX); /* Wangsimli */
+ waypoint = g_list_append(waypoint, (gpointer)via_pos);
LocationRoutePreference *pref = location_route_pref_new();
location_route_pref_set_route_type(pref, "FASTEST");
LocationRoadElementPenalty *penalty = NULL;
- penalty = location_route_element_penalty_new ();
+ penalty = location_route_element_penalty_new();
- location_route_element_penalty_set_id(penalty, 100);
+ location_route_element_penalty_set_id(penalty, "Penalty1");
location_route_element_penalty_set_direction(penalty, DIR_BOTH);
location_route_element_penalty_set_penalty(penalty, 8);
location_route_element_penalty_set_speed(penalty, 90);
location_route_element_penalty_set_validity_start_time(penalty, 146);
location_route_element_penalty_set_validity_end_time(penalty, 244);
- LocationRouteOptions *options = location_route_options_new ();
+ LocationRouteOptions *options = location_route_options_new();
if (NULL == options) {
g_printf("\n ERROR: options is NULL \n");
}
GList *penalty_list = NULL;
- penalty_list = g_list_append (penalty_list, penalty);
+ penalty_list = g_list_append(penalty_list, penalty);
if (NULL == penalty_list) {
g_printf("\n ERROR: penalty_list is NULL \n");
}
location_route_options_set_minimum_change_time(options, 30);
location_route_options_set_transit_type_allowed(options, TRANSIT_TYPE_RAIL_LIGHT, TRUE);
location_route_options_set_maximum_changes(options, 2);
- location_route_options_set_departure_time(options, 188);
- location_route_options_set_arrival_time(options, 244);
+ location_route_options_set_departure_time(options, 1373282862);
+ /*location_route_options_set_arrival_time(options, 244); */
location_route_pref_set_options(pref, options);
location_route_options_free(options);
+ LocationMapPref *mapPref = location_map_pref_new();
+ location_map_pref_set_maps_key(mapPref, "SpMLqvWrvuFmp27kV4e6/Md_LeHoPn0b4LPOxB60p4A");
+ location_map_set_service_pref(map_obj, mapPref);
+
ret = location_map_request_route(map_obj, origin, destination, waypoint, pref, cb_route, NULL, &req_id);
GetLocationError(str, ret);
if (ret != LOCATION_ERROR_NONE) {
- g_printf("Fail to search route by address. Error[%s]\n", str);
+ g_printf("Fail to search route by address. Error[%s]\n", str);
} else {
- g_printf("Search Route successfully, req_id %d\n", req_id);
+ g_printf("Search Route successfully, req_id %d\n", req_id);
}
- }else if(0 == g_strcmp0("12a", strOpt)) {
+ } else if (0 == g_strcmp0("12a", strOpt)) {
g_printf("location_map_request_route for a long distance\n");
- LocationPosition *origin = location_position_new(0, 29.783449,-95.373688, 0, LOCATION_STATUS_2D_FIX);
- LocationPosition *destination = location_position_new(0, 39.749962,-104.984665, 0, LOCATION_STATUS_2D_FIX);
+ LocationPosition *origin = location_position_new(0, 29.783449, -95.373688, 0, LOCATION_STATUS_2D_FIX);
+ LocationPosition *destination = location_position_new(0, 39.749962, -104.984665, 0, LOCATION_STATUS_2D_FIX);
GList *waypoint = NULL;
LocationRoutePreference *pref = location_route_pref_new();
location_route_pref_set_route_type(pref, "FASTEST");
+ LocationMapPref *mapPref = location_map_pref_new();
+ location_map_pref_set_maps_key(mapPref, "SpMLqvWrvuFmp27kV4e6/Md_LeHoPn0b4LPOxB60p4A");
+ location_map_set_service_pref(map_obj, mapPref);
+
ret = location_map_request_route(map_obj, origin, destination, waypoint, pref, cb_route, NULL, &req_id);
GetLocationError(str, ret);
if (ret != LOCATION_ERROR_NONE) {
- g_printf("Fail to search route by address. Error[%s]\n", str);
+ g_printf("Fail to search route by address. Error[%s]\n", str);
} else {
- g_printf("Search Route successfully, req_id %d\n", req_id);
+ g_printf("Search Route successfully, req_id %d\n", req_id);
}
- }else if(0 == g_strcmp0("13", strOpt)) {
+ } else if (0 == g_strcmp0("13", strOpt)) {
g_printf("location_map_cancel_route_request\n");
int req_id;
GetLocationError(str, ret);
if (ret != LOCATION_ERROR_NONE) {
g_printf("Fail to cancel route request. Error[%s]\n", str);
- }
- else {
+ } else {
g_printf("location_map_cancel_route_request, req_id %d\n", req_id);
}
- }else if (0 == g_strcmp0 ("14", strOpt)) {
+ } else if (0 == g_strcmp0("14", strOpt)) {
int idx = 0;
for (idx = 0; idx < MAP_SERVICE_TYPE_MAX; idx++) {
- g_printf("[%d:%d], ", idx, location_map_is_supported_provider_capability (map_obj, idx));
+ g_printf("[%d:%d], ", idx, location_map_is_supported_provider_capability(map_obj, idx));
}
- }else if (0 == g_strcmp0 ("15", strOpt)) {
+ } else if (0 == g_strcmp0("15", strOpt)) {
int idx = 0;
for (idx = 0; idx < MAP_SERVICE_TYPE_MAX; idx++) {
g_printf("[%d:", idx);
print_map_service_keys(map_obj, idx);
g_printf("]\n");
}
- }else if (0 == g_strcmp0 ("16", strOpt)) {
- GList *list = location_map_get_supported_providers (map_obj);
+ } else if (0 == g_strcmp0("16", strOpt)) {
+ GList *list = location_map_get_supported_providers(map_obj);
if (list) {
- g_list_foreach (list, _print_provider, NULL);
- g_list_free_full (list, g_free);
- }
- else {
+ g_list_foreach(list, _print_provider, NULL);
+ g_list_free_full(list, g_free);
+ } else {
g_printf("Fail to get supported_providers\n");
}
- }else if (0 == g_strcmp0 ("17", strOpt)) {
- gchar *default_provider = location_map_get_default_provider (map_obj);
+ } else if (0 == g_strcmp0("17", strOpt)) {
+ gchar *default_provider = location_map_get_default_provider(map_obj);
if (default_provider) {
g_printf("Defaut : [%s]\n", default_provider);
- g_free (default_provider);
- }
- else {
+ g_free(default_provider);
+ } else {
g_printf("Fail to get default provider\n");
}
- }else if (0 == g_strcmp0 ("18", strOpt)) {
+ } else if (0 == g_strcmp0("18", strOpt)) {
g_printf("[0].default [1].decarta [2].osm\n");
g_printf("Select provider: ");
int opt = PromptInt();
gboolean ret = FALSE;
- switch (opt)
- {
+ switch (opt) {
case 0:
- ret = location_map_set_provider (map_obj, NULL);
+ ret = location_map_set_provider(map_obj, NULL);
break;
case 1:
- ret = location_map_set_provider (map_obj, "decarta");
+ ret = location_map_set_provider(map_obj, "decarta");
break;
case 2:
- ret = location_map_set_provider (map_obj, "osm");
+ ret = location_map_set_provider(map_obj, "osm");
break;
default:
break;
}
if (ret == TRUE) {
- g_printf ("Success to set provider [%d]\n", opt);
- }
- else {
- g_printf ("Fail to set provider [%d]\n", opt);
+ g_printf("Success to set provider [%d]\n", opt);
+ } else {
+ g_printf("Fail to set provider [%d]\n", opt);
}
- }
- else if(0 == g_strcmp0("19", strOpt)) {
+ } else if (0 == g_strcmp0("19", strOpt)) {
int req_id;
int len = 0;
GetLocationError(str, ret);
if (ret != LOCATION_ERROR_NONE) {
g_printf("Fail to cancel Geocode request. Error[%s]\n", str);
- }
- else
+ } else
g_printf("location_map_cancel_geocode_request, req_id %d\n", req_id);
- }else if (0 == g_strcmp0 ("99", strOpt)) {
+ } else if (0 == g_strcmp0("20", strOpt)) {
+ g_printf("Get map version\n");
+ gchar *version = NULL;
+ ret = location_map_get_map_version(map_obj, &version);
+ if (ret != LOCATION_ERROR_NONE) {
+ g_printf("Fail to get map version[%d]\n", ret);
+ } else {
+ g_printf("Version : %s\n", version);
+ }
+ if (version) g_free(version);
+ } else if (0 == g_strcmp0("21", strOpt)) {
+ ret = location_map_update_map_data(map_obj, TRUE);
+ if (ret != LOCATION_ERROR_NONE) {
+ g_printf("Fail to update map data[%d]\n", ret);
+ } else {
+ g_printf("Success to updata map data. [TRUE] \n");
+ }
+ } else if (0 == g_strcmp0("22", strOpt)) {
+ ret = location_map_update_map_data(map_obj, FALSE);
+ if (ret != LOCATION_ERROR_NONE) {
+ g_printf("Fail to update map data[%d]\n", ret);
+ } else {
+ g_printf("Success to updata map data. [FALSE] \n");
+ }
+ } else if (0 == g_strcmp0("23", strOpt)) {
+ gboolean is_lastest_map_data_flag = FALSE;
+ ret = location_map_is_latest_map_data(map_obj, &is_lastest_map_data_flag);
+ if (ret != LOCATION_ERROR_NONE) {
+ g_printf("Fail to check the latest map data. Error Code [%d]\n", ret);
+ } else {
+ g_printf("Success to check the latest map data. [%s]\n", is_lastest_map_data_flag ? "TRUE" : "FALSE");
+ }
+ } else if (0 == g_strcmp0("99", strOpt)) {
if (map_obj) {
- g_object_set (map_obj, "provider", NULL, NULL);
+ g_object_set(map_obj, "provider", NULL, NULL);
}
- }else if (0 == g_strcmp0 ("99a", strOpt)) {
+ } else if (0 == g_strcmp0("99a", strOpt)) {
if (map_obj) {
- g_object_set (map_obj, "provider", "decarta", NULL);
+ g_object_set(map_obj, "provider", "decarta", NULL);
}
- }else if (0 == g_strcmp0 ("99b", strOpt)) {
+ } else if (0 == g_strcmp0("99b", strOpt)) {
if (map_obj) {
- g_object_set (map_obj, "provider", "osm", NULL);
+ g_object_set(map_obj, "provider", "osm", NULL);
}
- }else if(0 == g_strcmp0("q",strOpt) ){
+ } else if (0 == g_strcmp0("q", strOpt)) {
g_main_loop_quit(g_mainloop);
break;
}
#include <location.h>
static GMainLoop *loop = NULL;
-GSource* nmea_src = NULL;
+GSource *nmea_src = NULL;
static gboolean
-exit_program (gpointer data)
+exit_program(gpointer data)
{
- g_main_loop_quit (loop);
- g_debug ("Quit g_main_loop");
+ g_main_loop_quit(loop);
+ g_debug("Quit g_main_loop");
return FALSE;
}
static void
-cb_service_updated (GObject *self,
- guint type,
- gpointer data,
- gpointer accuracy,
- gpointer userdata)
+cb_service_updated(GObject *self,
+ guint type,
+ gpointer data,
+ gpointer accuracy,
+ gpointer userdata)
{
g_debug("cb_service_updated: type(%d) userdata(0x%x)", type, (unsigned int)userdata);
}
static void
-cb_service_enabled (GObject *self,
- guint status,
- gpointer userdata)
+cb_service_enabled(GObject *self,
+ guint status,
+ gpointer userdata)
{
g_debug("cb_service_enabled: status(%d) userdata(0x%x)", status, (unsigned int)userdata);
}
static void
-cb_service_disabled (GObject *self,
- guint status,
- gpointer userdata)
+cb_service_disabled(GObject *self,
+ guint status,
+ gpointer userdata)
{
g_debug("cb_service_disabled: status(%d) userdata(0x%x)", status, (unsigned int)userdata);
}
int
-main (int argc, char *argv[])
+main(int argc, char *argv[])
{
LocationObject *loc = NULL;
- location_init ();
+ location_init();
- loop = g_main_loop_new (NULL, TRUE);
+ loop = g_main_loop_new(NULL, TRUE);
- loc = location_new (LOCATION_METHOD_GPS);
+ loc = location_new(LOCATION_METHOD_GPS);
if (!loc) {
g_debug("location_new failed");
return -1;
}
- g_signal_connect (loc, "service-enabled", G_CALLBACK(cb_service_enabled), loc);
- g_signal_connect (loc, "service-disabled", G_CALLBACK(cb_service_disabled), loc);
- g_signal_connect (loc, "service-updated", G_CALLBACK(cb_service_updated), loc);
+ g_signal_connect(loc, "service-enabled", G_CALLBACK(cb_service_enabled), loc);
+ g_signal_connect(loc, "service-disabled", G_CALLBACK(cb_service_disabled), loc);
+ g_signal_connect(loc, "service-updated", G_CALLBACK(cb_service_updated), loc);
- if( LOCATION_ERROR_NONE != location_start (loc) ){
+ if (LOCATION_ERROR_NONE != location_start(loc)) {
g_debug("location_start failed");
return -1;
}
g_timeout_add_seconds(60, exit_program, NULL);
- g_main_loop_run (loop);
+ g_main_loop_run(loop);
- location_stop (loc);
- location_free (loc);
+ location_stop(loc);
+ location_free(loc);
return 0;
}
static GMainLoop *loop = NULL;
static gboolean
-exit_program (gpointer data)
+exit_program(gpointer data)
{
- g_main_loop_quit (loop);
- g_debug ("Quit g_main_loop");
+ g_main_loop_quit(loop);
+ g_debug("Quit g_main_loop");
return FALSE;
}
static void
-cb_service_updated (GObject *self,
- guint type,
- gpointer data,
- gpointer accuracy,
- gpointer userdata)
+cb_service_updated(GObject *self,
+ guint type,
+ gpointer data,
+ gpointer accuracy,
+ gpointer userdata)
{
g_debug("cb_service_updated: type(%d) userdata(0x%x)", type, (unsigned int)userdata);
- LocationAccuracy *acc = (LocationAccuracy*) accuracy;
+ LocationAccuracy *acc = (LocationAccuracy *) accuracy;
switch (type) {
- case POSITION_UPDATED: {
- LocationPosition *pos = (LocationPosition*) data;
- g_debug ("ASYNC>> Current position> time: %d, lat: %f, long: %f, alt: %f, status: %d",
- pos->timestamp, pos->latitude, pos->longitude, pos->altitude, pos->status);
- g_debug ("\tAccuracy level %d (%.0f meters %.0f meters)",
- acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
- }
+ case POSITION_UPDATED: {
+ LocationPosition *pos = (LocationPosition *) data;
+ g_debug("ASYNC>> Current position> time: %d, lat: %f, long: %f, alt: %f, status: %d",
+ pos->timestamp, pos->latitude, pos->longitude, pos->altitude, pos->status);
+ g_debug("\tAccuracy level %d (%.0f meters %.0f meters)",
+ acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
+ }
}
}
static void
-cb_service_enabled (GObject *self,
- guint status,
- gpointer userdata)
+cb_service_enabled(GObject *self,
+ guint status,
+ gpointer userdata)
{
g_debug("cb_service_enabled: status(%d) userdata(0x%x)", status, (unsigned int)userdata);
- LocationObject *loc = (LocationObject*)userdata;
+ LocationObject *loc = (LocationObject *)userdata;
LocationAccuracy *acc = NULL;
LocationPosition *pos = NULL;
- if (LOCATION_ERROR_NONE == location_get_position (loc, &pos, &acc)) {
- g_debug ("SYNC>> Current position> time: %d, lat: %f, long: %f, alt: %f, status: %d",
- pos->timestamp, pos->latitude, pos->longitude, pos->altitude, pos->status);
- g_debug ("\tAccuracy level %d (%.0f meters %.0f meters)",
- acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
+ if (LOCATION_ERROR_NONE == location_get_position(loc, &pos, &acc)) {
+ g_debug("SYNC>> Current position> time: %d, lat: %f, long: %f, alt: %f, status: %d",
+ pos->timestamp, pos->latitude, pos->longitude, pos->altitude, pos->status);
+ g_debug("\tAccuracy level %d (%.0f meters %.0f meters)",
+ acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
location_position_free(pos);
location_accuracy_free(acc);
- } else g_warning ("SYNC>> Current position> failed");
+ } else g_warning("SYNC>> Current position> failed");
}
static void
-cb_service_disabled (GObject *self,
- guint status,
- gpointer userdata)
+cb_service_disabled(GObject *self,
+ guint status,
+ gpointer userdata)
{
g_debug("cb_service_disabled: status(%d) userdata(0x%x)", status, (unsigned int)userdata);
}
int
-main (int argc, char *argv[])
+main(int argc, char *argv[])
{
LocationObject *loc = NULL;
- location_init ();
+ location_init();
- loop = g_main_loop_new (NULL, TRUE);
+ loop = g_main_loop_new(NULL, TRUE);
- loc = location_new (LOCATION_METHOD_GPS);
+ loc = location_new(LOCATION_METHOD_GPS);
if (!loc) {
g_debug("location_new failed");
return -1;
}
- g_signal_connect (loc, "service-enabled", G_CALLBACK(cb_service_enabled), loc);
- g_signal_connect (loc, "service-disabled", G_CALLBACK(cb_service_disabled), loc);
- g_signal_connect (loc, "service-updated", G_CALLBACK(cb_service_updated), loc);
+ g_signal_connect(loc, "service-enabled", G_CALLBACK(cb_service_enabled), loc);
+ g_signal_connect(loc, "service-disabled", G_CALLBACK(cb_service_disabled), loc);
+ g_signal_connect(loc, "service-updated", G_CALLBACK(cb_service_updated), loc);
- if( LOCATION_ERROR_NONE != location_start (loc) ){
+ if (LOCATION_ERROR_NONE != location_start(loc)) {
g_debug("location_start failed");
return -1;
}
g_timeout_add_seconds(60, exit_program, NULL);
- g_main_loop_run (loop);
+ g_main_loop_run(loop);
- location_stop (loc);
+ location_stop(loc);
LocationPosition *pos = NULL;
g_object_get(loc, "last-position", &pos, NULL);
if (pos) {
- g_debug ("Get property>> last-position> time: %d, lat: %f, long: %f, alt: %f, status: %d",
- pos->timestamp, pos->latitude, pos->longitude, pos->altitude, pos->status);
+ g_debug("Get property>> last-position> time: %d, lat: %f, long: %f, alt: %f, status: %d",
+ pos->timestamp, pos->latitude, pos->longitude, pos->altitude, pos->status);
location_position_free(pos);
} else g_warning("failed to get property> last-position");
- location_free (loc);
+ location_free(loc);
return 0;
}
static GMainLoop *loop = NULL;
static gboolean
-exit_program (gpointer data)
+exit_program(gpointer data)
{
- g_main_loop_quit (loop);
- g_debug ("Quit g_main_loop");
+ g_main_loop_quit(loop);
+ g_debug("Quit g_main_loop");
return FALSE;
}
static void
-cb_service_updated (GObject *self,
- guint type,
- gpointer data,
- gpointer accuracy,
- gpointer userdata)
+cb_service_updated(GObject *self,
+ guint type,
+ gpointer data,
+ gpointer accuracy,
+ gpointer userdata)
{
g_debug("cb_service_updated: type(%d) userdata(0x%x)", type, (unsigned int)userdata);
}
static void
-cb_service_enabled (GObject *self,
- guint status,
- gpointer userdata)
+cb_service_enabled(GObject *self,
+ guint status,
+ gpointer userdata)
{
g_debug("cb_service_enabled: status(%d) userdata(0x%x)", status, (unsigned int)userdata);
}
static void
-cb_service_disabled (GObject *self,
- guint status,
- gpointer userdata)
+cb_service_disabled(GObject *self,
+ guint status,
+ gpointer userdata)
{
g_debug("cb_service_disabled: status(%d) userdata(0x%x)", status, (unsigned int)userdata);
}
int
-main (int argc, char *argv[])
+main(int argc, char *argv[])
{
LocationObject *loc = NULL;
- location_init ();
+ location_init();
- loop = g_main_loop_new (NULL, TRUE);
+ loop = g_main_loop_new(NULL, TRUE);
- loc = location_new (LOCATION_METHOD_GPS);
+ loc = location_new(LOCATION_METHOD_GPS);
if (!loc) {
g_debug("location_new failed");
return -1;
g_object_get(loc, "method", &method, NULL);
g_debug("Get property>> method:%d", method);
- char* devname = NULL;
- g_object_get(loc, "dev-name", &devname, NULL);
- if (devname) {
- g_debug("Get property>> dev-name: %s", devname);
- g_free(devname);
- } else g_warning("failed to get property> dev-name");
-
- g_object_set(loc, "dev-name", "/dev/test", NULL);
- g_object_get(loc, "dev-name", &devname, NULL);
- if (devname) {
- g_debug("Get property>> dev-name: %s", devname);
- g_free(devname);
- } else g_warning("failed to set property> dev-name");
-
- g_signal_connect (loc, "service-enabled", G_CALLBACK(cb_service_enabled), loc);
- g_signal_connect (loc, "service-disabled", G_CALLBACK(cb_service_disabled), loc);
- g_signal_connect (loc, "service-updated", G_CALLBACK(cb_service_updated), loc);
-
- if( LOCATION_ERROR_NONE != location_start (loc) ){
+ g_signal_connect(loc, "service-enabled", G_CALLBACK(cb_service_enabled), loc);
+ g_signal_connect(loc, "service-disabled", G_CALLBACK(cb_service_disabled), loc);
+ g_signal_connect(loc, "service-updated", G_CALLBACK(cb_service_updated), loc);
+
+ if (LOCATION_ERROR_NONE != location_start(loc)) {
g_debug("location_start failed");
return -1;
}
- g_timeout_add_seconds (60, exit_program, NULL);
- g_main_loop_run (loop);
+ g_timeout_add_seconds(60, exit_program, NULL);
+ g_main_loop_run(loop);
- location_stop (loc);
+ location_stop(loc);
LocationPosition *pos = NULL;
g_object_get(loc, "last-position", &pos, NULL);
if (pos) {
- g_debug ("Get property>> last-position> time: %d, lat: %f, long: %f, alt: %f, status: %d",
- pos->timestamp, pos->latitude, pos->longitude, pos->altitude, pos->status);
+ g_debug("Get property>> last-position> time: %d, lat: %f, long: %f, alt: %f, status: %d",
+ pos->timestamp, pos->latitude, pos->longitude, pos->altitude, pos->status);
location_position_free(pos);
} else g_warning("failed to get property> last-position");
- location_free (loc);
+ location_free(loc);
return 0;
}
#include <location.h>
static GMainLoop *loop = NULL;
-GSource* sat_src = NULL;
+GSource *sat_src = NULL;
static gboolean
-exit_program (gpointer data)
+exit_program(gpointer data)
{
- g_main_loop_quit (loop);
- g_debug ("Quit g_main_loop");
+ g_main_loop_quit(loop);
+ g_debug("Quit g_main_loop");
return FALSE;
}
static void
-cb_service_updated (GObject *self,
- guint type,
- gpointer data,
- gpointer accuracy,
- gpointer userdata)
+cb_service_updated(GObject *self,
+ guint type,
+ gpointer data,
+ gpointer accuracy,
+ gpointer userdata)
{
g_debug("cb_service_updated: type(%d) userdata(0x%x)", type, (unsigned int)userdata);
- LocationObject *loc = (LocationObject*)userdata;
+ LocationObject *loc = (LocationObject *)userdata;
LocationSatellite *sat = NULL;
int idx = 0;
- g_object_get (loc, "satellite", &sat, NULL);
+ g_object_get(loc, "satellite", &sat, NULL);
if (sat) {
- g_debug ("SYNC>> Current Sattelite> satellite in view = %d, satellite in used = %d", sat->num_of_sat_inview, sat->num_of_sat_used);
- g_debug ("\tinview satellite information = ");
- for (idx=0; idx<sat->num_of_sat_inview; idx++) {
+ g_debug("SYNC>> Current Sattelite> satellite in view = %d, satellite in used = %d", sat->num_of_sat_inview, sat->num_of_sat_used);
+ g_debug("\tinview satellite information = ");
+ for (idx = 0; idx < sat->num_of_sat_inview; idx++) {
guint prn;
gboolean used;
guint elevation;
guint azimuth;
gint snr;
location_satellite_get_satellite_details(sat, idx, &prn, &used, &elevation, &azimuth, &snr);
- g_debug ("\t\t[%02d] used: %d, prn: %d, elevation: %d, azimuth: %d, snr: %d",
- idx, used, prn, elevation, azimuth, snr);
+ g_debug("\t\t[%02d] used: %d, prn: %d, elevation: %d, azimuth: %d, snr: %d",
+ idx, used, prn, elevation, azimuth, snr);
}
- location_satellite_free (sat);
- } else g_warning ("SYNC>> Current Sattelite> failed");
+ location_satellite_free(sat);
+ } else g_warning("SYNC>> Current Sattelite> failed");
}
static void
-cb_service_enabled (GObject *self,
- guint status,
- gpointer userdata)
+cb_service_enabled(GObject *self,
+ guint status,
+ gpointer userdata)
{
g_debug("cb_service_enabled: status(%d) userdata(0x%x)", status, (unsigned int)userdata);
}
static void
-cb_service_disabled (GObject *self,
- guint status,
- gpointer userdata)
+cb_service_disabled(GObject *self,
+ guint status,
+ gpointer userdata)
{
g_debug("cb_service_disabled: status(%d) userdata(0x%x)", status, (unsigned int)userdata);
}
int
-main (int argc, char *argv[])
+main(int argc, char *argv[])
{
LocationObject *loc = NULL;
- location_init ();
+ location_init();
- loop = g_main_loop_new (NULL, TRUE);
+ loop = g_main_loop_new(NULL, TRUE);
- loc = location_new (LOCATION_METHOD_GPS);
+ loc = location_new(LOCATION_METHOD_GPS);
if (!loc) {
g_debug("location_new failed");
return -1;
}
- g_signal_connect (loc, "service-enabled", G_CALLBACK(cb_service_enabled), loc);
- g_signal_connect (loc, "service-disabled", G_CALLBACK(cb_service_disabled), loc);
- g_signal_connect (loc, "service-updated", G_CALLBACK(cb_service_updated), loc);
+ g_signal_connect(loc, "service-enabled", G_CALLBACK(cb_service_enabled), loc);
+ g_signal_connect(loc, "service-disabled", G_CALLBACK(cb_service_disabled), loc);
+ g_signal_connect(loc, "service-updated", G_CALLBACK(cb_service_updated), loc);
- if( LOCATION_ERROR_NONE != location_start (loc) ){
+ if (LOCATION_ERROR_NONE != location_start(loc)) {
g_debug("location_start failed");
return -1;
}
g_timeout_add_seconds(60, exit_program, NULL);
- g_main_loop_run (loop);
+ g_main_loop_run(loop);
- location_stop (loc);
- location_free (loc);
+ location_stop(loc);
+ location_free(loc);
return 0;
}
static GMainLoop *loop = NULL;
static gboolean
-exit_program (gpointer data)
+exit_program(gpointer data)
{
- g_main_loop_quit (loop);
- g_debug ("Quit g_main_loop");
+ g_main_loop_quit(loop);
+ g_debug("Quit g_main_loop");
return FALSE;
}
static void
-cb_service_updated (GObject *self,
- guint type,
- gpointer data,
- gpointer accuracy,
- gpointer userdata)
+cb_service_updated(GObject *self,
+ guint type,
+ gpointer data,
+ gpointer accuracy,
+ gpointer userdata)
{
g_debug("cb_service_updated: type(%d) userdata(0x%x)", type, (unsigned int)userdata);
- LocationAccuracy *acc = (LocationAccuracy*) accuracy;
+ LocationAccuracy *acc = (LocationAccuracy *) accuracy;
switch (type) {
- case VELOCITY_UPDATED: {
- LocationVelocity *vel = (LocationVelocity*) data;
- g_debug ("ASYNC>> Current velocity> time: %d, speed: %f, direction:%f, climb:%f",
- vel->timestamp, vel->speed, vel->direction, vel->climb);
- g_debug ("\tAccuracy level %d (%.0f meters %.0f meters)",
- acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
- }
+ case VELOCITY_UPDATED: {
+ LocationVelocity *vel = (LocationVelocity *) data;
+ g_debug("ASYNC>> Current velocity> time: %d, speed: %f, direction:%f, climb:%f",
+ vel->timestamp, vel->speed, vel->direction, vel->climb);
+ g_debug("\tAccuracy level %d (%.0f meters %.0f meters)",
+ acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
+ }
}
}
static void
-cb_service_enabled (GObject *self,
- guint status,
- gpointer userdata)
+cb_service_enabled(GObject *self,
+ guint status,
+ gpointer userdata)
{
g_debug("cb_service_enabled: status(%d) userdata(0x%x)", status, (unsigned int)userdata);
- LocationObject *loc = (LocationObject*)userdata;
+ LocationObject *loc = (LocationObject *)userdata;
LocationAccuracy *acc = NULL;
LocationVelocity *vel = NULL;
- if (LOCATION_ERROR_NONE == location_get_velocity (loc, &vel, &acc)) {
- g_debug ("SYNC>> Current velocity> time: %d, speed: %f, direction:%f, climb:%f",
- vel->timestamp, vel->speed, vel->direction, vel->climb);
- g_debug ("\tAccuracy level %d (%.0f meters %.0f meters)",
- acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
+ if (LOCATION_ERROR_NONE == location_get_velocity(loc, &vel, &acc)) {
+ g_debug("SYNC>> Current velocity> time: %d, speed: %f, direction:%f, climb:%f",
+ vel->timestamp, vel->speed, vel->direction, vel->climb);
+ g_debug("\tAccuracy level %d (%.0f meters %.0f meters)",
+ acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
location_velocity_free(vel);
location_accuracy_free(acc);
- } else g_warning ("SYNC>> Current velocity> failed");
+ } else g_warning("SYNC>> Current velocity> failed");
}
static void
-cb_service_disabled (GObject *self,
- guint status,
- gpointer userdata)
+cb_service_disabled(GObject *self,
+ guint status,
+ gpointer userdata)
{
g_debug("cb_service_disabled: status(%d) userdata(0x%x)", status, (unsigned int)userdata);
}
int
-main (int argc, char *argv[])
+main(int argc, char *argv[])
{
LocationObject *loc = NULL;
- location_init ();
+ location_init();
- loop = g_main_loop_new (NULL, TRUE);
+ loop = g_main_loop_new(NULL, TRUE);
- loc = location_new (LOCATION_METHOD_GPS);
+ loc = location_new(LOCATION_METHOD_GPS);
if (!loc) {
g_debug("location_new failed");
return -1;
}
- g_signal_connect (loc, "service-enabled", G_CALLBACK(cb_service_enabled), loc);
- g_signal_connect (loc, "service-disabled", G_CALLBACK(cb_service_disabled), loc);
- g_signal_connect (loc, "service-updated", G_CALLBACK(cb_service_updated), loc);
+ g_signal_connect(loc, "service-enabled", G_CALLBACK(cb_service_enabled), loc);
+ g_signal_connect(loc, "service-disabled", G_CALLBACK(cb_service_disabled), loc);
+ g_signal_connect(loc, "service-updated", G_CALLBACK(cb_service_updated), loc);
- if( LOCATION_ERROR_NONE != location_start (loc) ){
+ if (LOCATION_ERROR_NONE != location_start(loc)) {
g_debug("location_start failed");
return -1;
}
g_timeout_add_seconds(60, exit_program, NULL);
- g_main_loop_run (loop);
+ g_main_loop_run(loop);
- location_stop (loc);
- location_free (loc);
+ location_stop(loc);
+ location_free(loc);
return 0;
}
static GMainLoop *loop = NULL;
static void
-cb_service_updated (GObject *self,
- guint type,
- gpointer data,
- gpointer accuracy,
- gpointer userdata)
+cb_service_updated(GObject *self,
+ guint type,
+ gpointer data,
+ gpointer accuracy,
+ gpointer userdata)
{
g_debug("cb_service_updated: type(%d) userdata(0x%x)", type, (unsigned int)userdata);
- LocationAccuracy *acc = (LocationAccuracy*) accuracy;
+ LocationAccuracy *acc = (LocationAccuracy *) accuracy;
switch (type) {
- case POSITION_UPDATED: {
- LocationPosition *pos = (LocationPosition*) data;
- g_debug ("ASYNC>> Current position> time: %d, lat: %f, long: %f, alt: %f, status: %d",
- pos->timestamp, pos->latitude, pos->longitude, pos->altitude, pos->status);
- g_debug ("\tAccuracy level %d (%.0f meters %.0f meters)",
- acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
- }
- break;
- case VELOCITY_UPDATED: {
- LocationVelocity *vel = (LocationVelocity*) data;
- g_debug ("ASYNC>> Current velocity> time: %d, speed: %f, direction:%f, climb:%f",
- vel->timestamp, vel->speed, vel->direction, vel->climb);
- g_debug ("\tAccuracy level %d (%.0f meters %.0f meters)",
- acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
- }
- break;
- default:
- g_warning ("ASYNC>> Undefined update type");
- break;
+ case POSITION_UPDATED: {
+ LocationPosition *pos = (LocationPosition *) data;
+ g_debug("ASYNC>> Current position> time: %d, lat: %f, long: %f, alt: %f, status: %d",
+ pos->timestamp, pos->latitude, pos->longitude, pos->altitude, pos->status);
+ g_debug("\tAccuracy level %d (%.0f meters %.0f meters)",
+ acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
+ }
+ break;
+ case VELOCITY_UPDATED: {
+ LocationVelocity *vel = (LocationVelocity *) data;
+ g_debug("ASYNC>> Current velocity> time: %d, speed: %f, direction:%f, climb:%f",
+ vel->timestamp, vel->speed, vel->direction, vel->climb);
+ g_debug("\tAccuracy level %d (%.0f meters %.0f meters)",
+ acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
+ }
+ break;
+ default:
+ g_warning("ASYNC>> Undefined update type");
+ break;
}
}
static void
-cb_service_enabled (GObject *self,
- guint status,
- gpointer userdata)
+cb_service_enabled(GObject *self,
+ guint status,
+ gpointer userdata)
{
g_debug("cb_service_enabled: status(%d) userdata(0x%x)", status, (unsigned int)userdata);
- LocationObject *loc = (LocationObject*)userdata;
+ LocationObject *loc = (LocationObject *)userdata;
LocationAccuracy *acc = NULL;
LocationPosition *pos = NULL;
LocationVelocity *vel = NULL;
- if (LOCATION_ERROR_NONE == location_get_position (loc, &pos, &acc)) {
- g_debug ("SYNC>> Current position> time: %d, lat: %f, long: %f, alt: %f, status: %d",
- pos->timestamp, pos->latitude, pos->longitude, pos->altitude, pos->status);
- g_debug ("\tAccuracy level %d (%.0f meters %.0f meters)",
- acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
+ if (LOCATION_ERROR_NONE == location_get_position(loc, &pos, &acc)) {
+ g_debug("SYNC>> Current position> time: %d, lat: %f, long: %f, alt: %f, status: %d",
+ pos->timestamp, pos->latitude, pos->longitude, pos->altitude, pos->status);
+ g_debug("\tAccuracy level %d (%.0f meters %.0f meters)",
+ acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
location_position_free(pos);
location_accuracy_free(acc);
- } else g_warning ("SYNC>> Current position> failed");
- if (LOCATION_ERROR_NONE == location_get_velocity (loc, &vel, &acc)) {
- g_debug ("SYNC>> Current velocity> time: %d, speed: %f, direction:%f, climb:%f",
- vel->timestamp, vel->speed, vel->direction, vel->climb);
- g_debug ("\tAccuracy level %d (%.0f meters %.0f meters)",
- acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
+ } else g_warning("SYNC>> Current position> failed");
+ if (LOCATION_ERROR_NONE == location_get_velocity(loc, &vel, &acc)) {
+ g_debug("SYNC>> Current velocity> time: %d, speed: %f, direction:%f, climb:%f",
+ vel->timestamp, vel->speed, vel->direction, vel->climb);
+ g_debug("\tAccuracy level %d (%.0f meters %.0f meters)",
+ acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
location_velocity_free(vel);
location_accuracy_free(acc);
- } else g_warning ("SYNC>> Current velocity> failed");
+ } else g_warning("SYNC>> Current velocity> failed");
}
static void
-cb_service_disabled (GObject *self,
- guint status,
- gpointer userdata)
+cb_service_disabled(GObject *self,
+ guint status,
+ gpointer userdata)
{
g_debug("cb_service_disabled: status(%d) userdata(0x%x)", status, (unsigned int)userdata);
}
static void
-cb_zone_in (GObject *self,
- gpointer boundary,
- gpointer position,
- gpointer accuracy)
+cb_zone_in(GObject *self,
+ gpointer boundary,
+ gpointer position,
+ gpointer accuracy)
{
- LocationPosition *pos = (LocationPosition*) position;
- LocationAccuracy *acc = (LocationAccuracy*) accuracy;
+ LocationPosition *pos = (LocationPosition *) position;
+ LocationAccuracy *acc = (LocationAccuracy *) accuracy;
- g_debug ("ASYNC>> ZoneIn> Current position: time: %d, lat: %f, long: %f, alt: %f",
- pos->timestamp, pos->latitude, pos->longitude, pos->altitude);
- g_debug ("\tAccuracy level %d (%.0f meters %.0f meters)",
- acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
+ g_debug("ASYNC>> ZoneIn> Current position: time: %d, lat: %f, long: %f, alt: %f",
+ pos->timestamp, pos->latitude, pos->longitude, pos->altitude);
+ g_debug("\tAccuracy level %d (%.0f meters %.0f meters)",
+ acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
}
static void
-cb_zone_out (GObject *self,
- gpointer boundary,
- gpointer position,
- gpointer accuracy)
+cb_zone_out(GObject *self,
+ gpointer boundary,
+ gpointer position,
+ gpointer accuracy)
{
- LocationPosition *pos = (LocationPosition*) position;
- LocationAccuracy *acc = (LocationAccuracy*) accuracy;
+ LocationPosition *pos = (LocationPosition *) position;
+ LocationAccuracy *acc = (LocationAccuracy *) accuracy;
- g_debug ("ASYNC>> ZoneOut> Current position: time: %d, lat: %f, long: %f, alt: %f",
- pos->timestamp, pos->latitude, pos->longitude, pos->altitude);
- g_debug ("\tAccuracy level %d (%.0f meters %.0f meters)",
- acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
+ g_debug("ASYNC>> ZoneOut> Current position: time: %d, lat: %f, long: %f, alt: %f",
+ pos->timestamp, pos->latitude, pos->longitude, pos->altitude);
+ g_debug("\tAccuracy level %d (%.0f meters %.0f meters)",
+ acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
}
int
-main (int argc, char *argv[])
+main(int argc, char *argv[])
{
LocationObject *loc = NULL;
- // If application is executed by AUL, this is not needed.
- g_setenv("PKG_NAME", "org.tizen.wps-test", 1);
+ /* If application is executed by AUL, this is not needed. */
+ g_setenv("PKG_NAME", "com.samsung.wps-test", 1);
- location_init ();
+ location_init();
- loop = g_main_loop_new (NULL, TRUE);
+ loop = g_main_loop_new(NULL, TRUE);
- loc = location_new (LOCATION_METHOD_WPS);
+ loc = location_new(LOCATION_METHOD_WPS);
if (!loc) {
g_debug("location_new failed");
return -1;
g_object_get(loc, "boundary", &bound, NULL);
if (bound) {
g_debug("Get property>> boundary> type: %d", bound->type);
- location_boundary_free (bound);
+ location_boundary_free(bound);
} else g_warning("failed to get property> boundary");
LocationPosition *rb = location_position_new(0, 37.255, 127.056, 0, LOCATION_STATUS_2D_FIX);
LocationPosition *lt = location_position_new(0, 37.260, 127.050, 0, LOCATION_STATUS_2D_FIX);
bound = location_boundary_new_for_rect(lt, rb);
- location_position_free (rb);
- location_position_free (lt);
+ location_position_free(rb);
+ location_position_free(lt);
if (bound) {
g_object_set(loc, "boundary", bound, NULL);
location_boundary_free(bound);
g_object_get(loc, "boundary", &bound, NULL);
if (bound) {
g_debug("Set property>> boundary> type: %d, (%f,%f),(%f,%f)",
- bound->type,
- bound->rect.right_bottom->latitude, bound->rect.right_bottom->longitude,
- bound->rect.left_top->latitude, bound->rect.left_top->longitude);
- location_boundary_free (bound);
+ bound->type,
+ bound->rect.right_bottom->latitude, bound->rect.right_bottom->longitude,
+ bound->rect.left_top->latitude, bound->rect.left_top->longitude);
+ location_boundary_free(bound);
} else g_warning("failed to set property> boundary");
- g_signal_connect (loc, "service-enabled", G_CALLBACK(cb_service_enabled), loc);
- g_signal_connect (loc, "service-disabled", G_CALLBACK(cb_service_disabled), loc);
- g_signal_connect (loc, "service-updated", G_CALLBACK(cb_service_updated), loc);
- g_signal_connect (loc, "zone-in", G_CALLBACK(cb_zone_in), loc);
- g_signal_connect (loc, "zone-out", G_CALLBACK(cb_zone_out), loc);
+ g_signal_connect(loc, "service-enabled", G_CALLBACK(cb_service_enabled), loc);
+ g_signal_connect(loc, "service-disabled", G_CALLBACK(cb_service_disabled), loc);
+ g_signal_connect(loc, "service-updated", G_CALLBACK(cb_service_updated), loc);
+ g_signal_connect(loc, "zone-in", G_CALLBACK(cb_zone_in), loc);
+ g_signal_connect(loc, "zone-out", G_CALLBACK(cb_zone_out), loc);
- if (LOCATION_ERROR_NONE != location_start (loc)) {
+ if (LOCATION_ERROR_NONE != location_start(loc)) {
g_debug("location_start failed");
return -1;
}
- g_main_loop_run (loop);
+ g_main_loop_run(loop);
- location_stop (loc);
+ location_stop(loc);
LocationPosition *pos = NULL;
g_object_get(loc, "last-position", &pos, NULL);
if (pos) {
- g_debug ("Get property>> last-position> time: %d, lat: %f, long: %f, alt: %f, status: %d",
- pos->timestamp, pos->latitude, pos->longitude, pos->altitude, pos->status);
+ g_debug("Get property>> last-position> time: %d, lat: %f, long: %f, alt: %f, status: %d",
+ pos->timestamp, pos->latitude, pos->longitude, pos->altitude, pos->status);
location_position_free(pos);
} else g_warning("failed to get property> last-position");
- location_free (loc);
+ location_free(loc);
return 0;
}
static GMainLoop *loop = NULL;
static gboolean
-exit_program (gpointer data)
+exit_program(gpointer data)
{
- g_main_loop_quit (loop);
- g_debug ("Quit g_main_loop");
+ g_main_loop_quit(loop);
+ g_debug("Quit g_main_loop");
return FALSE;
}
static void
-cb_service_enabled (GObject *self,
- guint status,
- gpointer userdata)
+cb_service_enabled(GObject *self,
+ guint status,
+ gpointer userdata)
{
g_debug("cb_service_enabled: status(%d) userdata(0x%x)", status, (unsigned int)userdata);
}
static void
-cb_service_disabled (GObject *self,
- guint status,
- gpointer userdata)
+cb_service_disabled(GObject *self,
+ guint status,
+ gpointer userdata)
{
- g_debug("cb_service_disabled: status(%d) userdata(0x%x)", status, (unsigned int)userdata);
+ g_debug("cb_service_disabled: status(%d) userdata(0x%x)", status, (unsigned int)userdata);
}
static void
-cb_zone_in (GObject *self,
- gpointer boundary,
- gpointer position,
- gpointer accuracy)
+cb_zone_in(GObject *self,
+ gpointer boundary,
+ gpointer position,
+ gpointer accuracy)
{
- LocationPosition *pos = (LocationPosition*) position;
- LocationAccuracy *acc = (LocationAccuracy*) accuracy;
+ LocationPosition *pos = (LocationPosition *) position;
+ LocationAccuracy *acc = (LocationAccuracy *) accuracy;
- g_debug ("ASYNC>> ZoneIn> Current position: time: %d, lat: %f, long: %f, alt: %f",
- pos->timestamp, pos->latitude, pos->longitude, pos->altitude);
- g_debug ("\tAccuracy level %d (%.0f meters %.0f meters)",
- acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
+ g_debug("ASYNC>> ZoneIn> Current position: time: %d, lat: %f, long: %f, alt: %f",
+ pos->timestamp, pos->latitude, pos->longitude, pos->altitude);
+ g_debug("\tAccuracy level %d (%.0f meters %.0f meters)",
+ acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
}
static void
-cb_zone_out (GObject *self,
- gpointer boundary,
- gpointer position,
- gpointer accuracy)
+cb_zone_out(GObject *self,
+ gpointer boundary,
+ gpointer position,
+ gpointer accuracy)
{
- LocationPosition *pos = (LocationPosition*) position;
- LocationAccuracy *acc = (LocationAccuracy*) accuracy;
+ LocationPosition *pos = (LocationPosition *) position;
+ LocationAccuracy *acc = (LocationAccuracy *) accuracy;
- g_debug ("ASYNC>> ZoneOut> Current position: time: %d, lat: %f, long: %f, alt: %f",
- pos->timestamp, pos->latitude, pos->longitude, pos->altitude);
- g_debug ("\tAccuracy level %d (%.0f meters %.0f meters)",
- acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
+ g_debug("ASYNC>> ZoneOut> Current position: time: %d, lat: %f, long: %f, alt: %f",
+ pos->timestamp, pos->latitude, pos->longitude, pos->altitude);
+ g_debug("\tAccuracy level %d (%.0f meters %.0f meters)",
+ acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
}
int
-main (int argc, char *argv[])
+main(int argc, char *argv[])
{
LocationObject *loc = NULL;
- location_init ();
+ location_init();
- loop = g_main_loop_new (NULL, TRUE);
+ loop = g_main_loop_new(NULL, TRUE);
- loc = location_new (LOCATION_METHOD_GPS);
+ loc = location_new(LOCATION_METHOD_GPS);
if (!loc) {
g_debug("location_new failed");
return -1;
LocationPosition *rb = location_position_new(0, 37.258, 127.056, 0, LOCATION_STATUS_2D_FIX);
LocationPosition *lt = location_position_new(0, 37.260, 127.054, 0, LOCATION_STATUS_2D_FIX);
LocationBoundary *bound = location_boundary_new_for_rect(lt, rb);
- location_position_free (rb);
- location_position_free (lt);
+ location_position_free(rb);
+ location_position_free(lt);
if (bound) {
g_object_set(loc, "boundary", bound, NULL);
location_boundary_free(bound);
g_object_get(loc, "boundary", &bound, NULL);
if (bound) {
g_debug("Set property>> boundary> type: %d, (%f,%f),(%f,%f)",
- bound->type,
- bound->rect.right_bottom->latitude, bound->rect.right_bottom->longitude,
- bound->rect.left_top->latitude, bound->rect.left_top->longitude);
- location_boundary_free (bound);
+ bound->type,
+ bound->rect.right_bottom->latitude, bound->rect.right_bottom->longitude,
+ bound->rect.left_top->latitude, bound->rect.left_top->longitude);
+ location_boundary_free(bound);
} else g_warning("failed to set property> boundary");
- g_signal_connect (loc, "service-enabled", G_CALLBACK(cb_service_enabled), loc);
- g_signal_connect (loc, "service-disabled", G_CALLBACK(cb_service_disabled), loc);
- g_signal_connect (loc, "zone-in", G_CALLBACK(cb_zone_in), loc);
- g_signal_connect (loc, "zone-out", G_CALLBACK(cb_zone_out), loc);
+ g_signal_connect(loc, "service-enabled", G_CALLBACK(cb_service_enabled), loc);
+ g_signal_connect(loc, "service-disabled", G_CALLBACK(cb_service_disabled), loc);
+ g_signal_connect(loc, "zone-in", G_CALLBACK(cb_zone_in), loc);
+ g_signal_connect(loc, "zone-out", G_CALLBACK(cb_zone_out), loc);
- if( LOCATION_ERROR_NONE != location_start (loc) ){
+ if (LOCATION_ERROR_NONE != location_start(loc)) {
g_debug("location_start failed");
return -1;
}
- g_timeout_add_seconds (60, exit_program, NULL);
- g_main_loop_run (loop);
+ g_timeout_add_seconds(60, exit_program, NULL);
+ g_main_loop_run(loop);
- location_stop (loc);
- location_free (loc);
+ location_stop(loc);
+ location_free(loc);
return 0;
}