tizen beta release
authorKibum Kim <kb0929.kim@samsung.com>
Mon, 27 Feb 2012 04:34:13 +0000 (13:34 +0900)
committerKibum Kim <kb0929.kim@samsung.com>
Mon, 27 Feb 2012 04:34:13 +0000 (13:34 +0900)
49 files changed:
TC/tet_scen
TC/unit/Makefile
TC/unit/stc_gps_satellite.c
TC/unit/stc_gps_zone.c
TC/unit/tslist
TC/unit/utc_location_get_address.c
TC/unit/utc_location_get_address_from_position.c
TC/unit/utc_location_get_last_known_position.c [new file with mode: 0644]
TC/unit/utc_location_get_last_position.c [new file with mode: 0644]
TC/unit/utc_location_get_last_satellite.c [new file with mode: 0644]
TC/unit/utc_location_get_last_velocity.c [new file with mode: 0644]
TC/unit/utc_location_get_position_from_address.c
TC/unit/utc_location_get_position_from_freeformed_address.c
TC/unit/utc_location_get_satellite.c [new file with mode: 0644]
TC/unit/utc_properties_boundary.c
TC/unit/utc_signals_zone_in.c
TC/unit/utc_signals_zone_out.c
debian/changelog
debian/libslp-location.postinst
location/location-accuracy.h
location/location-address.h
location/location-boundary.h
location/location-common-util.c
location/location-common-util.h
location/location-geocode.c
location/location-gps.c
location/location-hybrid.c
location/location-ielement.c
location/location-ielement.h
location/location-module-internal.h
location/location-module.h
location/location-position.h
location/location-satellite.h
location/location-setting.c
location/location-setting.h
location/location-signaling-util.c
location/location-sps.c
location/location-types.h
location/location-wps.c
location/location.c
location/location.h
tests/address-sample.c
tests/cps-test.c
tests/gps-test.c
tests/hybrid-test.c
tests/ips-test.c
tests/location-api-test.c
tests/sps-test.c
tests/wps-test.c

index 305a021..f036f23 100644 (file)
@@ -1,29 +1,32 @@
 # auto generated tet_scen
 all
        "Starting Full Test Suite"
-       /unit/utc_location_init
-    /unit/utc_location_new
-    /unit/utc_location_free
-    /unit/utc_location_start
-    /unit/utc_location_stop
-       /unit/utc_location_get_position
-    /unit/utc_location_get_velocity
+       /unit/stc_gps_nmea
+       /unit/stc_gps_position
+       /unit/stc_gps_satellite
+       /unit/stc_gps_velocity
+       /unit/stc_gps_zone
+       /unit/utc_location_free
        /unit/utc_location_get_address
-    /unit/utc_location_get_address_from_position
-    /unit/utc_location_get_position_from_address
-    /unit/utc_location_get_position_from_freeformed_address
-    /unit/utc_signals_service_disabled
-    /unit/utc_signals_service_enabled
-    /unit/utc_signals_service_updated
-    /unit/utc_signals_zone_in
+       /unit/utc_location_get_last_known_position
+       /unit/utc_location_get_address_from_position
+       /unit/utc_location_get_position_from_address
+       /unit/utc_location_get_position_from_freeformed_address
+       /unit/utc_location_get_position
+       /unit/utc_location_get_last_position
+       /unit/utc_location_get_velocity
+       /unit/utc_location_get_last_velocity
+       /unit/utc_location_get_satellite
+       /unit/utc_location_get_last_satellite
+       /unit/utc_location_init
+       /unit/utc_location_new
+       /unit/utc_location_start
+       /unit/utc_location_stop
+       /unit/utc_properties_method
+       /unit/utc_signals_service_disabled
+       /unit/utc_signals_service_enabled
+       /unit/utc_signals_service_updated
+       /unit/utc_signals_zone_in
        /unit/utc_signals_zone_out
-    /unit/utc_properties_method
-    /unit/utc_properties_boundary
-    /unit/utc_properties_last_position
-    /unit/stc_gps_position
-    /unit/stc_gps_velocity
-    /unit/stc_gps_satellite
-       /unit/stc_gps_nmea
-    /unit/stc_gps_zone
        "Completed Full Test Suite"
 # EOF
index 58743b6..2a33f95 100644 (file)
@@ -5,52 +5,67 @@
 # TC1 = utc_frameworkName_apiName_func
 # TC2 = utc_ApplicationLib_recurGetDayOfWeek_func
 TC1 = stc_gps_position
-TC2 = stc_gps_velocity 
-TC3 = stc_gps_satellite 
-TC4 = stc_gps_nmea 
-TC5 = stc_gps_zone  
+TC2 = stc_gps_velocity
+TC3 = stc_gps_satellite
+TC4 = stc_gps_nmea
+TC5 = stc_gps_zone
 TC6 = utc_location_init
 TC7 = utc_location_new
-TC8 = utc_location_start 
-TC9 = utc_location_stop 
-TC10 = utc_location_free 
-TC11 = utc_location_get_position 
-TC12 = utc_location_get_velocity         
-TC13 = utc_properties_last_position 
-TC14 = utc_properties_method 
-TC16 = utc_properties_boundary 
-TC17 = utc_signals_service_disabled 
-TC18 = utc_signals_service_enabled 
-TC19 = utc_signals_service_updated 
-TC20 = utc_signals_zone_in
-TC21 = utc_signals_zone_out
-TC22 = utc_location_get_address
-TC23 = utc_location_get_address_from_position
-TC24 = utc_location_get_position_from_address
-TC25 = utc_location_get_position_from_freeformed_address
+TC8 = utc_location_start
+TC9 = utc_location_stop
+TC10 = utc_location_free
+TC11 = utc_location_get_position
+TC12 = utc_location_get_last_position
+TC13 = utc_location_get_last_known_position
+TC14 = utc_location_get_velocity
+TC15 = utc_location_get_last_velocity
+TC16 = utc_location_get_satellite
+TC17 = utc_location_get_last_satellite
+TC18 = utc_properties_method
+TC19 = utc_signals_service_disabled
+TC20 = utc_signals_service_enabled
+TC21 = utc_signals_service_updated
+TC22 = utc_signals_zone_in
+TC23 = utc_signals_zone_out
+TC24 = utc_location_get_address
+TC25 = utc_location_get_address_from_position
+TC26 = utc_location_get_position_from_address
+TC27 = utc_location_get_position_from_freeformed_address
 
 #
 # add your Package Config Info Here
 #
 # e.g.,
 # PKGS=calendar
-PKGS= location gconf-2.0
+PKGS= gconf-2.0 network vconf location
 
-LDLIBS = `pkg-config --libs $(PKGS)` 
-LDLIBS +=$(TET_ROOT)/lib/tet3/tcm_s.o
-LDLIBS +=-L$(TET_ROOT)/lib/tet3 -ltcm_s
-LDLIBS +=-L$(TET_ROOT)/lib/tet3 -lapi_s
+LDLIBS = $(TET_ROOT)/lib/tet3/tcm_s.o
+LDLIBS += -L$(TET_ROOT)/lib/tet3 -ltcm_s
+LDLIBS += -L$(TET_ROOT)/lib/tet3 -lapi_s
+LDLIBS += `pkg-config --libs $(PKGS)`
+
+TTLIBS = $(TET_ROOT)/lib/tet3/tcm_s.o
+TTLIBS += -L$(TET_ROOT)/lib/tet3 -ltcm_s
+TTLIBS += -L$(TET_ROOT)/lib/tet3 -lapi_s
+TTLIBS += `pkg-config --libs $(PKGS)`
 
 CC = gcc
-INCS  =  -I. `pkg-config --cflags $(PKGS)`
-INCS  += -I$(TET_ROOT)/inc/tet3 
-CFLAGS = $(INCS)
-CFLAGS += -Wall -D_TETWARE_MODE
+INCS  = -I$(TET_ROOT)/inc/tet3
+INCS  +=  -I.`pkg-config --cflags $(PKGS)`
+CFLAGS = -Wall -D_TETWARE_MODE
+CFLAGS += $(INCS)
 
 ###################################################
-# Modify here 
+# Modify here
 # depending on the Test Case you want to build
-# 
+#
 # e.g.,
