--- /dev/null
+Youngae Kang <youngae.kang@samsung.com>
+Yunhan Kim <yhan.kim@samsung.com>
+Genie Kim <daejins.kim@samsung.com>
+Minjune Kim <sena06.kim@samsung.com>
--- /dev/null
+Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+\r
+ Apache License\r
+ Version 2.0, January 2004\r
+ http://www.apache.org/licenses/\r
+\r
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\r
+\r
+ 1. Definitions.\r
+\r
+ "License" shall mean the terms and conditions for use, reproduction,\r
+ and distribution as defined by Sections 1 through 9 of this document.\r
+\r
+ "Licensor" shall mean the copyright owner or entity authorized by\r
+ the copyright owner that is granting the License.\r
+\r
+ "Legal Entity" shall mean the union of the acting entity and all\r
+ other entities that control, are controlled by, or are under common\r
+ control with that entity. For the purposes of this definition,\r
+ "control" means (i) the power, direct or indirect, to cause the\r
+ direction or management of such entity, whether by contract or\r
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the\r
+ outstanding shares, or (iii) beneficial ownership of such entity.\r
+\r
+ "You" (or "Your") shall mean an individual or Legal Entity\r
+ exercising permissions granted by this License.\r
+\r
+ "Source" form shall mean the preferred form for making modifications,\r
+ including but not limited to software source code, documentation\r
+ source, and configuration files.\r
+\r
+ "Object" form shall mean any form resulting from mechanical\r
+ transformation or translation of a Source form, including but\r
+ not limited to compiled object code, generated documentation,\r
+ and conversions to other media types.\r
+\r
+ "Work" shall mean the work of authorship, whether in Source or\r
+ Object form, made available under the License, as indicated by a\r
+ copyright notice that is included in or attached to the work\r
+ (an example is provided in the Appendix below).\r
+\r
+ "Derivative Works" shall mean any work, whether in Source or Object\r
+ form, that is based on (or derived from) the Work and for which the\r
+ editorial revisions, annotations, elaborations, or other modifications\r
+ represent, as a whole, an original work of authorship. For the purposes\r
+ of this License, Derivative Works shall not include works that remain\r
+ separable from, or merely link (or bind by name) to the interfaces of,\r
+ the Work and Derivative Works thereof.\r
+\r
+ "Contribution" shall mean any work of authorship, including\r
+ the original version of the Work and any modifications or additions\r
+ to that Work or Derivative Works thereof, that is intentionally\r
+ submitted to Licensor for inclusion in the Work by the copyright owner\r
+ or by an individual or Legal Entity authorized to submit on behalf of\r
+ the copyright owner. For the purposes of this definition, "submitted"\r
+ means any form of electronic, verbal, or written communication sent\r
+ to the Licensor or its representatives, including but not limited to\r
+ communication on electronic mailing lists, source code control systems,\r
+ and issue tracking systems that are managed by, or on behalf of, the\r
+ Licensor for the purpose of discussing and improving the Work, but\r
+ excluding communication that is conspicuously marked or otherwise\r
+ designated in writing by the copyright owner as "Not a Contribution."\r
+\r
+ "Contributor" shall mean Licensor and any individual or Legal Entity\r
+ on behalf of whom a Contribution has been received by Licensor and\r
+ subsequently incorporated within the Work.\r
+\r
+ 2. Grant of Copyright License. Subject to the terms and conditions of\r
+ this License, each Contributor hereby grants to You a perpetual,\r
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
+ copyright license to reproduce, prepare Derivative Works of,\r
+ publicly display, publicly perform, sublicense, and distribute the\r
+ Work and such Derivative Works in Source or Object form.\r
+\r
+ 3. Grant of Patent License. Subject to the terms and conditions of\r
+ this License, each Contributor hereby grants to You a perpetual,\r
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
+ (except as stated in this section) patent license to make, have made,\r
+ use, offer to sell, sell, import, and otherwise transfer the Work,\r
+ where such license applies only to those patent claims licensable\r
+ by such Contributor that are necessarily infringed by their\r
+ Contribution(s) alone or by combination of their Contribution(s)\r
+ with the Work to which such Contribution(s) was submitted. If You\r
+ institute patent litigation against any entity (including a\r
+ cross-claim or counterclaim in a lawsuit) alleging that the Work\r
+ or a Contribution incorporated within the Work constitutes direct\r
+ or contributory patent infringement, then any patent licenses\r
+ granted to You under this License for that Work shall terminate\r
+ as of the date such litigation is filed.\r
+\r
+ 4. Redistribution. You may reproduce and distribute copies of the\r
+ Work or Derivative Works thereof in any medium, with or without\r
+ modifications, and in Source or Object form, provided that You\r
+ meet the following conditions:\r
+\r
+ (a) You must give any other recipients of the Work or\r
+ Derivative Works a copy of this License; and\r
+\r
+ (b) You must cause any modified files to carry prominent notices\r
+ stating that You changed the files; and\r
+\r
+ (c) You must retain, in the Source form of any Derivative Works\r
+ that You distribute, all copyright, patent, trademark, and\r
+ attribution notices from the Source form of the Work,\r
+ excluding those notices that do not pertain to any part of\r
+ the Derivative Works; and\r
+\r
+ (d) If the Work includes a "NOTICE" text file as part of its\r
+ distribution, then any Derivative Works that You distribute must\r
+ include a readable copy of the attribution notices contained\r
+ within such NOTICE file, excluding those notices that do not\r
+ pertain to any part of the Derivative Works, in at least one\r
+ of the following places: within a NOTICE text file distributed\r
+ as part of the Derivative Works; within the Source form or\r
+ documentation, if provided along with the Derivative Works; or,\r
+ within a display generated by the Derivative Works, if and\r
+ wherever such third-party notices normally appear. The contents\r
+ of the NOTICE file are for informational purposes only and\r
+ do not modify the License. You may add Your own attribution\r
+ notices within Derivative Works that You distribute, alongside\r
+ or as an addendum to the NOTICE text from the Work, provided\r
+ that such additional attribution notices cannot be construed\r
+ as modifying the License.\r
+\r
+ You may add Your own copyright statement to Your modifications and\r
+ may provide additional or different license terms and conditions\r
+ for use, reproduction, or distribution of Your modifications, or\r
+ for any such Derivative Works as a whole, provided Your use,\r
+ reproduction, and distribution of the Work otherwise complies with\r
+ the conditions stated in this License.\r
+\r
+ 5. Submission of Contributions. Unless You explicitly state otherwise,\r
+ any Contribution intentionally submitted for inclusion in the Work\r
+ by You to the Licensor shall be under the terms and conditions of\r
+ this License, without any additional terms or conditions.\r
+ Notwithstanding the above, nothing herein shall supersede or modify\r
+ the terms of any separate license agreement you may have executed\r
+ with Licensor regarding such Contributions.\r
+\r
+ 6. Trademarks. This License does not grant permission to use the trade\r
+ names, trademarks, service marks, or product names of the Licensor,\r
+ except as required for reasonable and customary use in describing the\r
+ origin of the Work and reproducing the content of the NOTICE file.\r
+\r
+ 7. Disclaimer of Warranty. Unless required by applicable law or\r
+ agreed to in writing, Licensor provides the Work (and each\r
+ Contributor provides its Contributions) on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\r
+ implied, including, without limitation, any warranties or conditions\r
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\r
+ PARTICULAR PURPOSE. You are solely responsible for determining the\r
+ appropriateness of using or redistributing the Work and assume any\r
+ risks associated with Your exercise of permissions under this License.\r
+\r
+ 8. Limitation of Liability. In no event and under no legal theory,\r
+ whether in tort (including negligence), contract, or otherwise,\r
+ unless required by applicable law (such as deliberate and grossly\r
+ negligent acts) or agreed to in writing, shall any Contributor be\r
+ liable to You for damages, including any direct, indirect, special,\r
+ incidental, or consequential damages of any character arising as a\r
+ result of this License or out of the use or inability to use the\r
+ Work (including but not limited to damages for loss of goodwill,\r
+ work stoppage, computer failure or malfunction, or any and all\r
+ other commercial damages or losses), even if such Contributor\r
+ has been advised of the possibility of such damages.\r
+\r
+ 9. Accepting Warranty or Additional Liability. While redistributing\r
+ the Work or Derivative Works thereof, You may choose to offer,\r
+ and charge a fee for, acceptance of support, warranty, indemnity,\r
+ or other liability obligations and/or rights consistent with this\r
+ License. However, in accepting such obligations, You may act only\r
+ on Your own behalf and on Your sole responsibility, not on behalf\r
+ of any other Contributor, and only if You agree to indemnify,\r
+ defend, and hold each Contributor harmless for any liability\r
+ incurred by, or claims asserted against, such Contributor by reason\r
+ of your accepting any such warranty or additional liability.\r
+\r
+ END OF TERMS AND CONDITIONS\r
+\r
+ APPENDIX: How to apply the Apache License to your work.\r
+\r
+ To apply the Apache License to your work, attach the following\r
+ boilerplate notice, with the fields enclosed by brackets "[]"\r
+ replaced with your own identifying information. (Don't include\r
+ the brackets!) The text should be enclosed in the appropriate\r
+ comment syntax for the file format. We also recommend that a\r
+ file or class name and description of purpose be included on the\r
+ same "printed page" as the copyright notice for easier\r
+ identification within third-party archives.\r
+\r
+ Copyright [yyyy] [name of copyright owner]\r
+\r
+ Licensed under the Apache License, Version 2.0 (the "License");\r
+ you may not use this file except in compliance with the License.\r
+ You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+ Unless required by applicable law or agreed to in writing, software\r
+ distributed under the License is distributed on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ See the License for the specific language governing permissions and\r
+ limitations under the License.\r
+\r
--- /dev/null
+ACLOCAL_AMFLAGS=-I m4
+
+SUBDIRS= modules
--- /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-module], 0.1)
+AC_CONFIG_AUX_DIR([build-aux])
+AC_CONFIG_MACRO_DIR([m4])
+AC_CONFIG_HEADER([config.h])
+AC_CONFIG_SRCDIR([modules/geoclue-nominatim.c])
+AM_INIT_AUTOMAKE([1.10.2 foreign -Wall -Werror])
+
+# Check programs for making executable
+AC_PROG_CC
+AM_PROG_CC_C_O
+AC_PROG_INSTALL
+
+# Check programs for making libraries.
+AM_PROG_LIBTOOL
+
+# 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)
+
+# Checks libraries
+PKG_CHECK_MODULES(MODULE, [glib-2.0 gmodule-2.0 geoclue location])
+AC_SUBST(MODULE_LIBS)
+AC_SUBST(MODULE_CFLAGS)
+
+# Check dlog libraris
+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")
+ if test "x$have_dlog" = "xyes"; then
+ MODULE_CFLAGS="$MODULE_CFLAGS $DLOG_CFLAGS -DMOD_DLOG_DEBUG"
+ MODULE_LIBS="$MODULE_LIBS $DLOG_LIBS"
+ fi
+fi
+
+# Check D-Bus service path
+DBUS_SERVICES_DIR="${datadir}/dbus-1/services"
+AC_SUBST(DBUS_SERVICES_DIR)
+AC_DEFINE_UNQUOTED(DBUS_SERVICES_DIR, "$DBUS_SERVICES_DIR", [Where services dir for D-Bus is])
+
+# Generate files
+AC_CONFIG_FILES([
+Makefile
+modules/Makefile
+])
+
+AC_OUTPUT
--- /dev/null
+location-module (0.1.18-2) unstable; urgency=low
+
+ * rollback
+ * Git: slp/pkgs/l/location-module
+ * Tag: location-module_0.1.18-2
+
+ -- Minjune Kim <sena06.kim@samsung.com> Thu, 23 Feb 2012 14:25:43 +0900
+
+location-module (0.1.18-1) unstable; urgency=low
+
+ * remove location-geoclue-gpsd
+ * Git: slp/pkgs/l/location-module
+ * Tag: location-module_0.1.18-1
+
+ -- Genie Kim <daejins.kim@samsung.com> Fri, 10 Feb 2012 16:18:30 +0900
+
+location-module (0.1.17-1) unstable; urgency=low
+
+ * Support multiple result of geocode but it is workaround.
+ * Git: slp/pkgs/l/location-module
+ * Tag: location-module_0.1.17-1
+
+ -- Minjune Kim <sena06.kim@samsung.com> Thu, 09 Feb 2012 11:46:50 +0900
+
+location-module (0.1.16-4) unstable; urgency=low
+
+ * Modify lib path on postinst
+ * Git: slp/pkgs/l/location-module
+ * Tag: location-module_0.1.16-4
+
+ -- Minjune Kim <sena06.kim@samsung.com> Wed, 01 Feb 2012 14:26:56 +0900
+
+location-module (0.1.16-3) unstable; urgency=low
+
+ * Fix bug while using WPS module.
+ * Git: slp/pkgs/l/location-module
+ * Tag: location-module_0.1.16-3
+
+ -- Minjune Kim <sena06.kim@samsung.com> Mon, 19 Dec 2011 18:59:35 +0900
+
+location-module (0.1.16-2) unstable; urgency=low
+
+ * generate link file to support wps method on SDK.
+ * Git: slp/pkgs/l/location-module
+ * Tag: location-module_0.1.16-2
+
+ -- Minjune Kim <sena06.kim@samsung.com> Fri, 09 Dec 2011 20:15:04 +0900
+
+location-module (0.1.16-1) unstable; urgency=low
+
+ * add geoclue gpsd module
+ * Git: slp/pkgs/l/location-module
+ * Tag: location-module_0.1.16-1
+
+ -- Genie Kim <daejins.kim@samsung.com> Wed, 07 Dec 2011 16:50:31 +0900
+
+location-module (0.1.15-1) unstable; urgency=low
+
+ * remove not using packages(hostip/opencellid)
+ * Git: slp/pkgs/l/location-module
+ * Tag: location-module_0.1.15-1
+
+ -- Genie Kim <daejins.kim@samsung.com> Tue, 06 Dec 2011 22:40:14 +0900
+
+location-module (0.1.14-1) unstable; urgency=low
+
+ * move gpsd module to geoclue-providers for last knonw position
+ * Git: slp/pkgs/l/location-module
+ * Tag: location-module_0.1.14-1
+
+ -- Genie Kim <daejins.kim@samsung.com> Sat, 26 Nov 2011 12:17:29 +0900
+
+location-module (0.1.13-1) unstable; urgency=low
+
+ * use time_t for timestamp
+ * Git: slp/pkgs/l/location-module
+ * Tag: location-module_0.1.13-1
+
+ -- Genie Kim <daejins.kim@samsung.com> Mon, 17 Oct 2011 13:36:42 +0900
+
+location-module (0.1.12-1) unstable; urgency=low
+
+ * fixed BS about gmtime_r()
+ * Git: slp/pkgs/l/location-module
+ * Tag: location-module_0.1.12-1
+
+ -- Genie Kim <daejins.kim@samsung.com> Thu, 01 Sep 2011 14:04:33 +0900
+
+location-module (0.1.11-1) unstable; urgency=low
+
+ * fixed prevent defect
+ * Git: slp/pkgs/l/location-module
+ * Tag: location-module_0.1.11-1
+
+ -- Genie Kim <daejins.kim@samsung.com> Fri, 26 Aug 2011 13:38:29 +0900
+
+location-module (0.1.10-2) unstable; urgency=low
+
+ * change boilerplate
+ * Git: slp/pkgs/l/location-module
+ * Tag: location-module_0.1.10-2
+
+ -- Genie Kim <daejins.kim@samsung.com> Wed, 20 Jul 2011 17:52:15 +0900
+
+location-module (0.1.10-1) unstable; urgency=low
+
+ * Package: Release new location-geoclue-nominatim package
+ * Git: slp/pkgs/l/location-module
+ * Tag: location-module_0.1.10-1
+
+ -- Tae-Hwan Kim <the81.kim@samsung.com> Wed, 01 Jun 2011 21:14:33 +0900
+
+location-module (0.1.9-1) unstable; urgency=low
+
+ * Remove callbacks when location stops
+ * Git: slp/pkgs/l/location-module
+ * Tag: location-module_0.1.9-1
+
+ -- Tae-Hwan Kim <the81.kim@samsung.com> Fri, 13 May 2011 19:28:42 +0900
+
+location-module (0.1.8-2) unstable; urgency=low
+
+ * Apply New Location APIs
+ * Git: slp/pkgs/l/location-module
+ * Tag: location-module_0.1.8-2
+
+ -- Tae-Hwan Kim <the81.kim@samsung.com> Wed, 20 Apr 2011 11:16:12 +0900
+
+location-module (0.1.7-1) unstable; urgency=low
+
+ * Fix depends & timestamp
+ * Git: slp/pkgs/l/location-module
+ * Tag: location-module_0.1.7-1
+
+ -- Tae-Hwan Kim <the81.kim@samsung.com> Wed, 16 Feb 2011 21:02:21 +0900
+
+location-module (0.1.6-1) unstable; urgency=low
+
+ * Add geoclue-hostip module & geoclue-opencellid & geoclue-opencellid module
+ * Git: slp/pkgs/l/location-module
+ * Tag: location-module_0.1.6-1
+
+ -- Tae-Hwan Kim <the81.kim@samsung.com> Wed, 19 Jan 2011 13:32:18 +0900
+
+location-module (0.1.5-1) unstable; urgency=low
+
+ * Adapt to plug change again
+ * Git: slp/pkgs/l/location-module
+ * Tag: location-module_0.1.5-1
+
+ -- Tae-Hwan Kim <the81.kim@samsung.com> Tue, 21 Dec 2010 17:31:07 +0900
+
+location-module (0.1.4-0) unstable; urgency=low
+
+ * Adapt to plugin change
+ * Git: slp/pkgs/l/location-module
+ * Tag: location-module_0.1.4-0
+
+ -- Tae-Hwan Kim <the81.kim@samsung.com> Mon, 13 Dec 2010 10:32:35 +0900
+
+location-module (0.1.3-0) unstable; urgency=low
+
+ * Initialize is_started to FALSE
+ * Git: slp/pkgs/l/location-module
+ * Tag: location-module_0.1.3-0
+
+ -- Tae-Hwan Kim <the81.kim@samsung.com> Thu, 02 Dec 2010 13:36:02 +0900
+
+location-module (0.1.2-0) unstable; urgency=low
+
+ * Prevent duplicate start
+ * Git: slp/pkgs/l/location-module
+ * Tag: location-module_0.1.2-0
+
+ -- Tae-Hwan Kim <the81.kim@samsung.com> Mon, 29 Nov 2010 11:17:46 +0900
+
+location-module (0.1.1-0) unstable; urgency=low
+
+ * Add debug pkg & disable geoclue-skyhook
+ * Git: slp/pkgs/l/location-module
+ * Tag: location-module_0.1.1-0
+
+ -- Tae-Hwan Kim <the81.kim@samsung.com> Wed, 24 Nov 2010 22:21:17 +0900
+
+location-module (0.1.0-1) unstable; urgency=low
+
+ * Initial release
+ * Git: slp/pkgs/l/location-module
+ * Tag: location-module_0.1.0-1
+
+ -- Tae-Hwan Kim <the81.kim@samsung.com> Tue, 02 Nov 2010 20:10:07 +0900
--- /dev/null
+Source: location-module
+Section: libs
+Priority: extra
+Maintainer: Youngae Kang <youngae.kang@samsung.com>, Yunhan Kim <yhan.kim@samsung.com>, Genie Kim <daejins.kim@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
+Build-Depends: debhelper (>= 5), libglib2.0-dev, libslp-location-dev, libgeoclue-dev, libvconf-dev
+Standards-Version: 3.7.2
+
+Package: location-geoclue-nominatim
+Section: utils
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: geoclue-nominatim geocode module for location
+
+Package: location-module-dbg
+Section: libs
+Architecture: any
+Depends: ${misc:Depends}, location-geoclue-nominatim (=${binary:Version})
+Description: debug package for location-geoclue-nominatim
--- /dev/null
+@PREFIX@/lib/location/module/libgps0.so*
--- /dev/null
+#!/bin/sh
+
+if [ ! -e /usr/lib/location/module/libwps0.so ] ; then
+ cp -f /usr/lib/location/module/libgps0.so /usr/lib/location/module/libwps0.so
+fi
+
+sync
+
--- /dev/null
+@PREFIX@/lib/location/module/libgeocode0.so*
--- /dev/null
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+LDFLAGS ?=
+PREFIX ?= /usr
+DATADIR ?= /opt
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+ CFLAGS += -O0
+ CXXFLAGS += -O0
+else
+ CFLAGS += -O2
+ CXXFLAGS += -O2
+endif
+
+configure: configure-stamp
+configure-stamp:
+ dh_testdir
+ ./autogen.sh
+ # Add here commands to configure the package.
+ ./configure --prefix=$(PREFIX) --enable-dlog --enable-debug
+
+ touch configure-stamp
+
+build: build-stamp
+
+build-stamp: configure-stamp
+ dh_testdir
+
+ # Add here commands to compile the package.
+ $(MAKE)
+
+ for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
+ cat $$f > $${f%.in}; \
+ sed -i -e "s#@PREFIX@#$(PREFIX)#g" $${f%.in}; \
+ sed -i -e "s#@DATADIR@#$(DATADIR)#g" $${f%.in}; \
+ done
+
+ touch $@
+
+clean:
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp configure-stamp
+
+ # Add here commands to clean up after the build process.
+ - $(MAKE) clean
+
+ rm -rf CMakeCache.txt
+ rm -rf CMakeFiles
+ rm -rf cmake_install.cmake
+ rm -rf Makefile
+ rm -rf install_manifest.txt
+ rm -rf *.so
+
+ for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
+ rm -f $${f%.in}; \
+ done
+
+ dh_clean
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ # Add here commands to install the package into debian/wavplayer.
+ $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+ dh_testdir
+ dh_testroot
+ dh_installchangelogs
+# dh_installdocs
+ dh_installexamples
+ dh_install --sourcedir=debian/tmp
+# dh_installmenu
+# dh_installdebconf
+# dh_installlogrotate
+# dh_installemacsen
+# dh_installpam
+# dh_installmime
+# dh_python
+# dh_installinit
+# dh_installcron
+# dh_installinfo
+ dh_installman
+ dh_link
+ dh_strip --dbg-package=location-module-dbg
+ dh_compress
+ dh_fixperms
+# dh_perl
+ dh_makeshlibs
+ dh_installdeb
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
--- /dev/null
+pkgdir = $(libdir)/location/module
+pkg_LTLIBRARIES = libgeocode0.la
+
+# geoclue nominatim plugin
+libgeocode0_la_SOURCES = geoclue-nominatim.c $(utility)
+libgeocode0_la_CFLAGS = \
+ -fPIC\
+ $(MODULE_CFLAGS)
+libgeocode0_la_LIBADD = \
+ $(MODULE_LIBS)
--- /dev/null
+/*
+ * location-geoclue-gpsd
+ *
+ * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Youngae Kang <youngae.kang@samsung.com>, Yunhan Kim <yhan.kim@samsung.com>,
+ * Genie Kim <daejins.kim@samsung.com>, Minjune Kim <sena06.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 <glib.h>
+
+#include <location-module.h>
+
+#include <geoclue/geoclue-position.h>
+#include <geoclue/geoclue-velocity.h>
+#include <geoclue/geoclue-provider.h>
+#include <dlfcn.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include "log.h"
+
+typedef struct{
+ char devname[256];
+ GeocluePosition *pos;
+ GeoclueVelocity *vel;
+ LocModStatusCB status_cb;
+ LocModPositionCB pos_cb;
+ LocModVelocityCB vel_cb;
+ gpointer userdata;
+ gboolean is_started;
+} GeoclueGpsdData;
+
+static void
+status_callback (GeoclueProvider *provider,
+ gint status,
+ gpointer userdata)
+{
+ GeoclueGpsdData* gpsd = (GeoclueGpsdData*)userdata;
+ g_return_if_fail(gpsd->status_cb);
+
+ switch(status){
+ case GEOCLUE_STATUS_ERROR:
+ case GEOCLUE_STATUS_UNAVAILABLE:
+ case GEOCLUE_STATUS_ACQUIRING:
+ MOD_LOGD("Status callback>> GEOCLUE_STATUS_ACQUIRING/ERROR/UNAVAILABLE");
+ gpsd->status_cb(FALSE, LOCATION_STATUS_NO_FIX, gpsd->userdata);
+ break;
+ case GEOCLUE_STATUS_AVAILABLE:
+ MOD_LOGD("Status callback>> GEOCLUE_STATUS_AVAILABLE");
+ gpsd->status_cb(TRUE, LOCATION_STATUS_3D_FIX, gpsd->userdata);
+ break;
+ default:
+ break;
+ }
+}
+
+static void
+position_callback (GeocluePosition *position,
+ GeocluePositionFields fields,
+ int timestamp,
+ double latitude,
+ double longitude,
+ double altitude,
+ GeoclueAccuracy *accuracy,
+ gpointer userdata)
+{
+ GeoclueGpsdData* gpsd = (GeoclueGpsdData*)userdata;
+ g_return_if_fail(gpsd->pos_cb);
+
+ GeoclueAccuracyLevel level;
+ double horiz_acc;
+ double vert_acc;
+ geoclue_accuracy_get_details (accuracy, &level, &horiz_acc, &vert_acc);
+
+ LocationPosition *pos = NULL;
+ LocationAccuracy *acc = NULL;
+
+ if (fields & GEOCLUE_POSITION_FIELDS_LATITUDE &&
+ fields & GEOCLUE_POSITION_FIELDS_LONGITUDE) {
+ if(fields & GEOCLUE_POSITION_FIELDS_ALTITUDE)
+ pos = location_position_new (timestamp, latitude, longitude, altitude, LOCATION_STATUS_3D_FIX);
+ else pos = location_position_new (timestamp, latitude, longitude, 0, LOCATION_STATUS_2D_FIX);
+ } else pos = location_position_new (0, 0, 0, 0, LOCATION_STATUS_NO_FIX);
+
+ if (accuracy) {
+ GeoclueAccuracyLevel level;
+ double horiz_acc;
+ double vert_acc;
+ geoclue_accuracy_get_details (accuracy, &level, &horiz_acc, &vert_acc);
+ acc = location_accuracy_new (LOCATION_ACCURACY_LEVEL_DETAILED, horiz_acc, vert_acc);
+ } else acc = location_accuracy_new (LOCATION_ACCURACY_LEVEL_NONE, horiz_acc, vert_acc);
+
+ MOD_LOGD("Position callback>> time(%d) lat(%f) long(%f) alt(%f) status(%d) acc_level(%d) hoz_acc(%f) vert_acc(%f)",
+ pos->timestamp, pos->latitude, pos->longitude, pos->altitude, pos->status,
+ acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
+ gpsd->pos_cb(TRUE, pos, acc, gpsd->userdata);
+ location_position_free (pos);
+ location_accuracy_free (acc);
+}
+
+static void
+velocity_callback (GeoclueVelocity *velocity,
+ GeoclueVelocityFields fields,
+ int timestamp,
+ double speed,
+ double direction,
+ double climb,
+ gpointer userdata)
+{
+ GeoclueGpsdData* gpsd = (GeoclueGpsdData*)userdata;
+ g_return_if_fail(gpsd->vel_cb);
+
+ LocationVelocity *vel = NULL;
+ LocationAccuracy *acc = NULL;
+
+ if (fields & GEOCLUE_VELOCITY_FIELDS_SPEED &&
+ fields & GEOCLUE_VELOCITY_FIELDS_DIRECTION) {
+ if (fields & GEOCLUE_VELOCITY_FIELDS_CLIMB) vel = location_velocity_new (timestamp, speed, direction, climb);
+ else vel = location_velocity_new (timestamp, speed, direction, 0);
+ acc = location_accuracy_new (LOCATION_ACCURACY_LEVEL_DETAILED, 0, 0);
+ } else {
+ vel = location_velocity_new (0, 0, 0, 0);
+ acc = location_accuracy_new (LOCATION_ACCURACY_LEVEL_NONE, 0, 0);
+ }
+ MOD_LOGD("Velocity callback>> timestamp(%d) speed(%f) direction(%f) climb(%f) acc_level(%d) hoz_acc(%f) vert_acc(%f)",
+ vel->timestamp, vel->speed, vel->direction, vel->climb,
+ acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
+
+ gpsd->vel_cb(TRUE, vel, acc, gpsd->userdata);
+ location_velocity_free (vel);
+ location_accuracy_free (acc);
+}
+
+static void
+_unref_geoclue(GeoclueGpsdData* gpsd)
+{
+ if(gpsd->pos) {
+ g_signal_handlers_disconnect_by_func(G_OBJECT (GEOCLUE_PROVIDER(gpsd->pos)), G_CALLBACK (status_callback), gpsd);
+ g_signal_handlers_disconnect_by_func(G_OBJECT (GEOCLUE_PROVIDER(gpsd->pos)), G_CALLBACK (position_callback), gpsd);
+ g_object_unref (gpsd->pos);
+ gpsd->pos = NULL;
+ }
+
+ if( gpsd->vel != NULL){
+ g_signal_handlers_disconnect_by_func(G_OBJECT (GEOCLUE_PROVIDER(gpsd->vel)), G_CALLBACK (velocity_callback), gpsd);
+ g_object_unref (gpsd->vel);
+ gpsd->vel = NULL;
+ }
+ gpsd->is_started = FALSE;
+}
+
+static gboolean
+_ref_geoclue(GeoclueGpsdData* gpsd)
+{
+ if(gpsd->is_started == TRUE){
+ MOD_LOGW ("geoclue-gpsd is alredy started");
+ return TRUE;
+ }
+
+ gchar *service, *path;
+ service = g_strdup_printf ("org.freedesktop.Geoclue.Providers.Gpsd");
+ path = g_strdup_printf ("/org/freedesktop/Geoclue/Providers/Gpsd");
+
+ if(!gpsd->pos){
+ gpsd->pos = geoclue_position_new (service, path);
+ }
+ if(!gpsd->vel){
+ gpsd->vel = geoclue_velocity_new (service, path);
+ }
+ g_free (service);
+ g_free (path);
+ if(!gpsd->pos || !gpsd->vel){
+ MOD_LOGW ("Error while creating Geoclue object.");
+ _unref_geoclue(gpsd);
+ return FALSE;
+ }
+
+ gpsd->is_started = TRUE;
+ g_signal_connect (G_OBJECT (GEOCLUE_PROVIDER(gpsd->pos)), "status-changed", G_CALLBACK (status_callback), gpsd);
+ g_signal_connect (G_OBJECT (GEOCLUE_PROVIDER(gpsd->pos)), "position-changed", G_CALLBACK (position_callback), gpsd);
+ g_signal_connect (G_OBJECT (GEOCLUE_PROVIDER(gpsd->vel)), "velocity-changed", G_CALLBACK (velocity_callback), gpsd);
+
+ return TRUE;
+}
+
+static int
+start(gpointer handle, LocModStatusCB status_cb, LocModPositionCB pos_cb, LocModVelocityCB vel_cb, gpointer userdata)
+{
+ MOD_LOGD("start");
+ GeoclueGpsdData* gpsd = (GeoclueGpsdData*)handle;
+ g_return_val_if_fail(gpsd, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(status_cb, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(pos_cb, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(vel_cb, LOCATION_ERROR_NOT_AVAILABLE);
+
+ gpsd->status_cb = status_cb;
+ gpsd->pos_cb = pos_cb;
+ gpsd->vel_cb = vel_cb;
+ gpsd->userdata = userdata;
+ if (!_ref_geoclue(gpsd)) return LOCATION_ERROR_NOT_AVAILABLE;
+ return LOCATION_ERROR_NONE;
+}
+
+static int
+stop(gpointer handle)
+{
+ MOD_LOGD("stop");
+ GeoclueGpsdData* gpsd = (GeoclueGpsdData*)handle;
+ g_return_val_if_fail(gpsd, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(gpsd->status_cb, LOCATION_ERROR_NOT_AVAILABLE);
+ _unref_geoclue(gpsd);
+ gpsd->status_cb(FALSE, LOCATION_STATUS_NO_FIX, gpsd->userdata);
+ return LOCATION_ERROR_NONE;
+}
+
+static int
+get_position(
+ gpointer handle,
+ LocationPosition **position,
+ LocationAccuracy **accuracy)
+{
+ GeoclueGpsdData* gpsd = (GeoclueGpsdData*)handle;
+ g_return_val_if_fail(gpsd, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(gpsd->pos, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(position, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(accuracy, LOCATION_ERROR_PARAMETER);
+
+ GeocluePositionFields fields;
+ int timestamp;
+ double lat, lon, alt;
+ GeoclueAccuracy *_accuracy = NULL;
+ GError *error = NULL;
+
+ fields = geoclue_position_get_position (gpsd->pos, ×tamp,
+ &lat, &lon, &alt,
+ &_accuracy, &error);
+ if (error) {
+ MOD_LOGD ("Error getting position: %s", error->message);
+ g_error_free (error);
+ return LOCATION_ERROR_NOT_AVAILABLE;
+ }
+
+ if (fields & GEOCLUE_POSITION_FIELDS_LATITUDE &&
+ fields & GEOCLUE_POSITION_FIELDS_LONGITUDE) {
+ if(fields & GEOCLUE_POSITION_FIELDS_ALTITUDE) *position = location_position_new (timestamp, lat, lon, alt, LOCATION_STATUS_3D_FIX);
+ else *position = location_position_new (timestamp, lat, lon, 0, LOCATION_STATUS_2D_FIX);
+ } else *position = location_position_new (0, 0, 0, 0, LOCATION_STATUS_NO_FIX);
+
+ if (_accuracy) {
+ GeoclueAccuracyLevel level;
+ double horiz_acc;
+ double vert_acc;
+ geoclue_accuracy_get_details (_accuracy, &level, &horiz_acc, &vert_acc);
+ *accuracy = location_accuracy_new (LOCATION_ACCURACY_LEVEL_DETAILED, horiz_acc, vert_acc);
+ geoclue_accuracy_free (_accuracy);
+ } else *accuracy = location_accuracy_new (LOCATION_ACCURACY_LEVEL_NONE, 0, 0);
+
+ return LOCATION_ERROR_NONE;
+}
+
+static int
+get_velocity(
+ gpointer handle,
+ LocationVelocity **velocity,
+ LocationAccuracy **accuracy)
+{
+ GeoclueGpsdData* gpsd = (GeoclueGpsdData*)handle;
+ g_return_val_if_fail(gpsd, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(gpsd->vel, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(velocity, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(accuracy, LOCATION_ERROR_PARAMETER);
+
+ GeoclueVelocityFields fields;
+ int timestamp;
+ double spd, dir, climb;
+ GError *error = NULL;
+
+ fields = geoclue_velocity_get_velocity (gpsd->vel, ×tamp,
+ &spd, &dir, &climb,
+ &error);
+ if (error) {
+ MOD_LOGD ("Error getting velocity: %s", error->message);
+ g_error_free (error);
+ return LOCATION_ERROR_NOT_AVAILABLE;
+ }
+
+ if (fields & GEOCLUE_VELOCITY_FIELDS_SPEED &&
+ fields & GEOCLUE_VELOCITY_FIELDS_DIRECTION) {
+ if (fields & GEOCLUE_VELOCITY_FIELDS_CLIMB) *velocity = location_velocity_new (timestamp, spd, dir, climb);
+ else *velocity = location_velocity_new (timestamp, spd, dir, 0);
+ *accuracy = location_accuracy_new (LOCATION_ACCURACY_LEVEL_DETAILED, 0, 0);
+ } else {
+ *velocity = location_velocity_new (0, 0, 0, 0);
+ *accuracy = location_accuracy_new (LOCATION_ACCURACY_LEVEL_NONE, 0, 0);
+ }
+ return LOCATION_ERROR_NONE;
+}
+
+static int
+get_nmea(gpointer handle,
+ char **nmea_data)
+{
+ MOD_LOGD("get_nmea: not available");
+ return LOCATION_ERROR_NOT_AVAILABLE;
+}
+
+static int
+get_satellite(gpointer handle,
+ LocationSatellite **satellite)
+{
+ MOD_LOGD("get_satellite: not available");
+ return LOCATION_ERROR_NOT_AVAILABLE;
+}
+
+static int
+set_devname(gpointer handle,
+ const char *devname)
+{
+ GeoclueGpsdData* gpsd = (GeoclueGpsdData*)handle;
+ g_return_val_if_fail(gpsd, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(gpsd->devname, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(devname, LOCATION_ERROR_PARAMETER);
+ MOD_LOGD("set_devname: %s --> %s", gpsd->devname, devname);
+ g_stpcpy(gpsd->devname, devname);
+
+ return LOCATION_ERROR_NONE;
+}
+
+
+static int
+get_devname(gpointer handle,
+ char **devname)
+{
+ GeoclueGpsdData* gpsd = (GeoclueGpsdData*)handle;
+ g_return_val_if_fail(gpsd, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(gpsd->devname, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(devname, LOCATION_ERROR_PARAMETER);
+
+ *devname = g_strdup(gpsd->devname);
+ MOD_LOGD("get_devname: %s", *devname);
+
+ return LOCATION_ERROR_NONE;
+}
+
+LOCATION_MODULE_API gpointer
+init(LocModGpsOps* ops)
+{
+ MOD_LOGD("init");
+ g_return_val_if_fail(ops, NULL);
+ ops->start = start;
+ ops->stop = stop ;
+ ops->get_position = get_position;
+ ops->get_velocity = get_velocity;
+ Dl_info info;
+ if (dladdr(&get_position, &info) == 0) {
+ MOD_LOGD("failed to get module name");
+ } else if (g_str_has_prefix(info.dli_fname, "gps")) {
+ ops->get_nmea = get_nmea;
+ ops->get_satellite = get_satellite;
+ ops->set_devname = set_devname;
+ ops->get_devname = get_devname;
+ }
+
+ GeoclueGpsdData* gpsd = g_new0(GeoclueGpsdData, 1);
+ g_return_val_if_fail(gpsd, NULL);
+
+ g_stpcpy(gpsd->devname, "/dev/rfcomm0");
+ gpsd->pos = NULL;
+ gpsd->vel = NULL;
+ gpsd->status_cb= NULL;
+ gpsd->pos_cb = NULL;
+ gpsd->vel_cb = NULL;
+ gpsd->userdata = NULL;
+ gpsd->is_started = FALSE;
+
+ return (gpointer)gpsd;
+}
+
+LOCATION_MODULE_API void
+shutdown(gpointer handle)
+{
+ MOD_LOGD("shutdown");
+ GeoclueGpsdData* gpsd = (GeoclueGpsdData*)handle;
+ g_return_if_fail(gpsd);
+ _unref_geoclue(gpsd);
+ if(gpsd->status_cb) gpsd->status_cb(FALSE, LOCATION_STATUS_NO_FIX, gpsd->userdata);
+ g_free(gpsd);
+}
--- /dev/null
+/*
+ * location-geoclue-nominatim
+ *
+ * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Youngae Kang <youngae.kang@samsung.com>, Yunhan Kim <yhan.kim@samsung.com>,
+ * Genie Kim <daejins.kim@samsung.com>, Minjune Kim <sena06.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 <glib.h>
+
+#include <location-module.h>
+
+#include <geoclue/geoclue-geocode.h>
+#include <geoclue/geoclue-reverse-geocode.h>
+#include <geoclue/geoclue-provider.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include "log.h"
+
+typedef struct {
+ char* service_name;
+ GeoclueGeocode* geocoder;
+ GeoclueReverseGeocode* rev_geocoder;
+} NominatimHandle;
+
+typedef struct {
+ LocationPositionCB pos_cb;
+ LocationAddressCB addr_cb;
+ gpointer userdata;
+} NominatimData;
+
+static GHashTable*
+get_geoclue_addr_from_location_addr (const LocationAddress *address)
+{
+ if (!address) return NULL;
+
+ GHashTable *geoclue_addr = geoclue_address_details_new();
+ if (address->street) {
+ if (address->building_number) {
+ char *street_addr = g_strdup_printf ("%s %s", address->building_number, address->street);
+ geoclue_address_details_insert (geoclue_addr, GEOCLUE_ADDRESS_KEY_STREET, street_addr);
+ g_free (street_addr);
+ } else geoclue_address_details_insert (geoclue_addr, GEOCLUE_ADDRESS_KEY_STREET, address->street);
+ }
+ if (address->district) geoclue_address_details_insert (geoclue_addr, GEOCLUE_ADDRESS_KEY_AREA, address->district);
+ if (address->city) geoclue_address_details_insert (geoclue_addr, GEOCLUE_ADDRESS_KEY_LOCALITY, address->city);
+ if (address->state) geoclue_address_details_insert (geoclue_addr, GEOCLUE_ADDRESS_KEY_REGION, address->state);
+ if (address->country_code) geoclue_address_details_insert (geoclue_addr, GEOCLUE_ADDRESS_KEY_COUNTRY, address->country_code);
+ if (address->postal_code) geoclue_address_details_insert (geoclue_addr, GEOCLUE_ADDRESS_KEY_POSTALCODE, address->postal_code);
+
+ return geoclue_addr;
+}
+
+static LocationAddress*
+get_location_addr_from_geoclue_addr (GHashTable *geoclue_addr)
+{
+ if (!geoclue_addr) return NULL;
+
+ LocationAddress *addr = NULL;
+
+ gchar *country, *region, *locality, *postalcode, *area, *street;
+
+ country = g_hash_table_lookup (geoclue_addr, GEOCLUE_ADDRESS_KEY_COUNTRY);
+ region = g_hash_table_lookup (geoclue_addr, GEOCLUE_ADDRESS_KEY_REGION);
+ locality = g_hash_table_lookup (geoclue_addr, GEOCLUE_ADDRESS_KEY_LOCALITY);
+ area = g_hash_table_lookup (geoclue_addr, GEOCLUE_ADDRESS_KEY_AREA);
+ postalcode = g_hash_table_lookup (geoclue_addr, GEOCLUE_ADDRESS_KEY_POSTALCODE);
+ street = g_hash_table_lookup (geoclue_addr, GEOCLUE_ADDRESS_KEY_STREET);
+
+ addr = location_address_new (NULL, street, area, locality, region, country, postalcode);
+ return addr;
+}
+
+static LocationAccuracy *
+get_location_acc_from_geoclue_acc (GeoclueAccuracy *acc)
+{
+ if (!acc) return NULL;
+
+ LocationAccuracy *accuracy = NULL;
+ GeoclueAccuracyLevel level;
+ double horiz_acc;
+ double vert_acc;
+ geoclue_accuracy_get_details (acc, &level, &horiz_acc, &vert_acc);
+
+ if (level == GEOCLUE_ACCURACY_LEVEL_DETAILED) accuracy = location_accuracy_new (LOCATION_ACCURACY_LEVEL_DETAILED, horiz_acc, vert_acc);
+ else if (level == GEOCLUE_ACCURACY_LEVEL_STREET) accuracy = location_accuracy_new (LOCATION_ACCURACY_LEVEL_STREET, horiz_acc, vert_acc);
+ else if (level == GEOCLUE_ACCURACY_LEVEL_POSTALCODE) accuracy = location_accuracy_new (LOCATION_ACCURACY_LEVEL_POSTALCODE, horiz_acc, vert_acc);
+ else if (level == GEOCLUE_ACCURACY_LEVEL_LOCALITY) accuracy = location_accuracy_new (LOCATION_ACCURACY_LEVEL_LOCALITY, horiz_acc, vert_acc);
+ else if (level == GEOCLUE_ACCURACY_LEVEL_REGION) accuracy = location_accuracy_new (LOCATION_ACCURACY_LEVEL_REGION, horiz_acc, vert_acc);
+ else if (level == GEOCLUE_ACCURACY_LEVEL_COUNTRY) accuracy = location_accuracy_new (LOCATION_ACCURACY_LEVEL_COUNTRY, horiz_acc, vert_acc);
+ else accuracy = location_accuracy_new (LOCATION_ACCURACY_LEVEL_NONE, 0, 0);
+
+ return accuracy;
+}
+
+static void
+_unref_geoclue(NominatimHandle* handle)
+{
+ if (handle->geocoder) {
+ g_object_unref (handle->geocoder);
+ handle->geocoder = NULL;
+ }
+ if (handle->rev_geocoder) {
+ g_object_unref (handle->rev_geocoder);
+ handle->rev_geocoder = NULL;
+ }
+}
+
+static gboolean
+_ref_geoclue(NominatimHandle* handle)
+{
+ gchar *service, *path;
+ service = g_strdup_printf ("org.freedesktop.Geoclue.Providers.Nominatim");
+ path = g_strdup_printf ("/org/freedesktop/Geoclue/Providers/Nominatim");
+
+ if (!handle->geocoder) handle->geocoder = geoclue_geocode_new (service, path);
+ if (!handle->rev_geocoder) handle->rev_geocoder = geoclue_reverse_geocode_new (service, path);
+
+ if(!handle->geocoder || !handle->rev_geocoder){
+ MOD_LOGW ("Error while creating Geoclue object.");
+ _unref_geoclue(handle);
+ return FALSE;
+ }
+ return TRUE;
+}
+
+static void
+address_cb (GeoclueReverseGeocode *revgeocode,
+ GHashTable *details,
+ GeoclueAccuracy *accuracy,
+ GError *error,
+ gpointer userdata)
+{
+ NominatimData* data = (NominatimData*)userdata;
+ g_return_if_fail(data->addr_cb);
+
+ LocationAddress *addr = NULL;
+ LocationAccuracy *acc = NULL;
+ LocationError err = LOCATION_ERROR_NONE;
+
+ if (error) {
+ MOD_LOGW ("Error getting reverse geocode: %s", error->message);
+ err = LOCATION_ERROR_NOT_AVAILABLE;
+ } else {
+ if (accuracy) acc = get_location_acc_from_geoclue_acc (accuracy);
+ else acc = location_accuracy_new (LOCATION_ACCURACY_LEVEL_NONE, 0, 0);
+
+ if (details) addr = get_location_addr_from_geoclue_addr (details);
+ }
+
+ data->addr_cb (err, addr, acc, data->userdata);
+ if (addr) location_address_free (addr);
+ if (acc) location_accuracy_free (acc);
+ g_free (data);
+}
+
+static void _free_pos_list_item(gpointer data)
+{
+ g_return_if_fail(data);
+
+ LocationPosition *position = (LocationPosition *)data;
+ location_position_free(position);
+}
+
+static void _free_acc_list_item(gpointer data)
+{
+ g_return_if_fail(data);
+
+ LocationAccuracy *accuracy = (LocationAccuracy *)data;
+ location_accuracy_free(accuracy);
+}
+
+static void position_cb (GeoclueGeocode *geocode,
+ GeocluePositionFields fields,
+ double latitude,
+ double longitude,
+ double altitude,
+ GeoclueAccuracy *accuracy,
+ GError *error,
+ gpointer userdata)
+{
+ NominatimData* data = (NominatimData*)userdata;
+ GList *pos_list = NULL;
+ GList *acc_list = NULL;
+
+ g_return_if_fail(data->pos_cb);
+
+ LocationPosition *pos = NULL;
+ LocationAccuracy *acc = NULL;
+ LocationError err = LOCATION_ERROR_NONE;
+
+ if (error) {
+ MOD_LOGW ("Error getting geocode: %s", error->message);
+ err = LOCATION_ERROR_NOT_AVAILABLE;
+ } else {
+ if (fields & GEOCLUE_POSITION_FIELDS_LATITUDE &&
+ fields & GEOCLUE_POSITION_FIELDS_LONGITUDE) {
+ if(fields & GEOCLUE_POSITION_FIELDS_ALTITUDE) pos = location_position_new (0, latitude, longitude, altitude, LOCATION_STATUS_3D_FIX);
+ else pos = location_position_new (0, latitude, longitude, 0, LOCATION_STATUS_2D_FIX);
+
+ pos_list = g_list_append(pos_list, pos);
+ } else {
+ err = LOCATION_ERROR_NOT_FOUND;
+ }
+
+ if (accuracy) {
+ acc = get_location_acc_from_geoclue_acc (accuracy);
+ acc_list = g_list_append(acc_list, acc);
+ }
+ }
+ data->pos_cb (err, pos_list, acc_list, data->userdata);
+
+ if (pos_list) g_list_free_full(pos_list, _free_pos_list_item);
+ if (acc_list) g_list_free_full(pos_list, _free_acc_list_item);
+ g_free (data);
+
+}
+
+
+static int
+get_geocode (gpointer handle,
+ const LocationAddress *addr,
+ GList **pos_list,
+ GList **acc_list)
+{
+ NominatimHandle *nominatim = (NominatimHandle *)handle;
+ g_return_val_if_fail(nominatim, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(addr, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(pos_list, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(acc_list, LOCATION_ERROR_PARAMETER);
+
+ double lat, lon, alt;
+ GeoclueAccuracy *geoclue_acc = NULL;
+ GError *error = NULL;
+ LocationPosition *pos = NULL;
+ LocationAccuracy *acc = NULL;
+ LocationError err = LOCATION_ERROR_NONE;
+
+ GHashTable* geoclue_addr = get_geoclue_addr_from_location_addr (addr);
+ GeocluePositionFields fields = geoclue_geocode_address_to_position (nominatim->geocoder, geoclue_addr,
+ &lat, &lon, &alt,
+ &geoclue_acc, &error);
+ g_hash_table_destroy (geoclue_addr);
+
+ if (error) {
+ MOD_LOGW ("Error getting geocode: %s", error->message);
+ g_error_free (error);
+ return LOCATION_ERROR_NOT_AVAILABLE;
+ }
+
+ if (fields & GEOCLUE_POSITION_FIELDS_LATITUDE &&
+ fields & GEOCLUE_POSITION_FIELDS_LONGITUDE) {
+ if(fields & GEOCLUE_POSITION_FIELDS_ALTITUDE) pos = location_position_new (0, lat, lon, alt, LOCATION_STATUS_3D_FIX);
+ else pos = location_position_new (0, lat, lon, 0, LOCATION_STATUS_2D_FIX);
+
+ *pos_list = g_list_append(*pos_list, pos);
+ }
+ else {
+ err = LOCATION_ERROR_NOT_FOUND;
+ }
+
+ if (geoclue_acc) {
+ acc = get_location_acc_from_geoclue_acc (geoclue_acc);
+ geoclue_accuracy_free (geoclue_acc);
+
+ *acc_list = g_list_append(*acc_list, acc);
+ }
+
+ if (pos) location_position_free (pos);
+ if (acc) location_accuracy_free (acc);
+
+ return err;
+}
+
+
+static int
+get_geocode_async (gpointer handle,
+ const LocationAddress * addr,
+ LocationPositionCB callback,
+ gpointer userdata)
+{
+ NominatimHandle *nominatim = (NominatimHandle *)handle;
+ g_return_val_if_fail(nominatim, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(addr, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(callback, LOCATION_ERROR_PARAMETER);
+
+ GHashTable* geoclue_addr = get_geoclue_addr_from_location_addr (addr);
+ NominatimData *data = g_new0 (NominatimData, 1);
+ data->pos_cb = callback;
+ data->userdata = userdata;
+ geoclue_geocode_address_to_position_async (nominatim->geocoder, geoclue_addr, position_cb, data);
+ g_hash_table_destroy (geoclue_addr);
+
+ return LOCATION_ERROR_NONE;
+}
+
+static int
+get_geocode_freetext(gpointer handle,
+ const const gchar* addr,
+ GList **pos_list,
+ GList **acc_list)
+{
+ NominatimHandle *nominatim = (NominatimHandle *)handle;
+ g_return_val_if_fail(nominatim, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(addr, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(pos_list, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(acc_list, LOCATION_ERROR_PARAMETER);
+
+ double lat, lon, alt;
+ GeoclueAccuracy *geoclue_acc = NULL;
+ GError *error = NULL;
+ LocationPosition *pos = NULL;
+ LocationAccuracy *acc = NULL;
+ LocationError err = LOCATION_ERROR_NONE;
+
+ GeocluePositionFields fields = geoclue_geocode_freeform_address_to_position (nominatim->geocoder, addr,
+ &lat, &lon, &alt,
+ &geoclue_acc, &error);
+ if (error) {
+ MOD_LOGW ("Error getting geocode: %s", error->message);
+ g_error_free (error);
+ return LOCATION_ERROR_NOT_AVAILABLE;
+ }
+
+ if (fields & GEOCLUE_POSITION_FIELDS_LATITUDE &&
+ fields & GEOCLUE_POSITION_FIELDS_LONGITUDE) {
+ if(fields & GEOCLUE_POSITION_FIELDS_ALTITUDE) pos = location_position_new (0, lat, lon, alt, LOCATION_STATUS_3D_FIX);
+ else pos = location_position_new (0, lat, lon, 0, LOCATION_STATUS_2D_FIX);
+ *pos_list = g_list_append(*pos_list, pos);
+ }
+ else {
+ err = LOCATION_ERROR_NOT_FOUND;
+ }
+
+ if (geoclue_acc) {
+ acc = get_location_acc_from_geoclue_acc (geoclue_acc);
+ geoclue_accuracy_free (geoclue_acc);
+ *acc_list = g_list_append(*acc_list, acc);
+ }
+
+ if (pos) location_position_free (pos);
+ if (acc) location_accuracy_free (acc);
+ return err;
+}
+
+
+static int
+get_geocode_freetext_async (gpointer handle,
+ const gchar* addr,
+ LocationPositionCB callback,
+ gpointer userdata)
+{
+ NominatimHandle *nominatim = (NominatimHandle *)handle;
+ g_return_val_if_fail(nominatim, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(addr, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(callback, LOCATION_ERROR_PARAMETER);
+
+ NominatimData *data = g_new0 (NominatimData, 1);
+ data->pos_cb = callback;
+ data->userdata = userdata;
+ geoclue_geocode_freeform_address_to_position_async (nominatim->geocoder, addr, position_cb, data);
+
+ return LOCATION_ERROR_NONE;
+}
+
+static int
+get_reverse_geocode(gpointer handle,
+ const LocationPosition *pos,
+ LocationAddress **addr,
+ LocationAccuracy **acc)
+{
+ NominatimHandle *nominatim = (NominatimHandle *)handle;
+ g_return_val_if_fail(nominatim, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(pos, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(addr, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(acc, LOCATION_ERROR_PARAMETER);
+
+ GeoclueAccuracy *addr_acc = NULL;
+ GError *error = NULL;
+ GHashTable* geoclue_addr = NULL;
+
+ double lat = pos->latitude;
+ double lon = pos->longitude;
+ GeoclueAccuracy *pos_acc = geoclue_accuracy_new (GEOCLUE_ACCURACY_LEVEL_DETAILED, 0.0, 0.0);
+
+ gboolean success = geoclue_reverse_geocode_position_to_address (nominatim->rev_geocoder, lat, lon,
+ pos_acc, &geoclue_addr,
+ &addr_acc, &error);
+ geoclue_accuracy_free (pos_acc);
+
+ if (!success || error) {
+ MOD_LOGW ("Error getting reverse geocode: %s", error->message);
+ g_error_free (error);
+ return LOCATION_ERROR_NOT_AVAILABLE;
+ }
+
+ if (addr_acc) {
+ *acc = get_location_acc_from_geoclue_acc (addr_acc);
+ geoclue_accuracy_free (addr_acc);
+ } else *acc = location_accuracy_new (LOCATION_ACCURACY_LEVEL_NONE, 0, 0);
+ if (geoclue_addr) {
+ *addr = get_location_addr_from_geoclue_addr (geoclue_addr);
+ g_hash_table_destroy (geoclue_addr);
+ }
+
+ return LOCATION_ERROR_NONE;
+}
+
+static int
+get_reverse_geocode_async (gpointer handle,
+ const LocationPosition *pos,
+ LocationAddressCB callback,
+ gpointer userdata)
+{
+ NominatimHandle *nominatim = (NominatimHandle *)handle;
+ g_return_val_if_fail(nominatim, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail(pos, LOCATION_ERROR_PARAMETER);
+ g_return_val_if_fail(callback, LOCATION_ERROR_PARAMETER);
+
+ double lat = pos->latitude;
+ double lon = pos->longitude;
+ GeoclueAccuracy *pos_acc = geoclue_accuracy_new (GEOCLUE_ACCURACY_LEVEL_DETAILED, 0.0, 0.0);;
+ NominatimData *data = g_new0 (NominatimData, 1);
+ data->addr_cb = callback;
+ data->userdata = userdata;
+ geoclue_reverse_geocode_position_to_address_async (nominatim->rev_geocoder,
+ lat, lon, pos_acc,
+ address_cb, data);
+ geoclue_accuracy_free (pos_acc);
+
+ return LOCATION_ERROR_NONE;
+}
+
+static int
+get_service_name (gpointer handle,
+ gchar **service_name)
+{
+ NominatimHandle *nominatim = (NominatimHandle *)handle;
+ g_return_val_if_fail(nominatim, LOCATION_ERROR_NOT_AVAILABLE);
+ g_return_val_if_fail (service_name, LOCATION_ERROR_PARAMETER);
+ *service_name = g_strdup (nominatim->service_name);
+ return LOCATION_ERROR_NONE;
+}
+
+LOCATION_MODULE_API gpointer
+init (LocModGeoOps* ops)
+{
+ MOD_LOGD("init");
+ g_return_val_if_fail(ops, NULL);
+ NominatimHandle *handle = g_new0 (NominatimHandle, 1);
+ if (!_ref_geoclue(handle)) {
+ g_free (handle);
+ return NULL;
+ }
+ handle->service_name = g_strdup ("Nominatim");
+ ops->get_service_name = get_service_name;
+ ops->get_geocode = get_geocode;
+ ops->get_geocode_freetext = get_geocode_freetext;
+ ops->get_reverse_geocode = get_reverse_geocode;
+ ops->get_geocode_async = get_geocode_async;
+ ops->get_geocode_freetext_async = get_geocode_freetext_async;
+ ops->get_reverse_geocode_async = get_reverse_geocode_async;
+ return (gpointer)handle;
+}
+
+LOCATION_MODULE_API void
+shutdown (gpointer handle)
+{
+ MOD_LOGD("shutdown");
+ g_return_if_fail(handle);
+ NominatimHandle *nominatim = (NominatimHandle *)handle;
+ g_free (nominatim->service_name);
+ _unref_geoclue(nominatim);
+ g_free (nominatim);
+}
--- /dev/null
+/*
+ * location-module
+ *
+ * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Youngae Kang <youngae.kang@samsung.com>, Yunhan Kim <yhan.kim@samsung.com>,
+ * Genie Kim <daejins.kim@samsung.com>, Minjune Kim <sena06.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_LOG_H__
+#define __LOCATION_LOG_H__
+
+#define TAG_LOCATION "location_mod"
+
+#ifdef MOD_DLOG_DEBUG // if debug mode, show filename & line number
+#include <dlog.h>
+#define MOD_LOGD(fmt,args...) SLOG(LOG_DEBUG, TAG_LOCATION, "[%-15s:%-4d:%-27s][Mod]"fmt"\n", __FILE__, __LINE__, __FUNCTION__, ##args)
+#define MOD_LOGW(fmt,args...) SLOG(LOG_WARN, TAG_LOCATION, "[%-15s:%-4d:%-27s][Mod]"fmt"\n", __FILE__, __LINE__, __FUNCTION__, ##args)
+#define MOD_LOGI(fmt,args...) SLOG(LOG_INFO, TAG_LOCATION, "[%-15s:%-4d:%-27s][Mod]"fmt"\n", __FILE__, __LINE__, __FUNCTION__, ##args)
+#define MOD_LOGE(fmt,args...) SLOG(LOG_ERROR, TAG_LOCATION, "[%-15s:%-4d:%-27s][Mod]"fmt"\n", __FILE__, __LINE__, __FUNCTION__, ##args)
+#elif MOD_DLOG_RELEASE // if release mode, do not show filename & line number
+#include <dlog.h>
+#define MOD_LOGD(fmt,args...) SLOG(LOG_DEBUG, TAG_LOCATION, "[Mod]"fmt"\n", ##args)
+#define MOD_LOGW(fmt,args...) SLOG(LOG_WARN, TAG_LOCATION, "[Mod]"fmt"\n", ##args)
+#define MOD_LOGI(fmt,args...) SLOG(LOG_INFO, TAG_LOCATION, "[Mod]"fmt"\n", ##args)
+#define MOD_LOGE(fmt,args...) SLOG(LOG_ERROR, TAG_LOCATION, "[Mod]:"fmt"\n", ##args)
+#else // if do not use dlog
+#define MOD_LOGD(...) g_debug(__VA_ARGS__);
+#define MOD_LOGW(...) g_warning(__VA_ARGS__);
+#define MOD_LOGI(...) g_message(__VA_ARGS__);
+#define MOD_LOGE(...) g_error(__VA_ARGS__);
+#endif
+
+#endif
--- /dev/null
+Name: location-module
+Summary: Location module
+Version: 0.1.12
+Release: 5
+Group: TO_BE/FILLED_IN
+License: TO_BE/FILLED_IN
+Source0: %{name}-%{version}.tar.gz
+BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(location)
+BuildRequires: pkgconfig(geoclue)
+BuildRequires: pkgconfig(vconf)
+
+
+%description
+Location module
+
+
+%package -n location-geoclue-nominatim
+Summary: geoclue-nominatim geocode module for location
+Group: TO_BE/FILLED_IN
+
+%description -n location-geoclue-nominatim
+geoclue-nominatim geocode module for location
+
+%prep
+%setup -q
+
+%build
+./autogen.sh
+%configure --prefix=$(PREFIX) --enable-dlog --enable-debug
+
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+
+%files -n location-geoclue-nominatim
+%defattr(-,root,root,-)
+%{_libdir}/location/module/libgeocode0.so
+%{_libdir}/location/module/libgeocode0.so.*
+