Release Tizen2.0 beta
authorMinjune Kim <sena06.kim@samsung.com>
Tue, 21 Aug 2012 08:46:31 +0000 (17:46 +0900)
committerMinjune Kim <sena06.kim@samsung.com>
Tue, 21 Aug 2012 08:46:31 +0000 (17:46 +0900)
72 files changed:
AUTHORS
Makefile.am
TC/unit/utc_location_get_position_from_address.c
configure.ac
debian/changelog
debian/control
debian/libslp-location.postinst
location.pc.in
location/Makefile.am
location/include/location-map-types.h [new file with mode: 0644]
location/include/location-types.h
location/manager/Makefile.am
location/manager/location-boundary.c
location/manager/location-common-util.c
location/manager/location-common-util.h
location/manager/location-cps.c
location/manager/location-cps.h
location/manager/location-gps.c
location/manager/location-hybrid.c
location/manager/location-hybrid.h
location/manager/location-ielement.c
location/manager/location-ielement.h
location/manager/location-ips.c [deleted file]
location/manager/location-ips.h [deleted file]
location/manager/location-position.c
location/manager/location-position.h
location/manager/location-setting.h
location/manager/location-signaling-util.c
location/manager/location-signaling-util.h
location/manager/location-sps.c [deleted file]
location/manager/location-sps.h [deleted file]
location/manager/location-velocity.c
location/manager/location-velocity.h
location/manager/location-wps.c
location/manager/location.c
location/manager/location.h
location/map-service/Makefile.am
location/map-service/location-address.h
location/map-service/location-geocode.h
location/map-service/location-landmark-ext.h
location/map-service/location-landmark.c
location/map-service/location-landmark.h
location/map-service/location-map-ielement.c [new file with mode: 0644]
location/map-service/location-map-ielement.h [new file with mode: 0644]
location/map-service/location-map-pref.c [moved from location/map-service/location-pref.c with 70% similarity]
location/map-service/location-map-pref.h [moved from location/map-service/location-pref.h with 60% similarity]
location/map-service/location-map-service-ext.h
location/map-service/location-map-service.c
location/map-service/location-map-service.h
location/map-service/location-poi.c
location/map-service/location-poi.h
location/map-service/location-route-ext.h
location/map-service/location-route.c
location/map-service/location-route.h
location/map-service/map-internal.c
location/map-service/map-internal.h
location/map-service/map-service.c
location/map-service/map-service.h
location/module/location-module.h
location/module/module-internal.c
location/module/module-internal.h
packaging/libslp-location.spec
tests/Makefile.am
tests/address-sample.c
tests/cps-test.c
tests/gps-test.c
tests/hybrid-test.c
tests/ips-test.c [deleted file]
tests/location-api-test.c
tests/map-service-test.c [new file with mode: 0644]
tests/sps-test.c [deleted file]
tests/wps-test.c

diff --git a/AUTHORS b/AUTHORS
index a4570bb..cc7be1c 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,4 +1,3 @@
 Youngae Kang <youngae.kang@samsung.com>
 Yunhan Kim <yhan.kim@samsung.com>
-Minjune Kim <sena06.kim@samsung.com>
 Genie Kim <daejins.kim@samsung.com>
index 847e20c..f227da9 100644 (file)
@@ -1,6 +1,6 @@
 ACLOCAL_AMFLAGS=-I m4
 
-SUBDIRS=location tests
+SUBDIRS=location
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = location.pc
index f19c70c..a3c5e6e 100644 (file)
@@ -143,7 +143,7 @@ utc_location_get_position_from_address_03()
 static void
 utc_location_get_position_from_address_04()
 {
-       LocationAddress *addr = location_address_new ("1",  "Post Street", NULL, "san jose", "ca", NULL, "95113");;
+       LocationAddress *addr = location_address_new ("1",  "Post Street", NULL, "san jose", "ca", NULL, "95113");
        GList *acc_list = NULL;
        ret = location_get_position_from_address(loc, addr, NULL, &acc_list);
        location_address_free (addr);
index a646f28..06e7dfd 100755 (executable)
@@ -50,13 +50,13 @@ AC_COMPILE_IFELSE(
 AC_MSG_RESULT($has_visibility)
 
 # Check dependencies
-PKG_CHECK_MODULES(LOCATION, [glib-2.0 gobject-2.0 dbus-glib-1 gmodule-2.0 vconf])
+PKG_CHECK_MODULES(LOCATION, [glib-2.0 gobject-2.0 dbus-glib-1 gmodule-2.0 vconf vconf-internal-keys location-appman])
 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)
+#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],
@@ -84,7 +84,6 @@ location/Makefile
 location/manager/Makefile
 location/map-service/Makefile
 location/module/Makefile
-tests/Makefile
 ])
 
 AC_OUTPUT
index 370e857..0848fc8 100644 (file)
@@ -1,7 +1,133 @@
+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
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.3.34-13
 
  -- Minjune Kim <sena06.kim@samsung.com>  Mon, 02 Apr 2012 16:59:08 +0900
@@ -10,7 +136,6 @@ 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
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.3.34-12
 
  -- Minjune Kim <sena06.kim@samsung.com>  Tue, 27 Mar 2012 11:09:07 +0900
@@ -18,7 +143,6 @@ libslp-location (0.3.34-12) unstable; urgency=low
 libslp-location (0.3.34-11) unstable; urgency=low
 
   * Add location_route_step_set_transport_mode / location_route_step_get_transport_mode
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.3.34-11
 
  -- Minjune Kim <sena06.kim@samsung.com>  Mon, 26 Mar 2012 17:00:48 +0900
@@ -26,7 +150,6 @@ libslp-location (0.3.34-11) unstable; urgency=low
 libslp-location (0.3.34-10) unstable; urgency=low
 
   * Check param's range in funcs.
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.3.34-10
 
  -- Minjune Kim <sena06.kim@samsung.com>  Thu, 22 Mar 2012 13:18:42 +0900
@@ -34,7 +157,6 @@ libslp-location (0.3.34-10) unstable; urgency=low
 libslp-location (0.3.34-9) unstable; urgency=low
 
   * Fix the bug that location_get_map_service_pref returned fail
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.3.34-9
 
  -- Minjune Kim <sena06.kim@samsung.com>  Tue, 20 Mar 2012 22:15:17 +0900
@@ -42,7 +164,6 @@ libslp-location (0.3.34-9) unstable; urgency=low
 libslp-location (0.3.34-8) unstable; urgency=low
 
   * modity TC script and copy satellite info with timestamp
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.3.34-8
 
  -- Minjune Kim <sena06.kim@samsung.com>  Mon, 19 Mar 2012 20:49:24 +0900
@@ -50,7 +171,6 @@ libslp-location (0.3.34-8) unstable; urgency=low
 libslp-location (0.3.34-7) unstable; urgency=low
 
   * add libgconf-dbus-dev in control
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.3.34-7
 
  -- Genie Kim <daejins.kim@samsung.com>  Fri, 16 Mar 2012 11:33:54 +0900
@@ -58,7 +178,6 @@ libslp-location (0.3.34-7) unstable; urgency=low
 libslp-location (0.3.34-6) unstable; urgency=low
 
   * Support Capability APIs
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.3.34-6
 
  -- Minjune Kim <sena06.kim@samsung.com>  Wed, 14 Mar 2012 20:35:31 +0900
@@ -66,7 +185,6 @@ libslp-location (0.3.34-6) unstable; urgency=low
 libslp-location (0.3.34-5) unstable; urgency=low
 
   * Add dbus_g_thread_init & g_thread_init to location_init
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.3.34-5
 
  -- Minjune Kim <sena06.kim@samsung.com>  Fri, 09 Mar 2012 16:29:07 +0900
@@ -74,7 +192,6 @@ libslp-location (0.3.34-5) unstable; urgency=low
 libslp-location (0.3.34-4) unstable; urgency=low
 
   * Change a wps_start to support an emulator.
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.3.34-4
 
  -- Minjune Kim <sena06.kim@samsung.com>  Wed, 07 Mar 2012 10:59:54 +0900
@@ -83,16 +200,14 @@ libslp-location (0.3.34-3) unstable; urgency=low
 
   * Add POI func & Route prototype
   * Implement get_last_xxx & Update satellite info
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.3.34-3
 
- -- Minjune Kim <sena06.kim@samsung.com>  Thu, 23 Feb 2012 14:29:51 +0900
+ -- 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
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.3.34-2
 
  -- Minjune Kim <sena06.kim@samsung.com>  Mon, 13 Feb 2012 21:03:22 +0900
@@ -101,7 +216,6 @@ libslp-location (0.3.34-1) unstable; urgency=low
 
   * Support to get multi positions using geocode service.
   * Correct typo.
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.3.34-1
 
  -- Minjune Kim <sena06.kim@samsung.com>  Fri, 03 Feb 2012 15:01:49 +0900
@@ -109,7 +223,6 @@ libslp-location (0.3.34-1) unstable; urgency=low
 libslp-location (0.3.33-2) unstable; urgency=low
 
   * Remove a needless conditional code.
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.3.33-2
 
  -- Minjune Kim <sena06.kim@samsung.com>  Sun, 29 Jan 2012 09:48:48 +0900
@@ -117,7 +230,6 @@ libslp-location (0.3.33-2) unstable; urgency=low
 libslp-location (0.3.33-1) unstable; urgency=low
 
   * Enable to get last known position for each method.
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.3.33-1
 
  -- Minjune Kim <sena06.kim@samsung.com>  Thu, 19 Jan 2012 19:44:12 +0900
@@ -125,7 +237,6 @@ libslp-location (0.3.33-1) unstable; urgency=low
 libslp-location (0.3.32-1) unstable; urgency=low
 
   * Fix a bug that a module is not started when a service turns on.
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.3.32-1
 
  -- Minjune Kim <sena06.kim@samsung.com>  Fri, 06 Jan 2012 17:10:12 +0900
@@ -133,7 +244,6 @@ libslp-location (0.3.32-1) unstable; urgency=low
 libslp-location (0.3.31-2) unstable; urgency=low
 
   * check a method before creating its object.
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.3.31-2
 
  -- Minjune Kim <sena06.kim@samsung.com>  Mon, 19 Dec 2011 21:34:46 +0900
@@ -141,7 +251,6 @@ libslp-location (0.3.31-2) unstable; urgency=low
 libslp-location (0.3.31-1) unstable; urgency=low
 
   * change default value of location serverce from 'On' to 'Off'
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.3.31-1
 
  -- Genie Kim <daejins.kim@samsung.com>  Thu, 08 Dec 2011 20:08:49 +0900
@@ -149,7 +258,6 @@ libslp-location (0.3.31-1) unstable; urgency=low
 libslp-location (0.3.30-1) unstable; urgency=low
 
   * add an empty body of location_send_command & support exception case
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.3.30-1
 
  -- Minjune Kim <sena06.kim@samsung.com>  Tue, 06 Dec 2011 17:05:16 +0900
@@ -157,7 +265,6 @@ libslp-location (0.3.30-1) unstable; urgency=low
 libslp-location (0.3.29-1) unstable; urgency=low
 
   * Support multi boundaries & add new API, location_is_enabled_gps
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.3.29-1
 
  -- Minjune Kim <sena06.kim@samsung.com>  Thu, 03 Nov 2011 22:16:21 +0900
@@ -165,7 +272,6 @@ libslp-location (0.3.29-1) unstable; urgency=low
 libslp-location (0.3.28-1) unstable; urgency=low
 
   * fix the bug that the last value of logitude was truncated.
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.3.28-1
 
  -- Minjune Kim <sena06.kim@samsung.com>  Wed, 02 Nov 2011 14:42:03 +0900
@@ -173,7 +279,6 @@ libslp-location (0.3.28-1) unstable; urgency=low
 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
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.3.27-1
 
  -- Minjune Kim <sena06.kim@samsung.com>  Mon, 31 Oct 2011 11:17:21 +0900
@@ -181,7 +286,6 @@ libslp-location (0.3.27-1) unstable; urgency=low
 libslp-location (0.3.26-1) unstable; urgency=low
 
   * vconf key is changed and use time_t for timestamp
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.3.26-1
 
  -- Genie Kim <daejins.kim@samsung.com>  Mon, 17 Oct 2011 13:29:19 +0900
@@ -189,7 +293,6 @@ libslp-location (0.3.26-1) unstable; urgency=low
 libslp-location (0.3.25-1) unstable; urgency=low
 
   * add location_is_supported_method, location_send_command & update_interval
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.3.25-1
 
  -- Minjune Kim <sena06.kim@samsung.com>  Wed, 12 Oct 2011 12:36:45 +0900
@@ -197,7 +300,6 @@ libslp-location (0.3.25-1) unstable; urgency=low
 libslp-location (0.3.24-1) unstable; urgency=low
 
   * add location_get_last_known_position & fix prevent defect
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.3.24-1
 
  -- Genie Kim <daejins.kim@samsung.com>  Thu, 29 Sep 2011 21:37:27 +0900
@@ -205,7 +307,6 @@ libslp-location (0.3.24-1) unstable; urgency=low
 libslp-location (0.3.23-2) unstable; urgency=low
 
   * change maintainer in boilerplate
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.3.23-2
 
  -- Genie Kim <daejins.kim@samsung.com>  Wed, 20 Jul 2011 17:56:38 +0900
@@ -213,7 +314,6 @@ libslp-location (0.3.23-2) unstable; urgency=low
 libslp-location (0.3.23-1) unstable; urgency=low
 
   * Vconfkey value is changed by new UI guide
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.3.23-1
 
  -- Genie Kim <daejins.kim@samsung.com>  Fri, 01 Jul 2011 17:42:34 +0900
@@ -221,7 +321,6 @@ libslp-location (0.3.23-1) unstable; urgency=low
 libslp-location (0.3.22-1) unstable; urgency=low
 
   * Release New Location APIs
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.3.22-1
 
  -- Tae-Hwan Kim <the81.kim@samsung.com>  Wed, 20 Apr 2011 11:07:38 +0900
@@ -229,7 +328,6 @@ libslp-location (0.3.22-1) unstable; urgency=low
 libslp-location (0.2.22-1) unstable; urgency=low
 
   * Bug fix when hybrid exit
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.2.22-1
 
  -- Tae-Hwan Kim <the81.kim@samsung.com>  Thu, 10 Mar 2011 19:44:07 +0900
@@ -237,7 +335,6 @@ libslp-location (0.2.22-1) unstable; urgency=low
 libslp-location (0.2.21-1) unstable; urgency=low
 
   * Always update GPS data to PDR in hybrid mode & change some names
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.2.21-1
 
  -- Tae-Hwan Kim <the81.kim@samsung.com>  Thu, 10 Mar 2011 14:52:09 +0900
@@ -245,7 +342,6 @@ libslp-location (0.2.21-1) unstable; urgency=low
 libslp-location (0.2.20-1) unstable; urgency=low
 
   * Location eanbled by UX guide
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.2.20-1
 
  -- Tae-Hwan Kim <the81.kim@samsung.com>  Mon, 07 Mar 2011 21:01:50 +0900
@@ -253,15 +349,6 @@ libslp-location (0.2.20-1) unstable; urgency=low
 libslp-location (0.2.19-2) unstable; urgency=low
 
   * Release again for sbox i386 build
-  * Git: pkgs/l/libslp-location
-  * Tag: libslp-location_0.2.19-2
-
- -- Tae-Hwan Kim <the81.kim@samsung.com>  Mon, 07 Mar 2011 09:19:06 +0900
-
-libslp-location (0.2.19-1) unstable; urgency=low
-
-  * Apply prevent
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.2.19-1
 
  -- sangho park <sangho.g.park@samsung.com>  Tue, 22 Feb 2011 13:57:22 +0900
@@ -269,7 +356,6 @@ libslp-location (0.2.19-1) unstable; urgency=low
 libslp-location (0.2.18-2) unstable; urgency=low
 
   * Fix depends for Sbox1
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.2.18-2
 
  -- Tae-Hwan Kim <the81.kim@samsung.com>  Thu, 17 Feb 2011 20:07:52 +0900
@@ -277,7 +363,6 @@ libslp-location (0.2.18-2) unstable; urgency=low
 libslp-location (0.2.18-1) unstable; urgency=low
 
   * Add SPS object/module
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.2.18-1
 
  -- Tae-Hwan Kim <the81.kim@samsung.com>  Wed, 16 Feb 2011 16:52:43 +0900
@@ -285,7 +370,6 @@ libslp-location (0.2.18-1) unstable; urgency=low
 libslp-location (0.2.17-1) unstable; urgency=low
 
   * Apply prevent & Fix PG
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.2.17-1
 
  -- Tae-Hwan Kim <the81.kim@samsung.com>  Tue, 08 Feb 2011 13:04:34 +0900
@@ -293,7 +377,6 @@ libslp-location (0.2.17-1) unstable; urgency=low
 libslp-location (0.2.16-2) unstable; urgency=low
 
   * Add prevent & Fix accuracy
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.2.16-2
 
  -- Tae-Hwan Kim <the81.kim@samsung.com>  Tue, 25 Jan 2011 17:12:01 +0900
@@ -301,7 +384,6 @@ libslp-location (0.2.16-2) unstable; urgency=low
 libslp-location (0.2.16-1) unstable; urgency=low
 
   * Add CPS/IPS & Async address API & Appy vconf security
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.2.16-1
 
  -- Tae-Hwan Kim <the81.kim@samsung.com>  Wed, 19 Jan 2011 11:39:22 +0900
@@ -309,7 +391,6 @@ libslp-location (0.2.16-1) unstable; urgency=low
 libslp-location (0.2.15-1) unstable; urgency=low
 
   * Apply TC recomm. & change default setting value to 0
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.2.15-1
 
  -- Tae-hwan Kim <the81.kim@samsung.com>  Thu, 06 Jan 2011 10:21:04 +0900
@@ -317,7 +398,6 @@ libslp-location (0.2.15-1) unstable; urgency=low
 libslp-location (0.2.14-1) unstable; urgency=low
 
   * Change plugin & guide & Fix TC
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.2.14-1
 
  -- Tae-hwan Kim <the81.kim@samsung.com>  Mon, 20 Dec 2010 17:27:55 +0900
@@ -325,7 +405,6 @@ libslp-location (0.2.14-1) unstable; urgency=low
 libslp-location (0.2.13-0) unstable; urgency=low
 
   * Fix build dependency
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.2.13-0
 
  -- Tae-hwan Kim <the81.kim@samsung.com>  Mon, 13 Dec 2010 13:03:30 +0900
@@ -333,7 +412,6 @@ libslp-location (0.2.13-0) unstable; urgency=low
 libslp-location (0.2.12-0) unstable; urgency=low
 
   * Fix plugin & guide & add setting feature
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.2.12-0
 
  -- Tae-hwan Kim <the81.kim@samsung.com>  Mon, 13 Dec 2010 09:40:53 +0900
@@ -341,7 +419,6 @@ libslp-location (0.2.12-0) unstable; urgency=low
 libslp-location (0.2.11-0) unstable; urgency=low
 
   * Add hybri mode & Fix some bugs
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.2.11-0
 
  -- Tae-hwan Kim <the81.kim@samsung.com>  Mon, 29 Nov 2010 10:57:57 +0900
@@ -349,7 +426,6 @@ libslp-location (0.2.11-0) unstable; urgency=low
 libslp-location (0.2.10-0) unstable; urgency=low
 
   * Fix minor bugs
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.2.10-0
 
  -- Tae-hwan Kim <the81.kim@samsung.com>  Wed, 24 Nov 2010 23:26:37 +0900
@@ -357,7 +433,6 @@ libslp-location (0.2.10-0) unstable; urgency=low
 libslp-location (0.2.9-1) unstable; urgency=low
 
   * Remove caching
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.2.9-1
 
  -- Tae-hwan Kim <the81.kim@samsung.com>  Tue, 23 Nov 2010 14:29:20 +0900
@@ -365,7 +440,6 @@ libslp-location (0.2.9-1) unstable; urgency=low
 libslp-location (0.2.8-1) unstable; urgency=low
 
   * Fix plugin priority & Fix sample code bug
-  * git: pkgs/l/libslp-location
   * Tag: libslp-location_0.2.8-1
 
  -- Tae-hwan Kim <the81.kim@samsung.com>  Wed, 10 Nov 2010 21:46:03 +0900
@@ -373,7 +447,6 @@ libslp-location (0.2.8-1) unstable; urgency=low
 libslp-location (0.2.7-1) unstable; urgency=low
 
   * Add geocode object & Enable wps object
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.2.7-1
 
  -- Tae-hwan Kim <the81.kim@samsung.com>  Mon, 08 Nov 2010 23:03:50 +0900
@@ -381,7 +454,6 @@ libslp-location (0.2.7-1) unstable; urgency=low
 libslp-location (0.1.7-1) unstable; urgency=low
 
   * Remove unnecessary dependencies(geoclue-skyhook,gpsd ..)
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.1.7-1
 
  -- Tae-hwan Kim <the81.kim@samsung.com>  Mon, 01 Nov 2010 13:53:11 +0900
@@ -389,7 +461,6 @@ libslp-location (0.1.7-1) unstable; urgency=low
 libslp-location (0.1.6-1) unstable; urgency=low
 
   * Fix dependency
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.1.6-1
 
  -- Tae-hwan Kim <the81.kim@samsung.com>  Sun, 31 Oct 2010 16:59:48 +0900
@@ -397,7 +468,6 @@ libslp-location (0.1.6-1) unstable; urgency=low
 libslp-location (0.1.5-1) unstable; urgency=low
 
   * Fix for limo
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.1.5-1
 
  -- Tae-hwan Kim <the81.kim@samsung.com>  Fri, 29 Oct 2010 16:26:43 +0900
@@ -405,7 +475,6 @@ libslp-location (0.1.5-1) unstable; urgency=low
 libslp-location (0.1.4-2) unstable; urgency=low
 
   * Remove version field for limo
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.1.4-2
 
  -- Tae-hwan Kim <the81.kim@samsung.com>  Fri, 29 Oct 2010 14:50:42 +0900
@@ -413,7 +482,6 @@ libslp-location (0.1.4-2) unstable; urgency=low
 libslp-location (0.1.4-1) unstable; urgency=low
 
   * Add version field in control
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.1.4-1
 
  -- Tae-hwan Kim <the81.kim@samsung.com>  Fri, 29 Oct 2010 14:18:01 +0900
@@ -421,7 +489,6 @@ libslp-location (0.1.4-1) unstable; urgency=low
 libslp-location (0.1.3-1) unstable; urgency=low
 
   * Fix PG & sample, Change signal emission
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.1.3-1
 
  -- Tae-hwan Kim <the81.kim@samsung.com>  Fri, 29 Oct 2010 13:49:11 +0900
@@ -429,7 +496,6 @@ libslp-location (0.1.3-1) unstable; urgency=low
 libslp-location (0.1.2-1) unstable; urgency=low
 
   * Add more bolier plate
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.1.2-1
 
  -- Tae-hwan Kim <the81.kim@samsung.com>  Tue, 26 Oct 2010 16:40:31 +0900
@@ -437,7 +503,6 @@ libslp-location (0.1.2-1) unstable; urgency=low
 libslp-location (0.1.1-1) unstable; urgency=low
 
   * Fix for PG & Doxygen & Limo Contrib.
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.1.1-1
 
  -- Tae-hwan Kim <the81.kim@samsung.com>  Tue, 26 Oct 2010 12:22:16 +0900
@@ -445,7 +510,6 @@ libslp-location (0.1.1-1) unstable; urgency=low
 libslp-location (0.1.0-15) unstable; urgency=low
 
   * Update programming guide & test case for address APIs
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.1.0-15
 
  -- Tae-hwan Kim <the81.kim@samsung.com>  Sat, 16 Oct 2010 20:53:38 +0900
@@ -453,7 +517,6 @@ libslp-location (0.1.0-15) unstable; urgency=low
 libslp-location (0.1.0-14) unstable; urgency=low
 
   * Adapt to libdecarta
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.1.0-14
 
  -- Tae-hwan Kim <the81.kim@samsung.com>  Mon, 11 Oct 2010 22:33:14 +0900
@@ -461,7 +524,6 @@ libslp-location (0.1.0-14) unstable; urgency=low
 libslp-location (0.1.0-13) unstable; urgency=low
 
   * Add input parameter error handling & Change TC
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.1.0-13
 
  -- Tae-hwan Kim <the81.kim@samsung.com>  Mon, 27 Sep 2010 20:03:09 +0900
@@ -469,7 +531,6 @@ libslp-location (0.1.0-13) unstable; urgency=low
 libslp-location (0.1.0-12) unstable; urgency=low
 
   * Fix in zone in/out & Add more test case
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.1.0-12
 
  -- Tae-hwan Kim <the81.kim@samsung.com>  Fri, 17 Sep 2010 16:56:35 +0900
@@ -477,7 +538,6 @@ libslp-location (0.1.0-12) unstable; urgency=low
 libslp-location (0.1.0-11) unstable; urgency=low
 
   * Add glib-genmarshal & Remove marshal source/header
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.1.0-11
 
  -- Tae-hwan Kim <the81.kim@samsung.com>  Tue, 14 Sep 2010 10:18:37 +0900
@@ -485,7 +545,6 @@ libslp-location (0.1.0-11) unstable; urgency=low
 libslp-location (0.1.0-10) unstable; urgency=low
 
   * Change programming guide & doxygen comments
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.1.0-10
 
  -- Tae-hwan Kim <the81.kim@samsung.com>  Fri, 10 Sep 2010 14:52:24 +0900
@@ -493,7 +552,6 @@ libslp-location (0.1.0-10) unstable; urgency=low
 libslp-location (0.1.0-9) unstable; urgency=low
 
   * Change programming guilde & Add sample codes
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.1.0-9
 
  -- Tae-hwan Kim <the81.kim@samsung.com>  Thu, 09 Sep 2010 17:50:27 +0900
@@ -501,7 +559,6 @@ libslp-location (0.1.0-9) unstable; urgency=low
 libslp-location (0.1.0-8) unstable; urgency=low
 
   * Add zone in/out & boundary feature
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.1.0-8
 
  -- Tae-hwan Kim <the81.kim@samsung.com>  Mon, 06 Sep 2010 10:57:08 +0900
@@ -509,7 +566,6 @@ libslp-location (0.1.0-8) unstable; urgency=low
 libslp-location (0.1.0-7) unstable; urgency=low
 
   * Adapt to geoclue change
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.1.0-7
 
  -- Tae-hwan Kim <the81.kim@samsung.com>  Sat, 04 Sep 2010 19:40:16 +0900
@@ -517,7 +573,6 @@ libslp-location (0.1.0-7) unstable; urgency=low
 libslp-location (0.1.0-6) unstable; urgency=low
 
   * Change programming guide & test application
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.1.0-6
 
  -- Tae-hwan Kim <the81.kim@samsung.com>  Wed, 01 Sep 2010 20:07:34 +0900
@@ -525,7 +580,6 @@ libslp-location (0.1.0-6) unstable; urgency=low
 libslp-location (0.1.0-5) unstable; urgency=low
 
   * Change fw name in doxygen & release again
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.1.0-5
 
  -- Tae-hwan Kim <the81.kim@samsung.com>  Tue, 31 Aug 2010 23:28:12 +0900
@@ -533,7 +587,6 @@ libslp-location (0.1.0-5) unstable; urgency=low
 libslp-location (0.1.0-4) unstable; urgency=low
 
   * Add doxygen & change API return value to integer
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.1.0-4
 
  -- Tae-hwan Kim <the81.kim@samsung.com>  Tue, 31 Aug 2010 22:09:35 +0900
@@ -541,7 +594,6 @@ libslp-location (0.1.0-4) unstable; urgency=low
 libslp-location (0.1.0-3) unstable; urgency=low
 
   * Change header dependency for relase
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.1.0-3
 
  -- Tae-hwan Kim <the81.kim@samsung.com>  Mon, 30 Aug 2010 20:58:04 +0900
@@ -549,7 +601,6 @@ libslp-location (0.1.0-3) unstable; urgency=low
 libslp-location (0.1.0-2) unstable; urgency=low
 
   * Fix header include & Release again
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.1.0-2
 
  -- Tae-hwan Kim <the81.kim@samsung.com>  Mon, 30 Aug 2010 17:51:44 +0900
@@ -557,7 +608,6 @@ libslp-location (0.1.0-2) unstable; urgency=low
 libslp-location (0.1.0-1) unstable; urgency=low
 
   * Initial version
-  * Git: pkgs/l/libslp-location
   * Tag: libslp-location_0.1.0-1
 
  -- Tae-hwan Kim <the81.kim@samsung.com>  Mon, 30 Aug 2010 12:01:05 +0900
index 9527507..22b0c80 100755 (executable)
@@ -3,7 +3,7 @@ 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>
 Uploaders: Genie Kim <daejins.kim@samsung.com>
-Build-Depends: debhelper (>= 5), libglib2.0-dev, libdbus-glib-1-dev, dlog-dev, libvconf-dev, libvconf-keys-dev, libjson-glib-dev, libgconf-dbus-dev
+Build-Depends: debhelper (>= 5), libglib2.0-dev, libdbus-glib-1-dev, dlog-dev, libvconf-dev, libvconf-keys-dev, vconf-internal-keys-dev, libjson-glib-dev, libgconf-dbus-dev
 Standards-Version: 3.7.2
 Homepage: N/A
 
index 872b534..d3e98d7 100755 (executable)
@@ -1,8 +1,6 @@
 #!/bin/sh
 
 #setting 
-if [ "${USER}" = "root" ]
-then
 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
@@ -18,27 +16,19 @@ 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/last/cps/Timestamp "0" -f
+vconftool set -t double db/location/last/cps/Latitude "0.0" -f
+vconftool set -t double db/location/last/cps/Longitude "0.0" -f
+vconftool set -t double db/location/last/cps/Altitude "0.0" -f
+vconftool set -t double db/location/last/cps/HorAccuracy "0.0" -f
+if [ "${USER}" = "root" ]
+then
 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
 vconftool set -t int db/location/setting/SensorEnabled "0" -g 6514 -f
 else
 
-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 -f
 vconftool set -t int db/location/setting/AgpsEnabled "0" -f
 vconftool set -t int db/location/setting/NetworkEnabled "0" -f
index bf901e0..a9a8641 100644 (file)
@@ -7,7 +7,7 @@ datadir=@datadir@
 
 Name: location
 Description: SLP Location FW
-Requires: glib-2.0 gobject-2.0 gmodule-2.0 vconf
+Requires: glib-2.0 gobject-2.0 gmodule-2.0 vconf location-appman
 Version: @VERSION@
 Libs: -L${libdir} -lSLP-location
 Cflags: -I${includedir} -I${includedir}/location
index a5dd525..b4ada5b 100755 (executable)
@@ -7,43 +7,44 @@ MAP_SERVICE_DIR = map-service
 MODULE_DIR = module
 
 libSLP_location_la_SOURCES = \
-                                                       ${MANAGER_DIR}/location.c\
-                                                       ${MAP_SERVICE_DIR}/location-map-service.c
+                       ${MANAGER_DIR}/location.c\
+                       ${MAP_SERVICE_DIR}/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)
+                       -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)
+                       ${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 \
-                                                                 ${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-pref.h  \
-                                                                 ${MAP_SERVICE_DIR}/location-landmark.h  \
-                                                                 ${MAP_SERVICE_DIR}/location-landmark-ext.h  \
-                                                                 ${MODULE_DIR}/location-module.h
+                       ${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
diff --git a/location/include/location-map-types.h b/location/include/location-map-types.h
new file mode 100644 (file)
index 0000000..c36d788
--- /dev/null
@@ -0,0 +1,166 @@
+/*
+ * libslp-location
+ *
+ * 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_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_DISTANCE_UNIT,
+
+       MAP_SERVICE_PREF_PROPERTY,
+
+       MAP_SERVICE_GEOCODE_TYPE,
+       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;
+
+/**
+ * @brief Location Map Object redefined by GObject.
+ */
+typedef GObject LocationMapObject;
+
+/**
+ * @brief This represents address information such as building number, street name, etc.
+ */
+typedef struct _LocationAddress    LocationAddress;
+
+/**
+ * @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 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 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__ */
index c1d150d..f51ccd3 100644 (file)
  * limitations under the License.
  */
 
-#ifndef __LOCATION_TYPE_H__
-#define __LOCATION_TYPE_H__
+#ifndef __LOCATION_TYPES_H__
+#define __LOCATION_TYPES_H__
 
 #include <glib.h>
 #include <glib-object.h>
 
 G_BEGIN_DECLS
 
-#ifndef LOCATION_DEPRECATED_API
-#define LOCATION_DEPRECATED_API        __attribute__ ((deprecated))
-#endif
-
 /**
  * @file location-types.h
  * @brief This file contains the Location related structure, enumeration, and asynchronous function definitions.
@@ -42,6 +38,7 @@ G_BEGIN_DECLS
  * @{
  */
 
+
 /**
  * @brief This represents the returned error code of used functions.
  */
@@ -68,66 +65,18 @@ typedef enum
        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.
-       LOCATION_METHOD_IPS,         ///< This method uses IP address.
-       LOCATION_METHOD_SPS          ///< This method uses sensor.
 } LocationMethod;
 
 /**
- * @brief This represents the update type given by signal callback.
+ * @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.
-       ADDRESS_UPDATED,        ///< This type is used when address information is updated. This is not implemented yet.
-       GEOCODE_UPDATED,        ///< This type is used when geocode information is updated. This is not implemented yet.
-       REVERSEGEOCODE_UPDATED  ///< This type is used when reverse geocode information is updated. This is not implemented yet.
 } LocationUpdateType;
 
-typedef enum {
-       MAP_SERVICE_PREF_LANGUAGE,
-       MAP_SERVICE_PREF_DISTANCE_UNIT,
-
-       MAP_SERVICE_PREF_PROPERTY,
-
-       MAP_SERVICE_GEOCODE_TYPE,
-       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;
-
 /**
  * @brief Location object redefined by GObject.
  */
@@ -165,79 +114,9 @@ typedef struct _LocationAccuracy   LocationAccuracy;
 typedef struct _LocationBoundary   LocationBoundary;
 
 /**
- * @brief This represents address information such as building number, street name, etc.
- */
-typedef struct _LocationAddress    LocationAddress;
-
-/**
- * @brief This represents a structure of Location preference.
- */
-typedef struct _LocationPreference LocationPreference;
-
-/**
- * @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 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 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_TYPE_H__ */
+#endif /* __LOCATION_TYPES_H__ */
index df26216..cce6736 100644 (file)
@@ -19,7 +19,7 @@ liblocation_manager_la_SOURCES = \
                                                        location-common-util.c \\r
                                                        location-gps.c       \\r
                                                        location-wps.c       \\r
-                                                       location-sps.c       \\r
+                                                       location-cps.c       \\r
                                                        location-hybrid.c\r
 \r
 liblocation_manager_la_CFLAGS = \\r
index 7fa79ea..1ce61f2 100644 (file)
@@ -104,7 +104,7 @@ location_boundary_new_for_rect (LocationPosition* left_top,
        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(right_bottom->longitude <= left_top->longitude || right_bottom->latitude <= left_top->latitude)
                        return NULL;
        }
        else {
index 290a6e0..4e178d0 100644 (file)
  * limitations under the License.
  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <location-appman.h>
+
 #include "location.h"
 #include "location-common-util.h"
 #include "location-setting.h"
 #include "location-log.h"
 
+
+int location_application_enabled (void)
+{
+       pid_t pid = getpid();
+       location_appman_s *appman;
+       int enabled;
+       int found;
+       time_t timestamp;
+
+       if (TRUE == location_appman_check_developer_mode()) {
+               LOCATION_LOGE("Location is Enabled");
+               return TRUE;
+       }
+
+       if (location_appman_get_package_by_pid(pid, &appman) != LOCATION_APPMAN_ERROR_NONE) {
+               LOCATION_LOGE("Fail to location_appman_get_package_by_pid");
+               return FALSE;
+       }
+
+       if (location_appman_find_package(appman->package, &found) != LOCATION_APPMAN_ERROR_NONE) {
+               LOCATION_LOGE("Cannot find package [%s]", appman->package);
+               return FALSE;
+       }
+
+       if (found == LOCATION_APPMAN_PACKAGE_NOTFOUND) {
+               LOCATION_LOGD("First time to use location [%s]", appman->package);
+               if (location_appman_register_package(appman) != LOCATION_APPMAN_ERROR_NONE) {
+                       LOCATION_LOGE("Fail to register [%s]", appman->package);
+                       return FALSE;
+               }
+       } else {
+               LOCATION_LOGD("[%s] is already registered. Update recently used time", appman->package);
+               time(&timestamp);
+               if (location_appman_set_recently_used(appman->package, timestamp) != LOCATION_APPMAN_ERROR_NONE) {
+                       LOCATION_LOGD("Cannot update recently used time");
+               }
+       }
+
+       if (location_appman_is_enabled(appman->package, &enabled) != LOCATION_APPMAN_ERROR_NONE) {
+               LOCATION_LOGE("Fail to location_appman_is_enabled");
+               return FALSE;
+       }
+       return enabled;
+}
+
 static gint compare_position (gconstpointer a, gconstpointer b)
 {
        g_return_val_if_fail(a, 1);
@@ -169,3 +223,11 @@ int set_prop_removal_boundary(GList **prev_boundary_list, LocationBoundary* boun
 
        return LOCATION_ERROR_NONE;
 }
+
+void free_boundary_list (gpointer data)
+{
+       LocationBoundary *boundary = (LocationBoundary *)data;
+
+       location_boundary_free(boundary);
+}
+
index 99d005d..4ed94fd 100644 (file)
 
 G_BEGIN_DECLS
 
+int location_application_manager (void);
+int location_application_enabled (void);
+
 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);
 
 G_END_DECLS
 
index 63b0795..5e3b43e 100644 (file)
 #include "location-cps.h"
 #include "location-marshal.h"
 #include "location-ielement.h"
+#include "location-signaling-util.h"
+#include "location-common-util.h"
 
 typedef struct _LocationCpsPrivate {
        LocationCpsMod *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;
+       ZoneStatus zone_status;
+       guint pos_timer;
+       guint vel_timer;
 } LocationCpsPrivate;
 
 enum {
        PROP_0,
        PROP_METHOD_TYPE,
-       PROP_LAST_POSITION
+       PROP_POS_INTERVAL,
+       PROP_VEL_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_CPS, LocationCpsPrivate))
 
 static void location_ielement_interface_init (LocationIElementInterface *iface);
@@ -52,10 +74,180 @@ G_DEFINE_TYPE_WITH_CODE (LocationCps, location_cps, G_TYPE_OBJECT,
                          G_IMPLEMENT_INTERFACE (LOCATION_TYPE_IELEMENT,
                          location_ielement_interface_init));
 
+static gboolean
+_position_timeout_cb (gpointer data)
+{
+       GObject *object = (GObject *)data;
+       LocationCpsPrivate *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("VELOCITY 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)
+{
+       GObject *object = (GObject *)data;
+       LocationCpsPrivate *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
+cps_status_cb (gboolean enabled,
+       LocationStatus status,
+       gpointer self)
+{
+       LOCATION_LOGD("cps_status_cb");
+       g_return_if_fail(self);
+       LocationCpsPrivate* priv = GET_PRIVATE(self);
+       enable_signaling(self, signals, &(priv->enabled), enabled, status);
+       if (!priv->enabled) {
+               if (priv->pos_timer) {
+                       g_source_remove(g_source_remove(priv->pos_timer));
+                       priv->pos_timer = 0;
+               }
+               if (priv->vel_timer) {
+                       g_source_remove(g_source_remove(priv->vel_timer));
+                       priv->vel_timer = 0;
+               }
+       }
+}
+
+static void
+cps_position_cb (gboolean enabled,
+       LocationPosition *pos,
+       LocationAccuracy *acc,
+       gpointer self)
+{
+       LOCATION_LOGD("cps_position_cb");
+       g_return_if_fail(self);
+       g_return_if_fail(pos);
+       g_return_if_fail(acc);
+       LocationCpsPrivate* priv = GET_PRIVATE(self);
+
+       if (enabled && !priv->enabled) {
+               if (!priv->pos_timer) priv->pos_timer = g_timeout_add_seconds (priv->pos_interval, _position_timeout_cb, self);
+               if (!priv->vel_timer) priv->vel_timer = g_timeout_add_seconds (priv->vel_interval, _velocity_timeout_cb, self);
+       }
+
+       enable_signaling(self, signals, &(priv->enabled), enabled, pos->status);
+       position_signaling(self, signals, &(priv->enabled), priv->pos_interval, FALSE, &(priv->pos_updated_timestamp), &(priv->pos), &(priv->acc), priv->boundary_list, &(priv->zone_status), pos, acc);
+}
+
+static void
+cps_velocity_cb(gboolean enabled,
+       LocationVelocity *vel,
+       LocationAccuracy *acc,
+       gpointer self)
+{
+       LOCATION_LOGD("cps_velocity_cb");
+       g_return_if_fail(self);
+       LocationCpsPrivate* priv = GET_PRIVATE(self);
+       velocity_signaling(self, signals, &(priv->enabled), priv->vel_interval, FALSE, &(priv->vel_updated_timestamp), &(priv->vel), vel, acc);
+}
+
+static void
+location_setting_cps_cb (keynode_t *key,
+               gpointer self)
+{
+       LOCATION_LOGD("location_setting_cps_cb");
+       g_return_if_fail (key);
+       g_return_if_fail (self);
+
+       LocationCpsPrivate *priv = GET_PRIVATE(self);
+       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) {
+                       ret = priv->mod->ops.stop (priv->mod->handler);
+                       if (ret == LOCATION_ERROR_NONE) {
+                               priv->is_started = FALSE;
+                       }
+               }
+       }
+       else {
+               if (1 == location_setting_get_int (VCONFKEY_LOCATION_NETWORK_ENABLED) && priv->mod->ops.start && !priv->is_started) {
+                       LOCATION_LOGD("location resumed by setting");
+                       ret = priv->mod->ops.start (priv->mod->handler, cps_status_cb, cps_position_cb, cps_velocity_cb, NULL, self);
+                       if (ret == LOCATION_ERROR_NONE) {
+                               priv->is_started = TRUE;
+                       }
+               }
+       }
+}
+
 static void
 location_cps_dispose (GObject *gobject)
 {
        LOCATION_LOGD("location_cps_dispose");
+
+       LocationCpsPrivate *priv = GET_PRIVATE(gobject);
+       if (priv->set_noti == TRUE) {
+               location_setting_ignore_notify (VCONFKEY_LOCATION_NETWORK_ENABLED, location_setting_cps_cb);
+               priv->set_noti = FALSE;
+       }
+
+       if (priv->pos_timer) {
+               g_source_remove (priv->pos_timer);
+               priv->pos_timer = 0;
+       }
+
+       if (priv->vel_timer) {
+               g_source_remove (priv->vel_timer);
+               priv->vel_timer = 0;
+       }
+
        G_OBJECT_CLASS (location_cps_parent_class)->dispose (gobject);
 }
 
@@ -67,10 +259,98 @@ location_cps_finalize (GObject *gobject)
        module_free(priv->mod, "cps");
        priv->mod = NULL;
 
+       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;
+       }
+
        G_OBJECT_CLASS (location_cps_parent_class)->finalize (gobject);
 }
 
 static void
+location_cps_set_property (GObject *object,
+       guint property_id,
+       GValue *value,
+       GParamSpec *pspec)
+{
+       LocationCpsPrivate *priv = GET_PRIVATE(object);
+
+       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("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;
+                       }
+
+                       if (priv->pos_timer) {
+                               g_source_remove (priv->pos_timer);
+                               priv->pos_timer = g_timeout_add_seconds (priv->pos_interval, _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 = (guint)LOCATION_UPDATE_INTERVAL_DEFAULT;
+
+                       if (priv->vel_timer) {
+                               g_source_remove (priv->vel_timer);
+                               priv->vel_timer = g_timeout_add_seconds (priv->vel_interval, _velocity_timeout_cb, object);
+                       }
+
+                       break;
+               }
+               default:
+                       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+                       break;
+       }
+}
+
+static void
 location_cps_get_property (GObject *object,
        guint property_id,
        GValue *value,
@@ -82,8 +362,11 @@ location_cps_get_property (GObject *object,
                case PROP_METHOD_TYPE:
                        g_value_set_int(value, LOCATION_METHOD_CPS);
                        break;
-               case PROP_LAST_POSITION:{
-                       g_value_set_boxed (value, priv->pos);
+               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;
                }
                default:
@@ -93,32 +376,159 @@ location_cps_get_property (GObject *object,
 }
 
 static int
+location_cps_start (LocationCps *self)
+{
+       LOCATION_LOGD("location_cps_start");
+
+       LocationCpsPrivate* 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);
+
+       if (priv->is_started == TRUE) return LOCATION_ERROR_NONE;
+
+       int ret = LOCATION_ERROR_NONE;
+
+       if (!location_setting_get_int (VCONFKEY_LOCATION_NETWORK_ENABLED)) {
+               ret = LOCATION_ERROR_NOT_ALLOWED;
+       }
+       else {
+               ret = priv->mod->ops.start (priv->mod->handler, cps_status_cb, cps_position_cb, cps_velocity_cb, NULL, self);
+               if (ret == LOCATION_ERROR_NONE) {
+                       priv->is_started = TRUE;
+               }
+               else {
+                       return ret;
+               }
+       }
+
+       if (priv->set_noti == FALSE) {
+               location_setting_add_notify (VCONFKEY_LOCATION_NETWORK_ENABLED, location_setting_cps_cb, self);
+               priv->set_noti = TRUE;
+       }
+
+       return ret;
+}
+
+static int
+location_cps_stop (LocationCps *self)
+{
+       LOCATION_LOGD("location_cps_stop");
+       LocationCpsPrivate* 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);
+
+       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 {
+                       return ret;
+               }
+       }
+
+       if (priv->set_noti == TRUE) {
+               location_setting_ignore_notify (VCONFKEY_LOCATION_NETWORK_ENABLED, location_setting_cps_cb);
+               priv->set_noti = FALSE;
+       }
+
+       return ret;
+}
+
+static int
 location_cps_get_position (LocationCps *self,
-       LocationPosition **position,
-       LocationAccuracy **accuracy)
+               LocationPosition **position,
+               LocationAccuracy **accuracy)
 {
+       int ret = LOCATION_ERROR_NOT_AVAILABLE;
        LOCATION_LOGD("location_cps_get_position");
 
        LocationCpsPrivate *priv = GET_PRIVATE (self);
        g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
-       setting_retval_if_fail(GPS_ENABLED);
-       setting_retval_if_fail(NETWORK_ENABLED);
+
+       setting_retval_if_fail(VCONFKEY_LOCATION_NETWORK_ENABLED);
+
+       if (priv->pos) {
+               *position = location_position_copy (priv->pos);
+               ret = LOCATION_ERROR_NONE;
+       }
+
+       if (priv->acc) {
+       }
+       else {
+               *accuracy = location_accuracy_copy (priv->acc);
+       }
+
+       return ret;
+}
+
+static int
+location_cps_get_last_position (LocationCps *self,
+               LocationPosition **position,
+               LocationAccuracy **accuracy)
+{
+       LOCATION_LOGD("location_cps_get_last_position");
+
+       /* Do not need to check GPS_ENABLED and NETWORK_ENABLED */
+
+       LocationCpsPrivate *priv = GET_PRIVATE(self);
+       g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
 
        LocModCpsOps ops = priv->mod->ops;
        g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
-       g_return_val_if_fail (ops.get_position, LOCATION_ERROR_NOT_AVAILABLE);
-       int ret = ops.get_position(priv->mod->handler, position, accuracy);
-       if(priv->pos) location_position_free(priv->pos);
-       if(priv->acc) location_accuracy_free(priv->acc);
-       priv->pos = location_position_copy(*position);
-       priv->acc = location_accuracy_copy(*accuracy);
-       return ret;
+       g_return_val_if_fail (ops.get_last_position, LOCATION_ERROR_NOT_AVAILABLE);
+
+       return ops.get_last_position (priv->mod->handler, position, accuracy);
+}
+
+static int
+location_cps_get_velocity (LocationCps *self,
+               LocationVelocity **velocity,
+               LocationAccuracy **accuracy)
+{
+       LOCATION_LOGD("location_cps_get_velocity");
+       return LOCATION_ERROR_NOT_SUPPORTED;
+}
+
+static int
+location_cps_get_last_velocity (LocationCps *self,
+               LocationVelocity **velocity,
+               LocationAccuracy **accuracy)
+{
+       LOCATION_LOGD("location_cps_get_last_velocity");
+       return LOCATION_ERROR_NOT_SUPPORTED;
+}
+
+static int
+location_cps_get_satellite (LocationCps *self,
+               LocationSatellite **satellite)
+{
+       LOCATION_LOGD("location_cps_get_satellite");
+       return LOCATION_ERROR_NOT_SUPPORTED;
+}
+
+static int
+location_cps_get_last_satellite (LocationCps *self)
+{
+       LOCATION_LOGD("location_cps_get_last_satellite");
+       return LOCATION_ERROR_NOT_SUPPORTED;
 }
 
 static void
 location_ielement_interface_init (LocationIElementInterface *iface)
 {
-       iface->get_position = (TYPE_GET_POSITION)location_cps_get_position;
+       iface->start = (TYPE_START_FUNC) location_cps_start;
+       iface->stop = (TYPE_STOP_FUNC) location_cps_stop;
+       iface->get_position = (TYPE_GET_POSITION) location_cps_get_position;
+       iface->get_last_position = (TYPE_GET_POSITION) location_cps_get_last_position;
+       iface->get_velocity = (TYPE_GET_VELOCITY) location_cps_get_velocity;
+       iface->get_last_velocity = (TYPE_GET_VELOCITY)location_cps_get_last_velocity;
+       iface->get_satellite = (TYPE_GET_SATELLITE)location_cps_get_satellite;
+       iface->get_last_satellite = (TYPE_GET_SATELLITE)location_cps_get_last_satellite;
 }
 
 static void
@@ -130,8 +540,24 @@ location_cps_init (LocationCps *self)
        priv->mod = (LocationCpsMod*)module_new("cps");
        if(!priv->mod) LOCATION_LOGW("module loading failed");
 
+       priv->is_started = FALSE;
+       priv->set_noti = FALSE;
+       priv->enabled = FALSE;
+
+       priv->pos_interval = LOCATION_UPDATE_INTERVAL_DEFAULT;
+       priv->vel_interval = LOCATION_UPDATE_INTERVAL_DEFAULT;
+
+       priv->pos_updated_timestamp = 0;
+       priv->vel_updated_timestamp = 0;
+
        priv->pos = NULL;
        priv->acc = NULL;
+       priv->vel = NULL;
+       priv->zone_status = ZONE_STATUS_NONE;
+       priv->boundary_list = NULL;
+
+       priv->pos_timer = 0;
+       priv->vel_timer = 0;
 }
 
 static void
@@ -139,33 +565,108 @@ location_cps_class_init (LocationCpsClass *klass)
 {
        LOCATION_LOGD("location_cps_class_init");
        GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-       GParamSpec *pspec;
 
        gobject_class->get_property = location_cps_get_property;
+       gobject_class->set_property = location_cps_set_property;
 
        gobject_class->dispose = location_cps_dispose;
        gobject_class->finalize = location_cps_finalize;
 
        g_type_class_add_private (klass, sizeof (LocationCpsPrivate));
 
-       pspec = g_param_spec_int ("method",
+       signals[SERVICE_ENABLED] = g_signal_new ("service-enabled",
+                       G_TYPE_FROM_CLASS (klass),
+                       G_SIGNAL_RUN_FIRST |
+                       G_SIGNAL_NO_RECURSE,
+                       G_STRUCT_OFFSET (LocationCpsClass, 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 (LocationCpsClass, 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 (LocationCpsClass, 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 (LocationCpsClass, zone_in),
+                       NULL, NULL,
+                       location_VOID__UINT_POINTER_POINTER,
+                       G_TYPE_NONE, 3,
+                       G_TYPE_UINT,
+                       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 (LocationCpsClass, zone_out),
+                       NULL, NULL,
+                       location_VOID__UINT_POINTER_POINTER,
+                       G_TYPE_NONE, 3,
+                       G_TYPE_UINT,
+                       G_TYPE_POINTER,
+                       G_TYPE_POINTER);
+
+       properties[PROP_METHOD_TYPE] = g_param_spec_int ("method",
                                 "method type",
                                 "location method type name",
                                 LOCATION_METHOD_CPS,
                                 LOCATION_METHOD_CPS,
                                 LOCATION_METHOD_CPS,
                                 G_PARAM_READABLE);
-       g_object_class_install_property (gobject_class,
-                                   PROP_METHOD_TYPE,
-                                   pspec);
-
-       pspec = g_param_spec_boxed ("last-position",
-                                "cps last position prop",
-                                "cps last position data",
-                                LOCATION_TYPE_POSITION,
-                                G_PARAM_READABLE);
-       g_object_class_install_property (gobject_class,
-                                   PROP_LAST_POSITION,
-                                   pspec);
-}
 
+       properties[PROP_POS_INTERVAL] = g_param_spec_uint ("pos-interval",
+                               "cps position interval prop",
+                               "cps 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",
+                       "cps velocity interval prop",
+                       "cps 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",
+                       "cps boundary prop",
+                       "cps boundary data",
+                       G_PARAM_READWRITE);
+
+       properties[PROP_REMOVAL_BOUNDARY] = g_param_spec_boxed("removal-boundary",
+                       "cps removal boundary prop",
+                       "cps removal boundary data",
+                       LOCATION_TYPE_BOUNDARY,
+                       G_PARAM_READWRITE);
+
+       g_object_class_install_properties (gobject_class,
+                       PROP_MAX,
+                       properties);
+
+}
index 8e12a36..b628181 100644 (file)
@@ -49,6 +49,12 @@ struct _LocationCps
 struct _LocationCpsClass
 {
        GObjectClass parent_class;
+
+       void (* enabled) (guint type);
+       void (* disabled) (guint type);
+       void (* updated) (guint type, gpointer data);
+       void (* zone_in) (guint type, gpointer position, gpointer boundary);
+       void (* zone_out) (guint type, gpointer position, gpointer boundary);
 };
 
 GType location_cps_get_type (void);
index 131b41b..12fee81 100644 (file)
 #include "location-signaling-util.h"
 #include "location-common-util.h"
 
+#include <vconf-internal-location-keys.h>
 
 typedef struct _LocationGpsPrivate {
        LocationGpsMod*         mod;
        gboolean                is_started;
        gboolean                set_noti;
        gboolean                enabled;
-       guint                   interval;
+       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;
        GList*                  boundary_list;
        ZoneStatus              zone_status;
-       guint                   sat_timestamp;
        LocationSatellite*      sat;
+
+       guint                   pos_timer;
+       guint                   vel_timer;
+
 } LocationGpsPrivate;
 
 enum {
@@ -55,7 +64,9 @@ enum {
        PROP_DEV_NAME,
        PROP_METHOD_TYPE,
        PROP_LAST_POSITION,
-       PROP_UPDATE_INTERVAL,
+       PROP_POS_INTERVAL,
+       PROP_VEL_INTERVAL,
+       PROP_SAT_INTERVAL,
        PROP_BOUNDARY,
        PROP_REMOVAL_BOUNDARY,
        PROP_NMEA,
@@ -74,6 +85,72 @@ G_DEFINE_TYPE_WITH_CODE (LocationGps, location_gps, G_TYPE_OBJECT,
                          G_IMPLEMENT_INTERFACE (LOCATION_TYPE_IELEMENT,
                          location_ielement_interface_init));
 
+static gboolean
+_position_timeout_cb (gpointer data)
+{
+       GObject *object = (GObject *)data;
+       LocationGpsPrivate *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)
+{
+       GObject *object = (GObject *)data;
+       LocationGpsPrivate *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
 gps_status_cb (gboolean enabled,
        LocationStatus status,
@@ -83,6 +160,13 @@ gps_status_cb (gboolean enabled,
        g_return_if_fail(self);
        LocationGpsPrivate* priv = GET_PRIVATE(self);
        enable_signaling(self, signals, &(priv->enabled), enabled, status);
+
+       if (!priv->enabled) {
+               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
@@ -96,8 +180,10 @@ gps_position_cb (gboolean enabled,
        g_return_if_fail(pos);
        g_return_if_fail(acc);
        LocationGpsPrivate* priv = GET_PRIVATE(self);
+
        enable_signaling(self, signals, &(priv->enabled), enabled, pos->status);
-       position_signaling(self, signals, &(priv->enabled), priv->interval, &(priv->pos), &(priv->acc), priv->boundary_list, &(priv->zone_status), enabled, pos, acc);
+       position_signaling(self, signals, &(priv->enabled), priv->pos_interval, TRUE, &(priv->pos_updated_timestamp), &(priv->pos), &(priv->acc), priv->boundary_list, &(priv->zone_status), pos, acc);
+
 }
 
 static void
@@ -109,7 +195,7 @@ gps_velocity_cb (gboolean enabled,
        LOCATION_LOGD("gps_velocity_cb");
        g_return_if_fail(self);
        LocationGpsPrivate* priv = GET_PRIVATE(self);
-       velocity_signaling(self, signals, &(priv->enabled), priv->interval, &(priv->vel), enabled, vel, acc);
+       velocity_signaling(self, signals, &(priv->enabled), priv->vel_interval, TRUE, &(priv->vel_updated_timestamp), &(priv->vel), vel, acc);
 }
 
 static void
@@ -120,7 +206,29 @@ gps_satellite_cb (gboolean enabled,
        LOCATION_LOGD("gps_satellite_cb");
        g_return_if_fail(self);
        LocationGpsPrivate* priv = GET_PRIVATE(self);
-       satellite_signaling(self, signals, &(priv->enabled), priv->interval, &(priv->sat_timestamp), &(priv->sat), enabled, sat);
+       satellite_signaling(self, signals, &(priv->enabled), priv->sat_interval, TRUE, &(priv->sat_updated_timestamp), &(priv->sat), sat);
+}
+
+static void
+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);
+
+       if (location_setting_get_key_val(key) == VCONFKEY_LOCATION_GPS_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
@@ -139,12 +247,16 @@ location_setting_gps_cb (keynode_t *key,
        if (0 == location_setting_get_key_val(key) && priv->mod->ops.stop && priv->is_started) {
                LOCATION_LOGD("location stopped by setting");
                ret = priv->mod->ops.stop(priv->mod->handler);
-               if (ret == LOCATION_ERROR_NONE) priv->is_started = FALSE;
+               if (ret == LOCATION_ERROR_NONE) {
+                       priv->is_started = FALSE;
+               }
        }
        else if (1 == location_setting_get_key_val(key) && priv->mod->ops.start && !priv->is_started) {
                LOCATION_LOGD("location resumed by setting");
                ret = priv->mod->ops.start (priv->mod->handler, gps_status_cb, gps_position_cb, gps_velocity_cb, gps_satellite_cb, self);
-               if (ret == LOCATION_ERROR_NONE) priv->is_started = TRUE;
+               if (ret == LOCATION_ERROR_NONE) {
+                       priv->is_started = TRUE;
+               }
        }
 }
 
@@ -160,9 +272,8 @@ location_gps_start (LocationGps *self)
        if (priv->is_started == TRUE) return LOCATION_ERROR_NONE;
 
        int ret = LOCATION_ERROR_NONE;
-       int noti_err = 0;
 
-       if (!location_setting_get_int(GPS_ENABLED)) {
+       if (!location_setting_get_int(VCONFKEY_LOCATION_ENABLED)) {
                ret = LOCATION_ERROR_NOT_ALLOWED;
        }
        else {
@@ -176,10 +287,8 @@ location_gps_start (LocationGps *self)
        }
 
        if(priv->set_noti == FALSE) {
-               noti_err = location_setting_add_notify (GPS_ENABLED, location_setting_gps_cb, self);
-               if (noti_err != 0) {
-                       return LOCATION_ERROR_UNKNOWN;
-               }
+               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);
                priv->set_noti = TRUE;
        }
 
@@ -196,7 +305,6 @@ location_gps_stop (LocationGps *self)
        g_return_val_if_fail (priv->mod->ops.stop, LOCATION_ERROR_NOT_AVAILABLE);
 
        int ret = LOCATION_ERROR_NONE;
-       int noti_err = 0;
 
        if ( priv->is_started == TRUE) {
                ret = priv->mod->ops.stop (priv->mod->handler);
@@ -208,11 +316,14 @@ location_gps_stop (LocationGps *self)
                }
        }
 
+       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) {
-               noti_err = location_setting_ignore_notify (GPS_ENABLED, location_setting_gps_cb);
-               if (noti_err != 0) {
-                       return LOCATION_ERROR_UNKNOWN;
-               }
+               location_setting_ignore_notify (VCONFKEY_LOCATION_ENABLED, location_setting_gps_cb);
+               location_setting_ignore_notify (VCONFKEY_LOCATION_GPS_STATE, location_setting_search_cb);
                priv->set_noti = FALSE;
        }
 
@@ -223,7 +334,20 @@ static void
 location_gps_dispose (GObject *gobject)
 {
        LOCATION_LOGD("location_gps_dispose");
-       G_OBJECT_CLASS (location_gps_parent_class)->dispose (gobject);
+
+       LocationGpsPrivate* 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_ENABLED, location_setting_gps_cb);
+               location_setting_ignore_notify (VCONFKEY_LOCATION_GPS_STATE, location_setting_search_cb);
+               priv->set_noti = FALSE;
+       }
+
 }
 
 static void
@@ -231,8 +355,34 @@ location_gps_finalize (GObject *gobject)
 {
        LOCATION_LOGD("location_gps_finalize");
        LocationGpsPrivate* priv = GET_PRIVATE(gobject);
+
        module_free(priv->mod, "gps");
        priv->mod = NULL;
+
+       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_gps_parent_class)->finalize (gobject);
 }
 
@@ -270,17 +420,56 @@ location_gps_set_property (GObject *object,
                        if(ret != 0) LOCATION_LOGD("Removal boundary. Error[%d]", ret);
                        break;
                }
-               case PROP_UPDATE_INTERVAL: {
+               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;
+                       }
+                       else
+                               priv->pos_interval = (guint)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);
                        LOCATION_LOGD("Set prop>> update-interval: %u", interval);
                        if(interval > 0) {
                                if(interval < LOCATION_UPDATE_INTERVAL_MAX)
-                                       priv->interval = interval;
+                                       priv->vel_interval = interval;
                                else
-                                       priv->interval = (guint)LOCATION_UPDATE_INTERVAL_MAX;
+                                       priv->vel_interval = (guint)LOCATION_UPDATE_INTERVAL_MAX;
                        }
                        else
-                               priv->interval = (guint)LOCATION_UPDATE_INTERVAL_DEFAULT;
+                               priv->vel_interval = (guint)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);
+                       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;
+                       }
+                       else
+                               priv->sat_interval = (guint)LOCATION_UPDATE_INTERVAL_DEFAULT;
+
                        break;
                }
                default:
@@ -316,8 +505,14 @@ location_gps_get_property (GObject *object,
                case PROP_LAST_POSITION:
                        g_value_set_boxed (value, priv->pos);
                        break;
-               case PROP_UPDATE_INTERVAL:
-                       g_value_set_uint(value, priv->interval);
+               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_BOUNDARY:
                        g_value_set_pointer(value, g_list_first(priv->boundary_list));
@@ -357,16 +552,27 @@ 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);
-       setting_retval_if_fail(GPS_ENABLED);
+       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_position, LOCATION_ERROR_NOT_AVAILABLE);
-       return ops.get_position(priv->mod->handler, position, accuracy);
+
+       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
@@ -374,7 +580,7 @@ location_gps_get_last_position (LocationGps *self,
        LocationPosition **position,
        LocationAccuracy **accuracy)
 {
-       LOCATION_LOGD("location_gps_get_position");
+       LOCATION_LOGD("location_gps_get_last_position");
        // Enable to get a last position even though GPS_ENABLE dose not set on
 
        LocationGpsPrivate *priv = GET_PRIVATE (self);
@@ -394,14 +600,26 @@ location_gps_get_velocity (LocationGps *self,
 {
        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);
-       setting_retval_if_fail(GPS_ENABLED);
+       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_velocity, LOCATION_ERROR_NOT_AVAILABLE);
-       return ops.get_velocity(priv->mod->handler, velocity, accuracy);
+       
+       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
@@ -413,7 +631,7 @@ location_gps_get_last_velocity (LocationGps *self,
 
        LocationGpsPrivate *priv = GET_PRIVATE (self);
        g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
-       setting_retval_if_fail(GPS_ENABLED);
+       setting_retval_if_fail(VCONFKEY_LOCATION_ENABLED);
 
        LocModGpsOps ops = priv->mod->ops;
        g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
@@ -426,16 +644,19 @@ static int
 location_gps_get_satellite (LocationGps *self,
        LocationSatellite **satellite)
 {
+       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);
-       setting_retval_if_fail(GPS_ENABLED);
+       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_satellite, LOCATION_ERROR_NOT_AVAILABLE);
-       return ops.get_satellite(priv->mod->handler, satellite);
+       if (priv->sat) {
+               *satellite = location_satellite_copy (priv->sat);
+               ret = LOCATION_ERROR_NONE;
+       }
+       
+       return ret;
 }
 
 static int
@@ -446,7 +667,7 @@ location_gps_get_last_satellite (LocationGps *self,
 
        LocationGpsPrivate *priv = GET_PRIVATE (self);
        g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
-       setting_retval_if_fail(GPS_ENABLED);
+       setting_retval_if_fail(VCONFKEY_LOCATION_ENABLED);
 
        LocModGpsOps ops = priv->mod->ops;
        g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
@@ -479,13 +700,25 @@ location_gps_init (LocationGps *self)
        priv->is_started = FALSE;
        priv->set_noti = FALSE;
        priv->enabled= FALSE;
-       priv->interval = LOCATION_UPDATE_INTERVAL_DEFAULT;
+
+       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->pos = NULL;
        priv->vel = NULL;
        priv->acc = NULL;
+       priv->sat = NULL;
        priv->zone_status = ZONE_STATUS_NONE;
        priv->boundary_list = NULL;
+
+       priv->pos_timer = 0;
+       priv->vel_timer = 0;
+
 }
 
 static void
@@ -578,14 +811,30 @@ location_gps_class_init (LocationGpsClass *klass)
                        LOCATION_TYPE_POSITION,
                        G_PARAM_READABLE);
 
-       properties[PROP_UPDATE_INTERVAL] = g_param_spec_uint ("update-interval",
-                       "gps update interval prop",
-                       "gps update interval data",
+       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",
index 41f4c9c..e8c906c 100644 (file)
 
 #include "location-gps.h"
 #include "location-wps.h"
-#include "location-sps.h"
+#include "location-cps.h"
 
 typedef struct _LocationHybridPrivate {
        gboolean is_started;
        gboolean gps_enabled;
        gboolean wps_enabled;
-       gboolean sps_enabled;
-       guint interval;
-       guint sat_timestamp;
+       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;
-       LocationObject *sps;
        gboolean enabled;
        LocationMethod current_method;
        LocationPosition *pos;
@@ -57,13 +59,19 @@ typedef struct _LocationHybridPrivate {
        GList* boundary_list;
        ZoneStatus zone_status;
 
+       gboolean set_noti;
+       guint pos_timer;
+       guint vel_timer;
+
 } LocationHybridPrivate;
 
 enum {
        PROP_0,
        PROP_METHOD_TYPE,
        PROP_LAST_POSITION,
-       PROP_UPDATE_INTERVAL,
+       PROP_POS_INTERVAL,
+       PROP_VEL_INTERVAL,
+       PROP_SAT_INTERVAL,
        PROP_BOUNDARY,
        PROP_REMOVAL_BOUNDARY,
        PROP_MAX
@@ -80,70 +88,174 @@ 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 LocationObject*
-hybrid_get_update_method_obj (LocationHybridPrivate* priv)
+static gboolean
+hybrid_set_current_method (LocationHybridPrivate* priv, GType g_type)
 {
-       if(!priv->sps && !priv->gps && !priv->wps) return NULL;
-
-       LocationObject* obj = NULL;
-       if (priv->sps_enabled) {
-               LOCATION_LOGW("Current method is SPS");
-               priv->current_method = LOCATION_METHOD_SPS;
-               obj = priv->sps;
-       } else if (priv->gps_enabled) {
-               LOCATION_LOGW("Current method is GPS");
+       g_return_val_if_fail (priv, FALSE);
+
+       if (g_type == LOCATION_TYPE_GPS) {
                priv->current_method = LOCATION_METHOD_GPS;
-               obj = priv->gps;
-       } else if (priv->wps_enabled) {
-               LOCATION_LOGW("Current method is WPS");
+               LOCATION_LOGW("Set current Method [%d]\n", priv->current_method);
+       } else if (g_type == LOCATION_TYPE_WPS) {
                priv->current_method = LOCATION_METHOD_WPS;
-               obj = priv->wps;
-       } else {
-               LOCATION_LOGW("No current method available");
+               LOCATION_LOGW("Set current Method [%d]\n", priv->current_method);
+       } else if (g_type == LOCATION_TYPE_HYBRID){
                priv->current_method = LOCATION_METHOD_HYBRID;
-               obj = NULL;
+               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
-hybrid_is_equal_g_type_method(GType g_type, LocationMethod method)
+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_SPS && method == LOCATION_METHOD_SPS) return TRUE;
-       if (g_type == LOCATION_TYPE_GPS && method == LOCATION_METHOD_GPS) return TRUE;
-       if (g_type == LOCATION_TYPE_WPS && method == LOCATION_METHOD_WPS) return TRUE;
+       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
-hybrid_update_sps(LocationHybrid* self,
-       guint type,
-       gpointer data,
-       gpointer accuracy)
+location_hybrid_state_cb (keynode_t *key, gpointer self)
 {
-       LocationHybridPrivate* priv = GET_PRIVATE(self);
-       if (!priv->sps) return;
-       LOCATION_LOGD ("hybrid_update_sps");
+       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);
 
-       switch (type) {
-               case POSITION_UPDATED: {
-                       if (data) g_object_set(priv->sps, "position-base", data, NULL);
-                       if (priv->gps) {
-                               LocationSatellite* sat = NULL;
-                               g_object_get(priv->gps, "satellite", &sat, NULL);
-                               if (sat) {
-                                       g_object_set(priv->sps, "satellite-info", sat, NULL);
-                                       location_satellite_free (sat);
-                               }
-                       }
-                       if (accuracy) g_object_set(priv->sps, "accuracy-info", accuracy, NULL);
-                       break;
-               }
-               case VELOCITY_UPDATED:
-                       if (data) g_object_set(priv->sps, "velocity-base", data, NULL);
-                       if (accuracy) g_object_set(priv->sps, "accuracy-info", accuracy, NULL);
-                       break;
+       }
+       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;
        }
 }
 
@@ -154,25 +266,59 @@ hybrid_service_updated (GObject *obj,
        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;
+               }
+               case VELOCITY_UPDATED: {
+                       vel = (LocationVelocity *)data;
+                       if (!vel->timestamp) return;
+               }
+               case SATELLITE_UPDATED: {
+                       sat = (LocationSatellite *)data;
+                       if (!sat->timestamp) return;
+               }
+       }
+
        LocationHybridPrivate* priv = GET_PRIVATE((LocationHybrid*)self);
        GType g_type = G_TYPE_FROM_INSTANCE(obj);
        if (g_type == LOCATION_TYPE_GPS) {
                if (type == SATELLITE_UPDATED) {
-                       LocationSatellite *sat = (LocationSatellite *) data;
-                       satellite_signaling(self, signals, &(priv->enabled), priv->interval, &(priv->sat_timestamp), &(priv->sat), TRUE, sat);
-               } else hybrid_update_sps((LocationHybrid*)self, type, data, accuracy);
+                       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 || g_type == LOCATION_TYPE_CPS) && location_setting_get_int (VCONFKEY_LOCATION_WPS_STATE) == VCONFKEY_LOCATION_WPS_SEARCHING) {
+               LOCATION_LOGD ("Searching WPS or CPS");
+               return;
        }
 
-       if (hybrid_is_equal_g_type_method(g_type, priv->current_method)) {
+       if (hybrid_compare_g_type_method(priv, g_type)) {
                LocationAccuracy *acc = (LocationAccuracy*)accuracy;
                if (type == POSITION_UPDATED) {
-                       LocationPosition *pos = (LocationPosition*)data;
-                       position_signaling(self, signals, &(priv->enabled), priv->interval, &(priv->pos), &(priv->acc), priv->boundary_list, &(priv->zone_status), TRUE, pos, acc);
+                       position_signaling(self, signals, &(priv->enabled), priv->pos_interval, TRUE, &(priv->pos_updated_timestamp), &(priv->pos), &(priv->acc), priv->boundary_list, &(priv->zone_status), pos, acc);
+                       LOCATION_LOGW("Position updated. timestamp [%d]", priv->pos->timestamp);
                } else if (type == VELOCITY_UPDATED) {
-                       LocationVelocity *vel = (LocationVelocity*) data;
-                       velocity_signaling(self, signals, &(priv->enabled), priv->interval, &(priv->vel), TRUE, vel, acc);
-               }else LOCATION_LOGW ("Undefined GType updated");
+                       velocity_signaling(self, signals, &(priv->enabled), priv->vel_interval, TRUE, &(priv->vel_updated_timestamp), &(priv->vel), 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);
+                       }
        }
 
 }
@@ -185,16 +331,16 @@ hybrid_service_enabled (GObject *obj,
        LOCATION_LOGD ("hybrid_service_enabled");
        LocationHybridPrivate* priv = GET_PRIVATE((LocationHybrid*)self);
        GType g_type = G_TYPE_FROM_INSTANCE(obj);
-       if (g_type == LOCATION_TYPE_SPS)     priv->sps_enabled = TRUE;
-       else if(g_type == LOCATION_TYPE_GPS) priv->gps_enabled = TRUE;
+       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_obj(priv);
-       if(priv->sps_enabled || priv->gps_enabled || priv->wps_enabled)
+       hybrid_get_update_method(priv);
+       if(priv->gps_enabled || priv->wps_enabled)
                enable_signaling(self, signals, &(priv->enabled), TRUE, status);
+
 }
 
 static void
@@ -205,16 +351,16 @@ hybrid_service_disabled (GObject *obj,
        LOCATION_LOGD ("hybrid_service_disabled");
        LocationHybridPrivate* priv = GET_PRIVATE((LocationHybrid*)self);
        GType g_type = G_TYPE_FROM_INSTANCE(obj);
-       if (g_type == LOCATION_TYPE_SPS)     priv->sps_enabled = FALSE;
-       else if(g_type == LOCATION_TYPE_GPS) priv->gps_enabled = FALSE;
+       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_obj(priv);
-       if(!priv->sps_enabled && !priv->gps_enabled && !priv->wps_enabled)
+       hybrid_get_update_method(priv);
+       if(!priv->gps_enabled && !priv->wps_enabled)
                enable_signaling(self, signals, &(priv->enabled), FALSE, status);
+
 }
 
 static int
@@ -224,7 +370,6 @@ location_hybrid_start (LocationHybrid *self)
 
        int ret_gps = LOCATION_ERROR_NONE;
        int ret_wps = LOCATION_ERROR_NONE;
-       int ret_sps = LOCATION_ERROR_NONE;
 
        LocationHybridPrivate* priv = GET_PRIVATE(self);
        if (priv->is_started == TRUE)
@@ -232,14 +377,11 @@ location_hybrid_start (LocationHybrid *self)
 
        if(priv->gps) ret_gps = location_start(priv->gps);
        if(priv->wps) ret_wps = location_start(priv->wps);
-       if(priv->sps) ret_sps = location_start(priv->sps);
 
        if (ret_gps != LOCATION_ERROR_NONE &&
-               ret_wps != LOCATION_ERROR_NONE &&
-               ret_sps != LOCATION_ERROR_NONE) {
+                       ret_wps != LOCATION_ERROR_NONE) {
                if (ret_gps == LOCATION_ERROR_NOT_ALLOWED ||
-                               ret_wps == LOCATION_ERROR_NOT_ALLOWED ||
-                               ret_sps == LOCATION_ERROR_NOT_ALLOWED) {
+                               ret_wps == LOCATION_ERROR_NOT_ALLOWED) {
                        priv->is_started = TRUE;
                        return LOCATION_ERROR_NOT_ALLOWED;
                }
@@ -249,6 +391,13 @@ location_hybrid_start (LocationHybrid *self)
        }
 
        priv->is_started = TRUE;
+
+       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;
 }
 
@@ -263,19 +412,26 @@ location_hybrid_stop (LocationHybrid *self)
 
        int ret_gps = LOCATION_ERROR_NONE;
        int ret_wps = LOCATION_ERROR_NONE;
-       int ret_sps = LOCATION_ERROR_NONE;
 
        if(priv->gps) ret_gps = location_stop(priv->gps);
        if(priv->wps) ret_wps = location_stop(priv->wps);
-       if(priv->sps) ret_sps = location_stop(priv->sps);
 
        priv->is_started = FALSE;
 
        if (ret_gps != LOCATION_ERROR_NONE &&
-               ret_wps != LOCATION_ERROR_NONE &&
-               ret_sps != 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;
 }
 
@@ -283,6 +439,18 @@ 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);
 }
 
@@ -304,11 +472,30 @@ location_hybrid_finalize (GObject *gobject)
                g_signal_handlers_disconnect_by_func(priv->wps, G_CALLBACK (hybrid_service_updated), gobject);
                location_free(priv->wps);
        }
-       if (priv->sps) {
-               g_signal_handlers_disconnect_by_func(priv->sps, G_CALLBACK (hybrid_service_enabled), gobject);
-               g_signal_handlers_disconnect_by_func(priv->sps, G_CALLBACK (hybrid_service_disabled), gobject);
-               g_signal_handlers_disconnect_by_func(priv->sps, G_CALLBACK (hybrid_service_updated), gobject);
-               location_free(priv->sps);
+
+       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);
@@ -321,7 +508,7 @@ location_hybrid_set_property (GObject *object,
        GParamSpec *pspec)
 {
        LocationHybridPrivate* priv = GET_PRIVATE(object);
-       if (!priv->gps && !priv->wps && !priv->sps) {
+       if (!priv->gps && !priv->wps) {
                LOCATION_LOGW("Set property is not available now");
                return;
        }
@@ -340,17 +527,56 @@ location_hybrid_set_property (GObject *object,
                        if(ret != 0) LOCATION_LOGD("Removal boundary. Error[%d]", ret);
                        break;
                }
-               case PROP_UPDATE_INTERVAL: {
+               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->interval = interval;
+                                       priv->vel_interval = interval;
                                else
-                                       priv->interval = (guint) LOCATION_UPDATE_INTERVAL_MAX;
+                                       priv->vel_interval = (guint) LOCATION_UPDATE_INTERVAL_MAX;
 
                        }
                        else
-                               priv->interval = LOCATION_UPDATE_INTERVAL_DEFAULT;
+                               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:
@@ -366,7 +592,7 @@ location_hybrid_get_property (GObject *object,
        GParamSpec *pspec)
 {
        LocationHybridPrivate *priv = GET_PRIVATE (object);
-       if(!priv->gps && !priv->wps && !priv->sps){
+       if(!priv->gps && !priv->wps){
                LOCATION_LOGW("Get property is not available now");
                return;
        }
@@ -375,7 +601,7 @@ location_hybrid_get_property (GObject *object,
 
        switch (property_id){
        case PROP_METHOD_TYPE:
-               g_value_set_int(value, priv->current_method);
+               g_value_set_int(value, hybrid_get_current_method (priv));
                break;
        case PROP_LAST_POSITION:
                g_value_set_boxed(value, priv->pos);
@@ -383,8 +609,14 @@ location_hybrid_get_property (GObject *object,
        case PROP_BOUNDARY:
                g_value_set_pointer(value, g_list_first(priv->boundary_list));
                break;
-       case PROP_UPDATE_INTERVAL:
-               g_value_set_uint(value, priv->interval);
+       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);
@@ -397,13 +629,24 @@ location_hybrid_get_position (LocationHybrid *self,
        LocationPosition **position,
        LocationAccuracy **accuracy)
 {
+       int ret = LOCATION_ERROR_NOT_AVAILABLE;
        LOCATION_LOGD("location_hybrid_get_position");
-       setting_retval_if_fail(GPS_ENABLED);
+       if (!location_setting_get_int(VCONFKEY_LOCATION_ENABLED) && !location_setting_get_int(VCONFKEY_LOCATION_NETWORK_ENABLED)) {
+               return LOCATION_ERROR_NOT_ALLOWED;
+       }
 
        LocationHybridPrivate *priv = GET_PRIVATE (self);
-       LocationObject *obj = hybrid_get_update_method_obj(priv);
-       if(!obj) return LOCATION_ERROR_NOT_AVAILABLE;
-       return location_get_position (obj, position, accuracy);
+
+       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
@@ -412,7 +655,6 @@ location_hybrid_get_last_position (LocationHybrid *self,
        LocationAccuracy **accuracy)
 {
        LOCATION_LOGD("location_hybrid_get_last_position");
-       setting_retval_if_fail(GPS_ENABLED);
 
        int ret = LOCATION_ERROR_NONE;
        LocationPosition *gps_pos = NULL, *wps_pos = NULL;
@@ -453,13 +695,24 @@ location_hybrid_get_velocity (LocationHybrid *self,
        LocationVelocity **velocity,
        LocationAccuracy **accuracy)
 {
+       int ret = LOCATION_ERROR_NOT_AVAILABLE;
        LOCATION_LOGD("location_hybrid_get_velocity");
-       setting_retval_if_fail(GPS_ENABLED);
+       if (!location_setting_get_int(VCONFKEY_LOCATION_ENABLED) && !location_setting_get_int(VCONFKEY_LOCATION_NETWORK_ENABLED)) {
+               return LOCATION_ERROR_NOT_ALLOWED;
+       }
 
        LocationHybridPrivate *priv = GET_PRIVATE (self);
-       LocationObject *obj = hybrid_get_update_method_obj(priv);
-       if(!obj) return LOCATION_ERROR_NOT_AVAILABLE;
-       return location_get_velocity (obj, velocity, accuracy);
+
+       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
@@ -468,7 +721,6 @@ location_hybrid_get_last_velocity (LocationHybrid *self,
        LocationAccuracy **accuracy)
 {
        LOCATION_LOGD("location_hybrid_get_last_velocity");
-       setting_retval_if_fail(GPS_ENABLED);
 
        int ret = LOCATION_ERROR_NONE;
        LocationHybridPrivate *priv = GET_PRIVATE (self);
@@ -510,15 +762,16 @@ static int
 location_hybrid_get_satellite (LocationHybrid *self,
        LocationSatellite **satellite)
 {
+       int ret = LOCATION_ERROR_NOT_AVAILABLE;
        LOCATION_LOGD("location_hybrid_get_satellite");
-       setting_retval_if_fail(GPS_ENABLED);
+       if (!location_setting_get_int(VCONFKEY_LOCATION_ENABLED) && !location_setting_get_int(VCONFKEY_LOCATION_NETWORK_ENABLED)) {
+               return LOCATION_ERROR_NOT_ALLOWED;
+       }
 
-       int ret = LOCATION_ERROR_NONE;
        LocationHybridPrivate *priv = GET_PRIVATE (self);
-       if (priv->gps) ret = location_get_satellite (priv->gps, satellite);
-       else {
-               *satellite = NULL;
-               ret = LOCATION_ERROR_NOT_AVAILABLE;
+       if (priv->sat) {
+               *satellite = location_satellite_copy (priv->sat);
+               ret = LOCATION_ERROR_NONE;
        }
 
        return ret;
@@ -529,7 +782,6 @@ location_hybrid_get_last_satellite (LocationHybrid *self,
        LocationSatellite **satellite)
 {
        LOCATION_LOGD("location_hybrid_get_last_satellite");
-       setting_retval_if_fail(GPS_ENABLED);
 
        int ret = LOCATION_ERROR_NONE;
        LocationHybridPrivate *priv = GET_PRIVATE (self);
@@ -563,17 +815,27 @@ location_hybrid_init (LocationHybrid *self)
        LocationHybridPrivate* priv = GET_PRIVATE(self);
 
        priv->is_started = FALSE;
-       priv->interval = LOCATION_UPDATE_INTERVAL_DEFAULT;
+       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->sps_enabled = FALSE;
+
        priv->gps = NULL;
        priv->wps = NULL;
-       priv->sps = 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(location_is_supported_method(LOCATION_METHOD_SPS)) priv->sps = location_new (LOCATION_METHOD_SPS);
 
        if(priv->gps){
                g_signal_connect (priv->gps, "service-enabled", G_CALLBACK(hybrid_service_enabled), self);
@@ -585,20 +847,18 @@ location_hybrid_init (LocationHybrid *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);
        }
-       if(priv->sps){
-               g_signal_connect (priv->sps, "service-enabled", G_CALLBACK(hybrid_service_enabled), self);
-               g_signal_connect (priv->sps, "service-disabled", G_CALLBACK(hybrid_service_disabled), self);
-               g_signal_connect (priv->sps, "service-updated", G_CALLBACK(hybrid_service_updated), self);
-       }
 
-       priv->current_method = LOCATION_METHOD_HYBRID;
+       hybrid_set_current_method (priv, LOCATION_TYPE_HYBRID);
        priv->enabled= FALSE;
 
        priv->pos = NULL;
        priv->vel = NULL;
        priv->acc = NULL;
+       priv->sat = NULL;
+
        priv->zone_status = ZONE_STATUS_NONE;
        priv->boundary_list = NULL;
+
 }
 
 static void
@@ -685,9 +945,23 @@ location_hybrid_class_init (LocationHybridClass *klass)
                        LOCATION_TYPE_POSITION,
                        G_PARAM_READABLE);
 
-       properties[PROP_UPDATE_INTERVAL] = g_param_spec_uint ("update-interval",
-                       "update interval prop",
-                       "update interval data",
+       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,
index a044992..762722b 100644 (file)
@@ -59,6 +59,8 @@ struct _LocationHybridClass
 
 GType location_hybrid_get_type (void);
 
+#define HYBRID_POSITION_EXPIRATION_TIME                9
+
 G_END_DECLS
 
 #endif
index ffa63cb..d46a9fe 100644 (file)
@@ -143,204 +143,3 @@ location_ielement_get_last_velocity (LocationIElement *self,
        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_get_geocode (LocationIElement *self,
-       const LocationAddress *address,
-       GList **position_list,
-       GList **accuracy_list)
-{
-       g_return_val_if_fail (LOCATION_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
-       g_return_val_if_fail (address, LOCATION_ERROR_PARAMETER);
-       g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->get_geocode, LOCATION_ERROR_NOT_AVAILABLE);
-       return LOCATION_IELEMENT_GET_INTERFACE (self)->get_geocode (self, address, position_list, accuracy_list);
-}
-
-int
-location_ielement_get_geocode_freeform (LocationIElement *self,
-       const gchar *address,
-       GList **position_list,
-       GList **accuracy_list)
-{
-       g_return_val_if_fail (LOCATION_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
-       g_return_val_if_fail (address, LOCATION_ERROR_PARAMETER);
-       g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->get_geocode_freeform, LOCATION_ERROR_NOT_AVAILABLE);
-       return LOCATION_IELEMENT_GET_INTERFACE (self)->get_geocode_freeform (self, address, position_list, accuracy_list);
-}
-
-int
-location_ielement_get_reversegeocode (LocationIElement *self,
-       const LocationPosition *position,
-       LocationAddress **address,
-       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 (address, LOCATION_ERROR_PARAMETER);
-       g_return_val_if_fail (accuracy, LOCATION_ERROR_PARAMETER);
-       g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->get_reversegeocode, LOCATION_ERROR_NOT_AVAILABLE);
-       return LOCATION_IELEMENT_GET_INTERFACE (self)->get_reversegeocode (self, position, address, accuracy);
-}
-
-int
-location_ielement_get_geocode_async (LocationIElement *self,
-       const LocationAddress *address,
-       LocationPositionCB callback,
-       gpointer userdata)
-{
-       g_return_val_if_fail (LOCATION_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 (LOCATION_IELEMENT_GET_INTERFACE (self)->get_geocode_async, LOCATION_ERROR_NOT_AVAILABLE);
-       return LOCATION_IELEMENT_GET_INTERFACE (self)->get_geocode_async (self, address, callback, userdata);
-}
-
-int
-location_ielement_get_geocode_freeform_async (LocationIElement *self,
-       const gchar *address,
-       LocationPositionCB callback,
-       gpointer userdata)
-{
-       g_return_val_if_fail (LOCATION_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 (LOCATION_IELEMENT_GET_INTERFACE (self)->get_geocode_freeform_async, LOCATION_ERROR_NOT_AVAILABLE);
-       return LOCATION_IELEMENT_GET_INTERFACE (self)->get_geocode_freeform_async (self, address, callback, userdata);
-}
-
-int
-location_ielement_get_reversegeocode_async (LocationIElement *self,
-       const LocationPosition *position,
-       LocationAddressCB callback,
-       gpointer userdata)
-{
-       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 (callback, LOCATION_ERROR_PARAMETER);
-       g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->get_reversegeocode_async, LOCATION_ERROR_NOT_AVAILABLE);
-       return LOCATION_IELEMENT_GET_INTERFACE (self)->get_reversegeocode_async (self, position, callback, userdata);
-}
-
-int
-location_ielement_search_poi (LocationIElement *self,
-               const LocationPOIFilter * filter, const LocationPosition *position,
-               const LocationPreference *svc_pref, const LocationPOIPreference * pref,
-               LocationPOICB cb, const gpointer user_data, guint * req_id)
-{
-       g_return_val_if_fail (LOCATION_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_IELEMENT_GET_INTERFACE (self)->search_poi, LOCATION_ERROR_NOT_AVAILABLE);
-
-       return LOCATION_IELEMENT_GET_INTERFACE (self)->search_poi(self,
-                       filter, position, svc_pref, pref, cb, user_data, req_id);
-}
-
-int
-location_ielement_search_poi_by_area (LocationIElement *self,
-               const LocationPOIFilter * filter, const LocationBoundary * boundary,
-               const LocationPreference *svc_pref, const LocationPOIPreference * pref,
-               LocationPOICB cb, const gpointer user_data, guint * req_id)
-{
-       g_return_val_if_fail (LOCATION_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_IELEMENT_GET_INTERFACE (self)->search_poi_by_area, LOCATION_ERROR_NOT_AVAILABLE);
-
-       return LOCATION_IELEMENT_GET_INTERFACE (self)->search_poi_by_area (self,
-                       filter, boundary, svc_pref, pref, cb, user_data, req_id);
-}
-
-int
-location_ielement_search_poi_by_address (LocationIElement *self,
-               const LocationPOIFilter * filter, const LocationAddress * address,
-               const LocationPreference *svc_pref, const LocationPOIPreference * pref,
-               LocationPOICB cb, const gpointer user_data, guint * req_id)
-{
-       g_return_val_if_fail (LOCATION_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_IELEMENT_GET_INTERFACE (self)->search_poi_by_address, LOCATION_ERROR_NOT_AVAILABLE);
-
-       return LOCATION_IELEMENT_GET_INTERFACE (self)->search_poi_by_address (self,
-                       filter, address, svc_pref, pref, cb, user_data, req_id);
-}
-
-int
-location_ielement_search_poi_by_freeform (LocationIElement *self, const LocationPOIFilter * filter,
-               const gchar *freeform, const LocationPreference *svc_pref, const LocationPOIPreference *pref, LocationPOICB cb,
-               const gpointer user_data, guint * req_id)
-{
-       g_return_val_if_fail (LOCATION_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_IELEMENT_GET_INTERFACE (self)->search_poi_by_freeform, LOCATION_ERROR_NOT_AVAILABLE);
-
-       return LOCATION_IELEMENT_GET_INTERFACE (self)->search_poi_by_freeform (self,
-                       filter, freeform, svc_pref, pref, cb, user_data, req_id);
-}
-
-int
-location_ielement_cancel_poi_request (LocationIElement *self, guint req_id)
-{
-       g_return_val_if_fail (LOCATION_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
-       g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->cancel_poi_request, LOCATION_ERROR_NOT_AVAILABLE);
-
-       return LOCATION_IELEMENT_GET_INTERFACE (self)->cancel_poi_request (self, req_id);
-}
-
-int
-location_ielement_request_route (LocationIElement *self, const LocationPosition *origin,
-               const LocationPosition *destination, GList *waypoint,
-               const LocationPreference *svc_pref, const LocationRoutePreference *pref, LocationRouteCB cb, const gpointer user_data, guint *req_id)
-{
-       g_return_val_if_fail (LOCATION_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_IELEMENT_GET_INTERFACE (self)->request_route, LOCATION_ERROR_NOT_AVAILABLE);
-
-       return LOCATION_IELEMENT_GET_INTERFACE (self)->request_route (self,
-                       origin, destination, waypoint, svc_pref, pref, cb, user_data, req_id);
-}
-
-int
-location_ielement_cancel_route_request (LocationIElement *self, guint req_id)
-{
-       g_return_val_if_fail (LOCATION_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
-       g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->cancel_route_request, LOCATION_ERROR_NOT_AVAILABLE);
-
-       return LOCATION_IELEMENT_GET_INTERFACE (self)->cancel_route_request (self, req_id);
-}
-
-gboolean
-location_ielement_is_supported_map_provider_capability (LocationIElement *self, LocationMapServiceType type)
-{
-       g_return_val_if_fail (LOCATION_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
-       g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->is_supported_map_provider_capability, LOCATION_ERROR_NOT_AVAILABLE);
-
-       return LOCATION_IELEMENT_GET_INTERFACE (self)->is_supported_map_provider_capability (self, type);
-}
-
-int
-location_ielement_get_map_provider_capability_key (LocationIElement *self, LocationMapServiceType type, GList **key)
-{
-       g_return_val_if_fail (LOCATION_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
-       g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->get_map_provider_capability_key, LOCATION_ERROR_NOT_AVAILABLE);
-
-       return LOCATION_IELEMENT_GET_INTERFACE (self)->get_map_provider_capability_key (self, type, key);
-}
index 325ff6d..d821edd 100644 (file)
@@ -30,7 +30,6 @@
 #include <location-address.h>
 #include <location-boundary.h>
 #include <location-satellite.h>
-#include <location-poi.h>
 
 /**
  * @file location-ielement.h
@@ -61,21 +60,6 @@ typedef int (*TYPE_STOP_FUNC) (LocationIElement *self);
 typedef int (*TYPE_GET_POSITION)(LocationIElement *self, LocationPosition **position, 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_GET_GEOCODE)(LocationIElement *self, const LocationAddress *address, GList **position_list, GList **accuracy_list);
-typedef int (*TYPE_GET_GEOCODE_FREEFORM)(LocationIElement *self, const gchar *address, GList **position_list, GList **accuracy_list);
-typedef int (*TYPE_GET_REVERSEGEOCODE)(LocationIElement *self, const LocationPosition *position, LocationAddress **address, LocationAccuracy **accuracy);
-typedef int (*TYPE_GET_GEOCODE_ASYNC)(LocationIElement *self, const LocationAddress *address, LocationPositionCB callback, gpointer userdata);
-typedef int (*TYPE_GET_GEOCODE_FREEFORM_ASYNC)(LocationIElement *self, const gchar *address,  LocationPositionCB callback, gpointer userdata);
-typedef int (*TYPE_GET_REVERSEGEOCODE_ASYNC)(LocationIElement *self, const LocationPosition *position, LocationAddressCB callback, gpointer userdata);
-typedef int (*TYPE_SEARCH_POI) (LocationIElement *self, const LocationPOIFilter * filter, const LocationPosition *position, const LocationPreference *svc_pref, const LocationPOIPreference * pref, LocationPOICB cb, const gpointer user_data, guint *req_id);
-typedef int (*TYPE_SEARCH_POI_BY_AREA) (LocationIElement *self, const LocationPOIFilter *filter, const LocationBoundary * boundary, const LocationPreference *svc_pref, const LocationPOIPreference * pref, LocationPOICB cb, const gpointer user_data, guint *req_id);
-typedef int (*TYPE_SEARCH_POI_BY_ADDR) (LocationIElement *self, const LocationPOIFilter *filter, const LocationAddress * address, const LocationPreference *svc_pref, const LocationPOIPreference * pref, LocationPOICB cb, const gpointer user_data, guint *req_id);
-typedef int (*TYPE_SEARCH_POI_BY_FREEFORM) (LocationIElement *self, const LocationPOIFilter *filter, const gchar *freeform, const LocationPreference *svc_pref, const LocationPOIPreference * pref, LocationPOICB cb, const gpointer user_data, guint *req_id);
-typedef int (*TYPE_CANCEL_POI_REQUEST) (LocationIElement *self, guint req_id);
-typedef int (*TYPE_REQUEST_ROUTE) (LocationIElement *self, const LocationPosition *origin, const LocationPosition *destination, GList *waypoint, const LocationPreference *svc_pref, const LocationRoutePreference *pref, LocationRouteCB cb, const gpointer user_data, guint *req_id);
-typedef int (*TYPE_CANCEL_ROUTE_REQUEST) (LocationIElement *self, guint req_id);
-typedef gboolean (*TYPE_IS_SUPPORTED_MAP_PROVIDER_CAPABILITY) (LocationIElement *self, LocationMapServiceType type);
-typedef int (*TYPE_GET_MAP_PROVIDER_CAPABILITY_KEY)(LocationIElement *self, LocationMapServiceType type, GList **key);
 
 struct _LocationIElementInterface
 {
@@ -89,22 +73,6 @@ struct _LocationIElementInterface
        TYPE_GET_VELOCITY get_last_velocity;
        TYPE_GET_SATELLITE get_satellite;
        TYPE_GET_SATELLITE get_last_satellite;
-       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_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_MAP_PROVIDER_CAPABILITY is_supported_map_provider_capability;
-       TYPE_GET_MAP_PROVIDER_CAPABILITY_KEY get_map_provider_capability_key;
-
 };
 
 GType location_ielement_get_type (void);
@@ -117,21 +85,6 @@ int location_ielement_get_velocity (LocationIElement *self, LocationVelocity **v
 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_get_geocode (LocationIElement *self, const LocationAddress *address, GList **position_list, GList **accuracy_list);
-int location_ielement_get_geocode_freeform (LocationIElement *self, const gchar *address, GList **position_list, GList **accuracy_list);
-int location_ielement_get_reversegeocode (LocationIElement *self, const LocationPosition *position, LocationAddress **address, LocationAccuracy **accuracy);
-int location_ielement_get_geocode_async (LocationIElement *self, const LocationAddress *address, LocationPositionCB callback, gpointer userdata);
-int location_ielement_get_geocode_freeform_async (LocationIElement *self, const gchar *address, LocationPositionCB callback, gpointer userdata);
-int location_ielement_get_reversegeocode_async (LocationIElement *self, const LocationPosition *position, LocationAddressCB callback, gpointer userdata);
-int location_ielement_search_poi (LocationIElement *self, const LocationPOIFilter * filter, const LocationPosition *position, const LocationPreference *svc_pref, const LocationPOIPreference * pref, LocationPOICB cb, const gpointer user_data, guint * req_id);
-int location_ielement_search_poi_by_area (LocationIElement *self, const LocationPOIFilter * filter, const LocationBoundary * boundary, const LocationPreference *svc_pref, const LocationPOIPreference * pref, LocationPOICB cb, const gpointer user_data, guint * req_id);
-int location_ielement_search_poi_by_address (LocationIElement *self, const LocationPOIFilter * filter, const LocationAddress * address, const LocationPreference *svc_pref, const LocationPOIPreference * pref, LocationPOICB cb, const gpointer user_data, guint * req_id);
-int location_ielement_search_poi_by_freeform (LocationIElement *self, const LocationPOIFilter * filter, const gchar * freeform, const LocationPreference *svc_pref, const LocationPOIPreference * pref, LocationPOICB cb, const gpointer user_data, guint * req_id);
-int location_ielement_cancel_poi_request (LocationIElement *self, guint req_id);
-int location_ielement_request_route (LocationIElement *self, const LocationPosition *origin, const LocationPosition *destination, GList *waypoint, const LocationPreference *svc_pref, const LocationRoutePreference * pref, LocationRouteCB cb, const gpointer user_data, guint * req_id);
-int location_ielement_cancel_route_request (LocationIElement *self, guint req_id);
-gboolean location_ielement_is_supported_map_provider_capability (LocationIElement *self, LocationMapServiceType type);
-int location_ielement_get_map_provider_capability_key (LocationIElement *self, LocationMapServiceType type, GList **key);
 
 G_END_DECLS
 
diff --git a/location/manager/location-ips.c b/location/manager/location-ips.c
deleted file mode 100644 (file)
index b596404..0000000
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * libslp-location
- *
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "location-setting.h"
-#include "location-log.h"
-
-#include "module-internal.h"
-
-#include "location-ips.h"
-#include "location-marshal.h"
-#include "location-ielement.h"
-
-typedef struct _LocationIpsPrivate {
-       LocationIpsMod *mod;
-       LocationPosition *pos;
-       LocationAccuracy *acc;
-} LocationIpsPrivate;
-
-enum {
-       PROP_0,
-       PROP_METHOD_TYPE,
-       PROP_LAST_POSITION
-};
-
-#define GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), LOCATION_TYPE_IPS, LocationIpsPrivate))
-
-static void location_ielement_interface_init (LocationIElementInterface *iface);
-
-G_DEFINE_TYPE_WITH_CODE (LocationIps, location_ips, G_TYPE_OBJECT,
-                         G_IMPLEMENT_INTERFACE (LOCATION_TYPE_IELEMENT,
-                         location_ielement_interface_init));
-
-static void
-location_ips_dispose (GObject *gobject)
-{
-       LOCATION_LOGD("location_ips_dispose");
-       G_OBJECT_CLASS (location_ips_parent_class)->dispose (gobject);
-}
-
-static void
-location_ips_finalize (GObject *gobject)
-{
-       LOCATION_LOGD("location_ips_finalize");
-       LocationIpsPrivate* priv = GET_PRIVATE(gobject);
-       module_free(priv->mod, "ips");
-       priv->mod = NULL;
-
-       G_OBJECT_CLASS (location_ips_parent_class)->finalize (gobject);
-}
-
-static void
-location_ips_get_property (GObject *object,
-       guint property_id,
-       GValue *value,
-       GParamSpec *pspec)
-{
-       LocationIpsPrivate *priv = GET_PRIVATE (object);
-
-       switch (property_id){
-               case PROP_METHOD_TYPE:
-                       g_value_set_int(value, LOCATION_METHOD_IPS);
-                       break;
-               case PROP_LAST_POSITION:{
-                       g_value_set_boxed (value, priv->pos);
-                       break;
-               }
-               default:
-                       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-                       break;
-       }
-}
-
-static int
-location_ips_get_position (LocationIps *self,
-       LocationPosition **position,
-       LocationAccuracy **accuracy)
-{
-       LOCATION_LOGD("location_ips_get_position");
-
-       LocationIpsPrivate *priv = GET_PRIVATE (self);
-       g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
-       setting_retval_if_fail(GPS_ENABLED);
-       setting_retval_if_fail(NETWORK_ENABLED);
-
-       LocModIpsOps ops = priv->mod->ops;
-       g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
-       g_return_val_if_fail (ops.get_position, LOCATION_ERROR_NOT_AVAILABLE);
-       int ret = ops.get_position(priv->mod->handler, position, accuracy);
-       if (priv->pos) location_position_free(priv->pos);
-       if (priv->acc) location_accuracy_free(priv->acc);
-       priv->pos = location_position_copy(*position);
-       priv->acc = location_accuracy_copy(*accuracy);
-       return ret;
-}
-
-static void
-location_ielement_interface_init (LocationIElementInterface *iface)
-{
-       iface->get_position = (TYPE_GET_POSITION)location_ips_get_position;
-}
-
-static void
-location_ips_init (LocationIps *self)
-{
-       LOCATION_LOGD("location_ips_init");
-       LocationIpsPrivate* priv = GET_PRIVATE(self);
-
-       priv->mod = (LocationIpsMod*)module_new("ips");
-       if(!priv->mod) LOCATION_LOGW("module loading failed");
-
-       priv->pos = NULL;
-       priv->acc = NULL;
-}
-
-static void
-location_ips_class_init (LocationIpsClass *klass)
-{
-       LOCATION_LOGD("location_ips_class_init");
-       GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-       GParamSpec *pspec;
-
-       gobject_class->get_property = location_ips_get_property;
-
-       gobject_class->dispose = location_ips_dispose;
-       gobject_class->finalize = location_ips_finalize;
-
-       g_type_class_add_private (klass, sizeof (LocationIpsPrivate));
-
-       pspec = g_param_spec_int ("method",
-                                "method type",
-                                "location method type name",
-                                LOCATION_METHOD_IPS,
-                                LOCATION_METHOD_IPS,
-                                LOCATION_METHOD_IPS,
-                                G_PARAM_READABLE);
-       g_object_class_install_property (gobject_class,
-                                   PROP_METHOD_TYPE,
-                                   pspec);
-
-       pspec = g_param_spec_boxed ("last-position",
-                                "ips last position prop",
-                                "ips last position data",
-                                LOCATION_TYPE_POSITION,
-                                G_PARAM_READABLE);
-       g_object_class_install_property (gobject_class,
-                                   PROP_LAST_POSITION,
-                                   pspec);
-}
-
diff --git a/location/manager/location-ips.h b/location/manager/location-ips.h
deleted file mode 100644 (file)
index b8f1cc6..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * libslp-location
- *
- * 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_IPS_H__
-#define __LOCATION_IPS_H__
-
-#include <glib-object.h>
-
-/**
- * @file location-ips.h
- * @brief This file contains the internal definitions and structures related to IPS.
- */
-
-G_BEGIN_DECLS
-
-#define LOCATION_TYPE_IPS                  (location_ips_get_type ())
-#define LOCATION_IPS(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), LOCATION_TYPE_IPS, LocationIps))
-#define LOCATION_IS_IPS(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LOCATION_TYPE_IPS))
-#define LOCATION_IPS_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), LOCATION_TYPE_IPS, LocationIpsClass))
-#define LOCATION_IS_IPS_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), LOCATION_TYPE_IPS))
-#define LOCATION_IPS_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), LOCATION_TYPE_IPS, LocationIpsClass))
-
-typedef struct _LocationIps        LocationIps;
-typedef struct _LocationIpsClass   LocationIpsClass;
-
-struct _LocationIps
-{
-       GObject parent_instance;
-};
-
-struct _LocationIpsClass
-{
-       GObjectClass parent_class;
-};
-
-GType location_ips_get_type (void);
-
-G_END_DECLS
-
-#endif
index bac60f9..dc317fa 100644 (file)
@@ -25,6 +25,7 @@
 
 #include <math.h>
 #include <stdlib.h>
+#include <string.h>
 
 #include "location-position.h"
 #include "location-setting.h"
@@ -98,8 +99,6 @@ location_position_copy (const LocationPosition *position)
                                                                position->altitude,
                                                                position->status);
 
-       if(new_position) new_position->updated_timestamp = position->updated_timestamp;
-
        return new_position;
 
 }
index 1a2b08c..154c6d0 100644 (file)
@@ -62,7 +62,6 @@ typedef enum
 struct _LocationPosition
 {
        guint timestamp;        ///< Time stamp.
-       guint updated_timestamp;        ///< latest updated time stamp.
        gdouble latitude;       ///< Latitude data.
        gdouble longitude;      ///< Longitude data.
        gdouble altitude;       ///< Altitude data.
index 852e288..2fd3ce3 100644 (file)
 
 #include <glib.h>
 #include <vconf.h>
-#include <vconf-keys.h>
+#include <vconf-internal-location-keys.h>
 
 /**
  * @file location-setting.h
  * @brief This file contains the definitions and functions for setting.
  */
 
-#define VCONF_LOCATION_PATH            "db/location"
-
-#define GPS_ENABLED                    VCONFKEY_LOCATION_ENABLED
-#define LOCATION_SETTING_PATH          VCONF_LOCATION_PATH"/setting"
-#define AGPS_ENABLED                   LOCATION_SETTING_PATH"/AgpsEnabled"
-#define NETWORK_ENABLED                        LOCATION_SETTING_PATH"/NetworkEnabled"
-#define SENSOR_ENABLED                         LOCATION_SETTING_PATH"/SensorEnabled"
-
 #define LOCATION_UPDATE_INTERVAL_MIN           1
 #define LOCATION_UPDATE_INTERVAL_MAX           120
 #define LOCATION_UPDATE_INTERVAL_DEFAULT       LOCATION_UPDATE_INTERVAL_MIN
index 4306c46..7b11c3f 100644 (file)
@@ -26,8 +26,6 @@
 #include "location-signaling-util.h"
 #include "location-log.h"
 
-#define POS_EXPIRATION_TIME            9       /* sec */
-
 void
 enable_signaling (LocationObject *obj,
        guint32 signals[LAST_SIGNAL],
@@ -53,12 +51,13 @@ void
 position_signaling (LocationObject *obj,
        guint32 signals[LAST_SIGNAL],
        gboolean *prev_enabled,
-       guint interval,
+       int interval,
+       gboolean emit,
+       guint *updated_timestamp,
        LocationPosition **prev_pos,
        LocationAccuracy **prev_acc,
        GList *prev_bound,
        ZoneStatus *zone_status,
-       gboolean enabled,
        const LocationPosition *pos,
        const LocationAccuracy *acc)
 {
@@ -70,65 +69,58 @@ position_signaling (LocationObject *obj,
 
        int index = 0;
        gboolean is_inside = FALSE;
-       guint updated_timestamp = 0;
        GList *boundary_list = prev_bound;
        LocationBoundary *boundary = NULL;
 
-       if(!*prev_pos || !*prev_acc || location_accuracy_level_compare(*prev_acc, acc) != -1 ||
-                       (pos->timestamp - (*prev_pos)->timestamp) > POS_EXPIRATION_TIME) {
+       if (!pos->timestamp)    return;
 
-               if(*prev_pos) {
-                       updated_timestamp = (*prev_pos)->updated_timestamp;
-                       location_position_free(*prev_pos);
-               }
-               if(*prev_acc) location_accuracy_free(*prev_acc);
+       if (*prev_pos) location_position_free (*prev_pos);
+       if (*prev_acc) location_accuracy_free (*prev_acc);
 
-               if(!updated_timestamp || pos->timestamp - updated_timestamp >= interval) {
-                       LOCATION_LOGD("Signal emit: POSITION SERVICE_UPDATED");
-                       g_signal_emit(obj, signals[SERVICE_UPDATED], 0, POSITION_UPDATED, pos, acc);
-                       updated_timestamp = pos->timestamp;
-               }
+       *prev_pos = location_position_copy(pos);
+       *prev_acc = location_accuracy_copy(acc);
+       LOCATION_LOGD("timestamp[%d], lat [%f], lon [%f]", (*prev_pos)->timestamp, (*prev_pos)->latitude, (*prev_pos)->longitude);
 
-               if(boundary_list) {
-                       while((boundary = (LocationBoundary *)g_list_nth_data(boundary_list, index))!= NULL) {
+       if (emit && 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;
+       }
 
-                               is_inside = location_boundary_if_inside(boundary, pos);
-                               if(is_inside) {
-                                       break;
-                               }
-                               index++;
+       if(boundary_list) {
+               while((boundary = (LocationBoundary *)g_list_nth_data(boundary_list, index))!= NULL) {
+                       is_inside = location_boundary_if_inside(boundary, pos);
+                       if(is_inside) {
+                               break;
                        }
+                       index++;
+               }
 
-                       if(is_inside) {
-                               if(*zone_status != ZONE_STATUS_IN) {
-                                       LOCATION_LOGD("Signal emit: ZONE IN");
-                                       g_signal_emit(obj, signals[ZONE_IN], 0, NULL, pos, acc);
-                                       *zone_status = ZONE_STATUS_IN;
-                               }
+               if(is_inside) {
+                       if(*zone_status != ZONE_STATUS_IN) {
+                               LOCATION_LOGD("Signal emit: ZONE IN");
+                               g_signal_emit(obj, signals[ZONE_IN], 0, NULL, pos, acc);
+                               *zone_status = ZONE_STATUS_IN;
                        }
-                       else {
-                               if (*zone_status != ZONE_STATUS_OUT) {
-                                       LOCATION_LOGD("Signal emit : ZONE_OUT");
-                                       g_signal_emit(obj, signals[ZONE_OUT], 0, NULL, pos, acc);
-                                       *zone_status = ZONE_STATUS_OUT;
-                               }
+               }
+               else {
+                       if (*zone_status != ZONE_STATUS_OUT) {
+                               LOCATION_LOGD("Signal emit : ZONE_OUT");
+                               g_signal_emit(obj, signals[ZONE_OUT], 0, NULL, pos, acc);
+                               *zone_status = ZONE_STATUS_OUT;
                        }
-
                }
        }
-
-       *prev_pos = location_position_copy(pos);
-       *prev_acc = location_accuracy_copy(acc);
-       (*prev_pos)->updated_timestamp = updated_timestamp;
 }
 
 void
 velocity_signaling (LocationObject *obj,
        guint32 signals[LAST_SIGNAL],
        gboolean *prev_enabled,
-       guint interval,
+       int interval,
+       gboolean emit,
+       guint *updated_timestamp,
        LocationVelocity **prev_vel,
-       gboolean enabled,
        const LocationVelocity *vel,
        const LocationAccuracy *acc)
 {
@@ -136,64 +128,42 @@ velocity_signaling (LocationObject *obj,
        g_return_if_fail(signals);
        g_return_if_fail(vel);
 
-       guint updated_timestamp = 0;
-
-       if(*prev_vel) {
-               updated_timestamp = (*prev_vel)->updated_timestamp;
-               if(!location_velocity_equal(*prev_vel, vel)) {
-                       location_velocity_free (*prev_vel);
-               }
-       }
+       if (!vel->timestamp) return;
 
+       if (*prev_vel) location_velocity_free (*prev_vel);
        *prev_vel = location_velocity_copy (vel);
+       LOCATION_LOGD("timestamp[%d]", (*prev_vel)->timestamp);
 
-       if(!updated_timestamp || vel->timestamp - updated_timestamp >= interval) {
-
-               LOCATION_LOGD ("Signal emit: VELOCITY SERVICE_UPDATED");
-               LocationVelocity *temp_vel = location_velocity_copy (*prev_vel);
-               LocationAccuracy *temp_acc = location_accuracy_copy(acc);
-
-               g_signal_emit (obj, signals[SERVICE_UPDATED], 0, VELOCITY_UPDATED, temp_vel, temp_acc);
-
-               (*prev_vel)->updated_timestamp = vel->timestamp;
-
-               location_velocity_free(temp_vel);
-               location_accuracy_free(temp_acc);
-       }
-       else {
-               (*prev_vel)->updated_timestamp = updated_timestamp;
+       if (emit && 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;
        }
-
 }
 
 void
 satellite_signaling(LocationObject *obj,
        guint32 signals[LAST_SIGNAL],
        gboolean *prev_enabled,
-       guint interval,
-       guint *sat_timestamp,
+       int interval,
+       gboolean emit,
+       guint *updated_timestamp,
        LocationSatellite **prev_sat,
-       gboolean enabled,
        const LocationSatellite *sat)
 {
        g_return_if_fail(obj);
        g_return_if_fail(signals);
        g_return_if_fail(sat);
 
-       if (*prev_sat) {
-               location_satellite_free(*prev_sat);
-       }
+       if (!sat->timestamp) return;
 
+       if (*prev_sat) location_satellite_free (*prev_sat);
        *prev_sat = location_satellite_copy (sat);
-       if (!(*sat_timestamp) || sat->timestamp - *sat_timestamp > interval) {
-
-               LOCATION_LOGD ("Signal emit: SATELLITE SERVICE_UPDATED");
-               LocationSatellite *temp_sat = location_satellite_copy (sat);
 
-               g_signal_emit (obj, signals[SERVICE_UPDATED], 0, SATELLITE_UPDATED, temp_sat, NULL);
-
-               *sat_timestamp = sat->timestamp;
-
-               location_satellite_free(temp_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);
+               *updated_timestamp = sat->timestamp;
        }
+
 }
index 0ef62d5..8854169 100644 (file)
@@ -40,12 +40,21 @@ typedef enum {
 
 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], gboolean *prev_enabled, guint interval, LocationPosition **prev_pos, LocationAccuracy **prev_acc, GList *prev_bound, ZoneStatus *zone_status, gboolean enabled, const LocationPosition *pos, const LocationAccuracy *acc);
-
-void velocity_signaling (LocationObject* obj, guint32 signals[LAST_SIGNAL], gboolean *prev_enabled, guint interval, LocationVelocity **prev_vel, gboolean enabled, const LocationVelocity *vel, const LocationAccuracy *acc);
-
-void
-satellite_signaling(LocationObject *obj, guint32 signals[LAST_SIGNAL], gboolean *prev_enabled, guint interval, guint *sat_timestamp, LocationSatellite **pre_sat, gboolean enabled, const LocationSatellite *sat);
+void position_signaling (LocationObject *obj, guint32 signals[LAST_SIGNAL],
+               gboolean *prev_enabled, int interval, gboolean emit,
+               guint *updated_interval, LocationPosition **prev_pos, LocationAccuracy **prev_acc,
+               GList *prev_bound, ZoneStatus *zone_status,
+               const LocationPosition *pos, const LocationAccuracy *acc);
+
+void velocity_signaling (LocationObject* obj, guint32 signals[LAST_SIGNAL],
+               gboolean *prev_enabled, int interval, gboolean emit,
+               guint *updated_timestamp, LocationVelocity **prev_vel,
+               const LocationVelocity *vel, const LocationAccuracy *acc);
+
+void satellite_signaling(LocationObject *obj, guint32 signals[LAST_SIGNAL],
+               gboolean *prev_enabled, int interval, gboolean emit,
+               guint *updated_timestamp, LocationSatellite **pre_sat,
+               const LocationSatellite *sat);
 
 G_END_DECLS
 
diff --git a/location/manager/location-sps.c b/location/manager/location-sps.c
deleted file mode 100644 (file)
index 734d1d1..0000000
+++ /dev/null
@@ -1,598 +0,0 @@
-/*
- * libslp-location
- *
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "location-setting.h"
-#include "location-log.h"
-
-#include "module-internal.h"
-
-#include "location-sps.h"
-#include "location-marshal.h"
-#include "location-ielement.h"
-#include "location-signaling-util.h"
-#include "location-common-util.h"
-
-typedef struct _LocationSpsPrivate {
-       LocationSpsMod* mod;
-       gboolean is_started;
-       gboolean set_noti;
-       gboolean enabled;
-       guint    interval;
-       LocationPosition *pos;
-       LocationVelocity *vel;
-       LocationAccuracy *acc;
-       GList *boundary_list;
-       ZoneStatus zone_status;
-       LocationPosition *pos_base;
-       LocationVelocity *vel_base;
-       LocationAccuracy *acc_info;
-       LocationSatellite *sat_info;
-} LocationSpsPrivate;
-
-enum {
-       PROP_0,
-       PROP_METHOD_TYPE,
-       PROP_LAST_POSITION,
-       PROP_UPDATE_INTERVAL,
-       PROP_BOUNDARY,
-       PROP_REMOVAL_BOUNDARY,
-       PROP_POSITION_BASE,
-       PROP_VELOCITY_BASE,
-       PROP_ACCURACY_INFO,
-       PROP_SATELLITE_INFO,
-       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_SPS, LocationSpsPrivate))
-
-static void location_ielement_interface_init (LocationIElementInterface *iface);
-
-G_DEFINE_TYPE_WITH_CODE (LocationSps, location_sps, G_TYPE_OBJECT,
-                         G_IMPLEMENT_INTERFACE (LOCATION_TYPE_IELEMENT,
-                         location_ielement_interface_init));
-
-static void
-sps_status_cb (gboolean enabled,
-       LocationStatus status,
-       gpointer self)
-{
-       LOCATION_LOGD("sps_status_cb");
-       g_return_if_fail(self);
-       LocationSpsPrivate* priv = GET_PRIVATE(self);
-       enable_signaling(self, signals, &(priv->enabled), enabled, status);
-}
-
-static void
-sps_position_cb (gboolean enabled,
-       LocationPosition *pos,
-       LocationAccuracy *acc,
-       gpointer self)
-{
-       LOCATION_LOGD("sps_position_cb");
-       g_return_if_fail(self);
-       g_return_if_fail(pos);
-       g_return_if_fail(acc);
-       LocationSpsPrivate* priv = GET_PRIVATE(self);
-       enable_signaling(self, signals, &(priv->enabled), enabled, pos->status);
-
-       position_signaling(self, signals, &(priv->enabled), priv->interval, &(priv->pos), &(priv->acc), priv->boundary_list, &(priv->zone_status), enabled, pos, acc);
-}
-
-static void
-sps_velocity_cb (gboolean enabled,
-       LocationVelocity *vel,
-       LocationAccuracy *acc,
-       gpointer self)
-{
-       LOCATION_LOGD("sps_velocity_cb");
-       g_return_if_fail(self);
-       LocationSpsPrivate* priv = GET_PRIVATE(self);
-       velocity_signaling(self, signals, &(priv->enabled), priv->interval, &(priv->vel), enabled, vel, acc);
-}
-
-static void
-location_setting_sps_cb(keynode_t *key,
-       gpointer self)
-{
-       LOCATION_LOGD("location_setting_sps_cb");
-       g_return_if_fail(key);
-       g_return_if_fail(self);
-       LocationSpsPrivate* priv = GET_PRIVATE(self);
-       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) {
-                       ret = priv->mod->ops.stop(priv->mod->handler);
-                       if (ret == LOCATION_ERROR_NONE) priv->is_started = FALSE;
-               }
-       }
-       else {
-               if (location_setting_get_int(SENSOR_ENABLED) &&
-                               priv->mod->ops.start && !priv->is_started) {
-                       LOCATION_LOGD("location resumed by setting");
-                       ret = priv->mod->ops.start (priv->mod->handler, sps_status_cb, sps_position_cb, sps_velocity_cb, self);
-                       if (ret == LOCATION_ERROR_NONE) priv->is_started = TRUE;
-               }
-       }
-
-}
-
-static int
-location_sps_start (LocationSps *self)
-{
-       LOCATION_LOGD("location_sps_start");
-       LocationSpsPrivate* 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);
-       g_return_val_if_fail (priv->mod->ops.update_data, LOCATION_ERROR_NOT_AVAILABLE);
-
-       if( priv->is_started == TRUE) return LOCATION_ERROR_NONE;
-
-       int ret = LOCATION_ERROR_NONE;
-       int noti_err = 0;
-
-       if (!location_setting_get_int(GPS_ENABLED) || !location_setting_get_int(SENSOR_ENABLED)) {
-               ret = LOCATION_ERROR_NOT_ALLOWED;
-       }
-       else {
-               ret = priv->mod->ops.start(priv->mod->handler, sps_status_cb, sps_position_cb, sps_velocity_cb, self);
-               if (ret == LOCATION_ERROR_NONE) {
-                       priv->is_started = TRUE;
-               }
-               else {
-                       return ret;
-               }
-
-               priv->mod->ops.update_data(priv->mod->handler, priv->pos_base, priv->vel_base, priv->acc_info, priv->sat_info);
-       }
-
-       if (priv->set_noti == FALSE) {
-               noti_err = location_setting_add_notify (GPS_ENABLED, location_setting_sps_cb, self);
-               if (noti_err != 0) {
-                       return LOCATION_ERROR_UNKNOWN;
-               }
-               noti_err = location_setting_add_notify (SENSOR_ENABLED, location_setting_sps_cb, self);
-               if (noti_err != 0) {
-                       return LOCATION_ERROR_UNKNOWN;
-               }
-               priv->set_noti = TRUE;
-       }
-
-       return ret;
-}
-
-static int
-location_sps_stop (LocationSps *self)
-{
-       LOCATION_LOGD("location_sps_stop");
-       LocationSpsPrivate* 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);
-
-       int ret = LOCATION_ERROR_NONE;
-       int noti_err = 0;
-
-       if (priv->is_started == TRUE) {
-               ret = priv->mod->ops.stop (priv->mod->handler);
-               if (ret == LOCATION_ERROR_NONE) {
-                       priv->is_started = FALSE;
-               }
-               else {
-                       return ret;
-               }
-       }
-
-       if (priv->set_noti == TRUE) {
-               noti_err = location_setting_ignore_notify (GPS_ENABLED, location_setting_sps_cb);
-               if (noti_err != 0) {
-                       return LOCATION_ERROR_UNKNOWN;
-               }
-               noti_err = location_setting_ignore_notify (SENSOR_ENABLED, location_setting_sps_cb);
-               if (noti_err != 0) {
-                       return LOCATION_ERROR_UNKNOWN;
-               }
-               priv->set_noti = FALSE;
-       }
-
-       return ret;
-}
-
-static void
-location_sps_dispose (GObject *gobject)
-{
-       LOCATION_LOGD("location_sps_dispose");
-       G_OBJECT_CLASS (location_sps_parent_class)->dispose (gobject);
-}
-
-static void
-location_sps_finalize (GObject *gobject)
-{
-       LOCATION_LOGD("location_sps_finalize");
-       LocationSpsPrivate* priv = GET_PRIVATE(gobject);
-       module_free(priv->mod, "sps");
-       priv->mod = NULL;
-       G_OBJECT_CLASS (location_sps_parent_class)->finalize (gobject);
-}
-
-static void
-location_sps_set_property (GObject *object,
-       guint property_id,
-       const GValue *value,
-       GParamSpec *pspec)
-{
-       LocationSpsPrivate* priv = GET_PRIVATE(object);
-
-       g_return_if_fail (priv->mod);
-       g_return_if_fail (priv->mod->handler);
-       LocModSpsOps ops = priv->mod->ops;
-       g_return_if_fail (ops.update_data);
-
-       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_POSITION_BASE:{
-                       if(priv->pos_base) location_position_free(priv->pos_base);
-                       priv->pos_base = (LocationPosition*) g_value_dup_boxed (value);
-                       LOCATION_LOGD("Set prop>> base position: \t%lf, %lf, %lf, time: %d", priv->pos_base->latitude, priv->pos_base->longitude, priv->pos_base->altitude, priv->pos_base->timestamp);
-                       if (priv->is_started) ops.update_data (priv->mod->handler, priv->pos_base, priv->vel_base, priv->acc_info, priv->sat_info);
-                       break;
-               }
-               case PROP_VELOCITY_BASE:{
-                       if(priv->vel_base) location_velocity_free(priv->vel_base);
-                       priv->vel_base = (LocationVelocity*) g_value_dup_boxed (value);
-                       LOCATION_LOGD("Set prop>> base velocity: \t%lf, %lf, %lf, time: %d", priv->vel_base->speed, priv->vel_base->direction, priv->vel_base->climb, priv->vel_base->timestamp);
-                       if(priv->is_started) ops.update_data (priv->mod->handler, priv->pos_base, priv->vel_base, priv->acc_info, priv->sat_info);
-                       break;
-               }
-               case PROP_ACCURACY_INFO:{
-                       if(priv->acc_info) location_accuracy_free(priv->acc_info);
-                       priv->acc_info = (LocationAccuracy*) g_value_dup_boxed (value);
-                       LOCATION_LOGD("Set prop>> accuracy information: \t%d, %lf, %lf", priv->acc_info->level, priv->acc_info->horizontal_accuracy, priv->acc_info->vertical_accuracy);
-                       if(priv->is_started) ops.update_data (priv->mod->handler, priv->pos_base, priv->vel_base, priv->acc_info, priv->sat_info);
-                       break;
-               }
-               case PROP_SATELLITE_INFO:{
-                       if(priv->sat_info) location_satellite_free(priv->sat_info);
-                       priv->sat_info = (LocationSatellite*) g_value_dup_boxed (value);
-                       LOCATION_LOGD("Set prop>> satellite information: \tNofView:%d, NofUsed:%d", priv->sat_info->num_of_sat_inview, priv->sat_info->num_of_sat_used);
-                       if(priv->is_started) ops.update_data (priv->mod->handler, priv->pos_base, priv->vel_base, priv->acc_info, priv->sat_info);
-                       break;
-               }
-               case PROP_UPDATE_INTERVAL: {
-                       guint interval = g_value_get_uint(value);
-                       if(interval > 0) {
-                               if(interval < LOCATION_UPDATE_INTERVAL_MAX)
-                                       priv->interval = interval;
-                               else
-                                       priv->interval = (guint)LOCATION_UPDATE_INTERVAL_MAX;
-
-                       }
-                       else
-                               priv->interval = (guint)LOCATION_UPDATE_INTERVAL_DEFAULT;
-                       break;
-               }
-               default:
-                       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-                       break;
-       }
-}
-
-static void
-location_sps_get_property (GObject *object,
-                           guint property_id,
-                           GValue *value,
-                           GParamSpec *pspec)
-{
-       LocationSpsPrivate *priv = GET_PRIVATE (object);
-
-       switch (property_id){
-               case PROP_METHOD_TYPE:
-                       g_value_set_int(value, LOCATION_METHOD_SPS);
-                       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_POSITION_BASE:
-                       g_value_set_boxed (value, priv->pos_base);
-                       break;
-               case PROP_VELOCITY_BASE:
-                       g_value_set_boxed (value, priv->vel_base);
-                       break;
-               case PROP_ACCURACY_INFO:
-                       g_value_set_boxed (value, priv->acc_info);
-                       break;
-               case PROP_SATELLITE_INFO:
-                       g_value_set_boxed (value, priv->sat_info);
-                       break;
-               case PROP_UPDATE_INTERVAL:
-                       g_value_set_uint(value, priv->interval);
-                       break;
-               default:
-                       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-                       break;
-       }
-}
-
-static int
-location_sps_get_position (LocationSps *self,
-       LocationPosition **position,
-       LocationAccuracy **accuracy)
-{
-       LOCATION_LOGD("location_sps_get_position");
-
-       LocationSpsPrivate *priv = GET_PRIVATE (self);
-       g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
-       setting_retval_if_fail(GPS_ENABLED);
-       setting_retval_if_fail(SENSOR_ENABLED);
-
-       LocModSpsOps ops = priv->mod->ops;
-       g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
-       g_return_val_if_fail (ops.get_position, LOCATION_ERROR_NOT_AVAILABLE);
-       return ops.get_position(priv->mod->handler, position, accuracy);
-}
-
-static int
-location_sps_get_last_position (LocationSps *self,
-       LocationPosition **position,
-       LocationAccuracy **accuracy)
-{
-       LOCATION_LOGD("location_sps_get_last_position");
-       return LOCATION_ERROR_NOT_SUPPORTED;
-}
-
-static int
-location_sps_get_velocity (LocationSps *self,
-       LocationVelocity **velocity,
-       LocationAccuracy **accuracy)
-{
-       LOCATION_LOGD("location_sps_get_velocity");
-
-       LocationSpsPrivate *priv = GET_PRIVATE (self);
-       g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
-       setting_retval_if_fail(GPS_ENABLED);
-       setting_retval_if_fail(SENSOR_ENABLED);
-
-       LocModSpsOps ops = priv->mod->ops;
-       g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
-       g_return_val_if_fail (ops.get_velocity, LOCATION_ERROR_NOT_AVAILABLE);
-       return ops.get_velocity(priv->mod->handler, velocity, accuracy);
-}
-
-static int
-location_sps_get_last_velocity (LocationSps *self,
-       LocationVelocity **velocity,
-       LocationAccuracy **accuracy)
-{
-       LOCATION_LOGD("location_sps_get_last_velocity");
-       return LOCATION_ERROR_NOT_SUPPORTED;
-}
-
-static int
-location_sps_get_satellite (LocationSps *self,
-       LocationSatellite **satellite)
-{
-       LOCATION_LOGD("location_sps_get_satellite");
-       return LOCATION_ERROR_NOT_SUPPORTED;
-}
-
-static int
-location_sps_get_last_satellite (LocationSps *self,
-       LocationSatellite **satellite)
-{
-       LOCATION_LOGD("location_sps_get_last_satellite");
-       return LOCATION_ERROR_NOT_SUPPORTED;
-}
-
-static void
-location_ielement_interface_init (LocationIElementInterface *iface)
-{
-       iface->start = (TYPE_START_FUNC)location_sps_start;
-       iface->stop = (TYPE_STOP_FUNC)location_sps_stop;
-       iface->get_position = (TYPE_GET_POSITION)location_sps_get_position;
-       iface->get_last_position = (TYPE_GET_POSITION)location_sps_get_last_position;
-       iface->get_velocity = (TYPE_GET_VELOCITY)location_sps_get_velocity;
-       iface->get_last_velocity = (TYPE_GET_VELOCITY)location_sps_get_last_velocity;
-       iface->get_satellite = (TYPE_GET_SATELLITE)location_sps_get_satellite;
-       iface->get_last_satellite = (TYPE_GET_SATELLITE)location_sps_get_last_satellite;
-}
-
-static void
-location_sps_init (LocationSps *self)
-{
-       LOCATION_LOGD("location_sps_init");
-       LocationSpsPrivate* priv = GET_PRIVATE(self);
-
-       priv->mod = (LocationSpsMod*)module_new("sps");
-       if(!priv->mod)
-               LOCATION_LOGW("module loading failed");
-
-       priv->is_started = FALSE;
-       priv->enabled= FALSE;
-       priv->interval = LOCATION_UPDATE_INTERVAL_DEFAULT;
-       priv->pos = NULL;
-       priv->vel = NULL;
-       priv->acc = NULL;
-       priv->zone_status = ZONE_STATUS_NONE;
-       priv->boundary_list = NULL;
-
-       priv->pos_base = NULL;
-       priv->vel_base = NULL;
-       priv->acc_info = NULL;
-       priv->sat_info = NULL;
-}
-
-static void
-location_sps_class_init (LocationSpsClass *klass)
-{
-       LOCATION_LOGD("location_sps_class_init");
-       GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
-       gobject_class->set_property = location_sps_set_property;
-       gobject_class->get_property = location_sps_get_property;
-
-       gobject_class->dispose = location_sps_dispose;
-       gobject_class->finalize = location_sps_finalize;
-
-       g_type_class_add_private (klass, sizeof (LocationSpsPrivate));
-
-       signals[SERVICE_ENABLED] = g_signal_new ("service-enabled",
-                       G_TYPE_FROM_CLASS (klass),
-                       G_SIGNAL_RUN_FIRST |
-                       G_SIGNAL_NO_RECURSE,
-                       G_STRUCT_OFFSET (LocationSpsClass, 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 (LocationSpsClass, 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 (LocationSpsClass, 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 (LocationSpsClass, zone_in),
-                       NULL, NULL,
-                       location_VOID__UINT_POINTER_POINTER,
-                       G_TYPE_NONE, 3,
-                       G_TYPE_UINT,
-                       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 (LocationSpsClass, zone_out),
-                       NULL, NULL,
-                       location_VOID__UINT_POINTER_POINTER,
-                       G_TYPE_NONE, 3,
-                       G_TYPE_UINT,
-                       G_TYPE_POINTER,
-                       G_TYPE_POINTER);
-
-       properties[PROP_METHOD_TYPE]  = g_param_spec_int ("method",
-                       "method type",
-                       "location method type name",
-                       LOCATION_METHOD_SPS,
-                       LOCATION_METHOD_SPS,
-                       LOCATION_METHOD_SPS,
-                       G_PARAM_READABLE);
-
-       properties[PROP_LAST_POSITION] = g_param_spec_boxed ("last-position",
-                       "sps last position prop",
-                       "sps last position data",
-                       LOCATION_TYPE_POSITION,
-                       G_PARAM_READABLE);
-
-       properties[PROP_UPDATE_INTERVAL] = g_param_spec_uint ("update-interval",
-                       "sps update interval prop",
-                       "sps update 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",
-                       "sps boundary prop",
-                       "sps boundary data",
-                       G_PARAM_READWRITE);
-
-       properties[PROP_REMOVAL_BOUNDARY] = g_param_spec_boxed("removal-boundary",
-                       "sps removal boundary prop",
-                       "sps removal boundary data",
-                       LOCATION_TYPE_BOUNDARY,
-                       G_PARAM_READWRITE);
-
-       properties[PROP_POSITION_BASE] = g_param_spec_boxed ("position-base",
-                       "sps position base prop",
-                       "sps position base data",
-                       LOCATION_TYPE_POSITION,
-                       G_PARAM_READWRITE);
-
-       properties[PROP_VELOCITY_BASE] = g_param_spec_boxed ("velocity-base",
-                       "sps velocity base prop",
-                       "sps velocity base data",
-                       LOCATION_TYPE_VELOCITY,
-                       G_PARAM_READWRITE);
-
-       properties[PROP_ACCURACY_INFO] = g_param_spec_boxed ("accuracy-info",
-                       "sps accuracy information prop",
-                       "sps accuracy information data",
-                       LOCATION_TYPE_ACCURACY,
-                       G_PARAM_READWRITE);
-
-       properties[PROP_SATELLITE_INFO] = g_param_spec_boxed ("satellite-info",
-                       "sps satellite information prop",
-                       "sps satellite information data",
-                       LOCATION_TYPE_SATELLITE,
-                       G_PARAM_READWRITE);
-
-       g_object_class_install_properties (gobject_class,
-                       PROP_MAX,
-                       properties);
-}
diff --git a/location/manager/location-sps.h b/location/manager/location-sps.h
deleted file mode 100644 (file)
index f39815d..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * libslp-location
- *
- * 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_SPS_H__
-#define __LOCATION_SPS_H__
-
-#include <glib-object.h>
-
-/**
- * @file location-sps.h
- * @brief This file contains the internal definitions and structures related to SPS.
- */
-
-G_BEGIN_DECLS
-
-#define LOCATION_TYPE_SPS                  (location_sps_get_type ())
-#define LOCATION_SPS(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), LOCATION_TYPE_SPS, LocationSps))
-#define LOCATION_IS_SPS(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LOCATION_TYPE_SPS))
-#define LOCATION_SPS_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), LOCATION_TYPE_SPS, LocationSpsClass))
-#define LOCATION_IS_SPS_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), LOCATION_TYPE_SPS))
-#define LOCATION_SPS_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), LOCATION_TYPE_SPS, LocationSpsClass))
-
-typedef struct _LocationSps        LocationSps;
-typedef struct _LocationSpsClass   LocationSpsClass;
-
-struct _LocationSps
-{
-       GObject parent_instance;
-};
-
-struct _LocationSpsClass
-{
-       GObjectClass parent_class;
-
-       void (* enabled) (guint type);
-       void (* disabled) (guint type);
-       void (* updated) (guint type, gpointer data);
-       void (* zone_in) (guint type, gpointer position, gpointer boundary);
-       void (* zone_out) (guint type, gpointer position, gpointer boundary);
-};
-
-GType location_sps_get_type (void);
-
-G_END_DECLS
-
-#endif
index 61c839e..a63505f 100644 (file)
@@ -86,7 +86,6 @@ location_velocity_copy (const LocationVelocity *velocity)
                                                                velocity->speed,
                                                                velocity->direction,
                                                                velocity->climb);
-       if(new_velocity) new_velocity->updated_timestamp = velocity->updated_timestamp;
 
        return new_velocity;
 }
index 5112298..7159ef3 100644 (file)
@@ -48,7 +48,6 @@ GType location_velocity_get_type (void);
 struct _LocationVelocity
 {
        guint timestamp;                ///< Time stamp.
-       guint updated_timestamp;        ///< The latest updated 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)
index 06da7ca..88a871a 100644 (file)
@@ -42,19 +42,26 @@ typedef struct _LocationWpsPrivate {
        gboolean is_started;
        gboolean set_noti;
        gboolean enabled;
-       guint    interval;
+       guint   pos_updated_timestamp;
+       guint   pos_interval;
+       guint   vel_updated_timestamp;
+       guint   vel_interval;
        LocationPosition *pos;
        LocationVelocity *vel;
        LocationAccuracy *acc;
        GList *boundary_list;
        ZoneStatus zone_status;
+
+       guint           pos_timer;
+       guint           vel_timer;
 } LocationWpsPrivate;
 
 enum {
        PROP_0,
        PROP_METHOD_TYPE,
        PROP_LAST_POSITION,
-       PROP_UPDATE_INTERVAL,
+       PROP_POS_INTERVAL,
+       PROP_VEL_INTERVAL,
        PROP_BOUNDARY,
        PROP_REMOVAL_BOUNDARY,
        PROP_MAX
@@ -71,6 +78,72 @@ G_DEFINE_TYPE_WITH_CODE (LocationWps, location_wps, G_TYPE_OBJECT,
                          G_IMPLEMENT_INTERFACE (LOCATION_TYPE_IELEMENT,
                          location_ielement_interface_init));
 
+static gboolean
+_position_timeout_cb (gpointer data)
+{
+       GObject *object = (GObject *)data;
+       LocationWpsPrivate *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)
+{
+       GObject *object = (GObject *)data;
+       LocationWpsPrivate *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("POSITION 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
 wps_status_cb (gboolean enabled,
        LocationStatus status,
@@ -80,6 +153,16 @@ wps_status_cb (gboolean enabled,
        g_return_if_fail(self);
        LocationWpsPrivate* priv = GET_PRIVATE(self);
        enable_signaling(self, signals, &(priv->enabled), enabled, status);
+       if (!priv->enabled) {
+               if (priv->pos_timer) {
+                       g_source_remove (priv->pos_timer);
+                       priv->pos_timer = 0;
+               }
+               if (priv->vel_timer) {
+                       g_source_remove (priv->vel_timer);
+                       priv->vel_timer = 0;
+               }
+       }
 }
 
 static void
@@ -93,8 +176,14 @@ wps_position_cb (gboolean enabled,
        g_return_if_fail(pos);
        g_return_if_fail(acc);
        LocationWpsPrivate* priv = GET_PRIVATE(self);
+
+       if (!priv->enabled && enabled) {
+               if (!priv->pos_timer) priv->pos_timer = g_timeout_add_seconds (priv->pos_interval, _position_timeout_cb, self);
+               if (!priv->vel_timer) priv->vel_timer = g_timeout_add_seconds (priv->vel_interval, _velocity_timeout_cb, self);
+       }
+
        enable_signaling(self, signals, &(priv->enabled), enabled, pos->status);
-       position_signaling(self, signals, &(priv->enabled), priv->interval, &(priv->pos), &(priv->acc), priv->boundary_list, &(priv->zone_status), enabled, pos, acc);
+       position_signaling(self, signals, &(priv->enabled), priv->pos_interval, FALSE, &(priv->pos_updated_timestamp), &(priv->pos), &(priv->acc), priv->boundary_list, &(priv->zone_status), pos, acc);
 }
 
 static void
@@ -106,7 +195,7 @@ wps_velocity_cb(gboolean enabled,
        LOCATION_LOGD("wps_velocity_cb");
        g_return_if_fail(self);
        LocationWpsPrivate* priv = GET_PRIVATE(self);
-       velocity_signaling(self, signals, &(priv->enabled), priv->interval, &(priv->vel), enabled, vel, acc);
+       velocity_signaling(self, signals, &(priv->enabled), priv->vel_interval, FALSE, &(priv->vel_updated_timestamp), &(priv->vel), vel, acc);
 }
 
 static void
@@ -125,14 +214,18 @@ location_setting_wps_cb(keynode_t *key,
        if (location_setting_get_key_val(key) == 0) {
                if (priv->mod->ops.stop && priv->is_started) {
                        ret = priv->mod->ops.stop(priv->mod->handler);
-                       if (ret == LOCATION_ERROR_NONE) priv->is_started = FALSE;
+                       if (ret == LOCATION_ERROR_NONE) {
+                               priv->is_started = FALSE;
+                       }
                }
        }
        else {
-               if (1 == location_setting_get_int(NETWORK_ENABLED) && priv->mod->ops.start && !priv->is_started) {
+               if (1 == location_setting_get_int(VCONFKEY_LOCATION_NETWORK_ENABLED) && priv->mod->ops.start && !priv->is_started) {
                        LOCATION_LOGD("location resumed by setting");
                        ret = priv->mod->ops.start (priv->mod->handler, wps_status_cb, wps_position_cb, wps_velocity_cb, NULL, self);
-                       if (ret == LOCATION_ERROR_NONE) priv->is_started = TRUE;
+                       if (ret == LOCATION_ERROR_NONE) {
+                               priv->is_started = TRUE;
+                       }
                }
        }
 
@@ -150,9 +243,8 @@ location_wps_start (LocationWps *self)
        if (priv->is_started == TRUE) return LOCATION_ERROR_NONE;
 
        int ret = LOCATION_ERROR_NONE;
-       int noti_err = 0;
 
-       if (!location_setting_get_int(GPS_ENABLED) || !location_setting_get_int(NETWORK_ENABLED)) {
+       if (!location_setting_get_int(VCONFKEY_LOCATION_NETWORK_ENABLED)) {
                ret = LOCATION_ERROR_NOT_ALLOWED;
        }
        else {
@@ -166,14 +258,7 @@ location_wps_start (LocationWps *self)
        }
 
        if (priv->set_noti == FALSE) {
-               noti_err = location_setting_add_notify (GPS_ENABLED, location_setting_wps_cb, self);
-               if (noti_err != 0) {
-                       return LOCATION_ERROR_UNKNOWN;
-               }
-               noti_err = location_setting_add_notify (NETWORK_ENABLED, location_setting_wps_cb, self);
-               if (noti_err != 0) {
-                       return LOCATION_ERROR_UNKNOWN;
-               }
+               location_setting_add_notify (VCONFKEY_LOCATION_NETWORK_ENABLED, location_setting_wps_cb, self);
                priv->set_noti = TRUE;
        }
 
@@ -190,7 +275,6 @@ location_wps_stop (LocationWps *self)
        g_return_val_if_fail (priv->mod->ops.stop, LOCATION_ERROR_NOT_AVAILABLE);
 
        int ret = LOCATION_ERROR_NONE;
-       int noti_err = 0;
 
        if (priv->is_started == TRUE) {
                ret = priv->mod->ops.stop (priv->mod->handler);
@@ -203,14 +287,7 @@ location_wps_stop (LocationWps *self)
        }
 
        if (priv->set_noti == TRUE) {
-               noti_err = location_setting_ignore_notify (GPS_ENABLED, location_setting_wps_cb);
-               if (noti_err != 0) {
-                       return LOCATION_ERROR_UNKNOWN;
-               }
-               noti_err = location_setting_ignore_notify (NETWORK_ENABLED, location_setting_wps_cb);
-               if (noti_err != 0) {
-                       return LOCATION_ERROR_UNKNOWN;
-               }
+               location_setting_ignore_notify (VCONFKEY_LOCATION_NETWORK_ENABLED, location_setting_wps_cb);
                priv->set_noti = FALSE;
        }
 
@@ -221,6 +298,23 @@ static void
 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);
+               priv->set_noti = FALSE;
+
+               if (priv->pos_timer) {
+                       g_source_remove (priv->pos_timer);
+                       priv->pos_timer = 0;
+               }
+               if (priv->vel_timer) {
+                       g_source_remove (priv->vel_timer);
+                       priv->vel_timer = 0;
+               }
+
+       }
+
        G_OBJECT_CLASS (location_wps_parent_class)->dispose (gobject);
 }
 
@@ -230,6 +324,26 @@ location_wps_finalize (GObject *gobject)
        LOCATION_LOGD("location_wps_finalize");
        LocationWpsPrivate* priv = GET_PRIVATE(gobject);
        module_free(priv->mod, "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;
+       }
        G_OBJECT_CLASS (location_wps_parent_class)->finalize (gobject);
 }
 
@@ -255,16 +369,40 @@ location_wps_set_property (GObject *object,
                        if(ret != 0) LOCATION_LOGD("Set removal boundary. Error[%d]", ret);
                        break;
                }
-               case PROP_UPDATE_INTERVAL: {
+               case PROP_POS_INTERVAL: {
                        guint interval = g_value_get_uint(value);
                        if(interval > 0) {
                                if(interval < LOCATION_UPDATE_INTERVAL_MAX)
-                                       priv->interval = interval;
+                                       priv->pos_interval = interval;
                                else
-                                       priv->interval = (guint)LOCATION_UPDATE_INTERVAL_MAX;
+                                       priv->pos_interval = (guint)LOCATION_UPDATE_INTERVAL_MAX;
                        }
                        else
-                               priv->interval = (guint)LOCATION_UPDATE_INTERVAL_DEFAULT;
+                               priv->pos_interval = (guint)LOCATION_UPDATE_INTERVAL_DEFAULT;
+
+                       if (priv->pos_timer) {
+                               g_source_remove (priv->pos_timer);
+                               priv->pos_timer = g_timeout_add_seconds (priv->pos_interval, _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 = (guint)LOCATION_UPDATE_INTERVAL_DEFAULT;
+
+                       if (priv->vel_timer) {
+                               g_source_remove (priv->vel_timer);
+                               priv->vel_timer = g_timeout_add_seconds (priv->vel_interval, _velocity_timeout_cb, object);
+                       }
+
                        break;
                }
                default:
@@ -291,8 +429,11 @@ location_wps_get_property (GObject *object,
                case PROP_BOUNDARY:
                        g_value_set_pointer(value, g_list_first(priv->boundary_list));
                        break;
-               case PROP_UPDATE_INTERVAL:
-                       g_value_set_uint(value, priv->interval);
+               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;
                default:
                        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -305,17 +446,22 @@ 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);
-       setting_retval_if_fail(GPS_ENABLED);
-       setting_retval_if_fail(NETWORK_ENABLED);
+       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_position, LOCATION_ERROR_NOT_AVAILABLE);
-       return ops.get_position(priv->mod->handler, position, accuracy);
+       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
@@ -325,7 +471,7 @@ location_wps_get_last_position (LocationWps *self,
 {
        LOCATION_LOGD("location_wps_get_last_position");
 
-       /* Do not need to check GPS_ENABLED and NETWORK_ENABLED */
+       /* Do not need to check VCONFKEY_LOCATION_ENABLED and VCONFKEY_LOCATION_NETWORK_ENABLED */
 
        LocationWpsPrivate *priv = GET_PRIVATE (self);
        g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
@@ -343,17 +489,23 @@ 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);
-       setting_retval_if_fail(GPS_ENABLED);
-       setting_retval_if_fail(NETWORK_ENABLED);
+       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_velocity, LOCATION_ERROR_NOT_AVAILABLE);
-       return ops.get_velocity(priv->mod->handler, velocity, accuracy);
+       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
@@ -363,7 +515,7 @@ location_wps_get_last_velocity (LocationWps *self,
 {
        LOCATION_LOGD("location_wps_get_last_velocity");
 
-       /* Do not need to check GPS_ENABLED and NETWORK_ENABLED */
+       /* Do not need to check VCONFKEY_LOCATION_ENABLED and VCONFKEY_LOCATION_NETWORK_ENABLED */
 
        LocationWpsPrivate *priv = GET_PRIVATE (self);
        g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
@@ -416,13 +568,21 @@ location_wps_init (LocationWps *self)
        priv->is_started = FALSE;
        priv->set_noti = FALSE;
        priv->enabled= FALSE;
-       priv->interval = LOCATION_UPDATE_INTERVAL_DEFAULT;
+
+       priv->pos_interval = LOCATION_UPDATE_INTERVAL_DEFAULT;
+       priv->vel_interval = LOCATION_UPDATE_INTERVAL_DEFAULT;
+
+       priv->pos_updated_timestamp = 0;
+       priv->vel_updated_timestamp = 0;
 
        priv->pos = NULL;
        priv->vel = NULL;
        priv->acc = NULL;
        priv->zone_status = ZONE_STATUS_NONE;
        priv->boundary_list = NULL;
+
+       priv->pos_timer = 0;
+       priv->vel_timer = 0;
 }
 
 static void
@@ -509,9 +669,17 @@ location_wps_class_init (LocationWpsClass *klass)
                        LOCATION_TYPE_POSITION,
                        G_PARAM_READABLE);
 
-       properties[PROP_UPDATE_INTERVAL] = g_param_spec_uint ("update-interval",
-                       "wps update interval prop",
-                       "wps update interval data",
+       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,
index 29c6612..ee7f67a 100644 (file)
 #include "location-hybrid.h"
 #include "location-gps.h"
 #include "location-wps.h"
-#include "location-ips.h"
 #include "location-cps.h"
-#include "location-sps.h"
 #include "location-position.h"
 #include "map-service.h"
 #include "module-internal.h"
 #include "location-common-util.h"
 
-extern LocationObject *g_map_service;
-
 EXPORT_API
 int location_init (void)
 {
        LOCATION_LOGD("location_init");
        g_type_init ();
+
+#if !GLIB_CHECK_VERSION (2, 31, 0)
        if (!g_thread_supported()) g_thread_init (NULL);
+#endif
        dbus_g_thread_init ();
        if( FALSE == module_init() )
                return LOCATION_ERROR_NOT_AVAILABLE;
@@ -62,24 +61,21 @@ location_new (LocationMethod method)
 {
        LocationObject *self = NULL;
 
-       if (!g_map_service)
-               g_map_service = g_object_new (MAP_TYPE_SERVICE, NULL);
-
        switch (method) {
-       case LOCATION_METHOD_HYBRID:
-               self = g_object_new (LOCATION_TYPE_HYBRID, NULL);
-               break;
-       case LOCATION_METHOD_GPS:
-               self = g_object_new (LOCATION_TYPE_GPS, NULL);
-               break;
-       case LOCATION_METHOD_WPS:
-               self = g_object_new (LOCATION_TYPE_WPS, NULL);
-               break;
-       case LOCATION_METHOD_SPS:
-               self = g_object_new (LOCATION_TYPE_SPS, NULL);
-               break;
-       default:
-               break;
+               case LOCATION_METHOD_HYBRID:
+                       self = g_object_new (LOCATION_TYPE_HYBRID, NULL);
+                       break;
+               case LOCATION_METHOD_GPS:
+                       self = g_object_new (LOCATION_TYPE_GPS, NULL);
+                       break;
+               case LOCATION_METHOD_WPS:
+                       self = g_object_new (LOCATION_TYPE_WPS, NULL);
+                       break;
+               case LOCATION_METHOD_CPS:
+                       self = g_object_new (LOCATION_TYPE_CPS, NULL);
+                       break;
+               default:
+                       break;
        }
        return self;
 }
@@ -89,11 +85,6 @@ location_free (LocationObject *obj)
 {
        g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
 
-       if (g_map_service) {
-               g_object_unref (g_map_service);
-               g_map_service = NULL;
-       }
-
        g_object_unref (obj);
        return LOCATION_ERROR_NONE;
 }
@@ -102,6 +93,11 @@ EXPORT_API int
 location_start (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);
+       if (FALSE == location_application_enabled()) {
+               LOCATION_LOGD("Application dose not have permission");
+               return LOCATION_ERROR_NOT_ALLOWED;
+       }
        return location_ielement_start (LOCATION_IELEMENT(obj));
 }
 
@@ -109,6 +105,7 @@ 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);
        return location_ielement_stop (LOCATION_IELEMENT(obj));
 }
 
@@ -119,7 +116,7 @@ location_is_supported_method(LocationMethod method)
 
        switch(method) {
        case LOCATION_METHOD_HYBRID:
-               if(module_is_supported("gps") || module_is_supported("wps") || module_is_supported("sps"))
+               if(module_is_supported("gps") || module_is_supported("wps"))
                        is_supported = TRUE;
                break;
        case LOCATION_METHOD_GPS:
@@ -128,11 +125,9 @@ location_is_supported_method(LocationMethod method)
        case LOCATION_METHOD_WPS:
                is_supported = module_is_supported("wps");
                break;
-       case LOCATION_METHOD_SPS:
-               is_supported = module_is_supported("sps");
+       case LOCATION_METHOD_CPS:
+               is_supported = module_is_supported("cps");
                break;
-       case LOCATION_METHOD_CPS:       /* deprecated */
-       case LOCATION_METHOD_IPS:       /* deprecated */
        default:
                break;
        }
@@ -144,8 +139,9 @@ EXPORT_API gboolean
 location_is_enabled_gps(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);
 
-       return (gboolean) location_setting_get_int(GPS_ENABLED);
+       return (gboolean) location_setting_get_int(VCONFKEY_LOCATION_ENABLED);
 }
 
 EXPORT_API int
@@ -154,6 +150,7 @@ location_get_position (LocationObject *obj,
        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);
        return location_ielement_get_position (LOCATION_IELEMENT(obj), position, accuracy);
@@ -165,22 +162,17 @@ location_get_last_position (LocationObject *obj,
        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);
        return location_ielement_get_last_position (LOCATION_IELEMENT(obj), position, accuracy);
 }
 
 EXPORT_API int
-location_get_last_known_position (LocationObject *obj, LocationMethod method,
-       LocationLastPosition *last_position)
-{
-       return LOCATION_ERROR_NOT_SUPPORTED;
-}
-
-EXPORT_API int
 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 (satellite, LOCATION_ERROR_PARAMETER);
 
        return location_ielement_get_satellite (LOCATION_IELEMENT(obj), satellite);
@@ -190,6 +182,7 @@ 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 (G_OBJECT_TYPE(obj) != MAP_TYPE_SERVICE, LOCATION_ERROR_PARAMETER);
        g_return_val_if_fail (satellite, LOCATION_ERROR_PARAMETER);
 
        return location_ielement_get_last_satellite (LOCATION_IELEMENT(obj), satellite);
@@ -201,6 +194,7 @@ location_get_velocity (LocationObject *obj,
        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 (velocity, LOCATION_ERROR_PARAMETER);
        g_return_val_if_fail (accuracy, LOCATION_ERROR_PARAMETER);
 
@@ -213,6 +207,7 @@ location_get_last_velocity (LocationObject *obj,
        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 (velocity, LOCATION_ERROR_PARAMETER);
        g_return_val_if_fail (accuracy, LOCATION_ERROR_PARAMETER);
 
index 17f1164..e74ae40 100644 (file)
@@ -32,7 +32,6 @@
 #include <location-address.h>
 #include <location-boundary.h>
 #include <location-satellite.h>
-#include <location-map-service.h>
 
 G_BEGIN_DECLS
 
@@ -201,6 +200,24 @@ cb_service_updated (GObject *self,
                                        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_debug ("ASYNC>> Current Satellite> time: %d, satellite in view = %d, satellite in used = %d", sat->timestamp, 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++) {
+                               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);
+                       }
+               }
+                       break;
+
                default:
                        g_warning ("ASYNC>> Undefined update type");
                        break;
@@ -580,14 +597,6 @@ int location_get_last_satellite (LocationObject *obj, LocationSatellite **satell
 
 /**
  * @brief
- * Get last known position information with estimate of the accuracy.
- * @remarks This API would be DEPRECATED. \n
- * @see location_get_last_position
- */
-int location_get_last_known_position (LocationObject *obj, LocationMethod method, LocationLastPosition *last_position) LOCATION_DEPRECATED_API;
-
-/**
- * @brief
  * Get current velocity information with estimate of the accuracy.
  * @remarks Out parameters are should be freed.
  * @pre
index 8105fcb..ce4aeca 100644 (file)
@@ -6,7 +6,8 @@ MAP_SERVICE_DIR = map-service
 MODULE_DIR = module\r
 \r
 liblocation_map_service_la_SOURCES = \\r
-                                                        location-pref.c   \\r
+                                                        location-map-pref.c   \\r
+                                                        location-map-ielement.c \\r
                                                         location-address.c  \\r
                                                         location-geocode.c \\r
                                                         location-poi.c   \\r
index 77e6208..8b1109a 100644 (file)
@@ -22,7 +22,7 @@
 #ifndef __LOCATION_ADDRESS_H_
 #define __LOCATION_ADDRESS_H_
 
-#include <location-types.h>
+#include <location-map-types.h>
 
 G_BEGIN_DECLS
 
index 1e8b4de..e54b4a7 100644 (file)
@@ -22,7 +22,7 @@
 #ifndef __LOCATION_GEOCODE_H__
 #define __LOCATION_GEOCODE_H__
 
-#include <location-types.h>
+#include <location-map-types.h>
 
 G_BEGIN_DECLS
 
index 3658d6d..0aa8a25 100644 (file)
@@ -22,7 +22,7 @@
 #ifndef __LOCATION_LANDMARK_EXT_H__
 #define __LOCATION_LANDMARK_EXT_H__
 
-#include <location-types.h>
+#include <location-map-types.h>
 
 G_BEGIN_DECLS
 
@@ -42,67 +42,197 @@ G_BEGIN_DECLS
 
 /**
  * @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 [in] landmark - a #LocationLandmark
+ * @param [in] category - a GList
+ * @return gboolean
+ * @retval  TRUE if success
+ * @see location_landmark_get_category
  */
 gboolean location_landmark_set_category (const 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 [in] 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 (const 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 [in] 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 (const 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);
 
index 91c4504..334d3d0 100644 (file)
@@ -148,7 +148,7 @@ location_landmark_get_phone_number (const LocationLandmark *landmark)
 {
        g_return_val_if_fail(landmark, NULL);
 
-       return (const gchar *) landmark->phone_number;
+       return landmark->phone_number;
 }
 
 EXPORT_API GList *
index 401c801..0efaab0 100644 (file)
@@ -22,7 +22,7 @@
 #ifndef __LOCATION_LANDMARK_H__
 #define __LOCATION_LANDMARK_H__
 
-#include <location-types.h>
+#include <location-map-types.h>
 
 G_BEGIN_DECLS
 
diff --git a/location/map-service/location-map-ielement.c b/location/map-service/location-map-ielement.c
new file mode 100644 (file)
index 0000000..dd4bb36
--- /dev/null
@@ -0,0 +1,265 @@
+/*
+ * libslp-location
+ *
+ * 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.
+ */
+
+#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,
+       LocationPositionCB callback,
+       gpointer userdata)
+{
+       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 (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, callback, userdata);
+}
+
+int
+location_map_ielement_get_geocode_freeform_async (LocationMapIElement *self,
+       const gchar *address,
+       const LocationMapPref *svc_pref,
+       LocationPositionCB callback,
+       gpointer userdata)
+{
+       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 (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, callback, userdata);
+}
+
+int
+location_map_ielement_get_reversegeocode_async (LocationMapIElement *self,
+       const LocationPosition *position,
+       const LocationMapPref *svc_pref,
+       LocationAddressCB callback,
+       gpointer userdata)
+{
+       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 (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);
+}
+
+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);
+}
diff --git a/location/map-service/location-map-ielement.h b/location/map-service/location-map-ielement.h
new file mode 100644 (file)
index 0000000..ff21283
--- /dev/null
@@ -0,0 +1,101 @@
+/*
+ * libslp-location
+ *
+ * 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_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, LocationPositionCB callback, gpointer userdata);
+typedef int (*TYPE_GET_GEOCODE_FREEFORM_ASYNC)(LocationMapIElement *self, const gchar *address,  const LocationMapPref *svc_pref, LocationPositionCB callback, gpointer userdata);
+typedef int (*TYPE_GET_REVERSEGEOCODE_ASYNC)(LocationMapIElement *self, const LocationPosition *position, const LocationMapPref *svc_pref, LocationAddressCB callback, gpointer userdata);
+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_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, LocationPositionCB callback, gpointer userdata);
+int location_map_ielement_get_geocode_freeform_async (LocationMapIElement *self, const gchar *address, const LocationMapPref *svc_pref, LocationPositionCB callback, gpointer userdata);
+int location_map_ielement_get_reversegeocode_async (LocationMapIElement *self, const LocationPosition *position, const LocationMapPref *svc_pref, LocationAddressCB callback, gpointer userdata);
+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
similarity index 70%
rename from location/map-service/location-pref.c
rename to location/map-service/location-map-pref.c
index 28f2abb..486d8e3 100644 (file)
 #endif
 
 #include <glib.h>
-#include "location-types.h"
+#include "location-map-types.h"
 #include "map-service.h"
-#include "location-pref.h"
+#include "location-map-pref.h"
 
-struct _LocationPreference {
+struct _LocationMapPref {
        gchar *provider_name;                ///< Name of the service provier
     gchar *language;            ///< Language of the service preference.
     gchar *country;                            ///< Country of the service preference.
@@ -37,7 +37,7 @@ struct _LocationPreference {
 };
 
 EXPORT_API GList *
-location_pref_get_property_key (const LocationPreference *pref)
+location_map_pref_get_property_key (const LocationMapPref *pref)
 {
        g_return_val_if_fail (pref, NULL);
 
@@ -47,7 +47,7 @@ location_pref_get_property_key (const LocationPreference *pref)
 }
 
 EXPORT_API gchar *
-location_pref_get_language (const LocationPreference *pref)
+location_map_pref_get_language (const LocationMapPref *pref)
 {
        g_return_val_if_fail (pref, NULL);
 
@@ -55,7 +55,7 @@ location_pref_get_language (const LocationPreference *pref)
 }
 
 EXPORT_API gchar *
-location_pref_get_country (const LocationPreference *pref)
+location_map_pref_get_country (const LocationMapPref *pref)
 {
        g_return_val_if_fail (pref, NULL);
 
@@ -63,7 +63,7 @@ location_pref_get_country (const LocationPreference *pref)
 }
 
 EXPORT_API gchar *
-location_pref_get_distance_unit (const LocationPreference *pref)
+location_map_pref_get_distance_unit (const LocationMapPref *pref)
 {
        g_return_val_if_fail (pref, NULL);
 
@@ -71,7 +71,7 @@ location_pref_get_distance_unit (const LocationPreference *pref)
 }
 
 EXPORT_API gconstpointer
-location_pref_get_property (const LocationPreference *pref, gconstpointer key)
+location_map_pref_get_property (const LocationMapPref *pref, gconstpointer key)
 {
        g_return_val_if_fail (pref, NULL);
        g_return_val_if_fail (key, NULL);
@@ -81,7 +81,7 @@ location_pref_get_property (const LocationPreference *pref, gconstpointer key)
 }
 
 EXPORT_API gchar *
-location_pref_get_provider_name (const LocationPreference *pref)
+location_map_pref_get_provider_name (const LocationMapPref *pref)
 {
        g_return_val_if_fail (pref, NULL);
 
@@ -89,7 +89,7 @@ location_pref_get_provider_name (const LocationPreference *pref)
 }
 
 EXPORT_API gboolean
-location_pref_set_provider_name (LocationPreference *pref, const gchar *name)
+location_map_pref_set_provider_name (LocationMapPref *pref, const gchar *name)
 {
        g_return_val_if_fail (pref, FALSE);
 
@@ -104,7 +104,7 @@ location_pref_set_provider_name (LocationPreference *pref, const gchar *name)
 }
 
 EXPORT_API gboolean
-location_pref_set_language (LocationPreference *pref, const gchar * language)
+location_map_pref_set_language (LocationMapPref *pref, const gchar * language)
 {
        g_return_val_if_fail (pref, FALSE);
 
@@ -119,7 +119,7 @@ location_pref_set_language (LocationPreference *pref, const gchar * language)
 }
 
 EXPORT_API gboolean
-location_pref_set_country (LocationPreference *pref, const gchar *country)
+location_map_pref_set_country (LocationMapPref *pref, const gchar *country)
 {
        g_return_val_if_fail (pref, FALSE);
 
@@ -135,7 +135,7 @@ location_pref_set_country (LocationPreference *pref, const gchar *country)
 
 
 EXPORT_API gboolean
-location_pref_set_distance_unit (LocationPreference *pref, const gchar * unit)
+location_map_pref_set_distance_unit (LocationMapPref *pref, const gchar * unit)
 {
        g_return_val_if_fail (pref, FALSE);
 
@@ -150,7 +150,7 @@ location_pref_set_distance_unit (LocationPreference *pref, const gchar * unit)
 }
 
 EXPORT_API gboolean
-location_pref_set_property (LocationPreference *pref, gconstpointer key, gconstpointer value)
+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);
@@ -165,10 +165,10 @@ location_pref_set_property (LocationPreference *pref, gconstpointer key, gconstp
        return TRUE;
 }
 
-EXPORT_API LocationPreference *
-location_pref_new (void)
+EXPORT_API LocationMapPref *
+location_map_pref_new (void)
 {
-       LocationPreference *pref = g_slice_new0(LocationPreference);
+       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);
@@ -189,17 +189,17 @@ static void property_copy (gpointer key, gpointer value, gpointer user_data)
        g_hash_table_insert (properties, re_key, re_val);
 }
 
-EXPORT_API LocationPreference *
-location_pref_copy (LocationPreference *pref)
+EXPORT_API LocationMapPref *
+location_map_pref_copy (LocationMapPref *pref)
 {
        g_return_val_if_fail (pref, NULL);
 
-       LocationPreference *new_pref = location_pref_new();
+       LocationMapPref *new_pref = location_map_pref_new();
        if (!new_pref) return NULL;
 
-       location_pref_set_provider_name (new_pref, location_pref_get_provider_name(pref));
-       location_pref_set_language (new_pref, location_pref_get_language(pref));
-       location_pref_set_distance_unit (new_pref, location_pref_get_distance_unit(pref));
+       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);
@@ -208,15 +208,15 @@ location_pref_copy (LocationPreference *pref)
 }
 
 EXPORT_API void
-location_pref_free (LocationPreference * pref)
+location_map_pref_free (LocationMapPref * pref)
 {
        g_return_if_fail(pref);
 
-       location_pref_set_provider_name (pref, NULL);
-       location_pref_set_language (pref, NULL);
-       location_pref_set_distance_unit (pref, NULL);
+       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 (LocationPreference, pref);
+       g_slice_free (LocationMapPref, pref);
        pref = NULL;
 }
similarity index 60%
rename from location/map-service/location-pref.h
rename to location/map-service/location-map-pref.h
index 577eb17..05aff4f 100644 (file)
  * limitations under the License.
  */
 
-#ifndef __LOCATION_PREF_H__
-#define __LOCATION_PREF_H__
+#ifndef __LOCATION_MAP_PREF_H__
+#define __LOCATION_MAP_PREF_H__
 
-#include <location-types.h>
+#include <location-map-types.h>
 
 G_BEGIN_DECLS
 
 /**
- * @file location-pref.h
+ * @file location-map-pref.h
  * @brief This file contains the internal definitions and structures related to a service provider.
  * @addtogroup LocationMapService
  * @{
@@ -40,74 +40,72 @@ G_BEGIN_DECLS
 /**
  * @brief Get provider name to be used in the service request
  */
-gchar *location_pref_get_provider_name (const LocationPreference *pref);
+gchar *location_map_pref_get_provider_name (const LocationMapPref *pref);
 
 /**
  * @brief Get language to be used in the service request.
  */
-gchar *location_pref_get_language (const LocationPreference *pref);
+gchar *location_map_pref_get_language (const LocationMapPref *pref);
 
 /**
  * @brief Get country to be used in the service request.
  */
-gchar *location_pref_get_country (const LocationPreference *pref);
-
+gchar *location_map_pref_get_country (const LocationMapPref *pref);
 
 /**
  * @brief Get the preferred length unit to be used in the service request.
  */
-gchar *location_pref_get_distance_unit (const LocationPreference *pref);
+gchar *location_map_pref_get_distance_unit (const LocationMapPref *pref);
 
 /**
  * @brief Get available service of the service provider.
  */
-GList *location_pref_get_property_key (const LocationPreference *pref);
+GList *location_map_pref_get_property_key (const LocationMapPref *pref);
 
 /**
  * @brief Get property to be used in the service request.
  */
-gconstpointer location_pref_get_property (const LocationPreference *pref, gconstpointer key);
+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_pref_set_provider_name (LocationPreference *pref, const gchar *name);
+gboolean location_map_pref_set_provider_name (LocationMapPref *pref, const gchar *name);
 
 /**
  * @brief Set language to be used in the service request.
  */
-gboolean location_pref_set_language (LocationPreference *pref, const gchar *language);
+gboolean location_map_pref_set_language (LocationMapPref *pref, const gchar *language);
 
 /**
  * @brief Set country to be used in the service request.
  */
-gboolean location_pref_set_country (LocationPreference *pref, const gchar *country);
+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_pref_set_distance_unit (LocationPreference *pref, const gchar * unit);
+gboolean location_map_pref_set_distance_unit (LocationMapPref *pref, const gchar * unit);
 
 /**
  * @brief Set property to be used in the service request.
  */
-gboolean location_pref_set_property (LocationPreference *pref, gconstpointer key, gconstpointer value);
+gboolean location_map_pref_set_property (LocationMapPref *pref, gconstpointer key, gconstpointer value);
 
 /**
- * @brief Create a new LocationPreference.
+ * @brief Create a new LocationMapPref.
  */
-LocationPreference * location_pref_new (void);
+LocationMapPref * location_map_pref_new (void);
 
 /**
- * @brief Create a new LocationPreference.
+ * @brief Copy a new LocationMapPref.
  */
-LocationPreference * location_pref_copy (LocationPreference *pref);
-
+LocationMapPref * location_map_pref_copy (LocationMapPref *pref);
 
 /**
- * @brief Free a LocationPreference.
+ * @brief Free a LocationMapPref.
  */
-void location_pref_free (LocationPreference * pref);
+void location_map_pref_free (LocationMapPref *pref);
 
 /**
  * @} @}
@@ -115,7 +113,4 @@ void location_pref_free (LocationPreference * pref);
 
 G_END_DECLS
 
-#endif /* __LOCATION_PREF_H__ */
-
-
-
+#endif /* __LOCATION_MAP_PREF_H__ */
index e7df5ae..0a1b493 100644 (file)
@@ -24,7 +24,7 @@
 #define __LOCATION_MAP_SERVICE_EXT_H__
 
 
-#include <location-types.h>
+#include <location-map-types.h>
 #include <location-route-ext.h>
 #include <location-landmark-ext.h>
 
index 9bb0ebb..2d84d71 100644 (file)
 #include "location.h"
 #include "location-log.h"
 #include "location-setting.h"
-#include "location-ielement.h"
-#include "location-pref.h"
+#include "location-map-ielement.h"
+#include "location-map-pref.h"
+#include "location-map-service.h"
 #include "map-service.h"
 
-LocationObject *g_map_service = NULL;
+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);
 
-//static LocationObject *poi = NULL;
+       g_object_unref (obj);
+
+       return LOCATION_ERROR_NONE;
+}
 
 static gboolean
 is_connected_network()
@@ -54,274 +70,315 @@ is_connected_network()
 }
 
 EXPORT_API int
-location_get_position_from_address (LocationObject *obj,
+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_map_service, LOCATION_ERROR_NOT_AVAILABLE);
+       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_ielement_get_geocode (LOCATION_IELEMENT(g_map_service), address, position_list, accuracy_list);
+
+       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_get_position_from_freeformed_address (LocationObject *obj,
+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_map_service, LOCATION_ERROR_NOT_AVAILABLE);
+       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_ielement_get_geocode_freeform (LOCATION_IELEMENT(g_map_service), address, position_list, accuracy_list);
+       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_get_address (LocationObject *obj,
+location_map_get_address (LocationMapObject *obj,
        LocationAddress **address,
        LocationAccuracy **accuracy)
 {
-       g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
-       g_return_val_if_fail (g_map_service, LOCATION_ERROR_NOT_AVAILABLE);
-       g_return_val_if_fail (is_connected_network(), LOCATION_ERROR_NETWORK_NOT_CONNECTED);
-
-       LocationPosition *position = NULL;
-       int ret = location_ielement_get_position(LOCATION_IELEMENT (obj), &position, accuracy);
-       if (LOCATION_ERROR_NONE != ret) return ret;
-       ret = location_ielement_get_reversegeocode (LOCATION_IELEMENT(g_map_service), position, address, accuracy);
-       location_position_free (position);
-       return ret;
+       return LOCATION_ERROR_NOT_SUPPORTED;
 }
 
 EXPORT_API int
-location_get_address_from_position (LocationObject *obj,
+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_map_service, LOCATION_ERROR_NOT_AVAILABLE);
+       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_ielement_get_reversegeocode (LOCATION_IELEMENT(g_map_service), position, address, accuracy);
+
+       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_get_position_from_address_async (LocationObject *obj,
+location_map_get_position_from_address_async (LocationMapObject *obj,
        const LocationAddress *address,
        LocationPositionCB callback,
        gpointer userdata)
 {
        g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
-       g_return_val_if_fail (g_map_service, LOCATION_ERROR_NOT_AVAILABLE);
+       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_ielement_get_geocode_async (LOCATION_IELEMENT(g_map_service), address, callback, userdata);
+
+       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, callback, userdata);
+       location_map_pref_free(svc_pref);
+
+       return ret;
 }
 
 
 EXPORT_API int
-location_get_position_from_freeformed_address_async (LocationObject *obj,
+location_map_get_position_from_freeformed_address_async (LocationMapObject *obj,
        const gchar *address,
        LocationPositionCB callback,
        gpointer userdata)
 {
        g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
-       g_return_val_if_fail (g_map_service, LOCATION_ERROR_NOT_AVAILABLE);
+       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_ielement_get_geocode_freeform_async (LOCATION_IELEMENT(g_map_service), address, callback, userdata);
-}
 
-EXPORT_API int
-location_get_address_async (LocationObject *obj,
-       LocationAddressCB callback,
-       gpointer userdata)
-{
-       g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
-       g_return_val_if_fail (g_map_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_async (LOCATION_MAP_IELEMENT(obj), address, svc_pref, callback, userdata);
+       location_map_pref_free(svc_pref);
 
-       LocationPosition *position = NULL;
-       LocationAccuracy *acc = NULL;
-       int ret = location_ielement_get_position(LOCATION_IELEMENT(obj), &position, &acc);
-       if (LOCATION_ERROR_NONE != ret) return ret;
-       ret = location_ielement_get_reversegeocode_async (LOCATION_IELEMENT(g_map_service), position, callback, userdata);
-       location_position_free (position);
        return ret;
 }
 
 EXPORT_API int
-location_get_address_from_position_async (LocationObject *obj,
+location_map_get_address_from_position_async (LocationMapObject *obj,
        const LocationPosition *position,
        LocationAddressCB callback,
        gpointer userdata)
 {
        g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
-       g_return_val_if_fail (g_map_service, LOCATION_ERROR_NOT_AVAILABLE);
+       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_ielement_get_reversegeocode_async (LOCATION_IELEMENT(g_map_service), position, callback, userdata);
+       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);
+       location_map_pref_free(svc_pref);
+
+       return ret;
 }
 
 EXPORT_API int
-location_search_poi (LocationObject *obj,
-               const LocationPOIFilter * filter,
+location_map_search_poi (LocationMapObject *obj,
+               const LocationPOIFilter *filter,
                const LocationPosition *position,
-               const LocationPOIPreference * pref,
+               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 (g_map_service, LOCATION_ERROR_NOT_AVAILABLE);
        g_return_val_if_fail (is_connected_network(), LOCATION_ERROR_NETWORK_NOT_CONNECTED);
 
-       LocationPreference *svc_pref = location_get_map_service_pref (g_map_service);
+       LocationMapPref *svc_pref = location_map_get_service_pref (obj);
 
-       return location_ielement_search_poi (LOCATION_IELEMENT(g_map_service), filter, position, svc_pref, pref, cb, user_data, req_id);
+       return location_map_ielement_search_poi (LOCATION_MAP_IELEMENT(obj), filter, position, svc_pref, pref, cb, user_data, req_id);
 }
 
 EXPORT_API int
-location_search_poi_by_area (LocationObject *obj,
-               const LocationPOIFilter * filter,
-               const LocationBoundary * boundary,
-               const LocationPOIPreference * pref,
+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 (g_map_service, LOCATION_ERROR_NOT_AVAILABLE);
        g_return_val_if_fail (is_connected_network(), LOCATION_ERROR_NETWORK_NOT_CONNECTED);
 
-       LocationPreference *svc_pref = location_get_map_service_pref (g_map_service);
+       LocationMapPref *svc_pref = location_map_get_service_pref (obj);
 
-       return location_ielement_search_poi_by_area (LOCATION_IELEMENT(g_map_service), filter, boundary, svc_pref, pref, cb, user_data, req_id);
+       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_search_poi_by_address (LocationObject *obj, const LocationPOIFilter * filter,
+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 (g_map_service, LOCATION_ERROR_NOT_AVAILABLE);
        g_return_val_if_fail (is_connected_network(), LOCATION_ERROR_NETWORK_NOT_CONNECTED);
 
-       LocationPreference *svc_pref = location_get_map_service_pref (g_map_service);
+       LocationMapPref *svc_pref = location_map_get_service_pref (obj);
 
-       return location_ielement_search_poi_by_address (LOCATION_IELEMENT(g_map_service), filter, address, svc_pref, pref, cb, user_data, req_id);
+       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_search_poi_by_freeformed_address (LocationObject *obj,
-               const LocationPOIFilter * filter,
-               const gchar * address,
-               const LocationPOIPreference * pref,
-               LocationPOICB cb, gpointer user_data, guint * req_id)
+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 (g_map_service, LOCATION_ERROR_NOT_AVAILABLE);
        g_return_val_if_fail (is_connected_network(), LOCATION_ERROR_NETWORK_NOT_CONNECTED);
 
-       LocationPreference *svc_pref = location_get_map_service_pref (g_map_service);
+       LocationMapPref *svc_pref = location_map_get_service_pref (obj);
 
-       return location_ielement_search_poi_by_freeform (LOCATION_IELEMENT(g_map_service), filter, address, svc_pref, pref, cb, user_data, req_id);
+       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_cancel_poi_request (LocationObject *obj, guint req_id)
+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 (g_map_service, LOCATION_ERROR_NOT_AVAILABLE);
        g_return_val_if_fail (is_connected_network(), LOCATION_ERROR_NETWORK_NOT_CONNECTED);
 
-       return location_ielement_cancel_poi_request (LOCATION_IELEMENT(g_map_service), req_id);
+       return location_map_ielement_cancel_poi_request (LOCATION_MAP_IELEMENT(obj), req_id);
 }
 
 EXPORT_API int
-location_request_route (LocationObject *obj, LocationPosition *origin, LocationPosition *destination,
+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 (g_map_service, LOCATION_ERROR_NOT_AVAILABLE);
        g_return_val_if_fail (is_connected_network(), LOCATION_ERROR_NETWORK_NOT_CONNECTED);
 
-       LocationPreference *svc_pref = location_get_map_service_pref (g_map_service);
+       LocationMapPref *svc_pref = location_map_get_service_pref (obj);
 
-       return location_ielement_request_route (LOCATION_IELEMENT(g_map_service), origin, destination,
+       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_cancel_route_request (LocationObject *obj, guint req_id)
+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_map_service, LOCATION_ERROR_NOT_AVAILABLE);
+       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_ielement_cancel_route_request (LOCATION_IELEMENT(g_map_service), req_id);
+       return location_map_ielement_cancel_route_request (LOCATION_MAP_IELEMENT(obj), req_id);
 }
 
 EXPORT_API gboolean
-location_is_supported_map_provider_capability (LocationObject *obj, LocationMapServiceType type)
+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_map_service, 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_ielement_is_supported_map_provider_capability (LOCATION_IELEMENT(g_map_service), type);
+       return location_map_ielement_is_supported_provider_capability (LOCATION_MAP_IELEMENT(obj), type);
 }
 
 EXPORT_API int
-location_get_map_provider_capability_key (LocationObject *obj, LocationMapServiceType type, GList **key)
+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 (g_map_service, LOCATION_ERROR_PARAMETER);
        g_return_val_if_fail (is_connected_network(), LOCATION_ERROR_NETWORK_NOT_CONNECTED);
 
-       return location_ielement_get_map_provider_capability_key (LOCATION_IELEMENT(g_map_service), type, key);
+       return location_map_ielement_get_provider_capability_key (LOCATION_MAP_IELEMENT(obj), type, key);
 }
 
-EXPORT_API LocationPreference *
-location_get_map_service_pref (LocationObject *obj)
+EXPORT_API LocationMapPref *
+location_map_get_service_pref (LocationMapObject *obj)
 {
        g_return_val_if_fail (obj, NULL);
-       g_return_val_if_fail (g_map_service, NULL);
+       g_return_val_if_fail (G_OBJECT_TYPE(obj) == MAP_TYPE_SERVICE, NULL);
 
-       return map_service_get_pref (g_map_service);
+       return map_service_get_pref (obj);
 }
 
 EXPORT_API gboolean
-location_set_map_service_pref (LocationObject *obj, LocationPreference *pref)
+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);
-       g_return_val_if_fail (g_map_service, FALSE);
 
-       return map_service_set_pref (g_map_service, pref);
+       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);
+}
+
index 73421a4..2482e84 100644 (file)
 
 
 #include <glib.h>
-#include <location-types.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-pref.h>
 #include <location-landmark.h>
 
 G_BEGIN_DECLS
@@ -47,6 +48,24 @@ G_BEGIN_DECLS
  */
 
 /**
+* @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.
@@ -55,7 +74,7 @@ G_BEGIN_DECLS
  * Calling application must have an active data connection.
  * @post None.
  * @param [in]
- * obj - a #LocationObject created by #location_new
+ * obj - a #LocationMapObject created by #location_map_new
  * @param [in]
  * address - a #LocationAddress
  * @param [out]
@@ -67,7 +86,7 @@ G_BEGIN_DECLS
  *
  * Please refer #LocationError for more information.
  * @see
- * location_get_position_from_address_async\n
+ * location_map_get_position_from_address_async\n
  * @par Example
  * @code
 #include <location.h>
@@ -116,13 +135,13 @@ static void PrintAcc (gpointer data, gpointer user_data)
 
 int main (int argc, char *argv[])
 {
-       LocationObject *loc = NULL;
+       LocationMapObject *loc = NULL;
        int ret = LOCATION_ERROR_NONE;
 
        location_init ();
-       loc  = location_new (LOCATION_METHOD_GPS);
+       loc  = location_map_new (NULL);
        if(!loc){
-               g_debug("location_new failed");
+               g_debug("location_map_new failed");
                return -1;
        }
 
@@ -131,7 +150,7 @@ int main (int argc, char *argv[])
        LocationAddress *addr = NULL;
 
        addr = location_address_new ("1", "Post Street", NULL, "san jose", "ca", NULL, "95113");
-       if (LOCATION_ERROR_NONE == location_get_position_from_address(loc, addr, &pos_list, &acc_list)) {
+       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);
@@ -139,12 +158,12 @@ int main (int argc, char *argv[])
        g_list_foreach (acc_list, PrintAcc, NULL);
        g_list_free (pos_list);
        g_list_free (acc_list);
-       location_free (loc);
+       location_map_free (loc);
        return 0;
 }
  * @endcode
  */
-int location_get_position_from_address (LocationObject *obj, const LocationAddress *address, GList **position_list, GList **accuracy_list);
+int location_map_get_position_from_address (LocationMapObject *obj, const LocationAddress *address, GList **position_list, GList **accuracy_list);
 
 /**
  * @brief
@@ -156,7 +175,7 @@ int location_get_position_from_address (LocationObject *obj, const LocationAddre
  * Calling application must have an active data connection.
  * @post None.
  * @param [in]
- * obj - a #LocationObject created by #location_new
+ * obj - a #LocationMapObject created by #location_map_new
  * @param [in]
  * address - a #LocationAddress
  * @param [in]
@@ -168,10 +187,9 @@ int location_get_position_from_address (LocationObject *obj, const LocationAddre
  *
  * Please refer #LocationError for more information.
  * @see
- * location_get_position_from_address\n
+ * location_map_get_position_from_address\n
  * @par Example
  * @code
-#include <location.h>
 #include <location-map-service.h>
 
 static void PrintPos (gpointer data, gpointer user_data)
@@ -200,18 +218,18 @@ cb_position_from_address (LocationError error, GList *position_list, GList *accu
        }
 }
 
-void get_position_from_address(LocationObject* loc)
+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_get_position_from_address_async(loc, addr, cb_position_from_address, loc))
-               g_debug("location_get_position_from_address_async() success");
-       else g_warning ("location_get_position_from_address_async() failed");
+       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_get_position_from_address_async (LocationObject *obj, const LocationAddress *address, LocationPositionCB callback, gpointer userdata);
+int location_map_get_position_from_address_async (LocationMapObject *obj, const LocationAddress *address, LocationPositionCB callback, gpointer userdata);
 
 /**
  * @brief
@@ -222,7 +240,7 @@ int location_get_position_from_address_async (LocationObject *obj, const Locatio
  * Calling application must have an active data connection.
  * @post None.
  * @param [in]
- * obj - a #LocationObject created by #location_new
+ * obj - a #LocationMapObject created by #location_map_new
  * @param [in]
  * address - Free-formed address string to be used
  * @param [out]
@@ -234,7 +252,7 @@ int location_get_position_from_address_async (LocationObject *obj, const Locatio
  *
  * Please refer #LocationError for more information.
  * @see
- * location_get_position_from_freeformed_address_async\n
+ * location_map_get_position_from_freeformed_address_async\n
  * @par Example
  * @code
 #include <location.h>
@@ -282,13 +300,13 @@ static void PrintAcc (gpointer data, gpointer user_data)
 
 int main (int argc, char *argv[])
 {
-       LocationObject *loc = NULL;
+       LocationMapObject *loc = NULL;
        int ret = LOCATION_ERROR_NONE;
 
        location_init ();
-       loc  = location_new (LOCATION_METHOD_GPS);
+       loc  = location_map_new (NULL);
        if(!loc){
-               g_debug("location_new failed");
+               g_debug("location_map_new failed");
                return -1;
        }
 
@@ -297,7 +315,7 @@ int main (int argc, char *argv[])
        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_get_position_from_freeformed_address(loc, addr_str, &pos_list, &acc_list)) {
+       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);
@@ -310,7 +328,7 @@ int main (int argc, char *argv[])
 }
  * @endcode
  */
-int location_get_position_from_freeformed_address (LocationObject *obj, const gchar *address, GList **position_list, GList **accuracy_list);
+int location_map_get_position_from_freeformed_address (LocationMapObject *obj, const gchar *address, GList **position_list, GList **accuracy_list);
 
 /**
  * @brief
@@ -322,7 +340,7 @@ int location_get_position_from_freeformed_address (LocationObject *obj, const gc
  * Calling application must have an active data connection.
  * @post None.
  * @param [in]
- * obj - a #LocationObject created by #location_new
+ * obj - a #LocationMapObject created by #location_map_new
  * @param [in]
  * address - Free-formed address string to be used
  * @param [in]
@@ -334,7 +352,7 @@ int location_get_position_from_freeformed_address (LocationObject *obj, const gc
  *
  * Please refer #LocationError for more information.
  * @see
- * location_get_position_from_freeformed_address\n
+ * location_map_get_position_from_freeformed_address\n
  * @par Example
  * @code
 #include <location.h>
@@ -367,174 +385,19 @@ cb_position_from_freeformed_address (LocationError error, GList *position_list,
        }
 }
 
-void get_position_from_address(LocationObject* loc)
+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_get_position_from_freeformed_address_async(loc, addr_str, cb_position_from_freeformed_address, loc))
-               g_debug("location_get_position_from_freeformed_address_async() success");
-       else g_warning ("location_get_position_from_freeformed_address_async() failed");
+       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_get_position_from_freeformed_address_async (LocationObject *obj, const gchar *address, LocationPositionCB callback,       gpointer userdata);
-
-/**
- * @brief
- * Get current address information with estimate of the accuracy by using current position.
- * @remarks Out parameters are should be freed.
- * @pre
- * #location_init should be called before.\n
- * #location_start should be called before.\n
- * Calling application must have an active data connection.
- * @post None.
- * @param [in]
- * obj - a #LocationObject created by #location_new
- * @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_get_address_async\n
- * @par Example
- * @code
-#include <location.h>
-#include <location-map-service.h>
-static GMainLoop *loop = NULL;
-
-static void cb_service_enabled (GObject *self, guint status, gpointer userdata)
-{
-       g_debug("cb_service_enabled: status(%d) userdata(0x%x)", status, (unsigned int)userdata);
-
-       LocationAddress *addr = NULL;
-       LocationAccuracy *acc = NULL;
-       LocationObject *loc = (LocationObject*)userdata;
-
-       // This function works properly after service is enabled.
-       //Calling application must have an active data connection before using this function.
-       if (LOCATION_ERROR_NONE == location_get_address(loc, &addr, &acc)) {
-               g_debug ("SYNC>> Current address> %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>> Current address> failed");
-}
-
-int main (int argc, char *argv[])
-{
-       LocationObject *loc = NULL;
-       gulong handler_id = 0;
-       int ret = LOCATION_ERROR_NONE;
-
-       location_init ();
-
-       loop = g_main_loop_new (NULL, TRUE);
-
-       loc  = location_new (LOCATION_METHOD_GPS);
-       if(!loc){
-               g_debug("location_new failed");
-               return -1;
-       }
-
-       handler_id = g_signal_connect (loc, "service-enabled", G_CALLBACK(cb_service_enabled), loc);
-       location_start (loc);
-       g_main_loop_run (loop);
-
-       g_signal_handler_disconnect(loc, handler_id);
-       location_stop (loc);
-       location_free (loc);
-
-       return 0;
-}
- * @endcode
- */
-int location_get_address (LocationObject *obj, LocationAddress **address, LocationAccuracy **accuracy);
-
-/**
- * @brief
- * Get current address information asynchronously with estimate of the accuracy by using current position.
- * @remarks None.
- * @pre
- * #location_init should be called before.\n
- * #location_start 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 #LocationObject created by #location_new
- * @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_get_address\n
- * @par Example
- * @code
-#include <location.h>
-#include <location-map-service.h>
-static GMainLoop *loop = NULL;
-
-static void
-cb_address (LocationError error, LocationAddress *addr, LocationAccuracy *acc, gpointer userdata)
-{
-       g_debug ("ASYNC>> location_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_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;
-       // This function works properly after service is enabled.
-       //Calling application must have an active data connection before using this function.
-       if (LOCATION_ERROR_NONE == location_get_address_async(loc, cb_address, loc))
-               g_debug("location_get_address_async() success");
-       else g_warning ("location_get_address_async() failed");
-}
-
-
-int main (int argc, char *argv[])
-{
-       LocationObject *loc = NULL;
-       gulong handler_id = 0;
-       int ret = LOCATION_ERROR_NONE;
-
-       location_init ();
-
-       loop = g_main_loop_new (NULL, TRUE);
-
-       loc  = location_new (LOCATION_METHOD_GPS);
-       if(!loc){
-               g_debug("location_new failed");
-               return -1;
-       }
-
-       handler_id = g_signal_connect (loc, "service-enabled", G_CALLBACK(cb_service_enabled), loc);
-       location_start (loc);
-       g_main_loop_run (loop);
-
-       g_signal_handler_disconnect(loc, handler_id);
-       location_stop (loc);
-       location_free (loc);
-
-       return 0;
-}
- * @endcode
- */
-int location_get_address_async (LocationObject *obj, LocationAddressCB callback, gpointer userdata);
+int location_map_get_position_from_freeformed_address_async (LocationMapObject *obj, const gchar *address, LocationPositionCB callback,        gpointer userdata);
 
 /**
  * @brief
@@ -545,7 +408,7 @@ int location_get_address_async (LocationObject *obj, LocationAddressCB callback,
  * Calling application must have an active data connection.
  * @post None.
  * @param [in]
- * obj - a #LocationObject created by #location_new
+ * obj - a #LocationMapObject created by #location_map_new
  * @param [in]
  * position - a #LocationPosition
  * @param [out]
@@ -557,7 +420,7 @@ int location_get_address_async (LocationObject *obj, LocationAddressCB callback,
  *
  * Please refer #LocationError for more information.
  * @see
- * location_get_address_from_position_async\n
+ * location_map_get_address_from_position_async\n
  * @par Example
  * @code
 #include <location.h>
@@ -567,16 +430,16 @@ static GMainLoop *loop = NULL;
 int
 main (int argc, char *argv[])
 {
-       LocationObject *loc = NULL;
+       LocationMapObject *loc = NULL;
        int ret = LOCATION_ERROR_NONE;
 
        location_init ();
 
        loop = g_main_loop_new (NULL, TRUE);
 
-       loc  = location_new (LOCATION_METHOD_GPS);
+       loc  = location_map_new (NULL);
        if(!loc){
-               g_debug("location_new failed");
+               g_debug("location_map_new failed");
                return -1;
        }
 
@@ -586,7 +449,7 @@ main (int argc, char *argv[])
 
        //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_get_address_from_position(loc, pos, &addr, &acc)) {
+       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);
@@ -594,10 +457,11 @@ main (int argc, char *argv[])
                location_accuracy_free(acc);
        } else g_warning ("SYNC>> address from position> failed");
        location_position_free (pos);
+       location_map_free (loc);
 }
  * @endcode
  */
-int location_get_address_from_position (LocationObject *obj, const LocationPosition *position, LocationAddress **address, LocationAccuracy **accuracy);
+int location_map_get_address_from_position (LocationMapObject *obj, const LocationPosition *position, LocationAddress **address, LocationAccuracy **accuracy);
 
 /**
  * @brief
@@ -609,7 +473,7 @@ int location_get_address_from_position (LocationObject *obj, const LocationPosit
  * Calling application must have an active data connection.
  * @post None.
  * @param [in]
- * obj - a #LocationObject created by #location_new
+ * obj - a #LocationMapObject created by #location_map_new
  * @param [in]
  * position - a #LocationPosition
  * @param [in]
@@ -621,7 +485,7 @@ int location_get_address_from_position (LocationObject *obj, const LocationPosit
  *
  * Please refer #LocationError for more information.
  * @see
- * location_get_address_from_position\n
+ * location_map_get_address_from_position\n
  * @par Example
  * @code
 #include <location.h>
@@ -631,23 +495,23 @@ static GMainLoop *loop = NULL;
 static void
 cb_address_from_position (LocationError error, LocationAddress *addr, LocationAccuracy *acc, gpointer userdata)
 {
-       g_debug ("ASYNC>> location_get_address_from_position_async> %s %s %s %s %s %s %s",
+       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(LocationObject* loc)
+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_get_address_from_position_async(loc, pos, cb_address_from_position, loc))
-               g_debug("location_get_address_from_position_async() success");
-       else g_warning ("location_get_address_from_position_async() failed");
+       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_get_address_from_position_async (LocationObject *obj, const LocationPosition *position,   LocationAddressCB callback, gpointer userdata);
+int location_map_get_address_from_position_async (LocationMapObject *obj, const LocationPosition *position,    LocationAddressCB callback, gpointer userdata);
 
 /**
  * @brief Request a search service from service provider.
@@ -655,7 +519,7 @@ int location_get_address_from_position_async (LocationObject *obj, const Locatio
  * @pre #location_init should be called before.\n
  *      #location_poi_pref_new should be set before.
  * @post None.
- * @param [in] obj - a #LocationObject created by #location_new
+ * @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
@@ -695,7 +559,7 @@ static void poi_cb(LocationError error, guint req_id, GList * landmark_list, gch
        g_list_foreach (landmark_list, PrintLandmarkCb, NULL);
 }
 
-void search_poi(LocationObject* loc)
+void search_poi(LocationMapObject* loc)
 {
        int ret = 0;
        guint req_id = 0;
@@ -709,7 +573,7 @@ void search_poi(LocationObject* loc)
        location_poi_pref_set_sort_by(pref, "name");
        location_poi_pref_set_sort_order(pref, LOCATION_POI_PREF_SO_ASC);
 
-       ret = location_search_poi (loc, filter, pos, pref, poi_cb, loc, &req_id);
+       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);
        }
@@ -721,7 +585,7 @@ void search_poi(LocationObject* loc)
 }
  * @endcode
  */
-int location_search_poi (LocationObject *obj, const LocationPOIFilter * filter, const LocationPosition *position, const LocationPOIPreference * pref, LocationPOICB cb, gpointer user_data, guint * req_id);
+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.
@@ -729,7 +593,7 @@ int location_search_poi (LocationObject *obj, const LocationPOIFilter * filter,
  * @pre #location_init should be called before.\n
  *      #location_poi_pref_new should be set before.
  * @post None.
- * @param [in] obj - a #LocationObject created by #location_new
+ * @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
@@ -769,7 +633,7 @@ static void poi_cb(LocationError error, guint req_id, GList * landmark_list, gch
        g_list_foreach (landmark_list, PrintLandmarkCb, NULL);
 }
 
-void search_poi(LocationObject* loc)
+void search_poi(LocationMapObject* loc)
 {
        int ret = 0;
        guint req_id = 0;
@@ -786,7 +650,7 @@ void search_poi(LocationObject* loc)
        location_poi_pref_set_sort_by(pref, "name");
        location_poi_pref_set_sort_order(pref, LOCATION_POI_PREF_SO_ASC);
 
-       ret = location_search_poi_by_area (loc, filter, bbox, pref, poi_cb, loc, &req_id);
+       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);
        }
@@ -797,7 +661,7 @@ void search_poi(LocationObject* loc)
 }
  * @endcode
  */
-int location_search_poi_by_area (LocationObject *obj, const LocationPOIFilter * filter, const LocationBoundary * boundary, const LocationPOIPreference * pref, LocationPOICB cb, gpointer user_data, guint * req_id);
+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.
@@ -805,7 +669,7 @@ int location_search_poi_by_area (LocationObject *obj, const LocationPOIFilter *
  * @pre #location_init should be called before.\n
  *      #location_poi_pref_new should be set before.
  * @post None.
- * @param [in] obj - a #LocationObject created by #location_new
+ * @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
@@ -845,7 +709,7 @@ static void poi_cb(LocationError error, guint req_id, GList * landmark_list, gch
        g_list_foreach (landmark_list, PrintLandmarkCb, NULL);
 }
 
-void search_poi(LocationObject* loc)
+void search_poi(LocationMapObject* loc)
 {
        int ret = 0;
        guint req_id = 0;
@@ -860,7 +724,7 @@ void search_poi(LocationObject* loc)
        location_poi_pref_set_sort_by(pref, "name");
        location_poi_pref_set_sort_order(pref, LOCATION_POI_PREF_SO_ASC);
 
-       ret = location_search_poi_by_address (loc, filter, addr, pref, poi_cb, loc, &req_id);
+       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);
        }
@@ -871,7 +735,7 @@ void search_poi(LocationObject* loc)
 }
  * @endcode
  */
-int location_search_poi_by_address (LocationObject *obj, const LocationPOIFilter * filter, const LocationAddress * addr, const LocationPOIPreference * pref, LocationPOICB cb, gpointer user_data, guint * req_id);
+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.
@@ -879,7 +743,7 @@ int location_search_poi_by_address (LocationObject *obj, const LocationPOIFilter
  * @pre #location_init should be called before.\n
  *      #location_poi_pref_new should be set before.
  * @post None.
- * @param [in] obj - a #LocationObject created by #location_new
+ * @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
@@ -919,7 +783,7 @@ static void poi_cb(LocationError error, guint req_id, GList * landmark_list, gch
        g_list_foreach (landmark_list, PrintLandmarkCb, NULL);
 }
 
-void search_poi(LocationObject* loc)
+void search_poi(LocationMapObject* loc)
 {
        int ret = 0;
        guint req_id = 0;
@@ -934,7 +798,7 @@ void search_poi(LocationObject* loc)
        location_poi_pref_set_sort_by(pref, "name");
        location_poi_pref_set_sort_order(pref, LOCATION_POI_PREF_SO_ASC);
 
-       ret = location_search_poi_by_freeformed_address (loc, filter, addr, pref, poi_cb, loc, &req_id);
+       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);
        }
@@ -945,15 +809,15 @@ void search_poi(LocationObject* loc)
 }
  * @endcode
  */
-int location_search_poi_by_freeformed_address (LocationObject *obj, const LocationPOIFilter * filter, const gchar * address, const LocationPOIPreference * pref, LocationPOICB cb, gpointer user_data, guint * req_id);
+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_search_poi should be called before.
+ * @pre #location_map_search_poi should be called before.
  * @post None.
- * @param [in] obj - a #LocationObject created by #location_new
- * @param [in] req_id - a poi request id returned by location_search_poi
+ * @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.
@@ -987,7 +851,7 @@ static void poi_cb(LocationError error, guint req_id, GList * landmark_list, gch
        g_list_foreach (landmark_list, PrintLandmarkCb, NULL);
 }
 
-void search_poi(LocationObject* loc)
+void search_poi(LocationMapObject* loc)
 {
        int ret = 0;
        guint req_id = 0;
@@ -1002,12 +866,12 @@ void search_poi(LocationObject* loc)
        location_poi_pref_set_sort_by(pref, "name");
        location_poi_pref_set_sort_order(pref, LOCATION_POI_PREF_SO_ASC);
 
-       ret = location_search_poi (loc, filter, addr, pref, poi_cb, loc, &req_id);
+       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_cancel_poi_request (loc, req_id);
+       ret = location_map_cancel_poi_request (loc, req_id);
        if (ret != LOCATION_ERROR_NONE) {
                g_debug("Fail to cancel poi request. Err[%d]", ret);
        }
@@ -1018,14 +882,14 @@ void search_poi(LocationObject* loc)
 }
  * @endcode
  */
-int location_cancel_poi_request (LocationObject *obj, guint req_id);
+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_new should be called before.
+ * @pre #location_map_new should be called before.
  * @post None.
- * @param [in] obj - a #LocationObject created by #location_new
+ * @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
@@ -1175,7 +1039,7 @@ static void cb_route(LocationError error, guint req_id, GList * route_list, gcha
        }
 }
 
-int request_route(LocationObject *loc)
+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
@@ -1206,15 +1070,15 @@ int request_route(LocationObject *loc)
  }
  * @endcode
  */
-int location_request_route (LocationObject *obj, LocationPosition *origin, LocationPosition *destination, GList *waypoint, const LocationRoutePreference * pref, LocationRouteCB cb, gpointer user_data, guint * req_id);
+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_request_route should be called before.
+ * @pre #location_map_request_route should be called before.
  * @post None.
- * @param [in] obj - a #LocationObject created by #location_new
- * @param [in] req_id - a route request id returned by location_search_route
+ * @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.
@@ -1223,30 +1087,30 @@ int location_request_route (LocationObject *obj, LocationPosition *origin, Locat
 #include <location.h>
 #include <location-map-service.h>
 
-int cancel_route_request (LocationObject *loc, guint req_id)
+int cancel_route_request (LocationMapObject *loc, guint req_id)
 {
        g_printf("cancel_route_request\n");
 
        int ret = LOCATION_ERROR_NONE;
 
-       ret = location_cancel_route_request(loc, req_id);
+       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_cancel_route_request, req_id %d\n", req_id);
+               g_printf("location_map_cancel_route_request, req_id %d\n", req_id);
        }
 }
  * @endcode
  */
-int location_cancel_route_request (LocationObject *obj, guint req_id);
+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_new should be called before.
+ * @pre #location_map_new should be called before.
  * @post None.
- * @param [in] obj - a #LocationObject created by #location_new
+ * @param [in] obj - a #LocationMapObject created by #location_map_new
  * @param [in] type - a #LocationMapService
  * @return gboolean
  * @retval TRUE if supported
@@ -1255,13 +1119,13 @@ int location_cancel_route_request (LocationObject *obj, guint req_id);
 #include <location.h>
 #include <location-map-service.h>
 
-int check_map_service (LocationObject *loc)
+int check_map_service (LocationMapObject *loc)
 {
        g_printf("check_map_service\n");
 
        gboolean is_supported = FALSE;
 
-       is_supported = location_is_supported_map_provider_capability(loc, MAP_SERVICE_ROUTE_REQUEST_FEATURE_TO_AVOID);
+       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");
        }
@@ -1271,14 +1135,14 @@ int check_map_service (LocationObject *loc)
 }
  * @endcode
  */
-gboolean location_is_supported_map_provider_capability (LocationObject *obj, LocationMapServiceType type);
+gboolean location_map_is_supported_provider_capability (LocationMapObject *obj, LocationMapServiceType type);
 
 /**
  * @brief Get Map service key on a service provider
  * @remarks None
- * @pre #location_new should be called before.
+ * @pre #location_map_new should be called before.
  * @post None.
- * @param [in] obj - a #LocationObject created by #location_new
+ * @param [in] obj - a #LocationMapObject created by #location_map_new
  * @param [in] type - a #LocationMapService
  * @return GList
  * @retval a list of keys
@@ -1295,47 +1159,47 @@ static void _print_keys(gpointer data)
        g_printf("Key[%s] is available now\n", key);
 }
 
-int get_map_service_key (LocationObject *loc)
+int get_map_service_key (LocationMapObject *loc)
 {
        g_printf("check_map_service\n");
 
        GList *keys = NULL;
 
-       keys = location_get_map_provider_capability_key(loc, MAP_SERVICE_ROUTE_REQUEST_FEATURE_TO_AVOID);
+       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) doesnot have keys. Need to check wheither its service is supported.\n");
+               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_get_map_provider_capability_key (LocationObject *obj, LocationMapServiceType type, GList **key);
+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_new should be called before.
+ * @pre #location_map_new should be called before.
  * @post None.
- * @param [in] obj - a #LocationObject created by #location_new
- * @return #LocationPreference
+ * @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 (LocationObject loc)
+       int get_map_service_pref (LocationMapObject loc)
        {
                if (!loc) return -1;
 
-               LocationPreference *svc_pref = location_get_map_service_pref (loc);
+               LocationMapPref *svc_pref = location_map_get_service_pref (loc);
                if (!svc_pref) return -1;
 
-               gchar *name = location_pref_get_provider_name (svc_pref);
-               gchar *unit = location_pref_get_distance_unit (svc_pref);
-               gchar *language = location_pref_get_language (svc_pref);
+               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);
 
@@ -1344,15 +1208,15 @@ int location_get_map_provider_capability_key (LocationObject *obj, LocationMapSe
 
  * @endcode
  */
-LocationPreference *location_get_map_service_pref (LocationObject *obj);
+LocationMapPref *location_map_get_service_pref (LocationMapObject *obj);
 
 /**
  * @brief Set Map service preference on a service provider
  * @remarks None
- * @pre #location_new should be called before.
+ * @pre #location_map_new should be called before.
  * @post None.
- * @param [in] obj - a #LocationObject created by #location_new
- * @param [in] pref = a #LocationPreference
+ * @param [in] obj - a #LocationMapObject created by #location_map_new
+ * @param [in] pref = a #LocationMapPref
  * @return gboolean
  * @retval TRUE if success
  * @par Example
@@ -1360,25 +1224,59 @@ LocationPreference *location_get_map_service_pref (LocationObject *obj);
 #include <location.h>
 #include <location-map-service.h>
 
-int set_map_service_pref (LocationObject *loc)
+int set_map_service_pref (LocationMapObject *loc)
 {
        if (!loc) return -1;
 
-       LocationPreference *svc_pref = location_pref_new();
-       location_pref_set_language (svc_pref, "en");
-       location_pref_set_distance_unit (svc_pref, "MI");
+       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_set_map_service_pref (loc, svc_pref);
+       gboolean ret = location_map_set_service_pref (loc, svc_pref);
        if (!ret) {
-               location_pref_pref (svc_pref);
+               location_map_pref_pref (svc_pref);
                return -1;
        }
-       location_pref_pref (svc_pref);
+       location_map_pref_pref (svc_pref);
        return 0;
 }
  * @endcode
  */
-gboolean location_set_map_service_pref (LocationObject *obj, LocationPreference *pref);
+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);
 
 /**
  * @} @}
index 9dba262..2ac5cd4 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "location-log.h"
 #include "location-types.h"
-#include "location-pref.h"
+#include "location-map-pref.h"
 
 #include "map-service.h"
 
index 8e5d20b..9f0e0e0 100644 (file)
@@ -22,7 +22,7 @@
 #ifndef __LOCATION_POI_H__
 #define __LOCATION_POI_H__
 
-#include <location-types.h>
+#include <location-map-types.h>
 
 G_BEGIN_DECLS
 
@@ -80,7 +80,7 @@ LocationPOIPreference *location_poi_pref_copy (LocationPOIPreference *pref);
  * @pre #location_poi_pref_new should be called before.
  * @post None.
  * @param [in] pref - #LocationPOIPreference
- * @return #LocationPreference
+ * @return void
  * @retval NULL              if error occured
  * @see location_location_poi_pref_set_pref
  */
@@ -162,7 +162,7 @@ gboolean location_poi_pref_set_max_result (LocationPOIPreference * pref, guint m
 
 /**
  * @brief Set the sort criterion for poi service.
- * @remarks None.
+ * @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
@@ -188,7 +188,7 @@ gboolean location_poi_pref_set_sort_order (LocationPOIPreference *pref, Location
 
 /**
  * @brief Set property of poi preference.
- * @remarks None.
+ * @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
@@ -235,7 +235,7 @@ void location_poi_filter_free (LocationPOIFilter *filter);
 
 /**
  * @brief Set filter for poi service
- * @remarks None
+ * @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
index 14f59cc..fa73408 100644 (file)
@@ -22,7 +22,7 @@
 #ifndef __LOCATION_ROUTE_EXT_H__
 #define __LOCATION_ROUTE_EXT_H__
 
-#include <location-types.h>
+#include <location-map-types.h>
 
 G_BEGIN_DECLS
 
@@ -41,7 +41,8 @@ G_BEGIN_DECLS
 
 /**
  * @brief Set the origin #LocationPosition of #LocationRoute
- * @remarks The service provider should support route service.
+ * @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
@@ -54,7 +55,8 @@ gboolean location_route_set_origin (LocationRoute *route, const LocationPosition
 
 /**
  * @brief Set the destication #LocationPosition of #LocationRoute
- * @remarks The service provider should support route service.
+ * @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
@@ -67,7 +69,8 @@ gboolean location_route_set_destination (LocationRoute *route, const LocationPos
 
 /**
  * @brief Set the bounding box #LocationBoundary of #LocationRoute
- * @remarks The service provider should support route service.
+ * @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
@@ -92,7 +95,8 @@ gboolean location_route_set_total_distance (LocationRoute *route, gdouble total_
 
 /**
  * @brief Set the distance unit of #LocationRoute
- * @remarks The service provider should support route service.
+ * @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
@@ -118,7 +122,8 @@ gboolean location_route_set_total_duration (LocationRoute *route, glong total_du
 
 /**
  * @brief Set the propery value of #LocationRoute
- * @remarks The service provider should support route service.
+ * @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
@@ -132,7 +137,8 @@ gboolean location_route_set_property (LocationRoute *route, gconstpointer key, g
 
 /**
  * @brief Set the list of segments #LocationRouteSegment of #LocationRoute
- * @remarks The service provider should support route service.
+ * @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
@@ -145,7 +151,8 @@ 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.
+ * @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
@@ -158,7 +165,8 @@ gboolean location_route_segment_set_start_point (LocationRouteSegment *segment,
 
 /**
  * @brief Set the end point #LocationPosition of #LocationRouteSegment
- * @remarks The service provider should support route service.
+ * @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
@@ -171,7 +179,8 @@ gboolean location_route_segment_set_end_point (LocationRouteSegment *segment, co
 
 /**
  * @brief Set the bounding box #LocationBoundary of #LocationRouteSegment
- * @remarks The service provider should support route service.
+ * @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
@@ -210,7 +219,8 @@ gboolean location_route_segment_set_duration (LocationRouteSegment *segment, glo
 
 /**
  * @brief Set the property value of #LocationRouteSegment
- * @remarks The service provider should support route service.
+ * @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
@@ -224,7 +234,8 @@ gboolean location_route_segment_set_property (LocationRouteSegment *segment, gco
 
 /**
  * @brief Set the list of route steps #LocationRouteStep in #LocationRouteSegment
- * @remarks The service provider should support route service.
+ * @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
@@ -237,7 +248,8 @@ gboolean location_route_segment_set_route_step (LocationRouteSegment *segment, G
 
 /**
  * @brief Set the start point #LocationPosition of #LocationRouteStep
- * @remarks The service provider should support route service.
+ * @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
@@ -250,7 +262,8 @@ gboolean location_route_step_set_start_point (LocationRouteStep *step, const Loc
 
 /**
  * @brief Set the end point #LocationPosition of #LocationRouteStep
- * @remarks The service provider should support route service.
+ * @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
@@ -263,7 +276,8 @@ gboolean location_route_step_set_end_point (LocationRouteStep *step, const Locat
 
 /**
  * @brief Set the bounding box #LocationBoundary of #LocationRouteStep
- * @remarks The service provider should support route service.
+ * @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
@@ -302,7 +316,8 @@ gboolean location_route_step_set_duration (LocationRouteStep *step, glong durati
 
 /**
  * @brief Set the transport mode of #LocationRouteStep
- * @remarks The service provider should support route service.
+ * @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
@@ -315,7 +330,8 @@ gboolean location_route_step_set_transport_mode (LocationRouteStep *step, const
 
 /**
  * @brief Set the instruction of #LocationRouteStep
- * @remarks The service provider should support route service.
+ * @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
@@ -328,7 +344,8 @@ gboolean location_route_step_set_instruction (LocationRouteStep *step, const gch
 
 /**
  * @brief Set the list of geometry #LocationPosition in #LocationRouteStep
- * @remarks The service provider should support route service.
+ * @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
@@ -341,7 +358,8 @@ gboolean location_route_step_set_geometry (LocationRouteStep *step, GList *geome
 
 /**
  * @brief Set the property value of #LocationRouteStep
- * @remarks The service provider should support route service.
+ * @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
index 7ffe8e5..c76d14f 100644 (file)
@@ -1280,7 +1280,7 @@ location_route_step_set_geometry (LocationRouteStep *step, GList *geometry)
                step->geometry = NULL;
        }
 
-       if (geometry) g_list_foreach (geometry, route_step_foreach_copy, step);
+       if (geometry) g_list_foreach (geometry, route_step_geometry_foreach_copy, step);
 
        return TRUE;
 
index 8bd8fa7..b15c769 100644 (file)
@@ -22,7 +22,7 @@
 #ifndef __LOCATION_ROUTE_H__
 #define __LOCATION_ROUTE_H__
 
-#include <location-types.h>
+#include <location-map-types.h>
 
 G_BEGIN_DECLS
 
index 0fcc499..d4f95ae 100644 (file)
 #include "location-types.h"
 #include "module-internal.h"
 #include "location-route.h"
-#include "location-ielement.h"
+#include "location-map-ielement.h"
 #include "map-service.h"
 
 int
-map_service_get_geocode (LocationIElement *self,
+map_service_get_geocode (LocationMapIElement *self,
        const LocationAddress *address,
+       const LocationMapPref *svc_pref,
        GList **position_list,
        GList **accuracy_list)
 {
@@ -41,12 +42,13 @@ map_service_get_geocode (LocationIElement *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, position_list, accuracy_list);
+       return (priv->mod->ops.get_geocode)(priv->mod->handler, address, svc_pref, position_list, accuracy_list);
 }
 
 int
-map_service_get_geocode_freeform (LocationIElement *self,
+map_service_get_geocode_freeform (LocationMapIElement *self,
        const gchar  *address,
+       const LocationMapPref *svc_pref,
        GList **position_list,
        GList **accuracy_list)
 {
@@ -55,12 +57,13 @@ map_service_get_geocode_freeform (LocationIElement *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, position_list, accuracy_list);
+       return (priv->mod->ops.get_geocode_freetext)(priv->mod->handler, address, svc_pref, position_list, accuracy_list);
 }
 
 int
-map_service_get_reversegeocode (LocationIElement *self,
+map_service_get_reversegeocode (LocationMapIElement *self,
        const LocationPosition *position,
+       const LocationMapPref *svc_pref,
        LocationAddress **address,
        LocationAccuracy **accuracy)
 {
@@ -69,12 +72,13 @@ map_service_get_reversegeocode (LocationIElement *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, address, accuracy);
+       return (priv->mod->ops.get_reverse_geocode)(priv->mod->handler, position, svc_pref, address, accuracy);
 }
 
 int
-map_service_get_geocode_async (LocationIElement *self,
-       LocationAddress *address,
+map_service_get_geocode_async (LocationMapIElement *self,
+       const LocationAddress *address,
+       const LocationMapPref *svc_pref,
        LocationPositionCB callback,
        gpointer userdata)
 {
@@ -83,12 +87,13 @@ map_service_get_geocode_async (LocationIElement *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, callback, userdata);
+       return (priv->mod->ops.get_geocode_async)(priv->mod->handler, address, svc_pref, callback, userdata);
 }
 
 int
-map_service_get_geocode_freeform_async (LocationIElement *self,
+map_service_get_geocode_freeform_async (LocationMapIElement *self,
        const gchar *address,
+       const LocationMapPref *svc_pref,
        LocationPositionCB callback,
        gpointer userdata)
 {
@@ -97,12 +102,13 @@ map_service_get_geocode_freeform_async (LocationIElement *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, callback, userdata);
+       return (priv->mod->ops.get_geocode_freetext_async)(priv->mod->handler, address, svc_pref, callback, userdata);
 }
 
 int
-map_service_get_reversegeocode_async (LocationIElement *self,
+map_service_get_reversegeocode_async (LocationMapIElement *self,
        const LocationPosition *position,
+       const LocationMapPref *svc_pref,
        LocationAddressCB callback,
        gpointer userdata)
 {
@@ -111,13 +117,13 @@ map_service_get_reversegeocode_async (LocationIElement *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, callback, userdata);
+       return (priv->mod->ops.get_reverse_geocode_async)(priv->mod->handler, position, svc_pref, callback, userdata);
 }
 
 int
-map_service_search_poi (LocationIElement *self,
+map_service_search_poi (LocationMapIElement *self,
                const LocationPOIFilter *filter, const LocationPosition *position,
-               const LocationPreference *svc_pref, const LocationPOIPreference *pref,
+               const LocationMapPref *svc_pref, const LocationPOIPreference *pref,
                LocationPOICB cb, const gpointer user_data, guint *req_id)
 {
        LOCATION_LOGD("map_service_search_poi");
@@ -129,9 +135,9 @@ map_service_search_poi (LocationIElement *self,
 }
 
 int
-map_service_search_poi_by_area (LocationIElement *self,
+map_service_search_poi_by_area (LocationMapIElement *self,
                const LocationPOIFilter * filter, const LocationBoundary *boundary,
-               const LocationPreference *svc_pref, const LocationPOIPreference * pref,
+               const LocationMapPref *svc_pref, const LocationPOIPreference * pref,
                LocationPOICB cb, const gpointer user_data, guint *req_id)
 {
        LOCATION_LOGD("map_service_search_poi_by_area");
@@ -143,9 +149,9 @@ map_service_search_poi_by_area (LocationIElement *self,
 }
 
 int
-map_service_search_poi_by_address (LocationIElement *self,
+map_service_search_poi_by_address (LocationMapIElement *self,
                const LocationPOIFilter *filter, const LocationAddress *address,
-               const LocationPreference *svc_pref, const LocationPOIPreference *pref,
+               const LocationMapPref *svc_pref, const LocationPOIPreference *pref,
                                                LocationPOICB cb, const gpointer user_data, guint *req_id)
 {
        LOCATION_LOGD("map_service_search_poi_by_address");
@@ -157,9 +163,9 @@ map_service_search_poi_by_address (LocationIElement *self,
 }
 
 int
-map_service_search_poi_by_freeform (LocationIElement *self,
+map_service_search_poi_by_freeform (LocationMapIElement *self,
                const LocationPOIFilter *filter, const gchar *freeform,
-               const LocationPreference *svc_pref, const LocationPOIPreference *pref,
+               const LocationMapPref *svc_pref, const LocationPOIPreference *pref,
                LocationPOICB cb, const gpointer user_data, guint *req_id)
 {
        LOCATION_LOGD("map_service_search_poi_by_freeform");
@@ -171,7 +177,7 @@ map_service_search_poi_by_freeform (LocationIElement *self,
 }
 
 int
-map_service_cancel_poi_request (LocationIElement *self, guint req_id)
+map_service_cancel_poi_request (LocationMapIElement *self, guint req_id)
 {
        LOCATION_LOGD("map_service_cancel_poi_request");
        MapServicePrivate* priv = GET_PRIVATE(self);
@@ -183,9 +189,9 @@ map_service_cancel_poi_request (LocationIElement *self, guint req_id)
 
 
 int
-map_service_request_route (LocationIElement *self,
+map_service_request_route (LocationMapIElement *self,
                const LocationPosition *origin, const LocationPosition *destination, GList *waypoint,
-               const LocationPreference *svc_pref, const LocationRoutePreference * pref,
+               const LocationMapPref *svc_pref, const LocationRoutePreference * pref,
                LocationRouteCB cb, const gpointer user_data, guint * req_id)
 {
        LOCATION_LOGD("map_service_request_route");
@@ -198,7 +204,7 @@ map_service_request_route (LocationIElement *self,
 }
 
 int
-map_service_cancel_route_request (LocationIElement *self, guint req_id)
+map_service_cancel_route_request (LocationMapIElement *self, guint req_id)
 {
        LOCATION_LOGD("map_service_cancel_route_request");
        MapServicePrivate* priv = GET_PRIVATE(self);
@@ -210,26 +216,26 @@ map_service_cancel_route_request (LocationIElement *self, guint req_id)
 }
 
 gboolean
-map_service_is_supported_map_provider_capability (LocationIElement *self, LocationMapServiceType type)
+map_service_is_supported_provider_capability (LocationMapIElement *self, LocationMapServiceType type)
 {
-       LOCATION_LOGD("map_service_is_supported_map_provider_capability");
+       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_map_provider_capability, 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_map_provider_capability)(priv->mod->handler, type);
+       return (priv->mod->ops.is_supported_provider_capability)(priv->mod->handler, type);
 }
 
 int
-map_service_get_map_provider_capability_key (LocationIElement *self, LocationMapServiceType type, GList **key)
+map_service_get_provider_capability_key (LocationMapIElement *self, LocationMapServiceType type, GList **key)
 {
-       LOCATION_LOGD("map_service_get_map_provider_capability_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_map_provider_capability_key, 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_map_provider_capability_key)(priv->mod->handler, type, key);
+       return (priv->mod->ops.get_provider_capability_key)(priv->mod->handler, type, key);
 }
 
index 09aded7..a6481d7 100644 (file)
@@ -22,8 +22,8 @@
 #ifndef __MAP_INTERNAL_H__
 #define __MAP_INTERNAL_H__
 
-#include "location-types.h"
-#include "location-ielement.h"
+#include "location-map-types.h"
+#include "location-map-ielement.h"
 
 /**
  * @file map-internal.h
 
 G_BEGIN_DECLS
 
-int map_service_get_geocode (LocationIElement *self, const LocationAddress *address, GList **position_list, GList **accuracy_list);
+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 (LocationIElement *self, const gchar  *address, 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 (LocationIElement *self, const LocationPosition *position, LocationAddress **address, LocationAccuracy **accuracy);
+int map_service_get_reversegeocode (LocationMapIElement *self, const LocationPosition *position, const LocationMapPref *svc_pref, LocationAddress **address, LocationAccuracy **accuracy);
 
-int map_service_get_geocode_async (LocationIElement *self, LocationAddress *address, LocationPositionCB callback, gpointer userdata);
+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 (LocationIElement *self, const gchar *address, 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_get_reversegeocode_async (LocationIElement *self, const LocationPosition *position, LocationAddressCB callback, gpointer userdata);
+int map_service_get_reversegeocode_async (LocationMapIElement *self, const LocationPosition *position, const LocationMapPref *svc_pref, LocationAddressCB callback, gpointer userdata);
 
-int map_service_search_poi (LocationIElement *self,
+int map_service_search_poi (LocationMapIElement *self,
                const LocationPOIFilter *filter, const LocationPosition *position,
-               const LocationPreference *svc_pref, const LocationPOIPreference *pref,
+               const LocationMapPref *svc_pref, const LocationPOIPreference *pref,
                LocationPOICB cb, const gpointer user_data, guint * req_id);
 
-int map_service_search_poi_by_area (LocationIElement *self,
+int map_service_search_poi_by_area (LocationMapIElement *self,
                const LocationPOIFilter *filter, const LocationBoundary *boundary,
-               const LocationPreference *svc_pref, const LocationPOIPreference *pref,
+               const LocationMapPref *svc_pref, const LocationPOIPreference *pref,
                LocationPOICB cb, const gpointer user_data, guint * req_id);
 
-int map_service_search_poi_by_address (LocationIElement *self,
+int map_service_search_poi_by_address (LocationMapIElement *self,
                const LocationPOIFilter *filter, const LocationAddress *address,
-               const LocationPreference *svc_pref, const LocationPOIPreference *pref,
+               const LocationMapPref *svc_pref, const LocationPOIPreference *pref,
                LocationPOICB cb, const gpointer user_data, guint * req_id);
 
-int map_service_search_poi_by_freeform (LocationIElement *self,
+int map_service_search_poi_by_freeform (LocationMapIElement *self,
                const LocationPOIFilter * filter, const gchar *freeform,
-               const LocationPreference *svc_pref, const LocationPOIPreference *pref,
+               const LocationMapPref *svc_pref, const LocationPOIPreference *pref,
                LocationPOICB cb, const gpointer user_data, guint *req_id);
 
-int map_service_cancel_poi_request (LocationIElement *self, guint req_id);
+int map_service_cancel_poi_request (LocationMapIElement *self, guint req_id);
 
-int map_service_request_route (LocationIElement *self,
+int map_service_request_route (LocationMapIElement *self,
                const LocationPosition *origin, const LocationPosition *destination, GList *waypoint,
-               const LocationPreference *svc_pref, const LocationRoutePreference *pref,
+               const LocationMapPref *svc_pref, const LocationRoutePreference *pref,
                LocationRouteCB cb, const gpointer user_data, guint * req_id);
 
-int map_service_cancel_route_request (LocationIElement *self, guint req_id);
+int map_service_cancel_route_request (LocationMapIElement *self, guint req_id);
 
-gboolean map_service_is_supported_map_provider_capability (LocationIElement *self, LocationMapServiceType type);
+gboolean map_service_is_supported_provider_capability (LocationMapIElement *self, LocationMapServiceType type);
 
-int map_service_get_map_provider_capability_key (LocationIElement *self, LocationMapServiceType type, GList **key);
+int map_service_get_provider_capability_key (LocationMapIElement *self, LocationMapServiceType type, GList **key);
 
 G_END_DECLS
 
index 6c811b6..91f59fd 100644 (file)
 
 #include <glib-object.h>
 #include <vconf.h>
+#include <stdio.h>
+#include <string.h>
 #include "location-log.h"
-#include "location-pref.h"
+#include "location-map-pref.h"
 
 #include "module-internal.h"
 
 #include "map-internal.h"
 #include "map-service.h"
-#include "location-ielement.h"
+#include "location-map-ielement.h"
+
+#define MAP_SERVICE_PREFIX             "map-service"
+
+gchar *provider_list[] = {
+       "decarta",
+       "osm",
+};
+
 
 enum {
        PROP_0,
-       PROP_SERVICE_NAME
+       PROP_PROVIDER,
+       PROP_MAX
 };
 
-static void map_service_ielement_interface_init (LocationIElementInterface *iface);
+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_TYPE_IELEMENT, map_service_ielement_interface_init));
+       G_IMPLEMENT_INTERFACE (LOCATION_MAP_TYPE_IELEMENT, map_service_ielement_interface_init));
 
 static void
 _get_lang (gchar country_code[3], gchar lang_code[3])
@@ -96,12 +110,13 @@ map_service_get_property (GObject *object,
        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_SERVICE_NAME:{
+       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) ){
@@ -120,7 +135,57 @@ map_service_get_property (GObject *object,
 }
 
 static void
-map_service_ielement_interface_init (LocationIElementInterface *iface)
+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, 256, 0x0);
+                               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;
@@ -135,8 +200,8 @@ map_service_ielement_interface_init (LocationIElementInterface *iface)
        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_map_provider_capability = (TYPE_IS_SUPPORTED_MAP_PROVIDER_CAPABILITY) map_service_is_supported_map_provider_capability;
-       iface->get_map_provider_capability_key = (TYPE_GET_MAP_PROVIDER_CAPABILITY_KEY) map_service_get_map_provider_capability_key;
+       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;
 
 }
 
@@ -146,16 +211,14 @@ map_service_init (MapService *self)
        LOCATION_LOGD("map_service_init");
        MapServicePrivate* priv = GET_PRIVATE(self);
 
-       priv->mod = (LocationServiceMod*)module_new("map-service");
-       if(!priv->mod) LOCATION_LOGW("module loading failed");
-       priv->pref = location_pref_new ();
+       priv->pref = location_map_pref_new ();
        if(!priv->pref) LOCATION_LOGW("Service preference failed");
 
        gchar country[3], lang[3];
        _get_lang (country, lang);
-       location_pref_set_language (priv->pref, lang);
-       location_pref_set_distance_unit (priv->pref, "MI");
-       location_pref_set_provider_name (priv->pref, "decarta");
+       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
@@ -163,26 +226,26 @@ map_service_class_init (MapServiceClass *klass)
 {
        LOCATION_LOGD("map_service_class_init");
        GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-       GParamSpec *pspec;
 
        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 = g_param_spec_string ("service provider",
+       pspec[PROP_PROVIDER] = g_param_spec_string ("provider",
                                 "map service provider name prop",
                                 "map service provider name",
-                                DEFAULT_SERVICE,
-                                G_PARAM_READABLE);
-       g_object_class_install_property (gobject_class,
-                                   PROP_SERVICE_NAME,
+                                MAP_SERVICE_PREFIX,
+                                G_PARAM_READWRITE);
+       g_object_class_install_properties (gobject_class,
+                                   PROP_MAX,
                                    pspec);
 }
 
-LocationPreference *
+LocationMapPref *
 map_service_get_pref(GObject *obj)
 {
        LOCATION_LOGD("map_service_get_pref");
@@ -190,20 +253,88 @@ map_service_get_pref(GObject *obj)
        if (!priv) return NULL;
        if (!priv->pref) return NULL;
 
-       LocationPreference *pref = location_pref_copy(priv->pref);
+       LocationMapPref *pref = location_map_pref_copy(priv->pref);
 
        return pref;
 }
 
 gboolean
-map_service_set_pref (GObject *obj, LocationPreference *pref)
+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_pref_free(priv->pref);
+       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);
+       }
 
-       priv->pref = location_pref_copy (pref);
+       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, 128, 0x0);
+               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;
 }
index bde83c6..3b7b281 100644 (file)
@@ -43,8 +43,6 @@ typedef struct _MapServicePrivate        MapServicePrivate;
 #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 DEFAULT_SERVICE "decarta"
-
 #define GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), MAP_TYPE_SERVICE, MapServicePrivate))
 
 struct _MapService
@@ -59,14 +57,14 @@ struct _MapServiceClass
 
 struct _MapServicePrivate {
        LocationServiceMod* mod;
-       LocationPreference *pref;
+       LocationMapPref *pref;
 };
 
 GType map_service_get_type (void);
 
-LocationPreference *map_service_get_pref(GObject *obj);
+LocationMapPref *map_service_get_pref(GObject *obj);
 
-gboolean map_service_set_preference (GObject *obj, LocationPreference *pref);
+gboolean map_service_set_pref (GObject *obj, LocationMapPref *pref);
 
 G_END_DECLS
 
index 9f374c9..c5cbefb 100644 (file)
@@ -24,6 +24,7 @@
 
 #include <gmodule.h>
 #include <location-types.h>
+#include <location-map-types.h>
 #include <location-position.h>
 #include <location-velocity.h>
 #include <location-accuracy.h>
@@ -52,35 +53,35 @@ G_BEGIN_DECLS
 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, GList **position_list, GList **accuracy_list);
+       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, GList **position_list, GList **accuracy_list);
+       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, LocationAddress **address, LocationAccuracy **accuracy);
+       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, LocationPositionCB callback, gpointer userdata);
+       int (*get_geocode_async)(gpointer handle, const LocationAddress *address, const LocationMapPref *svc_pref, LocationPositionCB callback, gpointer userdata);
        ///< This is used for getting a geocode from a plug-in asynchronously.
-       int (*get_geocode_freetext_async)(gpointer handle, const gchar *address, LocationPositionCB callback, gpointer userdata);
+       int (*get_geocode_freetext_async)(gpointer handle, const gchar *address, const LocationMapPref *svc_pref, LocationPositionCB callback, gpointer userdata);
        ///< This is used for getting a geocode by using a free-fromed address from a plug-in asynchronously.
-       int (*get_reverse_geocode_async)(gpointer handle, const LocationPosition *position, LocationAddressCB callback, gpointer userdata);
+       int (*get_reverse_geocode_async)(gpointer handle, const LocationPosition *position, const LocationMapPref *svc_pref, LocationAddressCB callback, gpointer userdata);
        ///< 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 LocationPreference *svc_pref, const LocationPOIPreference *pref, LocationPOICB cb, const gpointer user_data, guint * req_id);
+       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 LocationPreference *svc_pref, const LocationPOIPreference *pref, LocationPOICB cb, const gpointer user_data, guint * req_id);
+       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 LocationPreference *svc_pref, const LocationPOIPreference *pref, LocationPOICB cb, const gpointer user_data, guint * req_id);
+       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 LocationPreference *svc_pref, const LocationPOIPreference *pref, LocationPOICB cb, const gpointer user_data, guint *req_id);
+       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 LocationPreference *svc_pref, const LocationRoutePreference * pref, LocationRouteCB cb, const gpointer user_data, guint * req_id);
+       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_map_provider_capability) (gpointer handle, LocationMapServiceType type);
+       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_map_provider_capability_key) (gpointer handle, LocationMapServiceType type, GList **key);
+       int (*get_provider_capability_key) (gpointer handle, LocationMapServiceType type, GList **key);
        ///< This is used to get map service keys on a plug-in.
 } LocModServiceOps;
 
@@ -134,28 +135,15 @@ typedef struct{
 } LocModWpsOps;
 
 /**
- * @brief This represents APIs declared in a SPS plug-in for location SPS modules.
- */
-typedef struct{
-       int (*start)(gpointer handle, LocModStatusCB status_cb, LocModPositionCB pos_cb, LocModVelocityCB vel_cb, gpointer userdata);                                                   ///< This is used for starting a SPS service from a plug-in. #LocModStatusCB, #LocModPositionCB and #LocModVelocityCB are given from a location framework to a plug-in for asynchronous signaling.
-       int (*stop)(gpointer handle);                                                                                                                                                   ///< This is used for stopping a SPS service from a plug-in.
-       int (*get_position)(gpointer handle, LocationPosition **position, LocationAccuracy **accuracy);                                                                                 ///< This is used for getting a position from a plug-in.
-       int (*get_velocity)(gpointer handle, LocationVelocity **velocity, LocationAccuracy **accuracy);                                                                                 ///< This is used for getting a velocity from a plug-in.
-       int (*update_data)(gpointer handle, const LocationPosition *position, const LocationVelocity *velocity, const LocationAccuracy *accuracy, const LocationSatellite *satellite);  ///< This is used for updating compensated position/velocity data for a plug-in.
-} LocModSpsOps;
-
-/**
- * @brief This represents APIs declared in a IPS plug-in for location IPS modules.
- */
-typedef struct{
-       int (*get_position)(gpointer handle, LocationPosition **position, LocationAccuracy **accuracy);          ///< This is used for getting a position from a plug-in.
-} LocModIpsOps;
-
-/**
  * @brief This represents APIs declared in a CPS plug-in for location CPS modules.
  */
 typedef struct{
-       int (*get_position)(gpointer handle, LocationPosition **position, LocationAccuracy **accuracy);          ///< This is used for getting a position from a plug-in.
+       int (*start)(gpointer handle, LocModStatusCB status_cb, LocModPositionCB pos_cb, LocModVelocityCB vel_cb, LocModSatelliteCB sat_cb, gpointer userdata);   ///< This is used for starting a WPS service from a plug-in. #LocModStatusCB, #LocModPositionCB, #LocModVelocityCB and #LocModSatelliteCB(Not used) are given from a location framework to a plug-in for asynchronous signaling.
+       int (*stop)(gpointer handle);
+       int (*get_position)(gpointer handle, LocationPosition **position, LocationAccuracy **accuracy);                                         ///< This is used for getting a position from a plug-in.
+       int (*get_velocity)(gpointer handle, LocationVelocity **velocity, LocationAccuracy **accuracy);                         ///< This is used for getting a velocity from a plug-in.
+       int (*get_last_position)(gpointer handle, LocationPosition **position, LocationAccuracy **accuracy);                                    ///< This is used for getting a last position from a plug-in.
+       int (*get_last_velocity)(gpointer handle, LocationVelocity **velocity, LocationAccuracy **accuracy);                    ///< This is used for getting a last velocity from a plug-in.
 } LocModCpsOps;
 
 /**
index 302a159..46214c0 100644 (file)
 #endif
 
 #include <glib.h>
+#include <stdio.h>
+#include <limits.h>
+#include <stdlib.h>
+#include <string.h>
 #include "module-internal.h"
 #include "location-log.h"
 
-#define MAX_MODULE_INDEX 10
+#define MAX_MODULE_INDEX 3
 const char* MODULE_PATH_PREFIX = "/usr/lib/location/module";
 
 static GMod*
@@ -168,30 +172,6 @@ mod_new (const char* module_name)
                        ret_mod = NULL;
                }else
                        ret_mod = (gpointer)_mod;
-       }else if(g_str_has_prefix(module_name, "ips")){
-               LocationIpsMod* _mod = g_new0(LocationIpsMod, 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, "sps")){
-               LocationSpsMod* _mod = g_new0(LocationSpsMod, 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{
                LOCATION_LOGW("module name (%s) is wrong", module_name);
                ret_mod = NULL;
@@ -207,7 +187,7 @@ mod_free (gpointer mod,
        if(!mod || !module_name)
                return;
 
-       if(0 == g_strcmp0(module_name, "map-service")){
+       if(g_str_has_prefix(module_name, "map-service")){
                LocationServiceMod* _mod = (LocationServiceMod*)mod;
                if(_mod->shutdown && _mod->handler){
                        _mod->shutdown(_mod->handler);
@@ -247,26 +227,6 @@ mod_free (gpointer mod,
                _mod->shutdown= NULL;
                gmod_free(_mod->gmod);
                _mod->gmod = NULL;
-       }else if(0 == g_strcmp0(module_name, "ips")){
-               LocationIpsMod* _mod = (LocationIpsMod*)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 if(0 == g_strcmp0(module_name, "sps")){
-               LocationSpsMod* _mod = (LocationSpsMod*)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
                LOCATION_LOGW("module name (%s) is wrong", module_name);
 
@@ -364,3 +324,25 @@ module_is_supported(const char *module_name)
 
        return found;
 }
+
+gchar *
+mod_get_realpath (const gchar *module_name)
+{
+       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);
+
+       realpath (link_path, origin_path);
+
+       if (!origin_path) {
+               LOCATION_LOGE ("Fail to get real path of [%s]", module_name);
+               return NULL;
+       }
+
+       path = strrchr(origin_path, '/');
+       if (!path) return NULL;
+
+       return g_strdup (path);
+}
index 47b8280..f118b01 100644 (file)
@@ -68,28 +68,13 @@ typedef struct{
        LocModCpsOps ops;
 } LocationCpsMod;
 
-typedef struct{
-       GMod* gmod;
-       gpointer handler;
-       gpointer (*init)(LocModIpsOps* ops);
-       void (*shutdown)(gpointer handle);
-       LocModIpsOps ops;
-} LocationIpsMod;
-
-typedef struct{
-       GMod* gmod;
-       gpointer handler;
-       gpointer (*init)(LocModSpsOps* ops);
-       void (*shutdown)(gpointer handle);
-       LocModSpsOps ops;
-} LocationSpsMod;
-
 G_BEGIN_DECLS
 
 gboolean module_init(void);
 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
 
index 0ba8019..add3f10 100644 (file)
@@ -1,10 +1,9 @@
-
 Name:       libslp-location
 Summary:    Location Based Service
-Version:    0.3.34
-Release:    2
+Version:    0.3.38
+Release:    1
 Group:      System/Libraries
-License:    Apache-2.0
+License:    TBD
 Source0:    %{name}-%{version}.tar.gz
 Requires(post):  /sbin/ldconfig
 Requires(post):  /usr/bin/vconftool
@@ -15,7 +14,8 @@ BuildRequires:  pkgconfig(dbus-glib-1)
 BuildRequires:  pkgconfig(gmodule-2.0)
 BuildRequires:  pkgconfig(dlog)
 BuildRequires:  pkgconfig(vconf)
-BuildRequires:  pkgconfig(json-glib-1.0)
+BuildRequires:  pkgconfig(location-appman)
+#BuildRequires:  pkgconfig(json-glib-1.0)
 
 
 %description
@@ -70,12 +70,11 @@ 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/last/sps/Timestamp "0" -f
-vconftool set -t double db/location/last/sps/Latitude "0.0" -f
-vconftool set -t double db/location/last/sps/Longitude "0.0" -f
-vconftool set -t double db/location/last/sps/Altitude "0.0" -f
-vconftool set -t double db/location/last/sps/HorAccuracy "0.0" -f
-vconftool set -t double db/location/last/sps/VerAccuracy "0.0" -f
+vconftool set -t int db/location/last/cps/Timestamp "0" -f
+vconftool set -t double db/location/last/cps/Latitude "0.0" -f
+vconftool set -t double db/location/last/cps/Longitude "0.0" -f
+vconftool set -t double db/location/last/cps/Altitude "0.0" -f
+vconftool set -t double db/location/last/cps/HorAccuracy "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
index c9d697d..6da5435 100644 (file)
@@ -1,11 +1,10 @@
 dir_location = $(top_srcdir)/location
-noinst_PROGRAMS = location-api-test gps-test wps-test hybrid-test ips-test cps-test sps-test\
-                                 position-sample-gps velocity-sample nmea-sample satellite-sample property-sample zone-sample address-sample
+noinst_PROGRAMS = location-api-test gps-test wps-test hybrid-test cps-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
-ips_test_SOURCES =  ips-test.c
 cps_test_SOURCES =  cps-test.c
 position_sample_gps_SOURCES =   position-sample-gps.c
 velocity_sample_SOURCES = velocity-sample.c
@@ -15,6 +14,7 @@ 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\
index e830329..9788347 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <gconf/gconf-client.h>
 #include <location.h>
+#include <location-map-service.h>
 
 static GMainLoop *loop = NULL;
 
@@ -64,7 +65,7 @@ cb_address (LocationError error,
                g_debug("cb_address failed: error=%d\n", error);
                return;
        }
-       g_debug ("ASYNC>> location_get_address_async> %s %s %s %s %s %s %s",
+       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);
 }
@@ -108,7 +109,7 @@ cb_address_from_position (LocationError error, LocationAddress *addr, LocationAc
                g_debug("cb_address_from_position failed: error=%d\n", error);
                return;
        }
-       g_debug ("ASYNC>> location_get_address_from_position_async> %s %s %s %s %s %s %s",
+       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);
 }
@@ -119,47 +120,30 @@ cb_service_enabled (GObject *self,
        gpointer userdata)
 {
        g_debug("cb_service_enabled: status(%d) userdata(0x%x)", status, (unsigned int)userdata);
-
-       LocationAddress *addr = NULL;
-       LocationAccuracy *acc = NULL;
-       LocationObject *loc = (LocationObject*)userdata;
-
-       LocationError err = location_get_address(loc, &addr, &acc);
-       if (LOCATION_ERROR_NONE == err) {
-               g_debug ("SYNC>> location_get_address() 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_get_address() failed> error code:%d", err);
-
-       err = location_get_address_async(loc, cb_address, loc);
-       if (LOCATION_ERROR_NONE == err) g_debug("location_get_address_async() success");
-       else g_warning ("location_get_address_async() failed> error code:%d", err);
 }
 
 static gboolean
 async_request (gpointer loc)
 {
        LocationAddress *addr = location_address_new ("1", "Post Street", NULL, "san jose", "ca", NULL, "95113");
-       LocationError err = location_get_position_from_address_async(loc, addr, cb_position_from_address, loc);
+       LocationError err = location_map_get_position_from_address_async(loc, addr, cb_position_from_address, loc);
        if (LOCATION_ERROR_NONE == err)
-               g_debug("location_get_position_from_address_async() success");
-       else g_warning ("location_get_position_from_address_async() failed> error code:%d", 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);
 
        gchar *addr_str = g_strdup("4 N 2nd Street 95113");
-       err = location_get_position_from_freeformed_address_async(loc, addr_str, cb_position_from_freeformed_address, loc);
+       err = location_map_get_position_from_freeformed_address_async(loc, addr_str, cb_position_from_freeformed_address, loc);
        if (LOCATION_ERROR_NONE == err)
-               g_debug("location_get_position_from_freeformed_address_async() success");
-       else g_warning ("location_get_position_from_freeformed_address_async() failed> error code:%d", 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);
        g_free(addr_str);
 
        LocationPosition *pos = location_position_new (0, 37.3322, -121.8720, 0, LOCATION_STATUS_2D_FIX);
-       err = location_get_address_from_position_async(loc, pos, cb_address_from_position, loc);
+       err = location_map_get_address_from_position_async(loc, pos, cb_address_from_position, loc);
        if (LOCATION_ERROR_NONE == err)
-               g_debug("location_get_address_from_position_async() success");
-       else g_warning ("location_get_address_from_position_async() failed> error code:%d", 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);
        return FALSE;
 }
@@ -167,18 +151,18 @@ async_request (gpointer loc)
 int
 main (int argc, char *argv[])
 {
-       LocationObject *loc = NULL;
+       LocationMapObject *loc = NULL;
 
        // If application is executed by AUL, this is not needed.
-       g_setenv("PKG_NAME", "com.samsung.address-sample", 1);
+       g_setenv("PKG_NAME", "org.tizen.address-sample", 1);
 
        g_type_init();
        location_init ();
        loop = g_main_loop_new (NULL, TRUE);
 
-       loc  = location_new (LOCATION_METHOD_GPS);
+       loc  = location_map_new (NULL);
        if (!loc) {
-               g_warning("location_new failed");
+               g_warning("location_map_new failed");
                return -1;
        }
 
@@ -189,47 +173,41 @@ main (int argc, char *argv[])
        LocationAddress *addr = NULL;
 
        addr = location_address_new ("1", "Post Street", NULL, "san jose", "ca", NULL, "95113");
-       LocationError err = location_get_position_from_address(loc, addr, &pos_list, &acc_list);
+       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_get_position_from_address() failed> error code:%d", err);
+       } 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");
-       err = location_get_position_from_freeformed_address(loc, addr_str, &pos_list, &acc_list);
+       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_get_position_from_freeformed_address() failed> error code:%d", err);
+       } 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);
-       err = location_get_address_from_position(loc, pos, &addr, &acc);
+       err = location_map_get_address_from_position(loc, pos, &addr, &acc);
        if (LOCATION_ERROR_NONE == err) {
-               g_debug ("SYNC>> location_get_address_from_position() success> %s %s %s %s %s %s %s",
+               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_get_address_from_position() failed> error code:%d", err);
+       } 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_timeout_add_seconds (3, async_request, loc);
-       int ret = location_start (loc);
-       if( LOCATION_ERROR_NONE != ret ){
-               g_debug("location_start failed[%d]",ret);
-               return -1;
-       }
 
        g_timeout_add_seconds (60, exit_program, NULL);
        g_main_loop_run (loop);
 
-       location_stop (loc);
-       location_free (loc);
+       location_map_free (loc);
 
        return 0;
 }
index ea7c707..e5d500a 100644 (file)
@@ -44,7 +44,6 @@ main (int argc, char *argv[])
 
        LocationAccuracy *acc = NULL;
        LocationPosition *pos = NULL;
-       LocationAddress *addr = 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",
@@ -54,13 +53,6 @@ main (int argc, char *argv[])
                location_position_free(pos);
                location_accuracy_free(acc);
        } else g_warning ("SYNC>> Current position> failed");
-       if (LOCATION_ERROR_NONE == location_get_address(loc, &addr, &acc)) {
-               g_debug ("SYNC>> Current address> %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>> Current address> failed");
 
        g_object_get(loc, "last-position", &pos, NULL);
        if (pos) {
index c36dbf7..6b69b02 100644 (file)
@@ -69,7 +69,6 @@ cb_service_enabled (GObject *self,
        LocationAccuracy *acc = NULL;
        LocationPosition *pos = NULL;
        LocationVelocity *vel = NULL;
-       LocationAddress *addr = NULL;
        LocationSatellite *sat = NULL;
        gchar *nmea_data = NULL;
        int idx = 0;
@@ -90,13 +89,6 @@ cb_service_enabled (GObject *self,
                location_velocity_free(vel);
                location_accuracy_free(acc);
        } else g_warning ("SYNC>> Current velocity> failed");
-       if (LOCATION_ERROR_NONE == location_get_address(loc, &addr, &acc)) {
-               g_debug ("SYNC>> Current address> %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>> Current address> failed");
 
        g_object_get (loc, "satellite", &sat, NULL);
        if (sat) {
index 90b0d06..c8f4684 100644 (file)
@@ -68,7 +68,6 @@ cb_service_enabled (GObject *self,
        LocationAccuracy *acc = NULL;
        LocationPosition *pos = NULL;
        LocationVelocity *vel = NULL;
-       LocationAddress *addr = NULL;
        LocationMethod method;
 
        g_object_get(loc, "method", &method, NULL);
@@ -90,13 +89,6 @@ cb_service_enabled (GObject *self,
                location_velocity_free(vel);
                location_accuracy_free(acc);
        } else g_warning ("SYNC>> Current velocity> failed");
-       if (LOCATION_ERROR_NONE == location_get_address(loc, &addr, &acc)) {
-               g_debug ("SYNC>> Current address> %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>> Current address> failed");
        }
 
 static void
diff --git a/tests/ips-test.c b/tests/ips-test.c
deleted file mode 100644 (file)
index 19e40a1..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * libslp-location
- *
- * 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.h>
-
-int
-main (int argc, char *argv[])
-{
-       LocationObject *loc = NULL;
-
-       // If application is executed by AUL, this is not needed.
-       g_setenv("PKG_NAME", "com.samsung.ips-test", 1);
-
-       location_init ();
-
-       loc  = location_new (LOCATION_METHOD_IPS);
-       if (!loc) {
-               g_debug("location_new failed");
-               return -1;
-       }
-
-       LocationMethod method = LOCATION_METHOD_NONE;
-       g_object_get(loc, "method", &method, NULL);
-       g_debug("Get property>> method:%d", method);
-
-       LocationAccuracy *acc = NULL;
-       LocationPosition *pos = NULL;
-       LocationAddress *addr = 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);
-               location_position_free(pos);
-               location_accuracy_free(acc);
-       } else g_warning ("SYNC>> Current position> failed");
-       if (LOCATION_ERROR_NONE == location_get_address(loc, &addr, &acc)) {
-               g_debug ("SYNC>> Current address> %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>> Current address> failed");
-
-       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);
-               location_position_free(pos);
-       } else  g_warning("failed to get property> last-position");
-
-       location_free (loc);
-
-       return 0;
-}
index 2247f89..19e3aa6 100644 (file)
 #include <glib.h>
 #include <string.h>
 #include <glib/gprintf.h>
-#include <gconf/gconf-client.h>
 #include <location.h>
-#include <location-map-service.h>
-#include <location-poi.h>
 #include "location-api-test-util.h"
 
 #define STR_MAX        128
@@ -96,9 +93,9 @@ static void GetStatus(char str[STR_MAX], LocationStatus acc_level)
        }
 }
 
-static void GetMethod(char str[STR_MAX], LocationMethod acc_level)
+static void GetMethod(char str[STR_MAX], LocationMethod method)
 {
-       switch(acc_level)
+       switch(method)
        {
                case LOCATION_METHOD_HYBRID:
                        g_utf8_strncpy(str, "LOCATION_METHOD_HYBRID", STR_MAX);
@@ -109,15 +106,9 @@ static void GetMethod(char str[STR_MAX], LocationMethod acc_level)
                case LOCATION_METHOD_CPS:
                        g_utf8_strncpy(str, "LOCATION_METHOD_CPS", STR_MAX);
                        break;
-               case LOCATION_METHOD_IPS:
-                       g_utf8_strncpy(str, "LOCATION_METHOD_IPS", STR_MAX);
-                       break;
                case LOCATION_METHOD_WPS:
                        g_utf8_strncpy(str, "LOCATION_METHOD_WPS", STR_MAX);
                        break;
-               case LOCATION_METHOD_SPS:
-                       g_utf8_strncpy(str, "LOCATION_METHOD_SPS", STR_MAX);
-                       break;
                default:
                        g_utf8_strncpy(str, "Error: undefined method", STR_MAX);
        }
@@ -172,35 +163,6 @@ static int PromptInt()
        return ret;
 }
 
-static double PromptDB()
-{
-       char buf[255];
-       double ret;
-       fgets(buf, 255, stdin);
-       buf[strlen(buf)-1]='\0';
-       ret = g_ascii_strtod(buf, NULL);
-       return ret;
-}
-
-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);
-       }
-}
-
-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);
-       }
-
-}
-
 gulong g_sig_enable = 0;
 gulong g_sig_disable = 0;
 gulong g_sig_update = 0;
@@ -245,7 +207,10 @@ static void PrintProperty (LocationObject* loc)
        if (!loc) return;
        LocationMethod method = LOCATION_METHOD_NONE;
        LocationPosition *pos = NULL;
-       guint interval = 0;
+       LocationAccuracy *acc = NULL;
+       guint pos_interval = 0;
+       guint vel_interval = 0;
+       guint sat_interval = 0;
        gchar method_str[STR_MAX] = {0, };
        gchar status_str[STR_MAX] = {0, };
 
@@ -263,18 +228,28 @@ static void PrintProperty (LocationObject* loc)
                }
        }
 
-       g_object_get(loc, "last-position", &pos, NULL);
-       if (pos) {
+       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);
        }
-
-       g_object_get(loc, "update-interval", &interval, NULL);
-       g_printf("Update interval : [%u]", interval);
-
-       if (LOCATION_METHOD_CPS == method ||  LOCATION_METHOD_IPS == method) return;
+       
+       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) {
+               g_object_get(loc, "pos-interval", &pos_interval, NULL);
+               g_object_get(loc, "vel-interval", &vel_interval, NULL);
+       }
+       else if (method == LOCATION_METHOD_CPS) {
+               g_object_get(loc, "pos-interval", &pos_interval, NULL);
+       }
+       g_printf("Position interval : [%u], Velocity interval [%u], Satellite interval [%u]\n", pos_interval, vel_interval, sat_interval);
 
        g_printf("\nSignals: ");
        if (g_sig_enable)  g_printf("[service-enabled], ");
@@ -286,41 +261,33 @@ static void PrintProperty (LocationObject* loc)
 
 static void cb_service_enabled (GObject *self,         guint status, gpointer userdata)
 {
-       g_debug("cb_service_enabled: status(%d) userdata(0x%x)", status, (unsigned int)userdata);
+       g_printf("cb_service_enabled: status(%d) userdata(0x%x)", status, (unsigned int)userdata);
 
        LocationObject *loc = (LocationObject*)userdata;
        LocationAccuracy *acc = NULL;
        LocationPosition *pos = NULL;
        LocationVelocity *vel = NULL;
-       LocationAddress *addr = NULL;
        LocationMethod method;
 
        g_object_get(loc, "method", &method, NULL);
-       g_debug("Get property>> method:%d", method);
+       g_printf("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",
+               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_debug ("\tAccuracy level %d (%.0f meters %.0f meters)",
+               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_debug ("SYNC>> Current velocity> time: %d, speed: %f, direction:%f, climb:%f",
+               g_printf ("SYNC>> Current velocity> time: %d, speed: %f, direction:%f, climb:%f\n",
                        vel->timestamp, vel->speed, vel->direction, vel->climb);
-               g_debug ("\tAccuracy level %d (%.0f meters %.0f meters)",
+               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");
-       if (LOCATION_ERROR_NONE == location_get_address(loc, &addr, &acc)) {
-               g_debug ("SYNC>> Current address> %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>> Current address> failed");
+       } else g_warning ("SYNC>> Current velocity> failed\n");
 }
 
 static void
@@ -328,7 +295,7 @@ cb_service_disabled (GObject *self,
        guint status,
        gpointer userdata)
 {
-       g_debug("cb_service_disabled: status(%d) userdata(0x%x)", status, (unsigned int)userdata);
+       g_printf("cb_service_disabled: status(%d) userdata(0x%x)\n", status, (unsigned int)userdata);
 }
 
 static void
@@ -337,13 +304,13 @@ cb_zone_in (GObject *self,
        gpointer position,
        gpointer accuracy)
 {
-       g_debug("cb_zone_in: type(%d)", type);
+       g_printf("cb_zone_in: type(%d)\n", type);
        LocationPosition *pos = (LocationPosition*) position;
        LocationAccuracy *acc = (LocationAccuracy*) accuracy;
 
-       g_debug ("ASYNC>> ZoneIn> Current position: time: %d, lat: %f, long: %f, alt: %f",
+       g_printf ("ASYNC>> ZoneIn> Current position: time: %d, lat: %f, long: %f, alt: %f\n",
                pos->timestamp, pos->latitude, pos->longitude, pos->altitude);
-       g_debug ("\tAccuracy level %d (%.0f meters %.0f meters)",
+       g_printf ("\tAccuracy level %d (%.0f meters %.0f meters)\n",
                acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
 }
 
@@ -353,13 +320,13 @@ cb_zone_out (GObject *self,
        gpointer position,
        gpointer accuracy)
 {
-       g_debug("cb_zone_out: type(%d)", type);
+       g_printf("cb_zone_out: type(%d)\n", type);
        LocationPosition *pos = (LocationPosition*) position;
        LocationAccuracy *acc = (LocationAccuracy*) accuracy;
 
-       g_debug ("ASYNC>> ZoneOut> Current position: time: %d, lat: %f, long: %f, alt: %f",
+       g_printf ("ASYNC>> ZoneOut> Current position: time: %d, lat: %f, long: %f, alt: %f\n",
                pos->timestamp, pos->latitude, pos->longitude, pos->altitude);
-       g_debug ("\tAccuracy level %d (%.0f meters %.0f meters)",
+       g_printf ("\tAccuracy level %d (%.0f meters %.0f meters)\n",
                acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
 }
 
@@ -370,23 +337,23 @@ cb_service_updated (GObject *self,
        gpointer accuracy,
        gpointer userdata)
 {
-       g_debug("cb_service_updated: type(%d) userdata(0x%x)", type, (unsigned int)userdata);
+       g_printf("cb_service_updated: type(%d) userdata(0x%x)", type, (unsigned int)userdata);
 
        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",
+               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_debug ("\tAccuracy level %d (%.0f meters %.0f meters)",
+               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_debug ("ASYNC>> Current velocity> time: %d, speed: %f, direction:%f, climb:%f",
+               g_printf ("ASYNC>> Current velocity> time: %d, speed: %f, direction:%f, climb:%f\n",
                        vel->timestamp, vel->speed, vel->direction, vel->climb);
-               g_debug ("\tAccuracy level %d (%.0f meters %.0f meters)",
+               g_printf ("\tAccuracy level %d (%.0f meters %.0f meters)\n",
                        acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
        }
                break;
@@ -399,11 +366,11 @@ cb_service_updated (GObject *self,
                gint snr;
 
                LocationSatellite *sat = (LocationSatellite *)data;
-               g_debug ("SYNC>> Current Satellite> time: %d, satellite in view = %d, satellite in used = %d", sat->timestamp, sat->num_of_sat_inview, sat->num_of_sat_used);
-               g_debug ("\tinview satellite information = ");
+               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_debug ("\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\n", idx, used, prn, elevation, azimuth, snr);
                }
        }
                break;
@@ -413,289 +380,6 @@ cb_service_updated (GObject *self,
        }
 }
 
-static void _print_property (gpointer data, gpointer user_data)
-{
-       LocationLandmark *landmark = (LocationLandmark *)user_data;
-       gpointer key = (gpointer)data;
-       gpointer value = NULL;
-
-       if (key) {
-               value = (gpointer)location_landmark_get_property(landmark, key);
-               g_printf(", [%s:%s]", (gchar*) key, (gchar*) value);
-       }
-}
-
-static void
-__plugin_print_poi_list (gpointer data, gpointer user_data)
-{
-       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);
-
-       GList *key_list = location_landmark_get_property_key(landmark);
-       if (key_list) {
-               g_list_foreach(key_list, _print_property, landmark);
-       }
-
-       g_printf("\n");
-}
-
-
-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) {
-               g_printf("Failed :%d\n", error);
-               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);
-
-       if (error_code && error_msg) {
-               g_printf("__location_POI_cb: error_code[%s], error_msg[%s]\n", error_code, error_msg);
-       }
-}
-static void PrintStepInfo(const LocationRouteStep *step)
-{
-       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 position 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);
-}
-
-static void cb_print_route_step (gpointer data, gpointer user_data)
-{
-       g_printf("+++Step begin\n");
-       LocationRouteStep *step = (LocationRouteStep *)data;
-
-       PrintStepInfo(step);
-       g_printf("---Step end\n");
-}
-
-static void cb_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 position 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, cb_print_route_step, NULL);
-       }
-       g_printf("--Segment end\n");
-}
-
-
-static void cb_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, cb_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)
-{
-       g_printf("\n===== cb_route ======\n");
-       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, 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);
-       }
-}
-
-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);
-}
-
-static void cb_address(LocationError error, LocationAddress *addr, LocationAccuracy *acc, gpointer userdata)
-{
-       if (error != LOCATION_ERROR_NONE) {
-               g_printf("cb_address failed: error=%d\n", error);
-               return;
-       }
-       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);
-       GetAccuracyLevel(str, acc->level);
-       g_printf("level: [%s], horizontal_accuracy: [%f], vertical_accuracy: [%f]\n", str, acc->horizontal_accuracy, acc->vertical_accuracy);
-}
-
-typedef struct {
-       LocationObject *obj;
-       LocationPosition *pos;
-       LocationAddress *addr;
-       gchar *str_addr;
-       LocationPositionCB pos_cb;
-       LocationAddressCB addr_cb;
-       gpointer user_data;
-} IdleData;
-
-static gboolean idle_position_from_address_async(gpointer data)
-{
-       IdleData* idle_data = (IdleData*)data;
-       char str[STR_MAX];
-       int ret = location_get_position_from_address_async(idle_data->obj, idle_data->addr, idle_data->pos_cb, idle_data->user_data);
-       GetLocationError(str, ret);
-       g_printf("location_get_position_from_address_async: returned value [%s]\n", str);
-       location_address_free(idle_data->addr);
-       g_free(idle_data);
-       return FALSE;
-}
-
-static gboolean idle_position_from_freefromed_address_async(gpointer data)
-{
-       IdleData* idle_data = (IdleData*)data;
-       char str[STR_MAX];
-       int ret = location_get_position_from_freeformed_address_async(idle_data->obj, idle_data->str_addr, idle_data->pos_cb, idle_data->user_data);
-       GetLocationError(str, ret);
-       g_printf("location_get_position_from_freeformed_address_async: returned value [%s]\n", str);
-       g_free(idle_data->str_addr);
-       g_free(idle_data);
-       return FALSE;
-}
-
-static gboolean idle_address_async(gpointer data)
-{
-       IdleData* idle_data = (IdleData*)data;
-       char str[STR_MAX];
-       int ret = location_get_address_async(idle_data->obj, idle_data->addr_cb, idle_data->user_data);
-       GetLocationError(str, ret);
-       g_printf("location_get_address_async: returned value [%s]\n", str);
-       g_free(idle_data);
-       return FALSE;
-}
-
-static gboolean idle_address_from_position_async(gpointer data)
-{
-       IdleData* idle_data = (IdleData*)data;
-       char str[STR_MAX];
-       int ret = location_get_address_from_position_async(idle_data->obj, idle_data->pos, idle_data->addr_cb, idle_data->user_data);
-       GetLocationError(str, ret);
-       g_printf("location_get_address_from_position_async: returned value [%s]\n", str);
-       location_position_free(idle_data->pos);
-       g_free(idle_data);
-       return FALSE;
-}
-
-void _print_keys(gpointer value)
-{
-       g_printf(" %s ", (gchar*) value);
-}
-
-static void print_map_service_keys (LocationObject *obj, int type)
-{
-       GList *key = NULL;
-
-       int ret = location_get_map_provider_capability_key (obj, type, &key);
-
-       if (key) {
-               g_list_foreach (key, _print_keys, NULL);
-       }
-
-       g_list_free_full(key, g_free);
-}
-
 static void print_menu()
 {
        g_printf("\n================================= Location API Test =================================\n");
@@ -707,36 +391,18 @@ static void print_menu()
        g_printf("5.   location_stop\n");
        g_printf("6.   location_get_position\n");
        g_printf("6a.  location_get_last_position\n");
-       g_printf("6b.  location_get_last_known_position - will be deprecated. \n");
-       g_printf("7.   location_get_position_from_address\n");
-       g_printf("7a.  location_get_position_from_address_async\n");
-       g_printf("8.   location_get_position_from_freeformed_address\n");
-       g_printf("8a.  location_get_position_from_freeformed_address_async\n");
-       g_printf("9.   location_get_velocity\n");
-       g_printf("9a.  location_get_last_velocity\n");
-       g_printf("10.  location_get_satellite\n");
-       g_printf("10a. location_get_last_satellite\n");
-       g_printf("11.  location_get_address\n");
-       g_printf("11a. location_get_address_async\n");
-       g_printf("12.  location_get_address_from_position\n");
-       g_printf("12a. location_get_address_from_position_async\n");
-       g_printf("13.  location_get_distance\n");
-       g_printf("14.  location_is_supported_method\n");
-       g_printf("15.  location_is_enabled_gps\n");
-       g_printf("16.  location_search_poi\n");
-       g_printf("16a. location_search_poi_by_area\n");
-       g_printf("16b. location_search_poi_by_addr\n");
-       g_printf("16c. location_search_poi_by_freeformed_address\n");
-       g_printf("16d. location_search_poi_by_area\n");
-       g_printf("16e. location_cancel_poi_request\n");
-       g_printf("17.  location_request_route\n");
-       g_printf("17a. location_cancel_route_request\n");
-       g_printf("18.  location_is_supported_map_provider_capability\n");
-       g_printf("19.  location_get_map_provider_capability_key\n");
+       g_printf("7.   location_get_velocity\n");
+       g_printf("7a.  location_get_last_velocity\n");
+       g_printf("8.   location_get_satellite\n");
+       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");
        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, (6)Set update interval\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("==================================== Property ====================================\n");
        PrintProperty(location_obj);
        g_printf("\n==================================================================================\n");
@@ -748,21 +414,23 @@ int main(int argc, char** argv)
        int ret;
        char str[STR_MAX];
        GError *gerr = NULL;
-       guint req_id = 0;
 
        // If application is executed by AUL, this is not needed.
        g_setenv("PKG_NAME", "com.samsung.location-api-test", 1);
 
        g_type_init();
+
+#if !GLIB_CHECK_VERSION (2, 31, 0)
        if( !g_thread_supported() )
        {
                g_thread_init(NULL);
        }
+#endif
 
        GThread *g_main;
        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]",
+               g_printf("Error create gmain thread: Err domain[%d] Err code[%d] Err msg[%s]",
                        gerr->domain, gerr->code, gerr->message);
                g_error_free(gerr);
                return 0;
@@ -788,7 +456,7 @@ int main(int argc, char** argv)
                                g_printf("Location object already existed: [0x%x]", (unsigned int)location_obj);
                                continue;
                        }
-                       g_printf("LOCATION_METHOD_HYBRID[0] LOCATION_METHOD_GPS[1] LOCATION_METHOD_WPS[2] LOCATION_METHOD_SPS[5]\n");
+                       g_printf("LOCATION_METHOD_HYBRID[0] LOCATION_METHOD_GPS[1] LOCATION_METHOD_WPS[2] LOCATION_METHOD_CPS[3]\n");
                        g_printf("Select Location Method: ");
                        LocationMethod method = PromptInt();
                        location_obj = location_new(method);
@@ -797,6 +465,7 @@ int main(int argc, char** argv)
                } else if (0 == g_strcmp0("3",strOpt)) {
                        ret = location_free (location_obj);
                        location_obj = NULL;
+
                        g_sig_enable = 0;
                        g_sig_disable = 0;
                        g_sig_update = 0;
@@ -833,160 +502,15 @@ int main(int argc, char** argv)
                        ret = location_get_last_position (location_obj, &last_pos, &last_acc);
                        GetLocationError(str, ret);
                        if (ret == LOCATION_ERROR_NONE) {
-                               g_debug ("SYNC>> Last position> time: %d, lat: %f, long: %f, alt: %f, status: %d",
+                               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_debug ("\tAccuracy level %d (%.0f meters %.0f meters)",
+                               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 g_warning ("SYNC>> Last position> failed. Error[%s]",str);
 
-               } else if (0 == g_strcmp0("6b",strOpt)) {
-                       g_printf("LOCATION_METHOD_HYBRID[0] LOCATION_METHOD_GPS[1] LOCATION_METHOD_WPS[2] LOCATION_METHOD_SPS[5]\n");
-                       g_printf("Select Location Method: ");
-                       LocationMethod method = PromptInt();
-                       LocationLastPosition last_pos;
-                       ret = location_get_last_known_position(location_obj, method, &last_pos);
-                       GetLocationError(str, ret);
-                       g_printf("location_get_last_known_position: returned value [%s]\n", str);
-                       if (ret == LOCATION_ERROR_NONE) {
-                               g_printf("last position method[%d], latitude: [%f], longitude: [%f], altitude: [%f], horizontal_accuracy: [%f], vertical_accuracy: [%f]\n", last_pos.method, last_pos.latitude, last_pos.longitude, last_pos.altitude, last_pos.horizontal_accuracy, last_pos.vertical_accuracy);
-                       }
-               } else if (0 == g_strcmp0("7",strOpt)) {
-                       LocationAddress *add = NULL;
-                       GList *pos_list = NULL;
-                       GList *acc_list = NULL;
-
-                       g_printf("[0].San jose [1].수원 삼성  [2].Suwon HQ [*].Custom\n");
-                       g_printf("Select Address: ");
-                       int opt = PromptInt();
-                       if (opt == 0)      add = location_address_new ("1", "Post Street", NULL, "san jose", "ca", NULL, "95113");
-                       else if (opt == 1) add = location_address_new (NULL, "삼성전자", "매탄 3동", "수원시 영통구", "경기도",  NULL, NULL);
-                       else if (opt == 2) add = location_address_new (NULL, "Samsung Electro-Mechanics Co. LTD", "Maetan 3-dong", "Suwon Si Yeongtong-gu", "Gyeonggi-do", 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: ");
-                               fgets(building_number, 255, stdin);
-                               building_number[strlen(building_number)-1]='\0';
-                               g_printf("Input street: ");
-                               fgets(street, 255, stdin);
-                               street[strlen(street)-1]='\0';
-                               g_printf("Input state: ");
-                               fgets(state, 255, stdin);
-                               state[strlen(state)-1]='\0';
-                               g_printf("Input country code: ");
-                               fgets(country_code, 255, stdin);
-                               country_code[strlen(country_code)-1]='\0';
-                               g_printf("Input city: ");
-                               fgets(city, 255, stdin);
-                               city[strlen(city)-1]='\0';
-                               g_printf("Input district: ");
-                               fgets(district, 255, stdin);
-                               district[strlen(district)-1]='\0';
-                               g_printf("Input postal code: ");
-                               fgets(postal_code, 255, stdin);
-                               postal_code[strlen(postal_code)-1]='\0';
-                               add = location_address_new(building_number, street, district, city, state, country_code, postal_code);
-                       }
-                       ret = location_get_position_from_address (location_obj, add, &pos_list, &acc_list);
-                       if(add) location_address_free (add);
-                       GetLocationError(str, ret);
-                       g_printf("location_get_position_from_adress: returned value [%s]\n", str);
-                       if (ret == LOCATION_ERROR_NONE) {
-                               g_list_foreach (pos_list, PrintPos, NULL);
-                               g_list_foreach (acc_list, PrintAcc, NULL);
-                       }
-               } else if (0 == g_strcmp0("7a",strOpt)) {
-                       IdleData* data = g_new0(IdleData, 1);
-                       data->obj = location_obj;
-                       data->pos_cb = cb_position;
-                       data->user_data = location_obj;
-
-                       g_printf("[0].San jose [1].수원 삼성  [2].Suwon HQ [*].Custom\n");
-                       g_printf("Select Address: ");
-                       int opt = PromptInt();
-                       if (opt == 0)      data->addr = location_address_new ("1", "Post Street", NULL, "san jose", "ca", NULL, "95113");
-                       else if (opt == 1) data->addr = location_address_new (NULL, "삼성전자", "매탄3동", "수원시 영통구", "경기도",  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);
-                       else {
-                               char building_number[255], street[255], state[255], country_code[255], city[255], district[255], postal_code[255];
-                               g_printf("Input building number: ");
-                               fgets(building_number, 255, stdin);
-                               building_number[strlen(building_number)-1]='\0';
-                               g_printf("Input street: ");
-                               fgets(street, 255, stdin);
-                               street[strlen(street)-1]='\0';
-                               g_printf("Input state: ");
-                               fgets(state, 255, stdin);
-                               state[strlen(state)-1]='\0';
-                               g_printf("Input country code: ");
-                               fgets(country_code, 255, stdin);
-                               country_code[strlen(country_code)-1]='\0';
-                               g_printf("Input city: ");
-                               fgets(city, 255, stdin);
-                               city[strlen(city)-1]='\0';
-                               g_printf("Input district: ");
-                               fgets(district, 255, stdin);
-                               district[strlen(district)-1]='\0';
-                               g_printf("Input postal code: ");
-                               fgets(postal_code, 255, stdin);
-                               postal_code[strlen(postal_code)-1]='\0';
-                               data->addr = location_address_new(building_number, street, district, city, state, country_code, postal_code);
-                       }
-                       g_idle_add((GSourceFunc)idle_position_from_address_async, data);
-               }else if (0 == g_strcmp0("8",strOpt)) {
-                       gchar* addr = NULL;
-                       GList *pos_list = NULL;
-                       GList *acc_list = NULL;
-
-                       g_printf("[0].San jose [1].수원삼성  [2].Suwon HQ [*].Custom\n");
-                       g_printf("Select Address: ");
-                       int opt = PromptInt();
-                       if(opt == 0){
-                               addr = g_strdup("4 N 2nd Street 95113");
-                       }else if(opt == 1){
-                               addr = g_strdup("경기도 수원시 영통구 매탄 3동 삼성전자");
-                       }else if(opt == 2){
-                               addr = g_strdup("Samsung Electronics Co. LTD Maetan 3-dong, Suwon Si Yeongtong-gu, Gyeonggi-Do (Seoul 443-742 Korea), Rep of KOREA");
-                       }else{
-                               char buf[255];
-                               g_printf("Input freeform address: ");
-                               fgets(buf, 255, stdin);
-                               buf[strlen(buf)-1]='\0';
-                               addr = g_strdup(buf);
-                       }
-                       ret = location_get_position_from_freeformed_address(location_obj, addr, &pos_list, &acc_list);
-                       g_free(addr);
-                       GetLocationError(str, ret);
-                       g_printf("location_get_position_from_freeformed_adress: returned value [%s]\n", str);
-                       if(ret == LOCATION_ERROR_NONE){
-                               g_list_foreach (pos_list, PrintPos, NULL);
-                               g_list_foreach (acc_list, PrintAcc, NULL);
-                       }
-               }else if(0 == g_strcmp0("8a",strOpt) ){
-                       IdleData* data = g_new0(IdleData, 1);
-                       data->obj = location_obj;
-                       data->pos_cb = cb_position;
-                       data->user_data = location_obj;
-                       g_printf("[0].San jose [1].수원 삼성  [2].Suwon HQ [*].Custom\n");
-                       g_printf("Select Address: ");
-                       int opt = PromptInt();
-                       if(opt == 0){
-                               data->str_addr = g_strdup("4 N 2nd Street 95113");
-                       }else if(opt == 1){
-                               data->str_addr = g_strdup("경기도 수원시 영통구 매탄 3동 삼성전자");
-                       }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{
-                               char buf[255];
-                               g_printf("Input freeform address: ");
-                               fgets(buf, 255, stdin);
-                               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("9",strOpt) ){
+               }else if(0 == g_strcmp0("7",strOpt) ){
                        LocationVelocity *vel = NULL;
                        LocationAccuracy *acc = NULL;
                        ret = location_get_velocity(location_obj, &vel, &acc);
@@ -1002,20 +526,20 @@ int main(int argc, char** argv)
                        }
                        if(vel) location_velocity_free(vel);
                        if(acc) location_accuracy_free(acc);
-               }else if(0 == g_strcmp0("9a",strOpt) ){
+               }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);
                        GetLocationError(str, ret);
                        if (ret == LOCATION_ERROR_NONE) {
-                               g_debug ("SYNC>> Last velocity> time: %d, speed: %f, direction:%f, climb:%f",
+                               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_debug ("\tAccuracy level %d (%.0f meters %.0f meters)",
+                               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 g_warning ("SYNC>> Last velocity> failed. Error[%s]", str);
-               }else if(0 == g_strcmp0("10",strOpt) ){
+               }else if(0 == g_strcmp0("8",strOpt) ){
                        int ret = 0, idx = 0;
                        LocationSatellite *sat = NULL;
                        guint prn;
@@ -1027,15 +551,15 @@ int main(int argc, char** argv)
                        ret =  location_get_satellite (location_obj, &sat);
                        GetLocationError(str, ret);
                        if (ret == LOCATION_ERROR_NONE) {
-                               g_debug ("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_debug ("\tinview satellite information = ");
+                               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_debug ("\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);
                        } else g_warning ("SYNC>> Current satellite> failed. Error[%s]", str);
-               }else if(0 == g_strcmp0("10a",strOpt) ){
+               }else if(0 == g_strcmp0("8a",strOpt) ){
                        int ret = 0, idx = 0;
                        LocationSatellite *last_sat = NULL;
                        guint prn;
@@ -1047,77 +571,15 @@ int main(int argc, char** argv)
                        ret = location_get_last_satellite (location_obj, &last_sat);
                        GetLocationError(str, ret);
                        if (ret == LOCATION_ERROR_NONE) {
-                               g_debug ("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_debug ("\tinview satellite information = ");
+                               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_debug ("\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);
                        } else g_warning ("SYNC>> Last satellite> failed. Error[%s]", str);
-               } else if(0 == g_strcmp0("11",strOpt) ){
-                       LocationAddress *addr = NULL;
-                       LocationAccuracy *acc = NULL;
-                       ret = location_get_address(location_obj, &addr, &acc);
-                       GetLocationError(str, ret);
-                       g_printf("location_get_address: returned value [%s]\n", str);
-                       if(ret == LOCATION_ERROR_NONE){
-                               g_printf("building number: [%s], street: [%s], state: [%s], country code: [%s], city: [%s], district: [%s], postal code: [%s]\n",
-                                       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);
-                       }
-               }else if(0 == g_strcmp0("11a",strOpt) ){
-                       IdleData* data = g_new0(IdleData, 1);
-                       data->obj = location_obj;
-                       data->addr_cb = cb_address;
-                       data->user_data = location_obj;
-                       g_idle_add((GSourceFunc)idle_address_async, data);
-               }else if(0 == g_strcmp0("12",strOpt) ){
-                       LocationPosition *pos = NULL;
-                       LocationAddress *addr = NULL;
-                       LocationAccuracy *acc = NULL;
-                       g_printf("[0].San jose [1].Suwon HQ [*].Custom\n");
-                       g_printf("Select Position: ");
-                       int opt = PromptInt();
-                       if(opt == 0)      pos = location_position_new(0, 37.335276, -121.890059, 0, LOCATION_STATUS_2D_FIX);
-                       else if(opt == 1) pos = location_position_new(0, 37.257809, 127.056383, 0, LOCATION_STATUS_2D_FIX);
-                       else{
-                               g_printf("Input latitude: ");
-                               gdouble lat = PromptDB();
-                               g_printf("Input longitude: ");
-                               gdouble lon = PromptDB();
-                               pos = location_position_new(0, lat, lon, 0, LOCATION_STATUS_2D_FIX);
-                       }
-                       ret = location_get_address_from_position(location_obj, pos, &addr, &acc);
-                       GetLocationError(str, ret);
-                       g_printf("location_get_address_from_position: returned value [%s]\n", str);
-                       if(ret == LOCATION_ERROR_NONE){
-                               g_printf("building number: [%s], street: [%s], state: [%s], country code: [%s], city: [%s], district: [%s], postal code: [%s]\n",
-                                       addr->building_number, addr->street, addr->state, addr->country_code, addr->city, addr->district, addr->postal_code);
-                       }
-                       if(addr) location_address_free(addr);
-                       if(acc) location_accuracy_free(acc);
-               }else if(0 == g_strcmp0("12a",strOpt) ){
-                       IdleData* data = g_new0(IdleData, 1);
-                       data->obj = location_obj;
-                       data->addr_cb = cb_address;
-                       data->user_data = location_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);
-                       else if (opt == 1) data->pos = location_position_new(0, 37.257809, 127.056383, 0, LOCATION_STATUS_2D_FIX);
-                       else {
-                               g_printf("Input latitude: ");
-                               gdouble lat = PromptDB();
-                               g_printf("Input longitude: ");
-                               gdouble lon = PromptDB();
-                               data->pos = location_position_new(0, lat, lon, 0, LOCATION_STATUS_2D_FIX);
-                       }
-                       g_idle_add((GSourceFunc)idle_address_from_position_async, data);
-               }else if(0 == g_strcmp0("13",strOpt) ) {
+               }else if(0 == g_strcmp0("9",strOpt) ) {
 
                        gulong distance;
                        int ret = 0;
@@ -1139,13 +601,13 @@ int main(int argc, char** argv)
                                        g_printf("The approximate distance is [%lu]\n", distance);
                                        g_printf("cf.) It is approximately 969954.114 meter\n");
                        }
-               }else if(0 == g_strcmp0("14", strOpt)) {
+               }else if(0 == g_strcmp0("10", strOpt)) {
                        int method;
                        char method_str[STR_MAX] = {0, };
                        char input[8] = {0, };
                        gboolean is_supported = FALSE;
 
-                       g_printf("0.Hybrid 1.GPS 2.WPS 3.CPS(X) 4.IPS(X) 5.SPS\n");
+                       g_printf("0.Hybrid 1.GPS 2.WPS 3.CPS\n");
                        g_printf("Select Method :");
                        fgets(input, 8, stdin);
                        method = atoi(input);
@@ -1162,12 +624,10 @@ int main(int argc, char** argv)
                                        is_supported = location_is_supported_method(LOCATION_METHOD_WPS);
                                        break;
 
-                               case LOCATION_METHOD_SPS:
-                                       is_supported = location_is_supported_method(LOCATION_METHOD_SPS);
+                               case LOCATION_METHOD_CPS:
+                                       is_supported = location_is_supported_method(LOCATION_METHOD_CPS);
                                        break;
 
-                               case LOCATION_METHOD_CPS:
-                               case LOCATION_METHOD_IPS:
                                default:
                                        break;
 
@@ -1176,243 +636,11 @@ int main(int argc, char** argv)
 
                        g_printf("Method[%s] is %s.", method_str, is_supported ? "supported" : "not supported");
 
-               }else if(0 == g_strcmp0("15", strOpt)) {
+               }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("16", strOpt)) {
-                       g_printf("location_search_poi\n");
-                       //guint req_id = 0;  // move to upper
-
-                       LocationPOIFilter *filter = location_poi_filter_new();
-//                     gchar *key = g_strdup("KEYWORD");
-//                     gchar *value = g_strdup("pizza");
-//                     location_poi_filter_set(filter, key, value); // same with Type ?  CATEGORY, KEYWORD, POIName
-                       //location_poi_filter_set(filter, "CATEGORY", "restaurant");  // error, const char* can't be free!!!!, 120214
-                       location_poi_filter_set(filter, "KEYWORD", "pizza");
-                       //location_poi_filter_set(filter, "POIName", "cafe");
-
-                       LocationPOIPreference *pref = location_poi_pref_new();
-                       location_poi_pref_set_max_result(pref, 2);
-                       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_DESC);  //LOCATION_POI_PREF_SO_ASC
-
-                       // only the latitude/longitude
-                       LocationPosition *position = location_position_new(0, 37.771008, -122.41175, 0, LOCATION_STATUS_2D_FIX);
-
-                       ret = location_search_poi(location_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);
-                       } else {
-                                       g_printf("Seach POI success, req_id %d\n", req_id);
-                       }
-//                     g_free(item);
-//                     g_free(key);
-//                     g_free(value);
-                       location_poi_filter_free(filter);
-                       location_poi_pref_free(pref);
-                       location_position_free(position);
-
-               }else if(0 == g_strcmp0("16a", strOpt)) {
-                       g_printf("location_search_poi_by_area\n");
-                       
-                       // 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
-
-                       LocationPOIPreference *pref = location_poi_pref_new();
-                       location_poi_pref_set_max_result(pref, 2);
-                       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
-
-
-                       ret = location_search_poi_by_area(location_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);
-                       } else {
-                                       g_printf("Seach POI by area sucess, req_id %d\n", req_id);
-                       }
-
-                       g_free(key);
-                       g_free(value);
-                       g_free(item);
-                       location_position_free(center);
-                       location_boundary_free(bound);
-                       location_poi_filter_free(filter);
-                       location_poi_pref_free(pref);
-               }else if(0 == g_strcmp0("16b", strOpt)) {
-                       g_printf("location_search_poi_by_address\n");
-
-                       LocationAddress *addr = location_address_new("51", "N SAN PEDRO ST", NULL, "SAN JOSE", "SANTA CLARA", "CA", "95110");
-                       //landmark type ?
-                       //landmark name ?
-
-                       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
-
-                       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
-
-                       ret = location_search_poi_by_address(location_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);
-                       } else {
-                                       g_printf("Seach POI by address sucess, req_id %d\n", req_id);
-                       }
-
-                       g_free(key);
-                       g_free(value);
-                       g_free(item);
-
-                       location_address_free(addr);
-                       location_poi_filter_free(filter);
-                       location_poi_pref_free(pref);
-               }else if(0 == g_strcmp0("16c", strOpt)) {
-                       g_printf("location_search_poi_by_freeformed_address\n");
-               
-                       gchar *addr = g_strdup("North Second St.");
-
-                       LocationPOIFilter *filter = location_poi_filter_new();
-                       gchar *key = g_strdup("KEYWORD");
-                       gchar *value = g_strdup("restaurant");
-                       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
-                       
-                       ret = location_search_poi_by_freeformed_address(location_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);
-                       } else {
-                                       g_printf("Seach POI by address success, req_id %d\n", req_id);
-               }
-
-                       g_free(key);
-                       g_free(value);
-                       g_free(item);
-
-                       g_free(addr);
-                       location_poi_filter_free(filter);
-                       location_poi_pref_free(pref);
-               }else if(0 == g_strcmp0("16d", strOpt)) {
-                       gchar value[255] = {0, };
-
-                       // only circle supported by decarta
-                       LocationPosition *center = location_position_new(0, 37.56693, 126.97819, 0, LOCATION_STATUS_2D_FIX);
-                       gdouble radius = 800;
-                       LocationBoundary *bound = location_boundary_new_for_circle(center, radius);
-
-                       LocationPOIFilter *filter = location_poi_filter_new();
-
-                       g_printf("Input keyword :");
-                       scanf("%s", value);
-                       gchar *key = g_strdup("KEYWORD");
-                       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, 2);
-                       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
-
-
-                       ret = location_search_poi_by_area(location_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);
-                       } else {
-                                       g_printf("Seach POI by area sucess, req_id %d\n", req_id);
-                       }
-
-                       g_free(key);
-                       g_free(value);
-                       g_free(item);
-                       location_position_free(center);
-                       location_boundary_free(bound);
-                       location_poi_filter_free(filter);
-                       location_poi_pref_free(pref);
-               }else if(0 == g_strcmp0("16e", strOpt)) {
-                       int req_id;
-
-                       g_printf("Input ReqID : ");
-                       scanf("%d", &req_id);
-
-                       ret = location_cancel_poi_request(location_obj, req_id);
-                       GetLocationError(str, ret);
-                       if (ret != LOCATION_ERROR_NONE) {
-                               g_printf("Fail to cancel POI request. Error[%s]\n", str);
-                       }
-                       else
-                               g_printf("location_cancel_poi_request, req_id %d\n", req_id);
-               }else if(0 == g_strcmp0("17", strOpt)) {
-                       g_printf("17.  location_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
-
-                       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();
-                       location_route_pref_set_route_type(pref, "FASTEST");
-
-                       ret = location_request_route(location_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);
-                       } else {
-                                       g_printf("Search Route successfully, req_id %d\n", req_id);
-                       }
-               }else if(0 == g_strcmp0("17a", strOpt)) {
-                       g_printf("17a.  location_cancel_route_request\n");
-
-                       int req_id;
-                       g_printf("Input ReqID : ");
-                       scanf("%d", &req_id);
-
-                       ret = location_cancel_route_request(location_obj, req_id);
-                       GetLocationError(str, ret);
-                       if (ret != LOCATION_ERROR_NONE) {
-                               g_printf("Fail to cancel route request. Error[%s]\n", str);
-                       }
-                       else {
-                               g_printf("location_cancel_route_request, req_id %d\n", req_id);
-                       }
-
-               }else if (0 == g_strcmp0 ("18", strOpt)) {
-                       int idx = 0;
-                       for (idx = 0; idx < MAP_SERVICE_TYPE_MAX; idx++) {
-                               g_printf("[%d:%d], ", idx, location_is_supported_map_provider_capability (location_obj, idx));
-                       }
-               }else if (0 == g_strcmp0 ("19", strOpt)) {
-                       int idx = 0;
-                       for (idx = 0; idx < MAP_SERVICE_TYPE_MAX; idx++) {
-                               g_printf("[%d:", idx);
-                               print_map_service_keys(location_obj, idx);
-                               g_printf("]\n");
-                       }
                }else if(0 == g_strcmp0("99", strOpt)) {
                        int ret = 0;
                        const *str = "command";
@@ -1578,7 +806,19 @@ int main(int argc, char** argv)
                        g_printf("Input interval[1~120]:");
                        scanf("%u", &interval);
                        g_printf("changed interval to [%u]\n", interval);
-                       g_object_set(location_obj, "update-interval", interval, NULL);
+                       g_object_set(location_obj, "pos-interval", interval, NULL);
+               } else if (0 == g_strcmp0("c7", strOpt)) {
+                       guint interval = 1;
+                       g_printf("Input interval[1~120]:");
+                       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)) {
+                       guint interval = 1;
+                       g_printf("Input interval[1~120]:");
+                       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) ){
                        g_main_loop_quit(g_mainloop);
                        break;
diff --git a/tests/map-service-test.c b/tests/map-service-test.c
new file mode 100644 (file)
index 0000000..da01238
--- /dev/null
@@ -0,0 +1,1057 @@
+/*
+ * libslp-location
+ *
+ * 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 <string.h>
+#include <glib/gprintf.h>
+#include <gconf/gconf-client.h>
+#include <location-map-service.h>
+#include "location-api-test-util.h"
+
+#define STR_MAX        128
+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_printf("\n...Entering GMain Loop to Receive Notifications....\n");
+       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)
+       {
+               case LOCATION_ERROR_NONE:
+                       g_utf8_strncpy(str, "LOCATION_ERROR_NONE", STR_MAX);
+                       break;
+               case LOCATION_ERROR_NOT_ALLOWED:
+                       g_utf8_strncpy(str, "LOCATION_ERROR_NOT_ALLOWED", STR_MAX);
+                       break;
+               case LOCATION_ERROR_NOT_AVAILABLE:
+                       g_utf8_strncpy(str, "LOCATION_ERROR_NOT_AVAILABLE", STR_MAX);
+                       break;
+               case LOCATION_ERROR_NETWORK_FAILED:
+                       g_utf8_strncpy(str, "LOCATION_ERROR_NETWORK_FAILED", STR_MAX);
+                       break;
+               case LOCATION_ERROR_NETWORK_NOT_CONNECTED:
+                       g_utf8_strncpy(str, "LOCATION_ERROR_NETWORK_NOT_CONNECTED", STR_MAX);
+                       break;
+               case LOCATION_ERROR_CONFIGURATION:
+                       g_utf8_strncpy(str, "LOCATION_ERROR_CONFIGURATION", STR_MAX);
+                       break;
+               case LOCATION_ERROR_PARAMETER:
+                       g_utf8_strncpy(str, "LOCATION_ERROR_PARAMETER", STR_MAX);
+                       break;
+               case LOCATION_ERROR_UNKNOWN:
+                       g_utf8_strncpy(str, "LOCATION_ERROR_UNKNOWN", STR_MAX);
+                       break;
+               case LOCATION_ERROR_NOT_SUPPORTED:
+                       g_utf8_strncpy(str, "LOCATION_ERROR_UNKNOWN", STR_MAX);
+                       break;
+               default:
+                       g_utf8_strncpy(str, "Error: undefined error code", STR_MAX);
+       }
+}
+
+static void GetAccuracyLevel(char str[STR_MAX], LocationAccuracyLevel acc_level)
+{
+       switch (acc_level) {
+               case LOCATION_ACCURACY_LEVEL_NONE:
+                       g_utf8_strncpy(str, "LOCATION_ACCURACY_LEVEL_NONE", STR_MAX);
+                       break;
+               case LOCATION_ACCURACY_LEVEL_COUNTRY:
+                       g_utf8_strncpy(str, "LOCATION_ACCURACY_LEVEL_COUNTRY", STR_MAX);
+                       break;
+               case LOCATION_ACCURACY_LEVEL_REGION:
+                       g_utf8_strncpy(str, "LOCATION_ACCURACY_LEVEL_REGION", STR_MAX);
+                       break;
+               case LOCATION_ACCURACY_LEVEL_LOCALITY:
+                       g_utf8_strncpy(str, "LOCATION_ACCURACY_LEVEL_LOCALITY", STR_MAX);
+                       break;
+               case LOCATION_ACCURACY_LEVEL_POSTALCODE:
+                       g_utf8_strncpy(str, "LOCATION_ACCURACY_LEVEL_POSTALCODE", STR_MAX);
+                       break;
+               case LOCATION_ACCURACY_LEVEL_STREET:
+                       g_utf8_strncpy(str, "LOCATION_ACCURACY_LEVEL_STREET", STR_MAX);
+                       break;
+               case LOCATION_ACCURACY_LEVEL_DETAILED:
+                       g_utf8_strncpy(str, "LOCATION_ACCURACY_LEVEL_DETAILED", STR_MAX);
+                       break;
+               default:
+                       g_utf8_strncpy(str, "Error: undefined accuracy level", STR_MAX);
+       }
+}
+
+static void SelectOpt(char* buf)
+{
+       int iLen = 0;
+       fgets(buf, 255, stdin);
+       iLen = g_utf8_strlen(buf, -1);
+       buf[iLen-1] = '\0';
+}
+
+static int PromptInt()
+{
+       char buf[255];
+       int ret;
+       fgets(buf, 255, stdin);
+       buf[strlen(buf)-1]='\0';
+       ret = g_ascii_strtoll(buf, NULL, 10);
+       return ret;
+}
+
+static double PromptDB()
+{
+       char buf[255];
+       double ret;
+       fgets(buf, 255, stdin);
+       buf[strlen(buf)-1]='\0';
+       ret = g_ascii_strtod(buf, NULL);
+       return ret;
+}
+
+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)
+{
+       LocationLandmark *landmark = (LocationLandmark *)user_data;
+       gpointer key = (gpointer)data;
+       gpointer value = NULL;
+
+       if (key) {
+               value = (gpointer)location_landmark_get_property(landmark, key);
+               g_printf(", [%s:%s]", (gchar*) key, (gchar*) value);
+       }
+}
+
+static void
+__plugin_print_poi_list (gpointer data, gpointer user_data)
+{
+       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);
+
+       GList *key_list = location_landmark_get_property_key(landmark);
+       if (key_list) {
+               g_list_foreach(key_list, _print_property, landmark);
+       }
+
+       g_printf("\n");
+}
+
+
+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) {
+               g_printf("Failed :%d\n", error);
+               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);
+
+       if (error_code && error_msg) {
+               g_printf("__location_POI_cb: error_code[%s], error_msg[%s]\n", error_code, error_msg);
+       }
+}
+static void PrintStepInfo(const LocationRouteStep *step)
+{
+       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 position 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);
+}
+
+static void cb_print_route_step (gpointer data, gpointer user_data)
+{
+       g_printf("+++Step begin\n");
+       LocationRouteStep *step = (LocationRouteStep *)data;
+
+       PrintStepInfo(step);
+       g_printf("---Step end\n");
+}
+
+static void cb_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 position 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, cb_print_route_step, NULL);
+       }
+       g_printf("--Segment end\n");
+}
+
+
+static void cb_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, cb_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)
+{
+       g_printf("\n===== cb_route ======\n");
+       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);
+
+       if (route_list)
+               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);
+       }
+}
+
+static void cb_address(LocationError error, LocationAddress *addr, LocationAccuracy *acc, gpointer userdata)
+{
+       if (error != LOCATION_ERROR_NONE) {
+               g_printf("cb_address failed: error=%d\n", error);
+               return;
+       }
+       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);
+       GetAccuracyLevel(str, acc->level);
+       g_printf("level: [%s], horizontal_accuracy: [%f], vertical_accuracy: [%f]\n", str, acc->horizontal_accuracy, acc->vertical_accuracy);
+}
+
+typedef struct {
+       LocationObject *obj;
+       LocationPosition *pos;
+       LocationAddress *addr;
+       gchar *str_addr;
+       LocationPositionCB pos_cb;
+       LocationAddressCB addr_cb;
+       gpointer user_data;
+} IdleData;
+
+static gboolean idle_address_from_position_async(gpointer data)
+{
+       IdleData* idle_data = (IdleData*)data;
+       char str[STR_MAX];
+       int ret = location_map_get_address_from_position_async(idle_data->obj, idle_data->pos, idle_data->addr_cb, idle_data->user_data);
+       GetLocationError(str, ret);
+       g_printf("location_map_get_address_from_position_async: returned value [%s]\n", str);
+       location_position_free(idle_data->pos);
+       g_free(idle_data);
+       return FALSE;
+}
+
+void _print_keys(gpointer value)
+{
+       g_printf(" %s ", (gchar*) value);
+}
+
+static void print_map_service_keys (LocationObject *obj, int type)
+{
+       GList *key = NULL;
+
+       location_map_get_provider_capability_key (obj, type, &key);
+
+       if (key) {
+               g_list_foreach (key, _print_keys, NULL);
+       }
+
+       g_list_free_full(key, g_free);
+}
+
+void _print_provider (gpointer data, gpointer user_data)
+{
+       gchar *provider = (gchar *)data;
+
+       g_printf("[%s] is supported\n", provider);
+}
+
+static void print_menu()
+{
+       g_printf("\n================================= Location API Test =================================\n");
+       g_printf("q.   Exit\n");
+       g_printf("1.   location_init\n");
+       g_printf("2.   location_map_new for default \n");
+       g_printf("2a.   location_map_new for decarta \n");
+       g_printf("2b.   location_map_new for osm \n");
+       g_printf("3.   location_map_free\n");
+       g_printf("4.   location_map_get_address_from_position\n");
+       g_printf("4a.  location_map_get_address_from_position_async\n");
+       g_printf("5.   location_map_search_poi_with_keyword\n");
+       g_printf("5a.  location_map_search_poi_with_category\n");
+       g_printf("5b.  location_map_search_poi_with_poi_name\n");
+       g_printf("6.   location_map_search_poi_by_area_with_keyword\n");
+       g_printf("6a.  location_map_search_poi_by_area_with_category\n");
+       g_printf("6b.  location_map_search_poi_by_area_with_poi_name\n");
+       g_printf("7.   location_map_search_poi_by_addr_with_keyword\n");
+       g_printf("7a.  location_map_search_poi_by_addr_with_category\n");
+       g_printf("7b.  location_map_search_poi_by_addr_with_poi_name\n");
+       g_printf("8.   location_map_search_poi_by_freeformed_address_with_keyword\n");
+       g_printf("8a.  location_map_search_poi_by_freeformed_address_with_category\n");
+       g_printf("8b.  location_map_search_poi_by_freeformed_address_with_poi_name\n");
+       g_printf("9.   location_map_cancel_poi_request\n");
+       g_printf("10.  location_map_request_route\n");
+       g_printf("10a. location_map_request_route for a long distance\n");
+       g_printf("11.  location_map_cancel_route_request\n");
+       g_printf("12.  location_map_is_supported_provider_capability\n");
+       g_printf("13.  location_map_get_provider_capability_key\n");
+       g_printf("14.  location_map_get_supported_providers \n");
+       g_printf("15.  location_map_get_default_provider \n");
+       g_printf("16.  location_map_set_provider \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("==================================== Property ====================================\n");
+       PrintProperty(map_obj);
+       g_printf("\n==================================================================================\n");
+}
+
+int main(int argc, char** argv)
+{
+       char strOpt[255];
+       int ret;
+       char str[STR_MAX];
+       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);
+
+       g_type_init();
+
+#if !GLIB_CHECK_VERSION (2, 31, 0)
+       if( !g_thread_supported() )
+       {
+               g_thread_init(NULL);
+       }
+#endif
+
+       GThread *g_main;
+       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);
+               g_error_free(gerr);
+               return 0;
+       }
+
+       g_printf("--- Start LBS Test App ---\n");
+       while(1)
+       {
+               print_menu();
+               g_printf("Select option: ");
+               SelectOpt(strOpt);
+               g_printf("======================================================================================\n");
+               if (0 == g_strcmp0 ("x", 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)) {
+                       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");
+                       else             g_printf("Failed\n");
+               } 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");
+                       else             g_printf("Failed\n");
+               } 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");
+                       else             g_printf("Failed\n");
+               } 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) ){
+                       LocationPosition *pos = NULL;
+                       LocationAddress *addr = NULL;
+                       LocationAccuracy *acc = NULL;
+                       g_printf("[0].San jose [1].Suwon HQ [*].Custom\n");
+                       g_printf("Select Position: ");
+                       int opt = PromptInt();
+                       if(opt == 0)      pos = location_position_new(0, 37.335276, -121.890059, 0, LOCATION_STATUS_2D_FIX);
+                       else if(opt == 1) pos = location_position_new(0, 37.257809, 127.056383, 0, LOCATION_STATUS_2D_FIX);
+                       else{
+                               g_printf("Input latitude: ");
+                               gdouble lat = PromptDB();
+                               g_printf("Input longitude: ");
+                               gdouble lon = PromptDB();
+                               pos = location_position_new(0, lat, lon, 0, LOCATION_STATUS_2D_FIX);
+                       }
+                       ret = location_map_get_address_from_position(map_obj, pos, &addr, &acc);
+                       GetLocationError(str, ret);
+                       g_printf("location_map_get_address_from_position: returned value [%s]\n", str);
+                       if(ret == LOCATION_ERROR_NONE){
+                               g_printf("building number: [%s], street: [%s], state: [%s], country code: [%s], city: [%s], district: [%s], postal code: [%s]\n",
+                                       addr->building_number, addr->street, addr->state, addr->country_code, addr->city, addr->district, addr->postal_code);
+                       }
+                       if(addr) location_address_free(addr);
+                       if(acc) location_accuracy_free(acc);
+               }else if(0 == g_strcmp0("4a",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);
+                       else if (opt == 1) data->pos = location_position_new(0, 37.257809, 127.056383, 0, LOCATION_STATUS_2D_FIX);
+                       else {
+                               g_printf("Input latitude: ");
+                               gdouble lat = PromptDB();
+                               g_printf("Input longitude: ");
+                               gdouble lon = PromptDB();
+                               data->pos = location_position_new(0, lat, lon, 0, LOCATION_STATUS_2D_FIX);
+                       }
+                       g_idle_add((GSourceFunc)idle_address_from_position_async, data);
+               }else if(0 == g_strcmp0("5", strOpt)) {
+                       g_printf("location_map_search_poi\n");
+
+                       LocationPOIFilter *filter = location_poi_filter_new();
+                       location_poi_filter_set(filter, "KEYWORD", "pizza");
+
+                       LocationPOIPreference *pref = location_poi_pref_new();
+                       location_poi_pref_set_max_result(pref, 2);
+                       location_poi_pref_set_sort_by(pref, "Distance");
+                       location_poi_pref_set_sort_order(pref, LOCATION_POI_PREF_SO_DESC);
+
+                       LocationPosition *position = location_position_new(0, 37.771008, -122.41175, 0, LOCATION_STATUS_2D_FIX);
+
+                       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);
+                       } else {
+                                       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("5a", strOpt)) {
+                       g_printf("location_map_search_poi_with_category\n");
+                       LocationPOIFilter *filter = location_poi_filter_new();
+                       location_poi_filter_set(filter, "CATEGORY", "restaurant");
+
+                       LocationPOIPreference *pref = location_poi_pref_new();
+                       location_poi_pref_set_max_result(pref, 5);
+                       location_poi_pref_set_sort_by(pref, "Distance");
+                       location_poi_pref_set_sort_order(pref, LOCATION_POI_PREF_SO_ASC);
+
+                       LocationPosition *position = location_position_new(0, 37.771008, -122.41175, 0, LOCATION_STATUS_2D_FIX);
+
+                       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);
+                       } else {
+                                       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_pref_free(pref);
+                       location_position_free(position);
+
+               }else if(0 == g_strcmp0("5b", strOpt)) {
+                       g_printf("location_map_search_poi_with_poi_name\n");
+
+                       LocationPOIFilter *filter = location_poi_filter_new();
+                       location_poi_filter_set(filter, "POIName", "cafe");
+
+                       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.771008, -122.41175, 0, LOCATION_STATUS_2D_FIX);
+
+                       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);
+                       } else {
+                                       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("6", strOpt)) {
+                       g_printf("location_map_search_poi_by_area_with_keyword\n");
+
+                       // 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
+
+                       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
+
+
+                       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);
+                       } else {
+                                       g_printf("Seach POI by area sucess, req_id %d\n", req_id);
+                       }
+
+                       g_free(key);
+                       g_free(value);
+                       g_free(item);
+                       location_position_free(center);
+                       location_boundary_free(bound);
+                       location_poi_filter_free(filter);
+                       location_poi_pref_free(pref);
+               }else if(0 == g_strcmp0("6a", strOpt)) {
+                       g_printf("location_map_search_poi_by_area_with_category\n");
+
+                       // 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("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, 5);
+                       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_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);
+                       } else {
+                                       g_printf("Seach POI by area sucess, req_id %d\n", req_id);
+                       }
+
+                       g_free(key);
+                       g_free(value);
+                       g_free(item);
+                       location_position_free(center);
+                       location_boundary_free(bound);
+                       location_poi_filter_free(filter);
+                       location_poi_pref_free(pref);
+
+               }else if(0 == g_strcmp0("6b", strOpt)) {
+                       g_printf("location_map_search_poi_by_area_with_poi_name\n");
+                       
+                       // 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
+
+                       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
+
+
+                       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);
+                       } else {
+                                       g_printf("Seach POI by area sucess, req_id %d\n", req_id);
+                       }
+
+                       g_free(key);
+                       g_free(value);
+                       g_free(item);
+                       location_position_free(center);
+                       location_boundary_free(bound);
+                       location_poi_filter_free(filter);
+                       location_poi_pref_free(pref);
+
+               }else if(0 == g_strcmp0("7", 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");
+
+                       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_ASC);
+
+                       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);
+                       } else {
+                                       g_printf("Seach POI by address sucess, req_id %d\n", req_id);
+                       }
+
+                       g_free(key);
+                       g_free(value);
+                       g_free(item);
+
+                       location_address_free(addr);
+                       location_poi_filter_free(filter);
+                       location_poi_pref_free(pref);
+               }else if(0 == g_strcmp0("7a", 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");
+
+                       LocationPOIFilter *filter = location_poi_filter_new();
+                       location_poi_filter_set(filter, "CATEGORY", "restaurant");
+
+                       LocationPOIPreference *pref = location_poi_pref_new();
+                       location_poi_pref_set_max_result(pref, 10);
+                       location_poi_pref_set_sort_by(pref, "Distance");
+                       location_poi_pref_set_sort_order(pref, LOCATION_POI_PREF_SO_ASC);
+
+                       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);
+                       } else {
+                                       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("7b", 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");
+
+                       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, 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_ASC);
+
+                       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);
+                       } else {
+                                       g_printf("Seach POI by address sucess, req_id %d\n", req_id);
+                       }
+
+                       g_free(key);
+                       g_free(value);
+                       g_free(item);
+
+                       location_address_free(addr);
+                       location_poi_filter_free(filter);
+                       location_poi_pref_free(pref);
+
+               }else if(0 == g_strcmp0("8", strOpt)) {
+                       g_printf("location_map_search_poi_by_freeformed_address_with_keyword\n");
+
+                       gchar *addr = g_strdup("North Second St.");
+
+                       LocationPOIFilter *filter = location_poi_filter_new();
+                       location_poi_filter_set(filter, "KEYWORD", "station");
+
+                       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
+
+                       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);
+                       } else {
+                                       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("8a", strOpt)) {
+                       g_printf("location_map_search_poi_by_freeformed_address_with_category\n");
+               
+                       gchar *addr = g_strdup("North Second St.");
+
+                       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_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);
+                       } else {
+                                       g_printf("Seach POI by address success, req_id %d\n", req_id);
+               }
+
+                       g_free(key);
+                       g_free(value);
+                       g_free(item);
+
+                       g_free(addr);
+                       location_poi_filter_free(filter);
+                       location_poi_pref_free(pref);
+               }else if(0 == g_strcmp0("8b", strOpt)) {
+                       g_printf("location_map_search_poi_by_freeformed_address_with_poi_name\n");
+
+                       gchar *addr = g_strdup("North Second St.");
+
+                       LocationPOIFilter *filter = location_poi_filter_new();
+                       location_poi_filter_set(filter, "POIName", "pizza");
+
+                       LocationPOIPreference *pref = location_poi_pref_new();
+                       location_poi_pref_set_max_result(pref, 10);
+                       location_poi_pref_set_sort_by(pref, "Distance");
+                       location_poi_pref_set_sort_order(pref, 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);
+                       } else {
+                                       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("9", strOpt)) {
+                       int req_id;
+
+                       g_printf("Input ReqID : ");
+                       scanf("%d", &req_id);
+
+                       ret = location_map_cancel_poi_request(map_obj, req_id);
+                       GetLocationError(str, ret);
+                       if (ret != LOCATION_ERROR_NONE) {
+                               g_printf("Fail to cancel POI request. Error[%s]\n", str);
+                       }
+                       else
+                               g_printf("location_map_cancel_poi_request, req_id %d\n", req_id);
+               }else if(0 == g_strcmp0("10", 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
+
+                       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();
+                       location_route_pref_set_route_type(pref, "FASTEST");
+
+                       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);
+                       } else {
+                                       g_printf("Search Route successfully, req_id %d\n", req_id);
+                       }
+               }else if(0 == g_strcmp0("10a", 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);
+
+                       GList *waypoint = NULL;
+
+                       LocationRoutePreference *pref = location_route_pref_new();
+                       location_route_pref_set_route_type(pref, "FASTEST");
+
+                       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);
+                       } else {
+                                       g_printf("Search Route successfully, req_id %d\n", req_id);
+                       }
+
+
+               }else if(0 == g_strcmp0("11", strOpt)) {
+                       g_printf("location_map_cancel_route_request\n");
+
+                       int req_id;
+                       g_printf("Input ReqID : ");
+                       scanf("%d", &req_id);
+
+                       ret = location_map_cancel_route_request(map_obj, req_id);
+                       GetLocationError(str, ret);
+                       if (ret != LOCATION_ERROR_NONE) {
+                               g_printf("Fail to cancel route request. Error[%s]\n", str);
+                       }
+                       else {
+                               g_printf("location_map_cancel_route_request, req_id %d\n", req_id);
+                       }
+
+               }else if (0 == g_strcmp0 ("12", 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));
+                       }
+               }else if (0 == g_strcmp0 ("13", 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 ("14", 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_printf("Fail to get supported_providers\n");
+                       }
+               }else if (0 == g_strcmp0 ("15", 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_printf("Fail to get default provider\n");
+                       }
+               }else if (0 == g_strcmp0 ("16", strOpt)) {
+                       g_printf("[0].default [1].decarta [2].osm\n");
+                       g_printf("Select provider: ");
+                       int opt = PromptInt();
+                       gboolean ret = FALSE;
+                       switch (opt)
+                       {
+                               case 0:
+                                       ret = location_map_set_provider (map_obj, NULL);
+                                       break;
+                               case 1:
+                                       ret = location_map_set_provider (map_obj, "decarta");
+                                       break;
+                               case 2:
+                                       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);
+                       }
+               }else if (0 == g_strcmp0 ("99", strOpt)) {
+                       if (map_obj) {
+                               g_object_set (map_obj, "provider", NULL, NULL);
+                       }
+               }else if (0 == g_strcmp0 ("99a", strOpt)) {
+                       if (map_obj) {
+                               g_object_set (map_obj, "provider", "decarta", NULL);
+                       }
+               }else if (0 == g_strcmp0 ("99b", strOpt)) {
+                       if (map_obj) {
+                               g_object_set (map_obj, "provider", "osm",  NULL);
+                       }
+               }else if(0 == g_strcmp0("q",strOpt) ){
+                       g_main_loop_quit(g_mainloop);
+                       break;
+               }
+       }
+       g_thread_join(g_main);
+       g_printf("\n--- Exit LBS Test App ---\n");
+       return 1;
+}
diff --git a/tests/sps-test.c b/tests/sps-test.c
deleted file mode 100644 (file)
index a426aad..0000000
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- * libslp-location
- *
- * 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.h>
-
-static GMainLoop *loop = NULL;
-
-static void
-update_gps(LocationObject* loc)
-{
-       g_debug("update gps");
-       double ran = g_random_double()/200;
-       LocationPosition* pos = location_position_new (time(NULL), 37.257809 + ran, 127.056383 + ran, 150.199997 + ran, LOCATION_STATUS_3D_FIX);
-       g_object_set(loc, "position-base", pos, NULL);
-       location_position_free (pos);
-
-       LocationVelocity* vel = location_velocity_new (pos->timestamp, 0, 0, 0);
-       g_object_set(loc, "velocity-base", vel, NULL);
-       location_velocity_free (vel);
-
-       LocationAccuracy* acc = location_accuracy_new (LOCATION_ACCURACY_LEVEL_DETAILED, 0, 0);
-       g_object_set(loc, "accuracy-info", acc, NULL);
-       location_accuracy_free (acc);
-
-       LocationSatellite* sat = location_satellite_new (9);
-       location_satellite_set_satellite_details(sat, 0, 5, 1, 0, 0, 41);
-       location_satellite_set_satellite_details(sat, 1, 9, 1, 0, 0, 46);
-       location_satellite_set_satellite_details(sat, 2, 15, 1, 0, 0, 45);
-       location_satellite_set_satellite_details(sat, 3, 18, 1, 0, 0, 41);
-       location_satellite_set_satellite_details(sat, 4, 21, 1, 0, 0, 34);
-       location_satellite_set_satellite_details(sat, 5, 22, 0, 0, 0, 41);
-       location_satellite_set_satellite_details(sat, 6, 26, 0, 0, 0, 46);
-       location_satellite_set_satellite_details(sat, 7, 27, 0, 0, 0, 31);
-       location_satellite_set_satellite_details(sat, 8, 28, 0, 0, 0, 33);
-       g_object_set(loc, "satellite-info", sat, NULL);
-       location_satellite_free (sat);
-}
-
-static gboolean
-update_timer(gpointer data)
-{
-       update_gps(data);
-       return TRUE;
-}
-
-static void
-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;
-       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;
-       }
-}
-
-static void
-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;
-       LocationAccuracy *acc = NULL;
-       LocationPosition *pos = NULL;
-       LocationVelocity *vel = NULL;
-       LocationAddress *addr = 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);
-               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);
-               location_velocity_free(vel);
-               location_accuracy_free(acc);
-       } else g_warning ("SYNC>> Current velocity> failed");
-       if (LOCATION_ERROR_NONE == location_get_address(loc, &addr, &acc)) {
-               g_debug ("SYNC>> Current address> %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>> Current address> failed");
-}
-
-static void
-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,
-       guint type,
-       gpointer position,
-       gpointer accuracy)
-{
-       g_debug("cb_zone_in: type(%d)", type);
-       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);
-}
-
-static void
-cb_zone_out (GObject *self,
-       guint type,
-       gpointer position,
-       gpointer accuracy)
-{
-       g_debug("cb_zone_out: type(%d)", type);
-       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);
-}
-
-
-int
-main (int argc, char *argv[])
-{
-       LocationObject *loc = NULL;
-
-       // If application is executed by AUL, this is not needed.
-       g_setenv("PKG_NAME", "com.samsung.sps-test", 1);
-
-       location_init ();
-
-       loop = g_main_loop_new (NULL, TRUE);
-
-       loc  = location_new (LOCATION_METHOD_SPS);
-       if (!loc) {
-               g_debug("location_new failed");
-               return -1;
-       }
-
-       LocationMethod method = LOCATION_METHOD_NONE;
-       g_object_get(loc, "method", &method, NULL);
-       g_debug("Get property>> method:%d", method);
-
-       LocationBoundary *bound = NULL;
-       g_object_get(loc, "boundary", &bound, NULL);
-       if (bound) {
-               g_debug("Get property>> boundary> type: %d", bound->type);
-               location_boundary_free (bound);
-       } else g_warning("failed to get property> boundary");
-
-       LocationPosition *rb = location_position_new(0, 37.255, 127.060, 0, LOCATION_STATUS_2D_FIX);
-       LocationPosition *lt = location_position_new(0, 37.260, 127.055, 0, LOCATION_STATUS_2D_FIX);
-       bound = location_boundary_new_for_rect(lt, rb);
-       location_position_free (rb);
-       location_position_free (lt);
-       if (bound) {
-               g_object_set(loc, "boundary", bound, NULL);
-               location_boundary_free(bound);
-       } 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");
-
-       update_gps(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) ){
-               g_debug("location_start failed");
-               return -1;
-       }
-
-       g_timeout_add_seconds(1, update_timer, loc);
-       g_main_loop_run (loop);
-
-       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);
-               location_position_free(pos);
-       } else  g_warning("failed to get property> last-position");
-
-       location_free (loc);
-
-       return 0;
-}
index bd49060..1bd753e 100644 (file)
@@ -68,7 +68,6 @@ cb_service_enabled (GObject *self,
        LocationAccuracy *acc = NULL;
        LocationPosition *pos = NULL;
        LocationVelocity *vel = NULL;
-       LocationAddress *addr = 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",
@@ -86,13 +85,6 @@ cb_service_enabled (GObject *self,
                location_velocity_free(vel);
                location_accuracy_free(acc);
        } else g_warning ("SYNC>> Current velocity> failed");
-       if (LOCATION_ERROR_NONE == location_get_address(loc, &addr, &acc)) {
-               g_debug ("SYNC>> Current address> %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>> Current address> failed");
 }
 
 static void