-# 
-TCLIST = $(TC1) $(TC2) $(TC3) $(TC4) $(TC5) $(TC6) $(TC7) $(TC8) $(TC9) $(TC10) $(TC11) $(TC12) $(TC13) $(TC14) $(TC16) $(TC17) $(TC18) $(TC19) $(TC20) $(TC21) $(TC22) $(TC23) $(TC24) $(TC25)
+#
+TCLIST = $(TC1) $(TC2) $(TC3) $(TC4) $(TC5) $(TC6) $(TC7) $(TC8) $(TC9) $(TC10) $(TC11) $(TC12) $(TC13) $(TC14) $(TC16) $(TC17) $(TC18) $(TC19) $(TC20) $(TC21) $(TC22) $(TC23) $(TC24) $(TC25) $(TC26) $(TC27)
+
+all: $(TCLIST)
+       $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
+
+clean:
+       rm -f $(TCLIST)
+       rm -f *.o
index 86c6240..780d5b3 100644 (file)
@@ -123,8 +123,10 @@ _get_satellite (GObject *self,
                     gpointer userdata)
 {
        LocationSatellite *sat = NULL;
-       g_object_get (loc, "satellite", &sat, NULL);
-       if (sat) {
+       int ret = 0;
+
+       ret = location_get_satellite (loc, &sat);
+       if (ret == LOCATION_ERROR_NONE) {
                tet_result(TET_PASS);
                location_satellite_free (sat);
        } else tet_result(TET_FAIL);
index 3cfbb85..11d8150 100644 (file)
@@ -23,6 +23,8 @@
 #include <glib.h>
 #include <location.h>
 
+static gboolean g_is_found = FALSE;
+
 static void startup(), cleanup();
 void (*tet_startup) () = startup;
 void (*tet_cleanup) () = cleanup;
@@ -66,6 +68,27 @@ static GMainLoop *loop = NULL;
 int ret;
 LocationObject* loc;
 
+static void comp_boundary(LocationBoundary *bound, gpointer user_data)
+{
+       LocationBoundary *check_bound = (LocationBoundary *) user_data;
+
+       if(bound && bound->type == check_bound->type) {
+               switch(bound->type) {
+                       case LOCATION_BOUNDARY_RECT:
+                               if(bound->rect.right_bottom->latitude == check_bound->rect.right_bottom->latitude &&
+                                       bound->rect.right_bottom->longitude == check_bound->rect.right_bottom->longitude &&
+                                       bound->rect.left_top->latitude == check_bound->rect.left_top->latitude &&
+                                       bound->rect.left_top->longitude == check_bound->rect.left_top->longitude ){
+                                               g_is_found = TRUE;
+                                       }
+                                               break;
+                       default:
+                               break;
+               }
+       }
+}
+
+
 static gboolean
 exit_loop (gpointer data)
 {
@@ -154,35 +177,34 @@ utc_location_svc_enabled()
 static void
 utc_set_boundary_in_suwonHQ()
 {
+       int ret = 0;
        LocationPosition *rb = location_position_new(0, 37.253, 127.058, 0, LOCATION_STATUS_2D_FIX);
        LocationPosition *lt = location_position_new(0, 37.261, 127.052, 0, LOCATION_STATUS_2D_FIX);
        LocationBoundary *bound = location_boundary_new_for_rect(lt, rb);
        location_position_free (rb);
        location_position_free (lt);
-       g_object_set(loc, "boundary", bound, NULL);     
-       if (loc) {              
-               tet_result(TET_PASS);
-               location_boundary_free (bound);
-       } else tet_result(TET_FAIL);
+       ret = location_boundary_add(loc, bound);
+       if (!ret) tet_result(TET_PASS);
+       else tet_result(TET_FAIL);
+
+       location_boundary_free (bound);
 }
 
 static void
 utc_get_boundary_in_suwonHQ()
 {
-       LocationBoundary* bound = NULL; 
-       
-       g_object_get(loc, "boundary", &bound, NULL);
-       if ( bound && 
-               bound->type ==LOCATION_BOUNDARY_RECT &&
-               bound->rect.right_bottom->latitude == 37.253 &&
-               bound->rect.right_bottom->longitude == 127.058 &&
-               bound->rect.left_top->latitude == 37.261 &&
-               bound->rect.left_top->longitude == 127.052 ){           
-               tet_result(TET_PASS);
-               location_boundary_free (bound);
-       }
-       else
-               tet_result(TET_FAIL);
+       LocationPosition *rb = location_position_new(0, 37.253, 127.058, 0, LOCATION_STATUS_2D_FIX);
+       LocationPosition *lt = location_position_new(0, 37.261, 127.052, 0, LOCATION_STATUS_2D_FIX);
+       LocationBoundary *bound = location_boundary_new_for_rect(lt, rb);
+       location_position_free (rb);
+       location_position_free (lt);
+
+       g_is_found = FALSE;
+       location_boundary_foreach(loc, comp_boundary, bound);
+       if(g_is_found) tet_result(TET_PASS);
+       else tet_result(TET_FAIL);
+
+       location_boundary_free (bound);
 }
 
 static void
@@ -211,35 +233,35 @@ utc_zone_in()
 static void
 utc_set_boundary_in_Santorini()
 {
+       int ret = 0;
        LocationPosition *rb = location_position_new(0, 36.395, 25.41, 0, LOCATION_STATUS_2D_FIX);
        LocationPosition *lt = location_position_new(0, 36.413, 25.388, 0, LOCATION_STATUS_2D_FIX);
        LocationBoundary* bound = location_boundary_new_for_rect(lt, rb);
        location_position_free (rb);
        location_position_free (lt);
-       g_object_set(loc, "boundary", bound, NULL);             
 
-       if (loc) {
-               tet_result(TET_PASS);
-               location_boundary_free (bound);
-       } else tet_result(TET_FAIL);
+       ret = location_boundary_add(loc, bound);
+       if (!ret) tet_result(TET_PASS);
+       else tet_result(TET_FAIL);
+
+       location_boundary_free (bound);
 }
 
 static void
 utc_get_boundary_in_Santorini()
 {
-       LocationBoundary* bound = NULL; 
-       g_object_get(loc, "boundary", &bound, NULL);
-
-       if ( bound && 
-               bound->type ==LOCATION_BOUNDARY_RECT &&
-               bound->rect.right_bottom->latitude == 36.395 &&
-               bound->rect.right_bottom->longitude == 25.41 &&
-               bound->rect.left_top->latitude == 36.413 &&
-               bound->rect.left_top->longitude == 25.388 ){
-               tet_result(TET_PASS);
-               location_boundary_free (bound);
-       } else tet_result(TET_FAIL);            
-               
+       LocationPosition *rb = location_position_new(0, 36.395, 25.41, 0, LOCATION_STATUS_2D_FIX);
+       LocationPosition *lt = location_position_new(0, 36.413, 25.388, 0, LOCATION_STATUS_2D_FIX);
+       LocationBoundary* bound = location_boundary_new_for_rect(lt, rb);
+       location_position_free (rb);
+       location_position_free (lt);
+
+       g_is_found = FALSE;
+       location_boundary_foreach(loc, comp_boundary, bound);
+       if(g_is_found) tet_result(TET_PASS);
+       else tet_result(TET_FAIL);
+
+       location_boundary_free (bound);
 }
 
 static void
index 7d73612..e4a997f 100644 (file)
@@ -5,17 +5,20 @@ stc_gps_velocity
 stc_gps_zone
 utc_location_free
 utc_location_get_address
+utc_location_get_last_known_position
 utc_location_get_address_from_position
 utc_location_get_position_from_address
 utc_location_get_position_from_freeformed_address
 utc_location_get_position
+utc_location_get_last_position
 utc_location_get_velocity
+utc_location_get_last_velocity
+utc_location_get_satellite
+utc_location_get_last_satellite
 utc_location_init
 utc_location_new
 utc_location_start
 utc_location_stop
-utc_properties_boundary
-utc_properties_last_position
 utc_properties_method
 utc_signals_service_disabled
 utc_signals_service_enabled
index 3561da4..b069288 100644 (file)
@@ -21,7 +21,6 @@
 
 #include <tet_api.h>
 #include <glib.h>
-#include <gconf/gconf-client.h>
 #include <location.h>
 
 static void startup(), cleanup();
@@ -44,18 +43,6 @@ LocationObject* loc = NULL;
 int ret = LOCATION_ERROR_NONE;
 int isNetStarted = 0;
 
-#define GCONF_PROXY_MODE            "/system/proxy/mode"
-#define GCONF_HTTP_PROXY_HOST       "/system/http_proxy/host"
-#define GCONF_HTTP_PROXY_PORT       "/system/http_proxy/port"
-#define ENV_HTTP_PROXY              "http_proxy"
-
-static gboolean
-exit_loop (gpointer data)
-{
-       g_main_loop_quit (loop);
-       return FALSE;
-}
-
 static gboolean
 exit_loop_fail (gpointer data)
 {
@@ -65,18 +52,17 @@ exit_loop_fail (gpointer data)
 }
 
 static void startup()
-{      
+{
        location_init();
        loc = location_new(LOCATION_METHOD_GPS);
 
        loop = g_main_loop_new(NULL,FALSE);
-       g_main_loop_run (loop);
-       
-       tet_printf("\n TC startup");    
+
+       tet_printf("\n TC startup");
 }
 
 static void cleanup()
-{      
+{
        location_stop(loc);
        location_free(loc);
        tet_printf("\n TC End");
@@ -103,14 +89,14 @@ _get_address (GObject *self,
 
 static void
 utc_location_get_address_01()
-{              
+{
        g_signal_connect (loc, "service-enabled", G_CALLBACK(_get_address), loc);
        location_start(loc);
-       g_timeout_add_seconds(60, exit_loop_fail, NULL);
+       g_timeout_add_seconds(60, exit_loop_fail, loop);
        g_main_loop_run (loop); 
 }
 
-       static void
+static void
 utc_location_get_address_02()
 {
        LocationAccuracy *acc = NULL;
@@ -122,7 +108,7 @@ utc_location_get_address_02()
        else tet_result(TET_FAIL);
 }
 
-       static void
+static void
 utc_location_get_address_03()
 {
        LocationAccuracy *acc = NULL;
index fc52ece..cb16f38 100644 (file)
@@ -21,7 +21,6 @@
 
 #include <tet_api.h>
 #include <glib.h>
-#include <gconf/gconf-client.h>
 #include <location.h>
 
 static void startup(), cleanup();
@@ -45,11 +44,7 @@ static GMainLoop *loop = NULL;
 LocationObject* loc;
 int ret;
 int isNetStarted = 0;
-
-#define GCONF_PROXY_MODE            "/system/proxy/mode"
-#define GCONF_HTTP_PROXY_HOST       "/system/http_proxy/host"
-#define GCONF_HTTP_PROXY_PORT       "/system/http_proxy/port"
-#define ENV_HTTP_PROXY              "http_proxy"
+int g_state = 0;
 
 static gboolean
 exit_loop (gpointer data)
@@ -59,36 +54,34 @@ exit_loop (gpointer data)
 }
 
 static void startup()
-{      
+{
        location_init();
        loc = location_new(LOCATION_METHOD_GPS);
 
-       loop = g_main_loop_new(NULL,FALSE);             
-       g_main_loop_run (loop);
-
-       tet_printf("\n TC startup");    
+       loop = g_main_loop_new(NULL,FALSE);
+       tet_printf("\n TC startup");
 }
 
 static void cleanup()
-{      
+{
        location_free(loc);
        tet_printf("\n TC End");
 }
 
 static void
 utc_location_get_address_from_position_01()
-{      
+{
        LocationPosition *pos = location_position_new(0, 37.257809, 127.056383, 0, LOCATION_STATUS_2D_FIX);
        LocationAccuracy *acc = NULL;
        LocationAddress *addr = NULL;
        ret = location_get_address_from_position(loc, pos, &addr, &acc);
        location_position_free(pos);
-       tet_printf("Returned value: %d", ret);  
+       tet_printf("Returned value: %d", ret);
        if (ret == LOCATION_ERROR_NONE ||
                ret == LOCATION_ERROR_CONFIGURATION) {
                location_address_free(addr);
                location_accuracy_free(acc);
-               tet_result(TET_PASS);           
+               tet_result(TET_PASS);
        } else tet_result(TET_FAIL);
 }
 
@@ -98,7 +91,7 @@ utc_location_get_address_from_position_02()
        LocationPosition *pos = location_position_new(0, 37.257809, 127.056383, 0, LOCATION_STATUS_2D_FIX);
        LocationAccuracy *acc = NULL;
        LocationAddress *addr = NULL;
-       
+
        ret = location_get_address_from_position(NULL, pos, &addr, &acc);
        location_position_free(pos);
        location_address_free(addr);
diff --git a/TC/unit/utc_location_get_last_known_position.c b/TC/unit/utc_location_get_last_known_position.c
new file mode 100644 (file)
index 0000000..ae1fda3
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * 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 <tet_api.h>
+#include <glib.h>
+#include <location.h>
+
+static void startup(), cleanup();
+void (*tet_startup) () = startup;
+void (*tet_cleanup) () = cleanup;
+
+static void utc_location_get_last_known_position_01();
+static void utc_location_get_last_known_position_02();
+
+struct tet_testlist tet_testlist[] = {
+       {utc_location_get_last_known_position_01,1},
+       {utc_location_get_last_known_position_02,2},
+       {NULL,0},
+};
+
+int ret;
+LocationObject* loc;
+
+static void startup()
+{
+       ret = location_init();
+       loc = location_new(LOCATION_METHOD_GPS);
+       tet_printf("\n TC startup");
+}
+
+static void cleanup()
+{
+       if( loc )
+               location_free(loc);
+       tet_printf("\n TC End");
+}
+
+static void
+utc_location_get_last_known_position_01()
+{
+       int ret = 0;
+       LocationLastPosition last_known_position = {0, };
+
+       ret = location_get_last_known_position(loc, LOCATION_METHOD_HYBRID, &last_known_position);
+       if (ret == LOCATION_ERROR_NONE) tet_result(TET_PASS);
+       else tet_result(TET_FAIL);
+}
+
+static void
+utc_location_get_last_known_position_02()
+{
+       int ret = 0;
+       LocationLastPosition last_known_position = {0, };
+       ret = location_get_last_known_position(NULL, LOCATION_METHOD_HYBRID, &last_known_position);
+       if (ret == LOCATION_ERROR_NONE) tet_result(TET_PASS);
+       else tet_result(TET_FAIL);
+}
+
diff --git a/TC/unit/utc_location_get_last_position.c b/TC/unit/utc_location_get_last_position.c
new file mode 100644 (file)
index 0000000..59c3b1d
--- /dev/null
@@ -0,0 +1,100 @@
+/*
+ * 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 <tet_api.h>
+#include <glib.h>
+#include <location.h>
+
+static void startup(), cleanup();
+void (*tet_startup) () = startup;
+void (*tet_cleanup) () = cleanup;
+
+static void utc_location_get_last_position_01();
+static void utc_location_get_last_position_02();
+static void utc_location_get_last_position_03();
+static void utc_location_get_last_position_04();
+
+struct tet_testlist tet_testlist[] = {
+       {utc_location_get_last_position_01,1},
+       {utc_location_get_last_position_02,2},
+       {utc_location_get_last_position_03,3},
+       {utc_location_get_last_position_04,4},
+       {NULL,0},
+};
+
+int ret;
+LocationObject* loc;
+
+static void startup()
+{
+       location_init();
+       loc = location_new(LOCATION_METHOD_GPS);
+       tet_printf("\n TC startup");
+}
+
+static void cleanup()
+{
+       location_free(loc);
+       tet_printf("\n TC End");
+}
+
+static void
+utc_location_get_last_position_01()
+{
+       LocationPosition *last_pos = NULL;
+       LocationAccuracy *last_acc = NULL;
+
+       ret = location_get_last_position (loc, LOCATION_METHOD_GPS, &last_pos, &last_acc);
+       if (ret == LOCATION_ERROR_NONE) tet_result(TET_PASS);
+       else tet_result(TET_FAIL);
+}
+
+static void
+utc_location_get_last_position_02()
+{
+       LocationAccuracy *last_acc = NULL;
+       LocationPosition *last_pos = NULL;
+
+       ret = location_get_last_position (NULL, LOCATION_METHOD_HYBRID, &last_pos, &last_acc);
+       tet_printf("Returned value: %d", ret);
+       if (ret == LOCATION_ERROR_NONE) tet_result(TET_PASS);
+       else tet_result(TET_FAIL);
+}
+
+static void
+utc_location_get_last_position_03()
+{
+       LocationAccuracy *last_acc = NULL;
+       ret = location_get_last_position (loc, LOCATION_METHOD_GPS, NULL, &last_acc);
+       tet_printf("Returned value: %d", ret);
+       if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
+       else tet_result(TET_FAIL);
+}
+
+static void
+utc_location_get_last_position_04()
+{
+       LocationPosition *last_pos = NULL;
+       ret = location_get_last_position (loc, LOCATION_METHOD_GPS, &last_pos, NULL);
+       tet_printf("Returned value: %d", ret);
+       if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
+       else tet_result(TET_FAIL);
+}
diff --git a/TC/unit/utc_location_get_last_satellite.c b/TC/unit/utc_location_get_last_satellite.c
new file mode 100644 (file)
index 0000000..48ed49f
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+ * 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 <tet_api.h>
+#include <glib.h>
+#include <location.h>
+
+static void startup(), cleanup();
+void (*tet_startup) () = startup;
+void (*tet_cleanup) () = cleanup;
+
+static void utc_location_get_last_satellite_01();
+static void utc_location_get_last_satellite_02();
+static void utc_location_get_last_satellite_03();
+
+struct tet_testlist tet_testlist[] = {
+       {utc_location_get_last_satellite_01,1},
+       {utc_location_get_last_satellite_02,2},
+       {utc_location_get_last_satellite_03,3},
+       {NULL,0},
+};
+
+int ret;
+LocationObject* loc;
+
+static void startup()
+{
+       location_init();
+       loc = location_new(LOCATION_METHOD_GPS);
+       tet_printf("\n TC startup");
+}
+
+static void cleanup()
+{
+       location_free(loc);
+       tet_printf("\n TC End");
+}
+
+static void
+utc_location_get_last_satellite_01()
+{
+       int ret = 0;
+       LocationSatellite *last_sat = NULL;
+
+       ret = location_get_last_satellite (loc, &last_sat);
+       tet_printf("Returned value: %d", ret);
+       if (ret == LOCATION_ERROR_NONE) {
+               location_satellite_free(last_sat);
+               tet_result(TET_PASS);
+       } else tet_result(TET_FAIL);
+
+}
+
+static void
+utc_location_get_last_satellite_02()
+{
+       LocationSatellite *last_sat = NULL;
+       ret = location_get_last_satellite (NULL, &last_sat);
+       tet_printf("Returned value: %d", ret);
+       if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
+       else tet_result(TET_FAIL);
+}
+
+static void
+utc_location_get_last_satellite_03()
+{
+       ret = location_get_last_satellite (loc, NULL);
+       tet_printf("Returned value: %d", ret);
+       if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
+       else tet_result(TET_FAIL);
+}
diff --git a/TC/unit/utc_location_get_last_velocity.c b/TC/unit/utc_location_get_last_velocity.c
new file mode 100644 (file)
index 0000000..74d0e01
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+ * 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 <tet_api.h>
+#include <glib.h>
+#include <location.h>
+
+static void startup(), cleanup();
+void (*tet_startup) () = startup;
+void (*tet_cleanup) () = cleanup;
+
+static void utc_location_get_last_velocity_01();
+static void utc_location_get_last_velocity_02();
+static void utc_location_get_last_velocity_03();
+static void utc_location_get_last_velocity_04();
+
+struct tet_testlist tet_testlist[] = {
+       {utc_location_get_last_velocity_01,1},
+       {utc_location_get_last_velocity_02,2},
+       {utc_location_get_last_velocity_03,3},
+       {utc_location_get_last_velocity_04,4},
+       {NULL,0},
+};
+
+int ret;
+LocationObject* loc;
+
+static void startup()
+{
+       location_init();
+       loc = location_new(LOCATION_METHOD_GPS);
+       tet_printf("\n TC startup");
+}
+
+static void cleanup()
+{
+       location_free(loc);
+       tet_printf("\n TC End");
+}
+
+
+static void
+utc_location_get_last_velocity_01()
+{
+       LocationVelocity *last_vel = NULL;
+       LocationAccuracy *last_acc = NULL;
+       ret = location_get_last_velocity (loc, &last_vel, &last_acc);
+       tet_printf("Returned value: %d", ret);
+       if (ret == LOCATION_ERROR_NONE) {
+               location_velocity_free (last_vel);
+               location_accuracy_free (last_acc);
+               tet_result(TET_PASS);
+       } else tet_result(TET_FAIL);
+
+}
+
+
+static void
+utc_location_get_last_velocity_02()
+{
+       LocationVelocity *last_vel = NULL;
+       LocationAccuracy *last_acc = NULL;
+       ret = location_get_last_velocity (NULL, &last_vel, &last_acc);
+       tet_printf("Returned value: %d", ret);
+       if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
+       else tet_result(TET_FAIL);
+}
+
+static void
+utc_location_get_last_velocity_03()
+{
+       LocationAccuracy *last_acc = NULL;
+       ret = location_get_velocity (loc, NULL, &last_acc);
+       tet_printf("Returned value: %d", ret);
+       if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
+       else tet_result(TET_FAIL);
+}
+
+static void
+utc_location_get_last_velocity_04()
+{
+       LocationVelocity *last_vel = NULL;
+       ret = location_get_velocity (loc, &last_vel, NULL);
+       tet_printf("Returned value: %d", ret);
+       if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
+       else tet_result(TET_FAIL);
+}
index 558a7e3..f19c70c 100644 (file)
@@ -45,11 +45,8 @@ static GMainLoop *loop = NULL;
 LocationObject* loc;
 int ret;
 int isNetStarted = 0;
-
-#define GCONF_PROXY_MODE            "/system/proxy/mode"
-#define GCONF_HTTP_PROXY_HOST       "/system/http_proxy/host"
-#define GCONF_HTTP_PROXY_PORT       "/system/http_proxy/port"
-#define ENV_HTTP_PROXY              "http_proxy"
+int g_state = 0;
+gboolean is_found = FALSE;
 
 static gboolean
 exit_loop (gpointer data)
@@ -59,48 +56,73 @@ exit_loop (gpointer data)
 }
 
 static void startup()
-{      
+{
        location_init();
        loc = location_new(LOCATION_METHOD_GPS);
 
-       loop = g_main_loop_new(NULL,FALSE);             
-       g_main_loop_run (loop);
+       loop = g_main_loop_new(NULL,FALSE);
 
-       tet_printf("\n TC startup");    
+       tet_printf("\n TC startup");
 }
 
 static void cleanup()
-{      
+{
        location_free(loc);
        tet_printf("\n TC End");
 }
 
+static void comp_position (gpointer data, gpointer user_data)
+{
+       if (!data) return;
+
+       LocationPosition *pos = (LocationPosition *)data;
+
+       if (pos) {
+               if (37.325276 <= pos->latitude &&  pos->latitude <= 37.345276 &&
+                       -121.900059 <= pos->longitude && pos->longitude<= -121.880059) {
+                       is_found = TRUE;
+               }
+
+               location_position_free(pos);
+       }
+}
+
+static void free_accuracy (gpointer data, gpointer user_data)
+{
+       if (!data) return;
+
+       LocationAccuracy *acc = (LocationAccuracy *)data;
+
+       if (acc) location_accuracy_free(acc);
+}
+
 static void
 utc_location_get_position_from_address_01()
-{      
-       LocationPosition *pos = NULL;
-       LocationAccuracy *acc = NULL;
+{
+       GList *pos_list = NULL;
+       GList *acc_list = NULL;
        LocationAddress *addr = location_address_new ("1",  "Post Street", NULL, "san jose", "ca", NULL, "95113");
-       ret = location_get_position_from_address (loc, addr, &pos, &acc);
+       ret = location_get_position_from_address (loc, addr, &pos_list, &acc_list);
        location_address_free(addr);
        tet_printf("Returned value: %d", ret);
-       if( (ret == LOCATION_ERROR_NONE && 
-               37.325276 <= pos->latitude &&  pos->latitude <= 37.345276 &&
-               -121.900059 <= pos->longitude && pos->longitude<= -121.880059) ||
-               ret == LOCATION_ERROR_CONFIGURATION ) {
-               location_position_free(pos);
-               location_accuracy_free(acc);
-               tet_result(TET_PASS);
+       if (ret == LOCATION_ERROR_NONE) {
+               is_found = FALSE;
+               g_list_foreach (pos_list, comp_position, NULL);
+               g_list_foreach (acc_list, free_accuracy, NULL);
+               if (is_found)
+                       tet_result(TET_PASS);
+               else
+                       tet_result(TET_FAIL);
        } else tet_result(TET_FAIL);
 }
 
 static void
 utc_location_get_position_from_address_02()
 {
-       LocationPosition *pos = NULL;
-       LocationAccuracy *acc = NULL;
+       GList *pos_list = NULL;
+       GList *acc_list = NULL;
        LocationAddress *addr = location_address_new ("1",  "Post Street", NULL, "san jose", "ca", NULL, "95113");
-       ret = location_get_position_from_address (NULL, addr, &pos, &acc);
+       ret = location_get_position_from_address (NULL, addr, &pos_list, &acc_list);
        location_address_free(addr);
        tet_printf("Returned value: %d", ret);
        if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
@@ -110,9 +132,9 @@ utc_location_get_position_from_address_02()
 static void
 utc_location_get_position_from_address_03()
 {
-       LocationPosition *pos = NULL;
-       LocationAccuracy *acc = NULL;
-       ret = location_get_position_from_address(loc, NULL, &pos, &acc);
+       GList *pos_list = NULL;
+       GList *acc_list = NULL;
+       ret = location_get_position_from_address(loc, NULL, &pos_list, &acc_list);
        tet_printf("Returned value: %d", ret);
        if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
        else tet_result(TET_FAIL);
@@ -122,8 +144,8 @@ static void
 utc_location_get_position_from_address_04()
 {
        LocationAddress *addr = location_address_new ("1",  "Post Street", NULL, "san jose", "ca", NULL, "95113");;
-       LocationAccuracy *acc = NULL;
-       ret = location_get_position_from_address(loc, addr, NULL, &acc);
+       GList *acc_list = NULL;
+       ret = location_get_position_from_address(loc, addr, NULL, &acc_list);
        location_address_free (addr);
        tet_printf("Returned value: %d", ret);
        if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
index d33b750..6496db8 100644 (file)
@@ -21,7 +21,6 @@
 
 #include <tet_api.h>
 #include <glib.h>
-#include <gconf/gconf-client.h>
 #include <location.h>
 
 static void startup(), cleanup();
@@ -45,11 +44,7 @@ static GMainLoop *loop = NULL;
 LocationObject* loc;
 int ret;
 int isNetStarted = 0;
-
-#define GCONF_PROXY_MODE            "/system/proxy/mode"
-#define GCONF_HTTP_PROXY_HOST       "/system/http_proxy/host"
-#define GCONF_HTTP_PROXY_PORT       "/system/http_proxy/port"
-#define ENV_HTTP_PROXY              "http_proxy"
+gboolean is_found = FALSE;
 
 static gboolean
 exit_loop (gpointer data)
@@ -59,51 +54,69 @@ exit_loop (gpointer data)
 }
 
 static void startup()
-{      
+{
        location_init();
        loc = location_new(LOCATION_METHOD_GPS);
 
-       loop = g_main_loop_new(NULL,FALSE);             
-       g_main_loop_run (loop);
-
-       tet_printf("\n TC startup");    
+       loop = g_main_loop_new(NULL,FALSE);
+       tet_printf("\n TC startup");
 }
 
 static void cleanup()
-{      
+{
        location_free(loc);
        tet_printf("\n TC End");
 }
 
+static void comp_position (gpointer data, gpointer user_data)
+{
+       if (!data) return;
+       LocationPosition *pos = (LocationPosition *)data;
+       if (pos) {
+               if (37.325276 <= pos->latitude &&  pos->latitude <= 37.345276 &&
+               -121.900059 <= pos->longitude && pos->longitude<= -121.880059) {
+                       is_found = TRUE;
+               }
+               location_position_free (pos);
+       }
+}
+
+static void free_accuracy (gpointer data, gpointer user_data)
+{
+       if (!data) return;
+
+       LocationAccuracy *acc = (LocationAccuracy *)data;
+       if (acc) location_accuracy_free(acc);
+}
+
 static void
 utc_location_get_position_from_freeformed_address_01()
-{      
-       LocationPosition *pos = NULL;
-       LocationAccuracy *acc = NULL;
+{
+       GList *pos_list = NULL;
+       GList *acc_list = NULL;
        char* addr_str = g_strdup("4 N 2nd Street 95113");
-       ret = location_get_position_from_freeformed_address(loc, addr_str, &pos, &acc);
+       ret = location_get_position_from_freeformed_address(loc, addr_str, &pos_list, &acc_list);
        g_free(addr_str);
        tet_printf("Returned value: %d", ret);
-       if( (ret == LOCATION_ERROR_NONE && 
-               37.325276 <= pos->latitude &&  pos->latitude <= 37.345276 &&
-               -121.900059 <= pos->longitude && pos->longitude<= -121.880059) ||
-               ret == LOCATION_ERROR_CONFIGURATION ) {
-               location_position_free (pos);
-               location_accuracy_free (acc);
-               tet_result(TET_PASS);
+       if (ret == LOCATION_ERROR_NONE ) {
+               g_list_foreach (pos_list, comp_position, NULL);
+               g_list_foreach (acc_list, free_accuracy, NULL);
+               if (is_found == TRUE)
+                       tet_result(TET_PASS);
+               else
+                       tet_result(TET_FAIL);
        }
        else
                tet_result(TET_FAIL);
-       
 }
 
 static void
 utc_location_get_position_from_freeformed_address_02()
 {
-       LocationPosition *pos = NULL;
-       LocationAccuracy *acc = NULL;
+       GList *pos_list = NULL;
+       GList *acc_list = NULL;
        char* addr_str = g_strdup("4 N 2nd Street 95113");
-       ret = location_get_position_from_freeformed_address(NULL, addr_str, &pos, &acc);
+       ret = location_get_position_from_freeformed_address(NULL, addr_str, &pos_list, &acc_list);
        g_free(addr_str);
        tet_printf("Returned value: %d", ret);
        if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
@@ -113,9 +126,9 @@ utc_location_get_position_from_freeformed_address_02()
 static void
 utc_location_get_position_from_freeformed_address_03()
 {
-       LocationPosition *pos = NULL;
-       LocationAccuracy *acc = NULL;
-       ret = location_get_position_from_freeformed_address(loc, NULL, &pos, &acc);
+       GList *pos_list = NULL;
+       GList *acc_list = NULL;
+       ret = location_get_position_from_freeformed_address(loc, NULL, &pos_list, &acc_list);
        tet_printf("Returned value: %d", ret);
        if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
        else tet_result(TET_FAIL);
@@ -124,9 +137,9 @@ utc_location_get_position_from_freeformed_address_03()
 static void
 utc_location_get_position_from_freeformed_address_04()
 {
-       LocationAccuracy *acc = NULL;
+       GList *acc_list = NULL;
        char* addr_str = g_strdup("4 N 2nd Street 95113");
-       ret = location_get_position_from_freeformed_address(loc, addr_str, NULL, &acc);
+       ret = location_get_position_from_freeformed_address(loc, addr_str, NULL, &acc_list);
        g_free (addr_str);
        tet_printf("Returned value: %d", ret);
        if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
diff --git a/TC/unit/utc_location_get_satellite.c b/TC/unit/utc_location_get_satellite.c
new file mode 100644 (file)
index 0000000..3f906a0
--- /dev/null
@@ -0,0 +1,112 @@
+/*
+ * 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 <tet_api.h>
+#include <glib.h>
+#include <location.h>
+
+static void startup(), cleanup();
+void (*tet_startup) () = startup;
+void (*tet_cleanup) () = cleanup;
+
+static void utc_location_get_satellite_01();
+static void utc_location_get_satellite_02();
+static void utc_location_get_satellite_03();
+
+struct tet_testlist tet_testlist[] = {
+       {utc_location_get_satellite_01,1},
+       {utc_location_get_satellite_02,2},
+       {utc_location_get_satellite_03,3},
+       {NULL,0},
+};
+
+static GMainLoop *loop = NULL;
+int ret;
+LocationObject* loc;
+
+static gboolean
+exit_loop (gpointer data)
+{
+       g_main_loop_quit (loop);
+       tet_result(TET_FAIL);
+       return FALSE;
+}
+
+static void startup()
+{
+       location_init();
+       loc = location_new(LOCATION_METHOD_GPS);
+       location_start(loc);
+       loop = g_main_loop_new(NULL,FALSE);
+       tet_printf("\n TC startup");
+}
+
+static void cleanup()
+{
+       location_stop(loc);
+       location_free(loc);
+       tet_printf("\n TC End");
+}
+
+static void
+_get_satellite (GObject *self,
+                               guint _status,
+                    gpointer userdata)
+{
+       LocationSatellite *sat = NULL;
+       LocationObject *loc = (LocationObject*)userdata;
+
+       ret = location_get_satellite (loc, &sat);
+       tet_printf("Returned value: %d", ret);
+       if (ret == LOCATION_ERROR_NONE) {
+               location_satellite_free(sat);
+               tet_result(TET_PASS);
+       } else tet_result(TET_FAIL);
+       g_main_loop_quit (loop);
+}
+
+static void
+utc_location_get_satellite_01()
+{
+       g_signal_connect (loc, "service-enabled", G_CALLBACK(_get_satellite), loc);
+       g_timeout_add_seconds(60, exit_loop, loop);
+       g_main_loop_run (loop);
+}
+
+static void
+utc_location_get_satellite_02()
+{
+       LocationSatellite *sat = NULL;
+       ret = location_get_satellite (NULL, &sat);
+       tet_printf("Returned value: %d", ret);
+       if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
+       else tet_result(TET_FAIL);
+}
+
+static void
+utc_location_get_satellite_03()
+{
+       LocationSatellite *sat = NULL;
+       ret = location_get_satellite (loc, NULL);
+       tet_printf("Returned value: %d", ret);
+       if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
+       else tet_result(TET_FAIL);
+}
index 8cc0845..ae8a422 100644 (file)
@@ -23,6 +23,9 @@
 #include <glib.h>
 #include <location.h>
 
+#include "test_common.c"
+
+static gboolean g_is_found = FALSE;
 static void startup(), cleanup();
 void (*tet_startup) () = startup;
 void (*tet_cleanup) () = cleanup;
@@ -34,13 +37,34 @@ struct tet_testlist tet_testlist[] = {
        {utc_set_boundary_in_suwonHQ,1},
        {utc_get_boundary_in_suwonHQ,2},
        {NULL,0},
-};     
+};
 
 int ret;
 LocationObject* loc;
 
+static void comp_boundary(LocationBoundary *bound, gpointer user_data)
+{
+       LocationBoundary *check_bound = (LocationBoundary *) user_data;
+
+       if(bound && bound->type == check_bound->type) {
+               switch(bound->type) {
+                       case LOCATION_BOUNDARY_RECT:
+                               if(bound->rect.right_bottom->latitude == check_bound->rect.right_bottom->latitude &&
+                                       bound->rect.right_bottom->longitude == check_bound->rect.right_bottom->longitude &&
+                                       bound->rect.left_top->latitude == check_bound->rect.left_top->latitude &&
+                                       bound->rect.left_top->longitude == check_bound->rect.left_top->longitude ){
+                                       g_is_found = TRUE;
+                               }
+                               break;
+                       
+                       default:
+                               break;
+               }
+       }
+}
+
 static void startup()
-{      
+{
        location_init();
        loc = location_new(LOCATION_METHOD_GPS);
        location_start(loc);
@@ -48,7 +72,7 @@ static void startup()
 }
 
 static void cleanup()
-{      
+{
        location_stop(loc);
        location_free(loc);
        tet_printf("\n TC End");
@@ -57,30 +81,34 @@ static void cleanup()
 static void
 utc_set_boundary_in_suwonHQ()
 {
+       int ret = 0;
        LocationPosition *rb = location_position_new(0, 37.258, 127.056, 0, LOCATION_STATUS_2D_FIX);
        LocationPosition *lt = location_position_new(0, 37.260, 127.054, 0, LOCATION_STATUS_2D_FIX);
        LocationBoundary* bound = location_boundary_new_for_rect(lt, rb);
-       g_object_set(loc, "boundary", bound, NULL);
+
+       ret = location_boundary_add(loc, bound);
+       if (!ret) {
+               tet_result(TET_PASS);
+       } else tet_result(TET_FAIL);
+
        location_position_free (rb);
        location_position_free (lt);
        location_boundary_free(bound);
-       if (loc) {
-               tet_result(TET_PASS);           
-       } else tet_result(TET_FAIL);
 }
 
 static void
 utc_get_boundary_in_suwonHQ()
 {
-       LocationBoundary* bound = NULL; 
-       g_object_get(loc, "boundary", &bound, NULL);
-       if ( bound && 
-               bound->type == LOCATION_BOUNDARY_RECT &&
-               bound->rect.right_bottom->latitude == 37.258 &&
-               bound->rect.right_bottom->longitude == 127.056 &&
-               bound->rect.left_top->latitude == 37.260 &&
-               bound->rect.left_top->longitude == 127.054 ){           
-               tet_result(TET_PASS);
-               location_boundary_free (bound);
-       } else tet_result(TET_FAIL);
+       LocationPosition *rb = location_position_new(0, 37.258, 127.056, 0, LOCATION_STATUS_2D_FIX);
+       LocationPosition *lt = location_position_new(0, 37.260, 127.054, 0, LOCATION_STATUS_2D_FIX);
+       LocationBoundary* bound = location_boundary_new_for_rect(lt, rb);
+
+       g_is_found = FALSE;
+       location_boundary_foreach(loc, comp_boundary, bound);
+       if(g_is_found) tet_result(TET_PASS);
+       else tet_result(TET_FAIL);
+
+       location_position_free (rb);
+       location_position_free (lt);
+       location_boundary_free (bound);
 }
index c0d42c9..e69f6f8 100644 (file)
@@ -18,7 +18,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 #include <tet_api.h>
 #include <glib.h>
 #include <location.h>
@@ -32,7 +31,7 @@ static void utc_zone_in();
 struct tet_testlist tet_testlist[] = {
        {utc_zone_in,1},
        {NULL,0},
-};     
+};
 
 static GMainLoop *loop = NULL;
 int ret;
@@ -47,24 +46,25 @@ exit_loop (gpointer data)
 }
 
 static void startup()
-{      
+{
        location_init();
        loc = location_new(LOCATION_METHOD_GPS);
        location_start(loc);
-       loop = g_main_loop_new(NULL,FALSE);     
+       loop = g_main_loop_new(NULL,FALSE);
 
        LocationPosition *rb = location_position_new(0, 37.254, 127.057, 0, LOCATION_STATUS_2D_FIX);
        LocationPosition *lt = location_position_new(0, 37.261, 127.050, 0, LOCATION_STATUS_2D_FIX);
        LocationBoundary* bound = location_boundary_new_for_rect(lt, rb);
+       location_boundary_add(loc, bound);
+
        location_position_free (rb);
        location_position_free (lt);
-       g_object_set(loc, "boundary", bound, NULL);     
-       location_boundary_free (bound); 
+       location_boundary_free (bound);
        tet_printf("\n TC startup");
 }
 
 static void cleanup()
-{      
+{
        location_stop(loc);
        location_free(loc);
        tet_printf("\n TC End");
@@ -89,5 +89,5 @@ utc_zone_in()
 {
        g_signal_connect (loc, "zone-in", G_CALLBACK(cb_zone_in), loc);
        g_timeout_add_seconds(60, exit_loop, NULL);
-       g_main_loop_run (loop); 
+       g_main_loop_run (loop);
 }
index 5070a66..6eee476 100644 (file)
@@ -18,6 +18,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 #include <tet_api.h>
 #include <glib.h>
 #include <location.h>
@@ -46,24 +47,25 @@ exit_loop (gpointer data)
 }
 
 static void startup()
-{      
+{
        location_init();
        loc = location_new(LOCATION_METHOD_GPS);
        location_start(loc);
-       loop = g_main_loop_new(NULL,FALSE);     
+       loop = g_main_loop_new(NULL,FALSE);
 
        LocationPosition *rb = location_position_new(0, 36.395, 25.41, 0, LOCATION_STATUS_2D_FIX);
        LocationPosition *lt = location_position_new(0, 36.413, 25.388, 0, LOCATION_STATUS_2D_FIX);
        LocationBoundary* bound = location_boundary_new_for_rect(lt, rb);
+       location_boundary_add(loc, bound);
+
        location_position_free (rb);
        location_position_free (lt);
-       g_object_set(loc, "boundary", bound, NULL);
        location_boundary_free (bound);
        tet_printf("\n TC startup");
 }
 
 static void cleanup()
-{      
+{
        location_stop(loc);
        location_free(loc);
        tet_printf("\n TC End");
@@ -89,5 +91,5 @@ utc_zone_out()
 {
        g_signal_connect (loc, "zone-out", G_CALLBACK(_cb_zone_out), loc);
        g_timeout_add_seconds(60, exit_loop, NULL);
-       g_main_loop_run (loop); 
+       g_main_loop_run (loop);
 }
index 37124e8..f9d2e33 100644 (file)
@@ -1,10 +1,60 @@
-libslp-location (0.3.31-3) unstable; urgency=low
+libslp-location (0.3.34-4) unstable; urgency=low
 
-  * Change PKG name to "org.tizen" in test codes.
+  * Rollback
   * Git: pkgs/l/libslp-location
-  * Tag: libslp-location_0.3.31-3
+  * Tag: libslp-location_0.3.34-4
 
- -- Yunhan Kim <yhan.kim@samsung.com>  Fri, 23 Dec 2011 20:04:55 +0900
+ -- Minjune Kim <sena06.kim@samsung.com>  Thu, 23 Feb 2012 14:30:58 +0900
+
+libslp-location (0.3.34-3) unstable; urgency=low
+
+  * Add POI func & Route prototype
+  * Git: pkgs/l/libslp-location
+  * Tag: libslp-location_0.3.34-3
+
+ -- root <sena06.kim@samsung.com>  Thu, 23 Feb 2012 14:29:51 +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
+
+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
+
+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
+
+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
+
+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
 
 libslp-location (0.3.31-2) unstable; urgency=low
 
index eb04949..ee6360c 100755 (executable)
@@ -3,17 +3,46 @@
 #setting 
 if [ "${USER}" = "root" ]
 then
-vconftool set -t int db/location/position/Timestamp "0" -f
-vconftool set -t string db/location/position/LastPosition "" -f
-vconftool set -t int db/location/position/LastAccuracy "0" -f
+vconftool set -t int db/location/lastposition/gps/Timestamp "0" -f
+vconftool set -t double db/location/lastposition/gps/Latitude "0.0" -f
+vconftool set -t double db/location/lastposition/gps/Longitude "0.0" -f
+vconftool set -t double db/location/lastposition/gps/Altitude "0.0" -f
+vconftool set -t double db/location/lastposition/gps/HorAccuracy "0.0" -f
+vconftool set -t double db/location/lastposition/gps/VerAccuracy "0.0" -f
+vconftool set -t int db/location/lastposition/wps/Timestamp "0" -f
+vconftool set -t double db/location/lastposition/wps/Latitude "0.0" -f
+vconftool set -t double db/location/lastposition/wps/Longitude "0.0" -f
+vconftool set -t double db/location/lastposition/wps/Altitude "0.0" -f
+vconftool set -t double db/location/lastposition/wps/HorAccuracy "0.0" -f
+vconftool set -t int db/location/lastposition/sps/Timestamp "0" -f
+vconftool set -t double db/location/lastposition/sps/Latitude "0.0" -f
+vconftool set -t double db/location/lastposition/sps/Longitude "0.0" -f
+vconftool set -t double db/location/lastposition/sps/Altitude "0.0" -f
+vconftool set -t double db/location/lastposition/sps/HorAccuracy "0.0" -f
+vconftool set -t double db/location/lastposition/sps/VerAccuracy "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
 vconftool set -t int db/location/setting/SensorEnabled "0" -g 6514 -f
 else
-vconftool set -t int db/location/position/Timestamp "0" -f
-vconftool set -t string db/location/position/LastPosition "" -f
-vconftool set -t int db/location/position/LastAccuracy "0" -f
+
+vconftool set -t int db/location/lastposition/gps/Timestamp "0" -f
+vconftool set -t double db/location/lastposition/gps/Latitude "0.0" -f
+vconftool set -t double db/location/lastposition/gps/Longitude "0.0" -f
+vconftool set -t double db/location/lastposition/gps/Altitude "0.0" -f
+vconftool set -t double db/location/lastposition/gps/HorAccuracy "0.0" -f
+vconftool set -t double db/location/lastposition/gps/VerAccuracy "0.0" -f
+vconftool set -t int db/location/lastposition/wps/Timestamp "0" -f
+vconftool set -t double db/location/lastposition/wps/Latitude "0.0" -f
+vconftool set -t double db/location/lastposition/wps/Longitude "0.0" -f
+vconftool set -t double db/location/lastposition/wps/Altitude "0.0" -f
+vconftool set -t double db/location/lastposition/wps/HorAccuracy "0.0" -f
+vconftool set -t int db/location/lastposition/sps/Timestamp "0" -f
+vconftool set -t double db/location/lastposition/sps/Latitude "0.0" -f
+vconftool set -t double db/location/lastposition/sps/Longitude "0.0" -f
+vconftool set -t double db/location/lastposition/sps/Altitude "0.0" -f
+vconftool set -t double db/location/lastposition/sps/HorAccuracy "0.0" -f
+vconftool set -t double db/location/lastposition/sps/VerAccuracy "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 38f21a6..e006798 100644 (file)
@@ -53,7 +53,7 @@ struct _LocationAccuracy
 {
        LocationAccuracyLevel level;        ///< The accuracy level of the location information.
        gdouble horizontal_accuracy;        ///< The horizontal position uncertainty  of the location in meters.
-       gdouble vertical_accuracy;          ///< The vertical position unvertainty of the location in meters.
+       gdouble vertical_accuracy;          ///< The vertical position uncertainty of the location in meters.
 };
 
 GType location_accuracy_get_type(void);
@@ -66,7 +66,7 @@ GType location_accuracy_get_type(void);
  * @post    None.
  * @param [in]  level - The accuracy level of the location information.
  * @param [in]  horizontal_accuracy - The horizontal position uncertainty  of the location in meters.
- * @param [in]  vertical_accuracy - The vertical position unvertainty of the location in meters.
+ * @param [in]  vertical_accuracy - The vertical position uncertainty of the location in meters.
  * @return a new #LocationAccuracy
  * @retval NULL if error occured
  */
index 45747a1..eb450a5 100644 (file)
@@ -42,7 +42,7 @@ struct _LocationAddress
        gchar *street;           ///< Full street name.
        gchar *district;         ///< Municipal district name.
        gchar *city;             ///< City name.
-       gchar *state;            ///< State or provinc region of a nation.
+       gchar *state;            ///< State or province region of a nation.
        gchar *country_code;     ///< Country name.
        gchar *postal_code;      ///< Postal delivery code.
 };
@@ -59,7 +59,7 @@ GType location_address_get_type(void);
  * @param [in]  street - Full street name.
  * @param [in]  district - Municipal district name.
  * @param [in]  city - City name.
- * @param [in]  state - State or provinc region of a nation.
+ * @param [in]  state - State or province region of a nation.
  * @param [in]  country_code - Country name.
  * @param [in]  postal_code - Postal delivery code.
  * @return a new #LocationAddress
index e6b70bc..9fe0d6e 100644 (file)
@@ -74,12 +74,12 @@ typedef struct {
 } LocationPolygon;
 
 /**
- * @brief This represents boundary information such as rectagular or circle area.
+ * @brief This represents boundary information such as rectangular or circle area.
  */
 struct _LocationBoundary{
        LocationBoundaryType type;   ///< The boundary type of this information.
        union {
-               LocationRect rect;           ///< The geographical information of a rectagle.
+               LocationRect rect;           ///< The geographical information of a rectangle.
                LocationCircle circle;       ///< The geographical information of a circle.
                LocationPolygon polygon;                ///< The geographical information of a polygon.
        };
@@ -89,7 +89,7 @@ GType location_boundary_get_type (void);
 #define LOCATION_TYPE_BOUNDARY (location_boundary_get_type ())
 
 /**
- * @brief   Create a rectagular type of new #LocationBoundary with given information.
+ * @brief   Create a rectangular type of new #LocationBoundary with given information.
  * @remarks None.
  * @pre     #location_init should be called before.\n
  * @post    None.
@@ -147,8 +147,8 @@ LocationBoundary *location_boundary_copy (const LocationBoundary* boundary);
 /**
  * @brief
  * Add Boundary on LocationFW.
- * You should call this fuction when you want to receive a corssing signal(zone-in/zone-out) from #LocationBoundary.
- * @remarks It suppoorts multi-boundaries. \n
+ * You should call this fuction when you want to receive a crossing signal(zone-in/zone-out) from #LocationBoundary.
+ * @remarks It supports multi-boundaries. \n
     However a duplicated boundary would not be allowed.
  * @pre
  * #location_new should be called before.\n
@@ -194,8 +194,8 @@ int location_boundary_add(const LocationObject *obj, const LocationBoundary *bou
 /**
  * @brief
  * Remove Boundary on LocationFW.
- * You should call this function when you don't want to receive a corssing signal(zone-in/zone-out) from #LocationBoundary any more.
- * @remarks It suppoorts multi-boundaries.
+ * You should call this function when you don't want to receive a crossing signal(zone-in/zone-out) from #LocationBoundary any more.
+ * @remarks It supports multi-boundaries.
  * @pre
  * #location_init should be called before.\n
  * @post None.
index 900bf30..231dc41 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "location.h"
 #include "location-common-util.h"
+#include "location-setting.h"
 #include "location-log.h"
 
 static gint compare_position (gconstpointer a, gconstpointer b)
@@ -169,4 +170,57 @@ int set_prop_removal_boundary(GList **prev_boundary_list, LocationBoundary* boun
        return LOCATION_ERROR_NONE;
 }
 
+int get_last_known_position (LocationMethod method, LocationLastPosition *last_pos)
+{
+       int timestamp = 0;
+       double longitude = 0.0, latitude = 0.0, altitude = 0.0;
+       double hor_accuracy = 0.0, ver_accuracy = 0.0;
+       LOCATION_LOGD("Method [%d]", method);
+       switch (method) {
+               case LOCATION_METHOD_SPS:
+                       if (vconf_get_int(SPS_LAST_TIMESTAMP, &timestamp) ||
+                               vconf_get_dbl(SPS_LAST_LATITUDE, &latitude) ||
+                               vconf_get_dbl(SPS_LAST_LONGITUDE, &longitude) ||
+                               vconf_get_dbl(SPS_LAST_ALTITUDE, &altitude) ||
+                               vconf_get_dbl(SPS_LAST_HORACCURACY, &hor_accuracy) ||
+                               vconf_get_dbl(SPS_LAST_VERACCURACY, &ver_accuracy)) {
+                               return -1;
+                       }
+                       break;
+               case LOCATION_METHOD_WPS:
+                       if (vconf_get_int(WPS_LAST_TIMESTAMP, &timestamp) ||
+                               vconf_get_dbl(WPS_LAST_LATITUDE, &latitude) ||
+                               vconf_get_dbl(WPS_LAST_LONGITUDE, &longitude) ||
+                               vconf_get_dbl(WPS_LAST_ALTITUDE, &altitude) ||
+                               vconf_get_dbl(WPS_LAST_HORACCURACY, &hor_accuracy)) {
+                               return -1;
+                       }
+                       break;
+               case LOCATION_METHOD_GPS:
+                       if (vconf_get_int(GPS_LAST_TIMESTAMP, &timestamp) ||
+                               vconf_get_dbl(GPS_LAST_LATITUDE, &latitude) ||
+                               vconf_get_dbl(GPS_LAST_LONGITUDE, &longitude) ||
+                               vconf_get_dbl(GPS_LAST_ALTITUDE, &altitude) ||
+                               vconf_get_dbl(GPS_LAST_HORACCURACY, &hor_accuracy) ||
+                               vconf_get_dbl(GPS_LAST_VERACCURACY, &ver_accuracy)) {
+                               return -1;
+                       }
+                       break;
+               case LOCATION_METHOD_HYBRID:
+               default:
+                       return -1;
+
+       }
+
+       last_pos->method = method;
+       last_pos->timestamp = (guint) timestamp;
+       last_pos->longitude = (gdouble) longitude;
+       last_pos->latitude = (gdouble) latitude;
+       last_pos->altitude = (gdouble) altitude;
+       last_pos->horizontal_accuracy = (gdouble) hor_accuracy;
+       last_pos->vertical_accuracy = (gdouble) ver_accuracy;
+
+       return 0;
+}
+
 
index 8918b39..99d9654 100644 (file)
@@ -38,6 +38,8 @@ G_BEGIN_DECLS
 int set_prop_boundary(GList **prev_boundary_list, GList *new_boundary_list);
 int set_prop_removal_boundary(GList **prev_boundary_list, LocationBoundary *boundary);
 
+int get_last_known_position (LocationMethod method, LocationLastPosition *last_pos);
+
 G_END_DECLS
 
 #endif
index 666af95..ce15850 100644 (file)
@@ -100,29 +100,29 @@ location_geocode_get_property (GObject *object,
 static int
 location_geocode_get_geocode (LocationGeocode *self,
        const LocationAddress *address,
-       LocationPosition **position,
-       LocationAccuracy **accuracy)
+       GList **position_list,
+       GList **accuracy_list)
 {
        LOCATION_LOGD("location_geocode_get_geocode");
        LocationGeocodePrivate* priv = GET_PRIVATE(self);
        g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
        g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
        g_return_val_if_fail (priv->mod->ops.get_geocode, LOCATION_ERROR_NOT_AVAILABLE);
-       return (priv->mod->ops.get_geocode)(priv->mod->handler, address, position, accuracy);
+       return (priv->mod->ops.get_geocode)(priv->mod->handler, address, position_list, accuracy_list);
 }
 
 static int
 location_geocode_get_geocode_freeform (LocationGeocode *self,
        const gchar  *address,
-       LocationPosition **position,
-       LocationAccuracy **accuracy)
+       GList **position_list,
+       GList **accuracy_list)
 {
        LOCATION_LOGD("location_geocode_get_geocode_freeform");
        LocationGeocodePrivate* priv = GET_PRIVATE(self);
        g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
        g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
        g_return_val_if_fail (priv->mod->ops.get_geocode_freetext, LOCATION_ERROR_NOT_AVAILABLE);
-       return (priv->mod->ops.get_geocode_freetext)(priv->mod->handler, address, position, accuracy);
+       return (priv->mod->ops.get_geocode_freetext)(priv->mod->handler, address, position_list, accuracy_list);
 }
 
 static int
index 9ab8a76..3c3588f 100644 (file)
@@ -38,6 +38,7 @@
 typedef struct _LocationGpsPrivate {
        LocationGpsMod*         mod;
        gboolean                is_started;
+       gboolean                set_noti;
        gboolean                enabled;
        guint                   interval;
        LocationPosition*       pos;
@@ -119,13 +120,18 @@ location_setting_gps_cb (keynode_t *key,
        LocationGpsPrivate* priv = GET_PRIVATE(self);
        g_return_if_fail (priv->mod);
        g_return_if_fail (priv->mod->handler);
-       if (0 == location_setting_get_key_val(key) && priv->mod->ops.stop) {
+
+       int ret = LOCATION_ERROR_NONE;
+
+       if (0 == location_setting_get_key_val(key) && priv->mod->ops.stop && priv->is_started) {
                LOCATION_LOGD("location stopped by setting");
-               priv->mod->ops.stop(priv->mod->handler);
+               ret = priv->mod->ops.stop(priv->mod->handler);
+               if (ret == LOCATION_ERROR_NONE) priv->is_started = FALSE;
        }
-       else if (1 == location_setting_get_key_val(key) && priv->mod->ops.start) {
+       else if (1 == location_setting_get_key_val(key) && priv->mod->ops.start && !priv->is_started) {
                LOCATION_LOGD("location resumed by setting");
-               priv->mod->ops.start (priv->mod->handler, gps_status_cb, gps_position_cb, gps_velocity_cb, self);
+               ret = priv->mod->ops.start (priv->mod->handler, gps_status_cb, gps_position_cb, gps_velocity_cb, self);
+               if (ret == LOCATION_ERROR_NONE) priv->is_started = TRUE;
        }
 }
 
@@ -137,14 +143,33 @@ location_gps_start (LocationGps *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);
-       setting_retval_if_fail (GPS_ENABLED);
+
        if (priv->is_started == TRUE) return LOCATION_ERROR_NONE;
 
-       int ret = priv->mod->ops.start (priv->mod->handler, gps_status_cb, gps_position_cb, gps_velocity_cb, self);
-       if (ret == LOCATION_ERROR_NONE) {
-               priv->is_started = TRUE;
-               location_setting_add_notify (GPS_ENABLED, location_setting_gps_cb, self);
+       int ret = LOCATION_ERROR_NONE;
+       int noti_err = 0;
+
+       if (!location_setting_get_int(GPS_ENABLED)) {
+               ret = LOCATION_ERROR_NOT_ALLOWED;
+       }
+       else {
+               ret = priv->mod->ops.start (priv->mod->handler, gps_status_cb, gps_position_cb, gps_velocity_cb, self);
+               if (ret == LOCATION_ERROR_NONE) {
+                       priv->is_started = TRUE;
+               }
+               else {
+                       return ret;
+               }
+       }
+
+       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;
+               }
+               priv->set_noti = TRUE;
        }
+
        return ret;
 }
 
@@ -156,13 +181,28 @@ location_gps_stop (LocationGps *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);
-       if (priv->is_started == FALSE) return LOCATION_ERROR_NONE;
 
-       int ret = priv->mod->ops.stop (priv->mod->handler);
-       if (ret == LOCATION_ERROR_NONE) {
-               priv->is_started = FALSE;
-               location_setting_ignore_notify (GPS_ENABLED, location_setting_gps_cb);
+       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_gps_cb);
+               if (noti_err != 0) {
+                       return LOCATION_ERROR_UNKNOWN;
+               }
+               priv->set_noti = FALSE;
+       }
+
        return ret;
 }
 
@@ -352,6 +392,7 @@ location_gps_init (LocationGps *self)
        if(!priv->mod) LOCATION_LOGW("module loading failed");
 
        priv->is_started = FALSE;
+       priv->set_noti = FALSE;
        priv->enabled= FALSE;
        priv->interval = LOCATION_UPDATE_INTERVAL_DEFAULT;
 
index db054a7..6e82d86 100644 (file)
@@ -213,7 +213,6 @@ static int
 location_hybrid_start (LocationHybrid *self)
 {
        LOCATION_LOGD("location_hybrid_start");
-       setting_retval_if_fail(GPS_ENABLED);
 
        int ret_gps = LOCATION_ERROR_NONE;
        int ret_wps = LOCATION_ERROR_NONE;
@@ -229,8 +228,17 @@ location_hybrid_start (LocationHybrid *self)
 
        if (ret_gps != LOCATION_ERROR_NONE &&
                ret_wps != LOCATION_ERROR_NONE &&
-               ret_sps != LOCATION_ERROR_NONE)
-               return LOCATION_ERROR_NOT_AVAILABLE;
+               ret_sps != LOCATION_ERROR_NONE) {
+               if (ret_gps == LOCATION_ERROR_NOT_ALLOWED ||
+                               ret_wps == LOCATION_ERROR_NOT_ALLOWED ||
+                               ret_sps == LOCATION_ERROR_NOT_ALLOWED) {
+                       priv->is_started = TRUE;
+                       return LOCATION_ERROR_NOT_ALLOWED;
+               }
+               else {
+                       return LOCATION_ERROR_NOT_AVAILABLE;
+               }
+       }
 
        priv->is_started = TRUE;
        return LOCATION_ERROR_NONE;
@@ -253,12 +261,13 @@ location_hybrid_stop (LocationHybrid *self)
        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)
                return LOCATION_ERROR_NOT_AVAILABLE;
 
-       priv->is_started = FALSE;
        return LOCATION_ERROR_NONE;
 }
 
index ea62ae8..3b17b01 100644 (file)
@@ -100,29 +100,27 @@ location_ielement_get_velocity (LocationIElement *self,
 int
 location_ielement_get_geocode (LocationIElement *self,
        const LocationAddress *address,
-       LocationPosition **position,
-       LocationAccuracy **accuracy)
+       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 (position, LOCATION_ERROR_PARAMETER);
-       g_return_val_if_fail (accuracy, 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, accuracy);
+
+       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,
-       LocationPosition **position,
-       LocationAccuracy **accuracy)
+       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 (position, LOCATION_ERROR_PARAMETER);
-       g_return_val_if_fail (accuracy, 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, accuracy);
+
+       return LOCATION_IELEMENT_GET_INTERFACE (self)->get_geocode_freeform (self, address, position_list, accuracy_list);
 }
 
 int
index 39a4815..a283321 100644 (file)
@@ -63,8 +63,8 @@ typedef int (*TYPE_START_FUNC)(LocationIElement *self);
 typedef int (*TYPE_STOP_FUNC) (LocationIElement *self);
 typedef int (*TYPE_GET_POSITION)(LocationIElement *self, LocationPosition **position, LocationAccuracy **accuracy);
 typedef int (*TYPE_GET_VELOCITY)(LocationIElement *self, LocationVelocity **velocity, LocationAccuracy **accuracy);
-typedef int (*TYPE_GET_GEOCODE)(LocationIElement *self, const LocationAddress *address, LocationPosition **position, LocationAccuracy **accuracy);
-typedef int (*TYPE_GET_GEOCODE_FREEFORM)(LocationIElement *self, const gchar *address, LocationPosition **position, LocationAccuracy **accuracy);
+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);
@@ -104,8 +104,8 @@ int location_ielement_start (LocationIElement *self);
 int location_ielement_stop(LocationIElement *self);
 int location_ielement_get_position (LocationIElement *self, LocationPosition **position, LocationAccuracy **accuracy);
 int location_ielement_get_velocity (LocationIElement *self, LocationVelocity **velocity, LocationAccuracy **accuracy);
-int location_ielement_get_geocode (LocationIElement *self, const LocationAddress *address, LocationPosition **position, LocationAccuracy **accuracy);
-int location_ielement_get_geocode_freeform (LocationIElement *self, const gchar *address, LocationPosition **position, LocationAccuracy **accuracy);
+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);
index 406a48f..868e743 100644 (file)
@@ -100,7 +100,9 @@ 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);
+
 G_END_DECLS
 
 #endif
index 7c8d7d1..a4469af 100644 (file)
@@ -52,8 +52,8 @@ 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, LocationPosition **position, LocationAccuracy **accuracy);         ///< This is used for getting a geocode from a plug-in.
-       int (*get_geocode_freetext)(gpointer handle, const gchar *address, LocationPosition **position, LocationAccuracy **accuracy);          ///< This is used for getting a geocode by using a free-fromed address from a plug-in.
+       int (*get_geocode)(gpointer handle, const LocationAddress *address, 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);          ///< 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); ///< 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);             ///< 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);              ///< This is used for getting a geocode by using a free-fromed address from a plug-in asynchronously.
index 585cbe0..4ef257b 100644 (file)
@@ -52,7 +52,7 @@ typedef enum
 struct _LocationPosition
 {
        guint timestamp;        ///< Time stamp.
-       guint updated_timestamp;        ///< lastest updated time stamp.
+       guint updated_timestamp;        ///< latest updated time stamp.
        gdouble latitude;       ///< Latitude data.
        gdouble longitude;      ///< Longitude data.
        gdouble altitude;       ///< Altitude data.
@@ -64,10 +64,13 @@ struct _LocationPosition
  */
 struct _LocationLastPosition
 {
+       LocationMethod method;  ///< Location Method.
        guint timestamp;        ///< Time stamp.
        gdouble latitude;       ///< Latitude data.
        gdouble longitude;      ///< Longitude data.
-       gdouble accuracy;       ///< Accuracy data.
+       gdouble altitude;       ///< Altitude data.
+       gdouble horizontal_accuracy;    ///< Horizontal accuracy data.
+       gdouble vertical_accuracy;      ///< Vertical accuracy data.
 };
 
 GType location_position_get_type (void);
@@ -99,7 +102,7 @@ LocationPosition *location_position_new (guint timestamp, gdouble latitude, gdou
 void location_position_free (LocationPosition *position);
 
 /**
- * @brief   Compares two positoins for equality, returning TRUE if they are equal.
+ * @brief   Compares two positions for equality, returning TRUE if they are equal.
  * @remarks None.
  * @pre     #location_init should be called before.\n
  * @post    None.
index a7a38ce..f91f98f 100644 (file)
@@ -40,15 +40,16 @@ typedef struct {
        guint prn;       ///< The PRNs(Pseudo-Random Noise code) of a satellite.
        gboolean used;   ///< TRUE if currently used satellite.
        guint elevation; ///< The elevation of a satellite.
-       guint azimuth;   ///< The degress from true north 000 to 359 of a satellite.
+       guint azimuth;   ///< The degree from true north 000 to 359 of a satellite.
        gint snr;        ///< The signal-to-noise ratio, dB of a satellite.
 } LocationSatelliteDetail;
 
 /**
- * @brief This represents position information such as number of satelltes in used or in view.
+ * @brief This represents position information such as number of satellites in used or in view.
  */
 struct _LocationSatellite
 {
+       guint timestamp;                           ///< Time stamp.
        guint num_of_sat_inview;                   ///< The number of satellites in view.
        guint num_of_sat_used;                     ///< The number of satellites in used.
        LocationSatelliteDetail* sat_inview;       ///< The information of satellites in view .
@@ -99,7 +100,7 @@ LocationSatellite *location_satellite_copy (const LocationSatellite *satellite);
  * @param [out]  prn - The PRNs(Pseudo-Random Noise code) of a #LocationSatellite
  * @param [out]  used - TRUE if a #LocationSatellite in used.
  * @param [out]  elevation - The elevation of a #LocationSatellite
- * @param [out]  azimuth - The degress from true north 000 to 359 of a#LocationSatellite
+ * @param [out]  azimuth - The degree from true north 000 to 359 of a#LocationSatellite
  * @param [out]  snr - The signal-to-noise ratio, dB of #LocationSatellite
  * @return gboolean
  * @retval\n
@@ -118,7 +119,7 @@ gboolean location_satellite_get_satellite_details (const LocationSatellite *sate
  * @param [in]  prn - The PRNs(Pseudo-Random Noise code) of a #LocationSatellite
  * @param [in]  used - TRUE if a #LocationSatellite in used.
  * @param [in]  elevation - The elevation of a #LocationSatellite
- * @param [in]  azimuth - The degress from true north 000 to 359 of a#LocationSatellite
+ * @param [in]  azimuth - The degree from true north 000 to 359 of a#LocationSatellite
  * @param [in]  snr - The signal-to-noise ratio, dB of #LocationSatellite
  * @return gboolean
  * @retval\n
index d380855..9f7e73a 100644 (file)
@@ -97,5 +97,5 @@ gint location_setting_ignore_notify(const gchar* path, SettingCB setting_cb)
                return -1;
        }
        LOCATION_LOGD("vconf notify removed [%s]", path);
-       return -1;
+       return 0;
 }
index fbb1a19..705f778 100644 (file)
@@ -28,7 +28,7 @@
 
 /**
  * @file location-setting.h
- * @brief This file contains the defintions and functions for setting.
+ * @brief This file contains the definitions and functions for setting.
  * @addtogroup LocationInternal
  * @{
  * @}
 
 #define VCONF_LOCATION_PATH            "db/location"
 
-#define LOCATION_POSITION_PATH                 VCONF_LOCATION_PATH"/position"
-#define LAST_TIMESTAMP                 LOCATION_POSITION_PATH"/Timestamp"
-#define LAST_POSITION                  LOCATION_POSITION_PATH"/LastPosition"
-#define LAST_ACCURACY                  LOCATION_POSITION_PATH"/LastAccuracy"
+#define LOCATION_LAST_POSITION_PATH            VCONF_LOCATION_PATH"/lastposition"
+#define GPS_LAST_POSITION_PATH                 LOCATION_LAST_POSITION_PATH"/gps"
+#define WPS_LAST_POSITION_PATH                 LOCATION_LAST_POSITION_PATH"/wps"
+#define SPS_LAST_POSITION_PATH                 LOCATION_LAST_POSITION_PATH"/sps"
+
+#define GPS_LAST_TIMESTAMP     GPS_LAST_POSITION_PATH"/Timestamp"
+#define GPS_LAST_LATITUDE      GPS_LAST_POSITION_PATH"/Latitude"
+#define GPS_LAST_LONGITUDE     GPS_LAST_POSITION_PATH"/Longitude"
+#define GPS_LAST_ALTITUDE      GPS_LAST_POSITION_PATH"/Altitude"
+#define GPS_LAST_HORACCURACY   GPS_LAST_POSITION_PATH"/HorAccuracy"
+#define GPS_LAST_VERACCURACY   GPS_LAST_POSITION_PATH"/VerAccuracy"
+
+#define WPS_LAST_TIMESTAMP     WPS_LAST_POSITION_PATH"/Timestamp"
+#define WPS_LAST_LATITUDE      WPS_LAST_POSITION_PATH"/Latitude"
+#define WPS_LAST_LONGITUDE     WPS_LAST_POSITION_PATH"/Longitude"
+#define WPS_LAST_ALTITUDE      WPS_LAST_POSITION_PATH"/Altitude"
+#define WPS_LAST_HORACCURACY   WPS_LAST_POSITION_PATH"/HorAccuracy"
+#define WPS_LAST_VERACCURACY   WPS_LAST_POSITION_PATH"/VerAccuracy"
+
+#define SPS_LAST_TIMESTAMP     SPS_LAST_POSITION_PATH"/Timestamp"
+#define SPS_LAST_LATITUDE      SPS_LAST_POSITION_PATH"/Latitude"
+#define SPS_LAST_LONGITUDE     SPS_LAST_POSITION_PATH"/Longitude"
+#define SPS_LAST_ALTITUDE      SPS_LAST_POSITION_PATH"/Altitude"
+#define SPS_LAST_HORACCURACY   SPS_LAST_POSITION_PATH"/HorAccuracy"
+#define SPS_LAST_VERACCURACY   SPS_LAST_POSITION_PATH"/VerAccuracy"
 
 #define GPS_ENABLED                    VCONFKEY_LOCATION_ENABLED
 #define LOCATION_SETTING_PATH          VCONF_LOCATION_PATH"/setting"
index eb2af00..263dc2f 100644 (file)
@@ -74,9 +74,7 @@ position_signaling (LocationObject *obj,
        GList *boundary_list = prev_bound;
        LocationBoundary *boundary = NULL;
 
-       if (prev_enabled == FALSE) enable_signaling(obj, signals, prev_enabled, enabled, pos->status);
-
-       if(*prev_pos || !*prev_acc || location_accuracy_level_compare(*prev_acc, acc) != -1 ||
+       if(!*prev_pos || !*prev_acc || location_accuracy_level_compare(*prev_acc, acc) != -1 ||
                        (pos->timestamp - (*prev_pos)->timestamp) > POS_EXPIRATION_TIME) {
 
                if(*prev_pos) {
@@ -140,8 +138,6 @@ velocity_signaling (LocationObject *obj,
 
        guint updated_timestamp = 0;
 
-       if (prev_enabled == FALSE) enable_signaling(obj, signals, prev_enabled, enabled, LOCATION_STATUS_NO_FIX);
-
        if(*prev_vel) {
                updated_timestamp = (*prev_vel)->updated_timestamp;
                if(!location_velocity_equal(*prev_vel, vel)) {
index 106053b..4f54fed 100644 (file)
@@ -37,6 +37,7 @@
 typedef struct _LocationSpsPrivate {
        LocationSpsMod* mod;
        gboolean is_started;
+       gboolean set_noti;
        gboolean enabled;
        guint    interval;
        LocationPosition *pos;
@@ -124,14 +125,24 @@ location_setting_sps_cb(keynode_t *key,
        LocationSpsPrivate* priv = GET_PRIVATE(self);
        g_return_if_fail (priv->mod);
        g_return_if_fail (priv->mod->handler);
-       if (0 == location_setting_get_key_val(key) && priv->mod->ops.stop) {
-               LOCATION_LOGD("location stopped by setting");
-               priv->mod->ops.stop(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_key_val(key) && priv->mod->ops.start) {
-               LOCATION_LOGD("location resumed by setting");
-               priv->mod->ops.start (priv->mod->handler, sps_status_cb, sps_position_cb, sps_velocity_cb, self);
+       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
@@ -143,17 +154,39 @@ location_sps_start (LocationSps *self)
        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);
-       setting_retval_if_fail(GPS_ENABLED);
-       setting_retval_if_fail(SENSOR_ENABLED);
+
        if( priv->is_started == TRUE) return LOCATION_ERROR_NONE;
 
-       int 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;
-               location_setting_add_notify (GPS_ENABLED, location_setting_sps_cb, self);
-               location_setting_add_notify (SENSOR_ENABLED, location_setting_sps_cb, self);
+       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;
 }
 
@@ -165,14 +198,32 @@ location_sps_stop (LocationSps *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);
-       if (priv->is_started == FALSE) return LOCATION_ERROR_NONE;
 
-       int ret = priv->mod->ops.stop (priv->mod->handler);
-       if (ret == LOCATION_ERROR_NONE){
-               priv->is_started = FALSE;
-               location_setting_ignore_notify (GPS_ENABLED, location_setting_sps_cb);
-               location_setting_ignore_notify (SENSOR_ENABLED, location_setting_sps_cb);
+       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;
 }
 
index fb74707..ab0c147 100644 (file)
 
 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.
@@ -49,6 +53,7 @@ typedef enum {
        LOCATION_ERROR_NETWORK_NOT_CONNECTED, ///< Network is not connected.
        LOCATION_ERROR_CONFIGURATION,  ///< Configuration setting is not correct.
        LOCATION_ERROR_PARAMETER,      ///< Input parameter is not correct.
+       LOCATION_ERROR_NOT_FOUND,      ///< Output is not found.
        LOCATION_ERROR_UNKNOWN,        ///< Unknown error.
 } LocationError;
 
@@ -73,6 +78,7 @@ 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.
@@ -89,7 +95,7 @@ typedef GObject LocationObject;
 typedef struct _LocationPosition   LocationPosition;
 
 /**
- * @brief This represents last known position information such as latitude-longitud values and accuracy.
+ * @brief This represents last known position information such as latitude-longitude values and accuracy.
  */
 typedef struct _LocationLastPosition   LocationLastPosition;
 
@@ -109,12 +115,12 @@ typedef struct _LocationAccuracy   LocationAccuracy;
 typedef struct _LocationAddress    LocationAddress;
 
 /**
- * @brief This represents boundary information such as rectagular or circle area.
+ * @brief This represents boundary information such as rectangular or circle area.
  */
 typedef struct _LocationBoundary   LocationBoundary;
 
 /**
- * @brief This represents position information such as number of satelltes in used or in view.
+ * @brief This represents position information such as number of satellites in used or in view.
  */
 typedef struct _LocationSatellite  LocationSatellite;
 
@@ -124,9 +130,9 @@ typedef struct _LocationSatellite  LocationSatellite;
 typedef struct _LocationPOIInfo    LocationPOIInfo;
 
 /**
- * @brief This represents callback function which will be called to give postiion information.
+ * @brief This represents callback function which will be called to give position information.
  */
-typedef void (*LocationPositionCB)(LocationError error, LocationPosition *position, LocationAccuracy *acc, gpointer userdata);
+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.
index 5b69e7d..8d11352 100644 (file)
@@ -40,6 +40,7 @@
 typedef struct _LocationWpsPrivate {
        LocationWpsMod* mod;
        gboolean is_started;
+       gboolean set_noti;
        gboolean enabled;
        guint    interval;
        LocationPosition *pos;
@@ -118,14 +119,23 @@ location_setting_wps_cb(keynode_t *key,
        LocationWpsPrivate* priv = GET_PRIVATE(self);
        g_return_if_fail (priv->mod);
        g_return_if_fail (priv->mod->handler);
-       if (0 == location_setting_get_key_val(key) && priv->mod->ops.stop) {
-               LOCATION_LOGD("location stopped by setting");
-               priv->mod->ops.stop(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_key_val(key) && priv->mod->ops.start) {
-               LOCATION_LOGD("location resumed by setting");
-               priv->mod->ops.start (priv->mod->handler, wps_status_cb, wps_position_cb, wps_velocity_cb, self);
+       else {
+               if (1 == location_setting_get_int(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, self);
+                       if (ret == LOCATION_ERROR_NONE) priv->is_started = TRUE;
+               }
        }
+
 }
 
 static int
@@ -136,16 +146,37 @@ location_wps_start (LocationWps *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);
-       setting_retval_if_fail (GPS_ENABLED);
-       setting_retval_if_fail (NETWORK_ENABLED);
+
        if (priv->is_started == TRUE) return LOCATION_ERROR_NONE;
 
-       int ret = priv->mod->ops.start (priv->mod->handler, wps_status_cb, wps_position_cb, wps_velocity_cb, self);
-       if (ret == LOCATION_ERROR_NONE) {
-               priv->is_started = TRUE;
-               location_setting_add_notify (GPS_ENABLED, location_setting_wps_cb, self);
-               location_setting_add_notify (NETWORK_ENABLED, location_setting_wps_cb, self);
+       int ret = LOCATION_ERROR_NONE;
+       int noti_err = 0;
+
+       if (!location_setting_get_int(GPS_ENABLED) || !location_setting_get_int(NETWORK_ENABLED)) {
+               ret = LOCATION_ERROR_NOT_ALLOWED;
+       }
+       else {
+               ret = priv->mod->ops.start (priv->mod->handler, wps_status_cb, wps_position_cb, wps_velocity_cb, self);
+               if (ret == LOCATION_ERROR_NONE) {
+                       priv->is_started = TRUE;
+               }
+               else {
+                       return ret;
+               }
        }
+
+       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;
+               }
+               priv->set_noti = TRUE;
+       }
+
        return ret;
 }
 
@@ -157,14 +188,32 @@ location_wps_stop (LocationWps *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);
-       if( priv->is_started == FALSE) return LOCATION_ERROR_NONE;
 
-       int ret = priv->mod->ops.stop (priv->mod->handler);
-       if (ret == LOCATION_ERROR_NONE) {
-               priv->is_started = FALSE;
-               location_setting_ignore_notify (GPS_ENABLED, location_setting_wps_cb);
-               location_setting_ignore_notify (NETWORK_ENABLED, location_setting_wps_cb);
+       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_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;
+               }
+               priv->set_noti = FALSE;
+       }
+
        return ret;
 }
 
@@ -306,6 +355,7 @@ location_wps_init (LocationWps *self)
        if(!priv->mod) LOCATION_LOGW("module loading failed");
 
        priv->is_started = FALSE;
+       priv->set_noti = FALSE;
        priv->enabled= FALSE;
        priv->interval = LOCATION_UPDATE_INTERVAL_DEFAULT;
 
index 5afe973..637aef5 100644 (file)
@@ -180,60 +180,101 @@ location_get_position (LocationObject *obj,
        LocationAccuracy **accuracy)
 {
        g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
+       g_return_val_if_fail (position, LOCATION_ERROR_PARAMETER);
+       g_return_val_if_fail (accuracy, LOCATION_ERROR_PARAMETER);
        return location_ielement_get_position (LOCATION_IELEMENT(obj), position, accuracy);
 }
 
 EXPORT_API int
-location_get_last_known_position (LocationObject *obj,
+location_get_last_position (LocationObject *obj, LocationMethod method,
+       LocationPosition **position,
+       LocationAccuracy **accuracy)
+{
+       g_return_val_if_fail (position, LOCATION_ERROR_PARAMETER);
+       g_return_val_if_fail (accuracy, LOCATION_ERROR_PARAMETER);
+
+       return LOCATION_ERROR_NONE;
+}
+
+EXPORT_API int
+location_get_last_known_position (LocationObject *obj, LocationMethod method,
        LocationLastPosition *last_position)
 {
        g_return_val_if_fail (last_position, LOCATION_ERROR_PARAMETER);
 
-       int ret = -1;
-       int lat, lon, acc;
-       char position[MAX_KEY_LENGTH + 1] = {0,};
-
-       snprintf(position, MAX_KEY_LENGTH + 1, "%s", location_setting_get_string(LAST_POSITION));
-       if (position[0] != '\0') {
-               location_last_position_a2i(position, &lat, &lon);
-               LOCATION_LOGD("location_last_position_a2i [%s][%d/%d]", position, lat, lon);
-               acc = location_setting_get_int(LAST_ACCURACY);
-
-               last_position->latitude = lat * 0.0001;
-               last_position->longitude = lon * 0.0001;
-               last_position->accuracy = acc * 0.0001;
-               LOCATION_LOGD("last_position [%f/%f]", last_position->latitude, last_position->longitude);
-               ret = LOCATION_ERROR_NONE;
-       } else {
-               LOCATION_LOGD("location_last_position is empty");
-               ret = LOCATION_ERROR_UNKNOWN;
+       LocationMethod redefined_method = method;
+
+       if (!obj) redefined_method = LOCATION_METHOD_HYBRID;
+
+       if (redefined_method == LOCATION_METHOD_HYBRID) {
+               int gps_timestamp = 0, wps_timestamp = 0, sps_timestamp = 0;
+               int latest_timestamp = 0;
+
+               redefined_method = LOCATION_METHOD_SPS;
+               vconf_get_int(GPS_LAST_TIMESTAMP, &gps_timestamp);
+               vconf_get_int(WPS_LAST_TIMESTAMP, &wps_timestamp);
+               vconf_get_int(SPS_LAST_TIMESTAMP, &sps_timestamp);
+
+               redefined_method = LOCATION_METHOD_SPS;
+               latest_timestamp = sps_timestamp;
+               if (gps_timestamp > sps_timestamp) {
+                       redefined_method = LOCATION_METHOD_GPS;
+                       latest_timestamp = gps_timestamp;
+               }
+
+               if (wps_timestamp > latest_timestamp) {
+                       redefined_method = LOCATION_METHOD_WPS;
+               }
+               
        }
 
-       return ret;
+       if (get_last_known_position (redefined_method, last_position)) {
+               return LOCATION_ERROR_UNKNOWN;
+       }
+
+       return LOCATION_ERROR_NONE;
+}
+
+EXPORT_API int
+location_get_satellite (LocationObject *obj, LocationSatellite **satellite)
+{
+       g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
+       g_return_val_if_fail (satellite, LOCATION_ERROR_PARAMETER);
+
+       return LOCATION_ERROR_NONE;;
+}
+
+EXPORT_API int
+location_get_last_satellite (LocationObject *obj, LocationSatellite **satellite)
+{
+       g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
+       g_return_val_if_fail (satellite, LOCATION_ERROR_PARAMETER);
+
+       return LOCATION_ERROR_NONE;;
 }
 
 EXPORT_API int
 location_get_position_from_address (LocationObject *obj,
        const LocationAddress *address,
-       LocationPosition **position,
-       LocationAccuracy **accuracy)
+       GList **position_list,
+       GList **accuracy_list)
 {
        g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
        g_return_val_if_fail (geocode, LOCATION_ERROR_NOT_AVAILABLE);
        g_return_val_if_fail (is_connected_network(), LOCATION_ERROR_NETWORK_NOT_CONNECTED);
-       return location_ielement_get_geocode (LOCATION_IELEMENT(geocode), address, position, accuracy);
+       return location_ielement_get_geocode (LOCATION_IELEMENT(geocode), address, position_list, accuracy_list);
 }
 
 EXPORT_API int
 location_get_position_from_freeformed_address (LocationObject *obj,
        const gchar *address,
-       LocationPosition **position,
-       LocationAccuracy **accuracy)
+       GList **position_list,
+       GList **accuracy_list)
 {
        g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
        g_return_val_if_fail (geocode, 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(geocode), address, position, accuracy);
+       return location_ielement_get_geocode_freeform (LOCATION_IELEMENT(geocode), address, position_list, accuracy_list);
 }
 
 EXPORT_API int
@@ -242,10 +283,24 @@ location_get_velocity (LocationObject *obj,
        LocationAccuracy **accuracy)
 {
        g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
+       g_return_val_if_fail (velocity, LOCATION_ERROR_PARAMETER);
+       g_return_val_if_fail (accuracy, LOCATION_ERROR_PARAMETER);
+
        return location_ielement_get_velocity (LOCATION_IELEMENT(obj), velocity, accuracy);
 }
 
 EXPORT_API int
+location_get_last_velocity (LocationObject *obj,
+       LocationVelocity **velocity,
+       LocationAccuracy **accuracy)
+{
+       g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
+       g_return_val_if_fail (velocity, LOCATION_ERROR_PARAMETER);
+       g_return_val_if_fail (accuracy, LOCATION_ERROR_PARAMETER);
+       return LOCATION_ERROR_NONE;
+}
+
+EXPORT_API int
 location_get_address (LocationObject *obj,
        LocationAddress **address,
        LocationAccuracy **accuracy)
index 62888e1..42f6f58 100644 (file)
@@ -160,6 +160,77 @@ int location_free (LocationObject *obj);
 #include <location.h>
 static GMainLoop *loop = NULL;
 
+static void cb_service_enabled (GObject *self, guint status, gpointer 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);
+
+       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_updated (GObject *self,
+       guint type,
+       gpointer data,
+       gpointer accuracy,
+       gpointer 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;
+       }
+}
+
+
 int main (int argc, char *argv[])
 {
        LocationObject *loc = NULL;
@@ -172,6 +243,9 @@ int main (int argc, char *argv[])
 
        g_object_set(loc, "update-interval", interval, NULL);
 
+       g_signal_connect (loc, "service-enabled", G_CALLBACK(cb_service_enabled), loc);
+       g_signal_connect (loc, "service-updated", G_CALLBACK(cb_service_updated), loc);
+
        location_start(loc);
        loop = g_main_loop_new (NULL, TRUE);
        g_main_loop_run (loop);  // GMainLoop is needed for receiving signals.
@@ -179,8 +253,8 @@ int main (int argc, char *argv[])
        // ...
        return 0;
 }
- * @endcode
- */
+* @endcode
+*/
 int location_start (LocationObject *obj);
 
 /**
@@ -360,22 +434,133 @@ int main (int argc, char *argv[])
 }
  * @endcode
  */
-int location_get_position (LocationObject *obj, LocationPosition **position,   LocationAccuracy **accuracy);
+int location_get_position (LocationObject *obj, LocationPosition **position, LocationAccuracy **accuracy);
 
 /**
  * @brief
- * Get last known position information with estimate of the accuracy.
- * @remarks None.
+ * Get last position information with estimate of the accuracy.
+ * @remarks This API is not implemented now. \n
+ *   Out parameters are should be freed.
  * @pre
  * #location_init should be called before.
  * @post None.
  * @param [in]
  * obj - a #LocationObject created by #location_new
+ * @param [out]
+ * position - a new #LocationPosition
+ * @param [out]
+ * accuracy - a new #LocationAccuracy
+ * @return int
+ * @retval 0                              Success
+ *
+ * Please refer #LocationError for more information.
+ * @see location_get_position
+ * @par Example
+ * @code
+#include <location.h>
+
+int main (int argc, char *argv[])
+{
+       LocationObject *loc = NULL;
+       int ret = 0;
+       LocationPosition *last_pos = NULL;
+       LocationAccuracy *last_acc = NULL;
+
+       location_init ();
+       loc  = location_new (LOCATION_METHOD_GPS);
+       if(!loc){
+               g_debug("location_new failed");
+               return -1;
+       }
+
+       if (LOCATION_ERROR_NONE == location_get_last_position (loc, LOCATION_METHOD_GPS, &last_pos, &last_acc)) {
+               g_debug ("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)",
+                       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");
+
+       location_free (loc);
+
+       return 0;
+}
+ * @endcode
+ */
+int location_get_last_position (LocationObject *obj, LocationMethod method, LocationPosition **position, LocationAccuracy **accuracy);
+
+/**
+ * @brief
+ * Get last satellite information.
+ * @remarks This API is not implemented now. \n
+ *   Out parameters are should be freed.
+ * @pre
+ * #location_init should be called before.
+ * @post None.
  * @param [in]
- * last_position - a #LocationLastPosition
+ * obj - a #LocationObject created by #location_new
+ * @param [out] satellite - a new #LocationSatellite
+ * @return int
+ * @retval 0                              Success
+ * Please refer #LocationError for more information.
+ * @see location_get_last_satellite
+ * @par Example
+ * @code
+#include <location.h>
+
+int main (int argc, char *argv[])
+{
+       LocationObject *loc = NULL;
+       int ret = 0, idx = 0;
+       LocationSatellite *sat = NULL;
+       guint prn;
+       gboolean used;
+       guint elevation;
+       guint azimuth;
+       gint snr;
+
+       location_init ();
+       loc  = location_new (LOCATION_METHOD_GPS);
+       if(!loc){
+               g_debug("location_new failed");
+               return -1;
+       }
+
+       if (LOCATION_ERROR_NONE == location_get_satellite (loc, &sat)) {
+               g_debug ("SYNC>> Current Sattelite> satellite in view = %d, satellite in used = %d", sat->num_of_sat_inview, sat->num_of_sat_used);
+               g_debug ("\tinview satellite information = ");
+               for (idx=0; idx<sat->num_of_sat_inview; idx++) {
+                       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);
+               }
+               location_satellite_free (sat);
+       } else g_warning ("SYNC>> Current satellite> failed");
+
+       location_free (loc);
+
+       return 0;
+}
+ * @endcode
+ */
+int location_get_satellite (LocationObject *obj, LocationSatellite **satellite);
+
+/**
+ * @brief
+ * Get last satellite information.
+ * @remarks This API is not implemented now. \n
+ *   Out parameters are should be freed.
+ * @pre
+ * #location_init should be called before.
+ * @post None.
+ * @param [in]
+ * obj - a #LocationObject created by #location_new
+ * @param [out]
+ * satellite - a new #LocationSatellite
  * @return int
  * @retval 0                              Success
  *
+ * Please refer #LocationError for more information.
  * @par Example
  * @code
 #include <location.h>
@@ -383,24 +568,46 @@ int location_get_position (LocationObject *obj, LocationPosition **position,      Loc
 int main (int argc, char *argv[])
 {
        LocationObject *loc = NULL;
-       LocationLastPosition last_pos;
+       int ret = 0, idx = 0;
+       LocationSatellite *last_sat = NULL;
+       guint prn;
+       gboolean used;
+       guint elevation;
+       guint azimuth;
+       gint snr;
+
        location_init ();
        loc  = location_new (LOCATION_METHOD_GPS);
-       if (!loc) {
+       if(!loc){
                g_debug("location_new failed");
                return -1;
        }
 
-       location_get_last_known_position(loc, &last_pos);
-       g_debug ("Last known position > lat: %f, long: %f, acc: %f", last_pos.latitude, last_pos.longitude, last_pos.accuracy);
+       if (LOCATION_ERROR_NONE == location_get_last_satellite (loc, &last_sat)) {
+               g_debug ("SYNC>> Last Sattelite> satellite in view = %d, satellite in used = %d", last_sat->num_of_sat_inview, last_sat->num_of_sat_used);
+               g_debug ("\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);
+               }
+               location_satellite_free (last_sat);
+       } else g_warning ("SYNC>> Last satellite> failed");
 
        location_free (loc);
+
        return 0;
 }
  * @endcode
  */
-int location_get_last_known_position (LocationObject *obj, LocationLastPosition *last_position);
+int location_get_last_satellite (LocationObject *obj, LocationSatellite **satellite);
 
+/**
+ * @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
@@ -415,9 +622,9 @@ int location_get_last_known_position (LocationObject *obj, LocationLastPosition
  * @param [in]
  * address - a #LocationAddress
  * @param [out]
- * position - a new #LocationPosition
+ * position_list - a list of #LocationPosition
  * @param [out]
- * accuracy - a new #LocationAccuracy
+ * accuracy_list - a list of #LocationAccuracy
  * @return int
  * @retval 0                              Success.
  *
@@ -428,6 +635,26 @@ int location_get_last_known_position (LocationObject *obj, LocationLastPosition
  * @code
 #include <location.h>
 
+static void PrintPos (gpointer data, gpointer user_data)
+{
+       LocationPosition *pos = (LocationPosition *)data;
+
+       if (pos) {
+               g_debug("time: [%d], latitude: [%f], longitude: [%f], altitude: [%f]\n", pos->timestamp, pos->latitude, pos->longitude, pos->altitude);
+               location_position_free (pos);
+       }
+}
+
+static void PrintAcc (gpointer data, gpointer user_data)
+{
+       LocationAccuracy *acc = (LocationAccuracy *)data;
+
+       if (acc) {
+               g_debug("level: [%d], horizontal_accuracy: [%f], vertical_accuracy: [%f]\n", acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
+               location_accuracy_free (acc);
+       }
+}
+
 int main (int argc, char *argv[])
 {
        LocationObject *loc = NULL;
@@ -440,27 +667,30 @@ int main (int argc, char *argv[])
                return -1;
        }
 
-       LocationPosition *pos = NULL;
-       LocationAccuracy *acc = NULL;
+       GList *pos_list = NULL;
+       GList *acc_list = NULL;
        LocationAddress *addr = NULL;
 
        addr = location_address_new ("1", "Post Street", NULL, "san jose", "ca", NULL, "95113");
-       if (LOCATION_ERROR_NONE == location_get_position_from_address(loc, addr, &pos, &acc)) {
-               g_debug ("SYNC>> position from address> 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);
+       if (LOCATION_ERROR_NONE == location_get_position_from_address(loc, addr, &pos_list, &acc_list)) {
+               g_list_foreach (pos_list, PrintPos, NULL);
+               g_list_foreach (acc_list, PrintAcc, NULL);
        } else g_warning ("SYNC>> position from address> failed");
-       location_address_free (addr);
 
+       if (pos_list) {
+               g_list_free (pos_list);
+       }
+       if (acc_list) {
+               g_list_free (acc_list);
+       }
+
+       location_address_free (addr);
        location_free (loc);
        return 0;
 }
  * @endcode
  */
-int location_get_position_from_address (LocationObject *obj, const LocationAddress *address, LocationPosition **position, LocationAccuracy **accuracy);
+int location_get_position_from_address (LocationObject *obj, const LocationAddress *address, GList **position_list, GList **accuracy_list);
 
 /**
  * @brief
@@ -489,12 +719,30 @@ int location_get_position_from_address (LocationObject *obj, const LocationAddre
  * @code
 #include <location.h>
 
+static void PrintPos (gpointer data, gpointer user_data)
+{
+       LocationPosition *pos = (LocationPosition *)data;
+
+       if (pos) {
+               g_debug("time: [%d], latitude: [%f], longitude: [%f], altitude: [%f]\n", pos->timestamp, pos->latitude, pos->longitude, pos->altitude);
+       }
+}
+
+static void PrintAcc (gpointer data, gpointer user_data)
+{
+       LocationAccuracy *acc = (LocationAccuracy *)data;
+
+       if (acc) {
+               g_debug("level: [%d], horizontal_accuracy: [%f], vertical_accuracy: [%f]\n", acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
+       }
+}
 static void
-cb_position_from_address (LocationError error, LocationPosition *pos, LocationAccuracy *acc, gpointer userdata)
+cb_position_from_address (LocationError error, GList *position_list, GList *accuracy_list, gpointer userdata)
 {
-       g_debug ("ASYNC>> location_get_position_from_address_async> time: %d, lat: %f, long: %f, alt: %f, status: %d",
-                       pos->timestamp, pos->latitude, pos->longitude, pos->altitude, pos->status);
-       g_debug ("\tAccuracy level %d (%.0f meters %.0f meters)", acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
+       if (position_list && accuracy_list) {
+               g_list_foreach (position_list, PrintPos);
+               g_list_foreach (accuracy_list, PrintAcc);
+       }
 }
 
 void get_position_from_address(LocationObject* loc)
@@ -523,9 +771,9 @@ int location_get_position_from_address_async (LocationObject *obj, const Locatio
  * @param [in]
  * address - Free-formed address string to be used
  * @param [out]
- * position - a new #LocationPosition
+ * position_list - a list of #LocationPosition
  * @param [out]
- * accuracy - a new #LocationAccuracy
+ * accuracy_list - a list of #LocationAccuracy
  * @return int
  * @retval 0                              Success
  *
@@ -536,6 +784,26 @@ int location_get_position_from_address_async (LocationObject *obj, const Locatio
  * @code
 #include <location.h>
 
+static void PrintPos (gpointer data, gpointer user_data)
+{
+       LocationPosition *pos = (LocationPosition *)data;
+
+       if (pos) {
+               g_debug("time: [%d], latitude: [%f], longitude: [%f], altitude: [%f]\n", pos->timestamp, pos->latitude, pos->longitude, pos->altitude);
+               location_position_free (pos);
+       }
+}
+
+static void PrintAcc (gpointer data, gpointer user_data)
+{
+       LocationAccuracy *acc = (LocationAccuracy *)data;
+
+       if (acc) {
+               g_debug("level: [%d], horizontal_accuracy: [%f], vertical_accuracy: [%f]\n", acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
+               location_accuracy_free (acc);
+       }
+}
+
 int main (int argc, char *argv[])
 {
        LocationObject *loc = NULL;
@@ -548,26 +816,22 @@ int main (int argc, char *argv[])
                return -1;
        }
 
-       LocationPosition *pos = NULL;
-       LocationAccuracy *acc = NULL;
+       GList *pos_list = NULL;
+       GList *acc_list = NULL;
        char* addr_str = g_strdup("4 N 2nd Street 95113");
        //Calling application must have an active data connection before using this function.
-       if (LOCATION_ERROR_NONE == location_get_position_from_freeformed_address(loc, addr_str, &pos, &acc)) {
-               g_debug ("SYNC>> position from freeformed address> 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);
+       if (LOCATION_ERROR_NONE == location_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);
        } else g_warning ("SYNC>> position from freeformed address> failed");
        g_free(addr_str);
 
-
        location_free (loc);
        return 0;
 }
  * @endcode
  */
-int location_get_position_from_freeformed_address (LocationObject *obj, const gchar *address, LocationPosition **position, LocationAccuracy **accuracy);
+int location_get_position_from_freeformed_address (LocationObject *obj, const gchar *address, GList **position_list, GList **accuracy_list);
 
 /**
  * @brief
@@ -596,12 +860,31 @@ int location_get_position_from_freeformed_address (LocationObject *obj, const gc
  * @code
 #include <location.h>
 
+static void PrintPos (gpointer data, gpointer user_data)
+{
+       LocationPosition *pos = (LocationPosition *)data;
+
+       if (pos) {
+               g_debug("time: [%d], latitude: [%f], longitude: [%f], altitude: [%f]\n", pos->timestamp, pos->latitude, pos->longitude, pos->altitude);
+       }
+}
+
+static void PrintAcc (gpointer data, gpointer user_data)
+{
+       LocationAccuracy *acc = (LocationAccuracy *)data;
+
+       if (acc) {
+               g_debug("level: [%d], horizontal_accuracy: [%f], vertical_accuracy: [%f]\n", acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
+       }
+}
+
 static void
-cb_position_from_freeformed_address (LocationError error, LocationPosition *pos, LocationAccuracy *acc, gpointer userdata)
+cb_position_from_freeformed_address (LocationError error, GList *position_list, GList *accuracy_list, gpointer userdata)
 {
-       g_debug ("ASYNC>> location_get_position_from_freeformed_address_async> time: %d, lat: %f, long: %f, alt: %f, status: %d",
-                       pos->timestamp, pos->latitude, pos->longitude, pos->altitude, pos->status);
-       g_debug ("\tAccuracy level %d (%.0f meters %.0f meters)", acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
+       if (position_list && accuracy_list) {
+               g_list_foreach (position_list, PrintPos);
+               g_list_foreach (accuracy_list, PrintAcc);
+       }
 }
 
 void get_position_from_address(LocationObject* loc)
@@ -691,6 +974,60 @@ int location_get_velocity (LocationObject *obj, LocationVelocity **velocity, Loc
 
 /**
  * @brief
+ * Get last velocity information with estimate of the accuracy.
+ * @remarks This API is not implemented now. \n
+ * Out parameters are should be freed.
+ * @pre
+ * #location_init should be called before.\n
+ * @post None.
+ * @param [in]
+ * obj - a #LocationObject created by #location_new
+ * @param [out]
+ * velocity - a new #LocationVelocity
+ * @param [out]
+ * accuracy - a new #LocationAccuracy
+ * @return int
+ * @retval 0                              Success
+ *
+ * Please refer #LocationError for more information.
+ * @see location_get_velocity
+ * @par Example
+ * @code
+#include <location.h>
+
+int main (int argc, char *argv[])
+{
+       LocationObject *loc = NULL;
+       LocationVelocity *last_vel = NULL;
+       LocationAccuracy *last_acc = NULL;
+       location_init ();
+
+       loc  = location_new (LOCATION_METHOD_GPS);
+       if(!loc){
+               g_debug("location_new failed");
+               return -1;
+       }
+
+       if (LOCATION_ERROR_NONE == location_get_last_velocity (loc, &last_vel, &last_acc)) {
+               g_debug ("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)",
+                       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.");
+
+       location_free (loc);
+
+       return 0;
+}
+ * @endcode
+ */
+int location_get_last_velocity (LocationObject *obj, LocationVelocity **velocity, LocationAccuracy **accuracy);
+
+
+/**
+ * @brief
  * Get current address information with estimate of the accuracy by using current position.
  * @remarks Out parameters are should be freed.
  * @pre
index 64f1273..4505288 100644 (file)
@@ -38,6 +38,28 @@ exit_program (gpointer data)
 }
 
 static void
+print_pos (gpointer data, gpointer user_data)
+{
+       LocationPosition *pos = (LocationPosition *)data;
+
+       if (pos) {
+               g_debug ("time: %d, lat: %f, long: %f, alt: %f, status: %d",
+                       pos->timestamp, pos->latitude, pos->longitude, pos->altitude, pos->status);
+               location_position_free (pos);
+       }
+}
+
+static void
+print_acc (gpointer data, gpointer user_data)
+{
+       LocationAccuracy *acc = (LocationAccuracy *)data;
+
+       if (acc) {
+               g_debug ("\tAccuracy level %d (%.0f meters %.0f meters)", acc->level, acc->horizontal_accuracy, acc->vertical_accuracy);
+               location_accuracy_free (acc);
+       }
+}
+static void
 cb_address (LocationError error,
        LocationAddress *addr,
        LocationAccuracy *acc,
@@ -61,27 +83,27 @@ cb_service_disabled (GObject *self,
 }
 
 static void
-cb_position_from_address (LocationError error, LocationPosition *pos, LocationAccuracy *acc, gpointer userdata)
+cb_position_from_address (LocationError error, GList *pos_list, GList *acc_list, gpointer userdata)
 {
        if (error != LOCATION_ERROR_NONE) {
                g_debug("cb_position_from_address failed: error=%d\n", error);
                return;
        }
-       g_debug ("ASYNC>> location_get_position_from_address_async> 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);
+
+       g_list_foreach (pos_list, print_pos, NULL);
+       g_list_foreach (acc_list, print_acc, NULL);
 }
 
 static void
-cb_position_from_freeformed_address (LocationError error, LocationPosition *pos, LocationAccuracy *acc, gpointer userdata)
+cb_position_from_freeformed_address (LocationError error, GList *pos_list, GList *acc_list, gpointer userdata)
 {
        if (error != LOCATION_ERROR_NONE) {
                g_debug("cb_position_from_freeformed_address failed: error=%d\n", error);
                return;
        }
-       g_debug ("ASYNC>> location_get_position_from_freeformed_address_async> 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);
+
+       g_list_foreach (pos_list, print_pos, NULL);
+       g_list_foreach (acc_list, print_acc, NULL);
 }
 
 static void
@@ -153,7 +175,7 @@ main (int argc, char *argv[])
        LocationObject *loc = NULL;
 
        // If application is executed by AUL, this is not needed.
-       g_setenv("PKG_NAME", "org.tizen.address-sample", 1);
+       g_setenv("PKG_NAME", "com.samsung.address-sample", 1);
 
        g_type_init();
        location_init ();
@@ -164,29 +186,26 @@ main (int argc, char *argv[])
                g_warning("location_new failed");
                return -1;
        }
+
        LocationPosition *pos = NULL;
        LocationAccuracy *acc = NULL;
+       GList *pos_list = NULL;
+       GList *acc_list = NULL;
        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, &acc);
+       LocationError err = location_get_position_from_address(loc, addr, &pos_list, &acc_list);
        if (LOCATION_ERROR_NONE == err) {
-               g_debug ("SYNC>> location_get_position_from_address() success> 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);
+               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);
        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, &acc);
+       err = location_get_position_from_freeformed_address(loc, addr_str, &pos_list, &acc_list);
        if (LOCATION_ERROR_NONE == err) {
-               g_debug ("SYNC>> location_get_position_from_freeformed_address() success> 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);
+               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);
        g_free(addr_str);
 
@@ -205,8 +224,9 @@ main (int argc, char *argv[])
        g_signal_connect (loc, "service-disabled", G_CALLBACK(cb_service_disabled), loc);
 
        g_timeout_add_seconds (3, async_request, loc);
-       if( LOCATION_ERROR_NONE != location_start (loc) ){
-               g_debug("location_start failed");
+       int ret = location_start (loc);
+       if( LOCATION_ERROR_NONE != ret ){
+               g_debug("location_start failed[%d]",ret);
                return -1;
        }
 
index de3a28e..f4bfff0 100644 (file)
@@ -28,7 +28,7 @@ main (int argc, char *argv[])
        LocationObject *loc = NULL;
 
        // If application is executed by AUL, this is not needed.
-       g_setenv("PKG_NAME", "org.tizen.cps-test", 1);
+       g_setenv("PKG_NAME", "com.samsung.cps-test", 1);
 
        location_init ();
 
index b989b44..23d5438 100644 (file)
@@ -168,7 +168,7 @@ main (int argc, char *argv[])
        LocationObject *loc = NULL;
 
        // If application is executed by AUL, this is not needed.
-       g_setenv("PKG_NAME", "org.tizen.gps-test", 1);
+       g_setenv("PKG_NAME", "com.samsung.gps-test", 1);
 
        location_init ();
 
index 03d36e3..4b6ae5d 100644 (file)
@@ -145,7 +145,7 @@ main (int argc, char *argv[])
        LocationObject *loc = NULL;
 
        // If application is executed by AUL, this is not needed.
-       g_setenv("PKG_NAME", "org.tizen.hybrid-test", 1);
+       g_setenv("PKG_NAME", "com.samsung.hybrid-test", 1);
 
        location_init ();
 
index a70895f..f7b2269 100644 (file)
@@ -28,7 +28,7 @@ main (int argc, char *argv[])
        LocationObject *loc = NULL;
 
        // If application is executed by AUL, this is not needed.
-       g_setenv("PKG_NAME", "org.tizen.ips-test", 1);
+       g_setenv("PKG_NAME", "com.samsung.ips-test", 1);
 
        location_init ();
 
index 0d3241e..b69070b 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include <glib.h>
+#include <string.h>
 #include <glib/gprintf.h>
 #include <gconf/gconf-client.h>
 #include <location/location.h>
@@ -184,6 +185,25 @@ static double PromptDB()
        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;
@@ -380,18 +400,17 @@ cb_service_updated (GObject *self,
 }
 
 static void cb_position (LocationError error,
-       LocationPosition *position,
-       LocationAccuracy *acc,
+       GList *pos_list,
+       GList *acc_list,
        gpointer userdata)
 {
        if (error != LOCATION_ERROR_NONE) {
                g_printf("cb_position failed: error=%d\n", error);
                return;
        }
-       char str[STR_MAX];
-       g_printf("userdata[0x%x] time: [%d], latitude: [%f], longitude: [%f], altitude: [%f]\n", (unsigned int)userdata, position->timestamp, position->latitude, position->longitude, position->altitude);
-       GetAccuracyLevel(str, acc->level);
-       g_printf("level: [%s], horizontal_accuracy: [%f], vertical_accuracy: [%f]\n", str, acc->horizontal_accuracy, acc->vertical_accuracy);
+
+       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)
@@ -474,19 +493,23 @@ static void print_menu()
        g_printf("4.   location_start\n");
        g_printf("5.   location_stop\n");
        g_printf("6.   location_get_position\n");
-       g_printf("6a.  location_get_last_known_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("10.  location_get_address\n");
-       g_printf("10a. location_get_address_async\n");
-       g_printf("11.  location_get_address_from_position\n");
-       g_printf("11a. location_get_address_from_position_async\n");
-       g_printf("12.  location_get_distance\n");
-       g_printf("13.  location_is_supported_method\n");
-       g_printf("14.  location_is_enabled_gps\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("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");
@@ -504,7 +527,7 @@ int main(int argc, char** argv)
        GError *gerr = NULL;
 
        // If application is executed by AUL, this is not needed.
-       g_setenv("PKG_NAME", "org.tizen.location-api-test", 1);
+       g_setenv("PKG_NAME", "com.samsung.location-api-test", 1);
 
        g_type_init();
        if( !g_thread_supported() )
@@ -541,7 +564,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_CPS[3] LOCATION_METHOD_IPS[4] LOCATION_METHOD_SPS[5]\n");
+                       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();
                        location_obj = location_new(method);
@@ -579,23 +602,44 @@ int main(int argc, char** argv)
                        if(pos) location_position_free(pos);
                        if(acc) location_accuracy_free(acc);
                } else if (0 == g_strcmp0("6a",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();
+                       LocationPosition *last_pos;
+                       LocationAccuracy *last_acc;
+                       int ret = 0;
+
+                       ret = location_get_last_position (location_obj, LOCATION_METHOD_GPS, &last_pos, &last_acc);
+                       if (ret == LOCATION_ERROR_NONE) {
+                               g_debug ("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)",
+                                       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[%d]",ret);
+
+               } 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, &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 latitude: [%f], longitude: [%f], accuracy: [%f]\n", last_pos.latitude, last_pos.longitude, last_pos.accuracy);
+                               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;
-                       LocationPosition *pos = NULL;
-                       LocationAccuracy *acc = NULL;
+                       GList *pos_list = NULL;
+                       GList *acc_list = NULL;
 
-                       g_printf("[0].San jose [1].¼ö¿ø»ï¼º [2].Suwon HQ [*].Custom\n");
+                       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 == 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];
@@ -622,25 +666,25 @@ int main(int argc, char** argv)
                                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, &acc);
+                       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_printf("time: [%d], latitude: [%f], longitude: [%f], altitude: [%f]\n", pos->timestamp, pos->latitude, pos->longitude, pos->altitude);
-                       if(pos) location_position_free(pos);
-                       if(acc) location_accuracy_free(acc);
+                       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("[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 == 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];
@@ -670,16 +714,16 @@ int main(int argc, char** argv)
                        g_idle_add((GSourceFunc)idle_position_from_address_async, data);
                }else if (0 == g_strcmp0("8",strOpt)) {
                        gchar* addr = NULL;
-                       LocationPosition *pos = NULL;
-                       LocationAccuracy *acc = NULL;
+                       GList *pos_list = NULL;
+                       GList *acc_list = NULL;
 
-                       g_printf("[0].San jose [1].¼ö¿ø»ï¼º [2].Suwon HQ [*].Custom\n");
+                       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("´ëÇѹα¹ °æ±âµµ ¼ö¿ø½Ã ¿µÅ뱸 ¸Åźµ¿ 436-52");
+                               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{
@@ -689,27 +733,26 @@ int main(int argc, char** argv)
                                buf[strlen(buf)-1]='\0';
                                addr = g_strdup(buf);
                        }
-                       ret = location_get_position_from_freeformed_address(location_obj, addr, &pos, &acc);
+                       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_printf("time: [%d], latitude: [%f], longitude: [%f], altitude: [%f]\n", pos->timestamp, pos->latitude, pos->longitude, pos->altitude);
+                               g_list_foreach (pos_list, PrintPos, NULL);
+                               g_list_foreach (acc_list, PrintAcc, NULL);
                        }
-                       if(pos) location_position_free(pos);
-                       if(acc) location_accuracy_free(acc);
                }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("[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("´ëÇѹα¹ °æ±âµµ ¼ö¿ø½Ã ¿µÅ뱸 ¸Åźµ¿ 436-52");
+                               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{
@@ -734,7 +777,57 @@ int main(int argc, char** argv)
                        }
                        if(vel) location_velocity_free(vel);
                        if(acc) location_accuracy_free(acc);
-               } else if(0 == g_strcmp0("10",strOpt) ){
+               }else if(0 == g_strcmp0("9a",strOpt) ){
+                       LocationVelocity *last_vel = NULL;
+                       LocationAccuracy *last_acc = NULL;
+                       if (LOCATION_ERROR_NONE == location_get_last_velocity (location_obj, &last_vel, &last_acc)) {
+                               g_debug ("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)",
+                                       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.");
+               }else if(0 == g_strcmp0("10",strOpt) ){
+                       int ret = 0, idx = 0;
+                       LocationSatellite *sat = NULL;
+                       guint prn;
+                       gboolean used;
+                       guint elevation;
+                       guint azimuth;
+                       gint snr;
+
+                       ret =  location_get_satellite (location_obj, &sat);
+                       if (ret == LOCATION_ERROR_NONE) {
+                               g_debug ("SYNC>> Current Sattelite> satellite in view = %d, satellite in used = %d", sat->num_of_sat_inview, sat->num_of_sat_used);
+                               g_debug ("\tinview satellite information = ");
+                               for (idx=0; idx<sat->num_of_sat_inview; idx++) {
+                                       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);
+                               }
+                               location_satellite_free (sat);
+                       } else g_warning ("SYNC>> Current satellite> failed. Error[%d]", ret);
+               }else if(0 == g_strcmp0("10a",strOpt) ){
+                       int ret = 0, idx = 0;
+                       LocationSatellite *last_sat = NULL;
+                       guint prn;
+                       gboolean used;
+                       guint elevation;
+                       guint azimuth;
+                       gint snr;
+
+                       ret = location_get_last_satellite (location_obj, &last_sat);
+
+                       if (ret == LOCATION_ERROR_NONE) {
+                               g_debug ("SYNC>> Last Sattelite> satellite in view = %d, satellite in used = %d", last_sat->num_of_sat_inview, last_sat->num_of_sat_used);
+                               g_debug ("\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);
+                               }
+                               location_satellite_free (last_sat);
+                       } else g_warning ("SYNC>> Last satellite> failed");
+               } else if(0 == g_strcmp0("11",strOpt) ){
                        LocationAddress *addr = NULL;
                        LocationAccuracy *acc = NULL;
                        ret = location_get_address(location_obj, &addr, &acc);
@@ -746,13 +839,13 @@ int main(int argc, char** argv)
                                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("10a",strOpt) ){
+               }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("11",strOpt) ){
+               }else if(0 == g_strcmp0("12",strOpt) ){
                        LocationPosition *pos = NULL;
                        LocationAddress *addr = NULL;
                        LocationAccuracy *acc = NULL;
@@ -777,7 +870,7 @@ int main(int argc, char** argv)
                        }
                        if(addr) location_address_free(addr);
                        if(acc) location_accuracy_free(acc);
-               }else if(0 == g_strcmp0("11a",strOpt) ){
+               }else if(0 == g_strcmp0("12a",strOpt) ){
                        IdleData* data = g_new0(IdleData, 1);
                        data->obj = location_obj;
                        data->addr_cb = cb_address;
@@ -796,7 +889,7 @@ int main(int argc, char** argv)
                                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("12",strOpt) ) {
+               }else if(0 == g_strcmp0("13",strOpt) ) {
 
                        gulong distance;
                        int ret = 0;
@@ -818,7 +911,7 @@ 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("13", strOpt)) {
+               }else if(0 == g_strcmp0("14", strOpt)) {
                        int method;
                        char method_str[STR_MAX] = {0, };
                        char input[8] = {0, };
@@ -855,7 +948,7 @@ int main(int argc, char** argv)
 
                        g_printf("Method[%s] is %s.", method_str, is_supported ? "supported" : "not supported");
 
-               }else if(0 == g_strcmp0("14", strOpt)) {
+               }else if(0 == g_strcmp0("15", strOpt)) {
                        gboolean is_enabled = FALSE;
                        is_enabled = location_is_enabled_gps(location_obj);
                        if(is_enabled == TRUE) g_printf("GPS is turned on");
index 7764341..d8c9745 100644 (file)
@@ -180,7 +180,7 @@ main (int argc, char *argv[])
        LocationObject *loc = NULL;
 
        // If application is executed by AUL, this is not needed.
-       g_setenv("PKG_NAME", "org.tizen.sps-test", 1);
+       g_setenv("PKG_NAME", "com.samsung.sps-test", 1);
 
        location_init ();
 
index 308ee9d..0d45e4a 100644 (file)
@@ -141,7 +141,7 @@ main (int argc, char *argv[])
        LocationObject *loc = NULL;
 
        // If application is executed by AUL, this is not needed.
-       g_setenv("PKG_NAME", "org.tizen.wps-test", 1);
+       g_setenv("PKG_NAME", "com.samsung.wps-test", 1);
 
        location_init ();