sync PRIVATE and RSA for tizen2.1 tizen_2.1 accepted/tizen/20130520.101053 submit/tizen/20130517.044936 submit/tizen_2.1/20130514.053126
authorGenie Kim <daejins.kim@samsung.com>
Wed, 8 May 2013 13:03:35 +0000 (22:03 +0900)
committerGenie Kim <daejins.kim@samsung.com>
Wed, 8 May 2013 13:03:35 +0000 (22:03 +0900)
42 files changed:
location/include/location-map-types.h
location/manager/Makefile.am
location/manager/location-accuracy.c
location/manager/location-cps.c [deleted file]
location/manager/location-cps.h [deleted file]
location/manager/location-gps.c
location/manager/location-hybrid.c
location/manager/location-ielement.c
location/manager/location-ielement.h
location/manager/location-position.c
location/manager/location-signaling-util.c
location/manager/location-signaling-util.h
location/manager/location-wps.c
location/manager/location.c
location/manager/location.h
location/map-service/location-geocode.c
location/map-service/location-geocode.h
location/map-service/location-landmark-ext.h
location/map-service/location-landmark.c
location/map-service/location-landmark.h
location/map-service/location-map-ielement.c
location/map-service/location-map-ielement.h
location/map-service/location-map-pref.c
location/map-service/location-map-pref.h
location/map-service/location-map-service.c
location/map-service/location-map-service.h
location/map-service/location-route-ext.h
location/map-service/location-route.c
location/map-service/location-route.h
location/map-service/map-internal.c
location/map-service/map-internal.h
location/map-service/map-service.c
location/module/Makefile.am
location/module/location-module.h
location/module/module-internal.c
location/module/module-internal.h
packaging/libslp-location.spec
tests/Makefile.am
tests/address-sample.c
tests/cps-test.c [deleted file]
tests/location-api-test.c
tests/map-service-test.c

index 7430986..45bac99 100644 (file)
@@ -47,6 +47,7 @@ typedef enum {
        MAP_SERVICE_PREF_PROPERTY,
 
        MAP_SERVICE_GEOCODE_TYPE,
+       MAP_SERVICE_GEOCODE_PREF_PROPERTY,
        MAP_SERVICE_REVERSE_GEOCODE_TYPE,
 
        MAP_SERVICE_POI_TYPE,
@@ -181,17 +182,34 @@ typedef enum {
     TRANSIT_TYPE_UNKNOWN = TRANSIT_TYPE_COUNT
 } TransitType;
 
+typedef enum
+{
+   OFFLINE, ///< Search offline
+   ONLINE,     ///< Search online
+   HYBRID      ///< Search online and offline, return results of one or both
+} ConnectivityMode;
+
 /**
  * @brief Location Map Object redefined by GObject.
  */
 typedef GObject LocationMapObject;
 
 /**
+ * @brief This represents a structure of ratings.
+ */
+typedef struct _LandmarkRating  LandmarkRating;
+
+/**
  * @brief This represents address information such as building number, street name, etc.
  */
 typedef struct _LocationAddress    LocationAddress;
 
 /**
+ * @brief This represents a structure of Location geocode preference.
+ */
+typedef struct _LocationGeocodePreference LocationGeocodePreference;
+
+/**
  * @brief This represents a structure of Location Map Preference.
  */
 typedef struct _LocationMapPref LocationMapPref;
@@ -207,6 +225,47 @@ typedef struct _LocationPOIFilter LocationPOIFilter;
 typedef struct _LocationPOIPreference LocationPOIPreference;
 
 /**
+ * @brief This represents a structure of Place Attribute.
+ */
+typedef struct _LandmarkAttribute    LandmarkAttribute;
+
+/**
+ * @brief This represents a structure of Contact Detail.
+ */
+typedef struct _LandmarkContact    LandmarkContact;
+
+/**
+ * @brief This represents a structure of Link Object.
+ */
+typedef struct _LandmarkLinkObject    LandmarkLinkObject;
+
+/**
+ * @brief This represents a structure of LandmarkMedia.
+ */
+
+typedef struct _LandmarkMedia   LandmarkMedia;
+
+/**
+ * @brief This represents a structure of LandmarkImage.
+ */
+typedef struct _LandmarkImage    LandmarkImage;
+
+/**
+ * @brief This represents a structure of LandmarkCategory.
+ */
+typedef struct _LandmarkCategory    LandmarkCategory;
+
+/**
+ * @brief This represents a structure of LandmarkEditorial.
+ */
+typedef struct _LandmarkEditorial    LandmarkEditorial;
+
+/**
+ * @brief This represents a structure of LandmarkReview.
+ */
+typedef struct _LandmarkReview    LandmarkReview;
+
+/**
  * @brief This represents a structure of Landmark information.
  */
 typedef struct _LocationLandmark    LocationLandmark;
index 9f8687a..7be44bf 100644 (file)
@@ -19,7 +19,6 @@ liblocation_manager_la_SOURCES = \
                                                        location-common-util.c \\r
                                                        location-gps.c \\r
                                                        location-wps.c \\r
-                                                       location-cps.c \\r
                                                        location-hybrid.c\r
 \r
 liblocation_manager_la_CFLAGS = \\r
index 8d04950..d519837 100644 (file)
@@ -76,7 +76,7 @@ comp_double_reverse(double a, double b)
        return 1;
 }
 
-int
+EXPORT_API int
 location_accuracy_level_compare(const LocationAccuracy *accuracy1, const LocationAccuracy *accuracy2)
 {
        g_return_val_if_fail(accuracy1, -1);
diff --git a/location/manager/location-cps.c b/location/manager/location-cps.c
deleted file mode 100644 (file)
index 0da9c40..0000000
+++ /dev/null
@@ -1,708 +0,0 @@
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- *          Genie Kim <daejins.kim@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "location-setting.h"
-#include "location-log.h"
-
-#include "module-internal.h"
-
-#include "location-cps.h"
-#include "location-marshal.h"
-#include "location-ielement.h"
-#include "location-signaling-util.h"
-#include "location-common-util.h"
-
-typedef struct _LocationCpsPrivate {
-       LocationCpsMod *mod;
-       gboolean is_started;
-       gboolean set_noti;
-       gboolean enabled;
-       guint pos_updated_timestamp;
-       guint pos_interval;
-       guint vel_updated_timestamp;
-       guint vel_interval;
-       LocationPosition *pos;
-       LocationVelocity *vel;
-       LocationAccuracy *acc;
-       GList *boundary_list;
-       guint pos_timer;
-       guint vel_timer;
-} LocationCpsPrivate;
-
-enum {
-       PROP_0,
-       PROP_METHOD_TYPE,
-       PROP_POS_INTERVAL,
-       PROP_VEL_INTERVAL,
-       PROP_BOUNDARY,
-       PROP_REMOVAL_BOUNDARY,
-       PROP_MAX
-};
-
-static guint32 signals[LAST_SIGNAL] = {0, };
-static GParamSpec *properties[PROP_MAX] = {NULL, };
-
-#define GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), LOCATION_TYPE_CPS, LocationCpsPrivate))
-
-static void location_ielement_interface_init (LocationIElementInterface *iface);
-
-G_DEFINE_TYPE_WITH_CODE (LocationCps, location_cps, G_TYPE_OBJECT,
-                       G_IMPLEMENT_INTERFACE (LOCATION_TYPE_IELEMENT,
-                       location_ielement_interface_init));
-
-static gboolean
-_position_timeout_cb (gpointer data)
-{
-       GObject *object = (GObject *)data;
-       LocationCpsPrivate *priv = GET_PRIVATE(object);
-       if (!priv) return FALSE;
-
-       LocationPosition *pos = NULL;
-       LocationAccuracy *acc = NULL;
-
-       if (priv->pos) {
-               pos = location_position_copy(priv->pos);
-       } else {
-               pos = location_position_new (0, 0.0, 0.0, 0.0, LOCATION_STATUS_NO_FIX);
-       }
-
-       if (priv->acc) {
-               acc = location_accuracy_copy (priv->acc);
-       } else {
-               acc = location_accuracy_new (LOCATION_ACCURACY_LEVEL_NONE, 0.0, 0.0);
-       }
-
-       LOCATION_LOGD("VELOCITY SERVICE_UPDATED");
-       g_signal_emit(object, signals[SERVICE_UPDATED], 0, POSITION_UPDATED, pos, acc);
-
-       location_position_free (pos);
-       location_accuracy_free (acc);
-
-       return TRUE;
-}
-
-static gboolean
-_velocity_timeout_cb (gpointer data)
-{
-       GObject *object = (GObject *)data;
-       LocationCpsPrivate *priv = GET_PRIVATE(object);
-       if (!priv) return FALSE;
-
-       LocationVelocity *vel = NULL;
-       LocationAccuracy *acc = NULL;
-
-       if (priv->vel) {
-               vel = location_velocity_copy(priv->vel);
-       } else {
-               vel = location_velocity_new (0, 0.0, 0.0, 0.0);
-       }
-
-       if (priv->acc) {
-               acc = location_accuracy_copy (priv->acc);
-       } else {
-               acc = location_accuracy_new (LOCATION_ACCURACY_LEVEL_NONE, 0.0, 0.0);
-       }
-
-       LOCATION_LOGD("VELOCITY SERVICE_UPDATED");
-       g_signal_emit(object, signals[SERVICE_UPDATED], 0, VELOCITY_UPDATED, vel, acc);
-
-       location_velocity_free (vel);
-       location_accuracy_free (acc);
-
-       return TRUE;
-}
-
-static void
-__reset_pos_data_from_priv(LocationCpsPrivate *priv)
-{
-       LOCATION_LOGD("__reset_pos_data_from_priv");
-       g_return_if_fail(priv);
-
-       if (priv->pos) {
-               location_position_free(priv->pos);
-               priv->pos = NULL;
-       }
-
-       if (priv->vel) {
-               location_velocity_free(priv->vel);
-               priv->vel = NULL;
-       }
-
-       if (priv->acc) {
-               location_accuracy_free(priv->acc);
-               priv->acc = NULL;
-       }
-}
-
-static void
-cps_status_cb (gboolean enabled,
-       LocationStatus status,
-       gpointer self)
-{
-       LOCATION_LOGD("cps_status_cb");
-       g_return_if_fail(self);
-       LocationCpsPrivate* priv = GET_PRIVATE(self);
-       enable_signaling(self, signals, &(priv->enabled), enabled, status);
-       if (!priv->enabled) {
-               if (priv->pos_timer) {
-                       g_source_remove(g_source_remove(priv->pos_timer));
-                       priv->pos_timer = 0;
-               }
-               if (priv->vel_timer) {
-                       g_source_remove(g_source_remove(priv->vel_timer));
-                       priv->vel_timer = 0;
-               }
-       }
-}
-
-static void
-cps_position_ext_cb (gboolean enabled,
-       LocationPosition *pos,
-       LocationVelocity *vel,
-       LocationAccuracy *acc,
-       gpointer self)
-{
-       LOCATION_LOGD("cps_position_ext_cb");
-       g_return_if_fail(self);
-       g_return_if_fail(pos);
-       g_return_if_fail(vel);
-       g_return_if_fail(acc);
-       LocationCpsPrivate* priv = GET_PRIVATE(self);
-
-       if (enabled && !priv->enabled) {
-               if (!priv->pos_timer) priv->pos_timer = g_timeout_add_seconds (priv->pos_interval, _position_timeout_cb, self);
-               if (!priv->vel_timer) priv->vel_timer = g_timeout_add_seconds (priv->vel_interval, _velocity_timeout_cb, self);
-       }
-
-       enable_signaling(self, signals, &(priv->enabled), enabled, pos->status);
-       position_signaling(self, signals, &(priv->enabled), priv->pos_interval, FALSE, &(priv->pos_updated_timestamp), &(priv->pos), &(priv->acc), priv->boundary_list, pos, acc);
-       velocity_signaling(self, signals, &(priv->enabled), priv->vel_interval, FALSE, &(priv->vel_updated_timestamp), &(priv->vel), vel, acc);
-}
-
-static void
-location_setting_cps_cb (keynode_t *key,
-               gpointer self)
-{
-       LOCATION_LOGD("location_setting_cps_cb");
-       g_return_if_fail (key);
-       g_return_if_fail (self);
-
-       LocationCpsPrivate *priv = GET_PRIVATE(self);
-       g_return_if_fail (priv->mod);
-       g_return_if_fail (priv->mod->handler);
-
-       int ret = LOCATION_ERROR_NONE;
-
-       if (location_setting_get_key_val (key) == 0) {
-               if (priv->mod->ops.stop && priv->is_started) {
-                       ret = priv->mod->ops.stop (priv->mod->handler);
-                       if (ret == LOCATION_ERROR_NONE) {
-                               priv->is_started = FALSE;
-                               __reset_pos_data_from_priv(priv);
-                       }
-               }
-       } else {
-               if (1 == location_setting_get_int (VCONFKEY_LOCATION_NETWORK_ENABLED) && priv->mod->ops.start && !priv->is_started) {
-                       LOCATION_LOGD("location resumed by setting");
-                       ret = priv->mod->ops.start (priv->mod->handler, cps_status_cb, cps_position_ext_cb, NULL, self);
-                       if (ret == LOCATION_ERROR_NONE) {
-                               priv->is_started = TRUE;
-                       }
-               }
-       }
-}
-
-static void
-location_cps_dispose (GObject *gobject)
-{
-       LOCATION_LOGD("location_cps_dispose");
-
-       LocationCpsPrivate *priv = GET_PRIVATE(gobject);
-       if (priv->set_noti == TRUE) {
-               location_setting_ignore_notify (VCONFKEY_LOCATION_NETWORK_ENABLED, location_setting_cps_cb);
-               priv->set_noti = FALSE;
-       }
-
-       if (priv->pos_timer) {
-               g_source_remove (priv->pos_timer);
-               priv->pos_timer = 0;
-       }
-
-       if (priv->vel_timer) {
-               g_source_remove (priv->vel_timer);
-               priv->vel_timer = 0;
-       }
-
-       G_OBJECT_CLASS (location_cps_parent_class)->dispose (gobject);
-}
-
-static void
-location_cps_finalize (GObject *gobject)
-{
-       LOCATION_LOGD("location_cps_finalize");
-       LocationCpsPrivate* priv = GET_PRIVATE(gobject);
-       module_free(priv->mod, "cps");
-       priv->mod = NULL;
-
-       if (priv->boundary_list) {
-               g_list_free_full (priv->boundary_list, free_boundary_list);
-               priv->boundary_list = NULL;
-       }
-
-       if (priv->pos) {
-               location_position_free(priv->pos);
-               priv->pos = NULL;
-       }
-
-       if (priv->vel) {
-               location_velocity_free(priv->vel);
-               priv->vel = NULL;
-       }
-
-       if (priv->acc) {
-               location_accuracy_free(priv->acc);
-               priv->acc = NULL;
-       }
-
-       G_OBJECT_CLASS (location_cps_parent_class)->finalize (gobject);
-}
-
-static void
-location_cps_set_property (GObject *object,
-       guint property_id,
-       GValue *value,
-       GParamSpec *pspec)
-{
-       LocationCpsPrivate *priv = GET_PRIVATE(object);
-
-       int ret = 0;
-
-       switch (property_id) {
-               case PROP_BOUNDARY:{
-                       GList *boundary_list = (GList *)g_list_copy(g_value_get_pointer(value));
-                       ret = set_prop_boundary(&priv->boundary_list, boundary_list);
-                       if(ret != 0) LOCATION_LOGD("Set boundary. Error[%d]", ret);
-                       break;
-               }
-               case PROP_REMOVAL_BOUNDARY: {
-                       LocationBoundary *req_boundary = (LocationBoundary*) g_value_dup_boxed(value);
-                       ret = set_prop_removal_boundary(&priv->boundary_list, req_boundary);
-                       if(ret != 0) LOCATION_LOGD("Set removal boundary. Error[%d]", ret);
-                       break;
-               }
-               case PROP_POS_INTERVAL: {
-                       guint interval = g_value_get_uint (value);
-
-                       if (interval > 0) {
-                               if (interval < LOCATION_UPDATE_INTERVAL_MAX)
-                                       priv->pos_interval = interval;
-                               else
-                                       priv->pos_interval = (guint) LOCATION_UPDATE_INTERVAL_MAX;
-                       } else {
-                               priv->pos_interval = (guint) LOCATION_UPDATE_INTERVAL_DEFAULT;
-                       }
-
-                       if (priv->pos_timer) {
-                               g_source_remove (priv->pos_timer);
-                               priv->pos_timer = g_timeout_add_seconds (priv->pos_interval, _position_timeout_cb, object);
-                       }
-
-                       break;
-               }
-
-               case PROP_VEL_INTERVAL: {
-                       guint interval = g_value_get_uint(value);
-                       if(interval > 0) {
-                               if(interval < LOCATION_UPDATE_INTERVAL_MAX)
-                                       priv->vel_interval = interval;
-                               else
-                                       priv->vel_interval = (guint)LOCATION_UPDATE_INTERVAL_MAX;
-                       } else
-                               priv->vel_interval = (guint)LOCATION_UPDATE_INTERVAL_DEFAULT;
-
-                       if (priv->vel_timer) {
-                               g_source_remove (priv->vel_timer);
-                               priv->vel_timer = g_timeout_add_seconds (priv->vel_interval, _velocity_timeout_cb, object);
-                       }
-
-                       break;
-               }
-               default:
-                       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-                       break;
-       }
-}
-
-static void
-location_cps_get_property (GObject *object,
-       guint property_id,
-       GValue *value,
-       GParamSpec *pspec)
-{
-       LocationCpsPrivate *priv = GET_PRIVATE (object);
-
-       switch (property_id){
-               case PROP_METHOD_TYPE:
-                       g_value_set_int(value, LOCATION_METHOD_CPS);
-                       break;
-               case PROP_BOUNDARY:
-                       g_value_set_pointer(value, g_list_first(priv->boundary_list));
-                       break;
-               case PROP_POS_INTERVAL: {
-                       g_value_set_uint (value, priv->pos_interval);
-                       break;
-               }
-               default:
-                       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-                       break;
-       }
-}
-
-static int
-location_cps_start (LocationCps *self)
-{
-       LOCATION_LOGD("location_cps_start");
-
-       LocationCpsPrivate* priv = GET_PRIVATE(self);
-       g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
-       g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
-       g_return_val_if_fail (priv->mod->ops.start, LOCATION_ERROR_NOT_AVAILABLE);
-
-       if (priv->is_started == TRUE) return LOCATION_ERROR_NONE;
-
-       int ret = LOCATION_ERROR_NOT_AVAILABLE;
-
-       if (!location_setting_get_int (VCONFKEY_LOCATION_NETWORK_ENABLED)) {
-               ret = LOCATION_ERROR_SETTING_OFF;
-       } else {
-               ret = priv->mod->ops.start (priv->mod->handler, cps_status_cb, cps_position_ext_cb, NULL, self);
-               if (ret == LOCATION_ERROR_NONE) {
-                       priv->is_started = TRUE;
-               }
-               else {
-                       return ret;
-               }
-       }
-
-       if (priv->set_noti == FALSE) {
-               location_setting_add_notify (VCONFKEY_LOCATION_NETWORK_ENABLED, location_setting_cps_cb, self);
-               priv->set_noti = TRUE;
-       }
-
-       return ret;
-}
-
-static int
-location_cps_stop (LocationCps *self)
-{
-       LOCATION_LOGD("location_cps_stop");
-       LocationCpsPrivate* priv = GET_PRIVATE(self);
-       g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
-       g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
-       g_return_val_if_fail (priv->mod->ops.stop, LOCATION_ERROR_NOT_AVAILABLE);
-
-       int ret = LOCATION_ERROR_NONE;
-
-       if (priv->is_started == TRUE) {
-               ret = priv->mod->ops.stop (priv->mod->handler);
-               if (ret == LOCATION_ERROR_NONE) {
-                       priv->is_started = FALSE;
-                       __reset_pos_data_from_priv(priv);
-               }
-               else {
-                       LOCATION_LOGD("Failed to stop. Error[%d]", ret);
-               }
-       }
-
-       if (priv->set_noti == TRUE) {
-               location_setting_ignore_notify (VCONFKEY_LOCATION_NETWORK_ENABLED, location_setting_cps_cb);
-               priv->set_noti = FALSE;
-       }
-
-       return ret;
-}
-
-static int
-location_cps_get_position (LocationCps *self,
-               LocationPosition **position,
-               LocationAccuracy **accuracy)
-{
-       int ret = LOCATION_ERROR_NOT_AVAILABLE;
-       LOCATION_LOGD("location_cps_get_position");
-
-       LocationCpsPrivate *priv = GET_PRIVATE (self);
-       g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
-
-       setting_retval_if_fail(VCONFKEY_LOCATION_NETWORK_ENABLED);
-
-       if (priv->is_started != TRUE) {
-               LOCATION_LOGD("location is not started");
-               return LOCATION_ERROR_NOT_AVAILABLE;
-       }
-
-       if (priv->pos) {
-               *position = location_position_copy (priv->pos);
-               if (priv->acc) *accuracy = location_accuracy_copy(priv->acc);
-               else *accuracy = location_accuracy_new(LOCATION_ACCURACY_LEVEL_NONE, 0.0, 0.0);
-               ret = LOCATION_ERROR_NONE;
-       }
-
-       return ret;
-}
-
-static int
-location_cps_get_position_ext (LocationCps *self,
-               LocationPosition **position,
-               LocationVelocity **velocity,
-               LocationAccuracy **accuracy)
-{
-       int ret = LOCATION_ERROR_NOT_AVAILABLE;
-       LOCATION_LOGD("location_cps_get_position");
-
-       LocationCpsPrivate *priv = GET_PRIVATE (self);
-       g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
-
-       setting_retval_if_fail(VCONFKEY_LOCATION_NETWORK_ENABLED);
-
-       if (priv->is_started != TRUE) {
-               LOCATION_LOGD("location is not started");
-               return LOCATION_ERROR_NOT_AVAILABLE;
-       }
-
-       if (priv->pos && priv->vel) {
-               *position = location_position_copy (priv->pos);
-               *velocity = location_velocity_copy (priv->vel);
-               if (priv->acc) *accuracy = location_accuracy_copy(priv->acc);
-               else *accuracy = location_accuracy_new(LOCATION_ACCURACY_LEVEL_NONE, 0.0, 0.0);
-               ret = LOCATION_ERROR_NONE;
-       }
-
-       return ret;
-}
-
-static int
-location_cps_get_last_position (LocationCps *self,
-               LocationPosition **position,
-               LocationAccuracy **accuracy)
-{
-       LOCATION_LOGD("location_cps_get_last_position");
-       return LOCATION_ERROR_NOT_SUPPORTED;
-}
-
-static int
-location_cps_get_last_position_ext (LocationCps *self,
-               LocationPosition **position,
-               LocationVelocity **velocity,
-               LocationAccuracy **accuracy)
-{
-       LOCATION_LOGD("location_cps_get_last_position_ext");
-       return LOCATION_ERROR_NOT_SUPPORTED;
-}
-
-static int
-location_cps_get_velocity (LocationCps *self,
-               LocationVelocity **velocity,
-               LocationAccuracy **accuracy)
-{
-       LOCATION_LOGD("location_cps_get_velocity");
-       return LOCATION_ERROR_NOT_SUPPORTED;
-}
-
-static int
-location_cps_get_last_velocity (LocationCps *self,
-               LocationVelocity **velocity,
-               LocationAccuracy **accuracy)
-{
-       LOCATION_LOGD("location_cps_get_last_velocity");
-       return LOCATION_ERROR_NOT_SUPPORTED;
-}
-
-static int
-location_cps_get_satellite (LocationCps *self,
-               LocationSatellite **satellite)
-{
-       LOCATION_LOGD("location_cps_get_satellite");
-       return LOCATION_ERROR_NOT_SUPPORTED;
-}
-
-static int
-location_cps_get_last_satellite (LocationCps *self)
-{
-       LOCATION_LOGD("location_cps_get_last_satellite");
-       return LOCATION_ERROR_NOT_SUPPORTED;
-}
-
-static void
-location_ielement_interface_init (LocationIElementInterface *iface)
-{
-       iface->start = (TYPE_START_FUNC) location_cps_start;
-       iface->stop = (TYPE_STOP_FUNC) location_cps_stop;
-       iface->get_position = (TYPE_GET_POSITION) location_cps_get_position;
-       iface->get_position_ext = (TYPE_GET_POSITION_EXT) location_cps_get_position_ext;
-       iface->get_last_position = (TYPE_GET_POSITION) location_cps_get_last_position;
-       iface->get_last_position_ext = (TYPE_GET_POSITION_EXT) location_cps_get_last_position_ext;
-       iface->get_velocity = (TYPE_GET_VELOCITY) location_cps_get_velocity;
-       iface->get_last_velocity = (TYPE_GET_VELOCITY)location_cps_get_last_velocity;
-       iface->get_satellite = (TYPE_GET_SATELLITE)location_cps_get_satellite;
-       iface->get_last_satellite = (TYPE_GET_SATELLITE)location_cps_get_last_satellite;
-}
-
-static void
-location_cps_init (LocationCps *self)
-{
-       LOCATION_LOGD("location_cps_init");
-       LocationCpsPrivate* priv = GET_PRIVATE(self);
-
-       priv->mod = (LocationCpsMod*)module_new("cps");
-       if(!priv->mod) LOCATION_LOGW("module loading failed");
-
-       priv->is_started = FALSE;
-       priv->set_noti = FALSE;
-       priv->enabled = FALSE;
-
-       priv->pos_interval = LOCATION_UPDATE_INTERVAL_DEFAULT;
-       priv->vel_interval = LOCATION_UPDATE_INTERVAL_DEFAULT;
-
-       priv->pos_updated_timestamp = 0;
-       priv->vel_updated_timestamp = 0;
-
-       priv->pos = NULL;
-       priv->acc = NULL;
-       priv->vel = NULL;
-       priv->boundary_list = NULL;
-
-       priv->pos_timer = 0;
-       priv->vel_timer = 0;
-}
-
-static void
-location_cps_class_init (LocationCpsClass *klass)
-{
-       LOCATION_LOGD("location_cps_class_init");
-       GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
-       gobject_class->get_property = location_cps_get_property;
-       gobject_class->set_property = location_cps_set_property;
-
-       gobject_class->dispose = location_cps_dispose;
-       gobject_class->finalize = location_cps_finalize;
-
-       g_type_class_add_private (klass, sizeof (LocationCpsPrivate));
-
-       signals[SERVICE_ENABLED] = g_signal_new ("service-enabled",
-                       G_TYPE_FROM_CLASS (klass),
-                       G_SIGNAL_RUN_FIRST |
-                       G_SIGNAL_NO_RECURSE,
-                       G_STRUCT_OFFSET (LocationCpsClass, enabled),
-                       NULL, NULL,
-                       location_VOID__UINT,
-                       G_TYPE_NONE, 1,
-                       G_TYPE_UINT);
-
-       signals[SERVICE_DISABLED] = g_signal_new ("service-disabled",
-                       G_TYPE_FROM_CLASS (klass),
-                       G_SIGNAL_RUN_FIRST |
-                       G_SIGNAL_NO_RECURSE,
-                       G_STRUCT_OFFSET (LocationCpsClass, disabled),
-                       NULL, NULL,
-                       location_VOID__UINT,
-                       G_TYPE_NONE, 1,
-                       G_TYPE_UINT);
-
-       signals[SERVICE_UPDATED] = g_signal_new ("service-updated",
-                       G_TYPE_FROM_CLASS (klass),
-                       G_SIGNAL_RUN_FIRST |
-                       G_SIGNAL_NO_RECURSE,
-                       G_STRUCT_OFFSET (LocationCpsClass, updated),
-                       NULL, NULL,
-                       location_VOID__UINT_POINTER_POINTER,
-                       G_TYPE_NONE, 3,
-                       G_TYPE_UINT,
-                       G_TYPE_POINTER,
-                       G_TYPE_POINTER);
-
-       signals[ZONE_IN] = g_signal_new ("zone-in",
-                       G_TYPE_FROM_CLASS (klass),
-                       G_SIGNAL_RUN_FIRST |
-                       G_SIGNAL_NO_RECURSE,
-                       G_STRUCT_OFFSET (LocationCpsClass, zone_in),
-                       NULL, NULL,
-                       location_VOID__POINTER_POINTER_POINTER,
-                       G_TYPE_NONE, 3,
-                       G_TYPE_POINTER,
-                       G_TYPE_POINTER,
-                       G_TYPE_POINTER);
-
-       signals[ZONE_OUT] = g_signal_new ("zone-out",
-                       G_TYPE_FROM_CLASS (klass),
-                       G_SIGNAL_RUN_FIRST |
-                       G_SIGNAL_NO_RECURSE,
-                       G_STRUCT_OFFSET (LocationCpsClass, zone_out),
-                       NULL, NULL,
-                       location_VOID__POINTER_POINTER_POINTER,
-                       G_TYPE_NONE, 3,
-                       G_TYPE_POINTER,
-                       G_TYPE_POINTER,
-                       G_TYPE_POINTER);
-
-       properties[PROP_METHOD_TYPE] = g_param_spec_int ("method",
-                                "method type",
-                                "location method type name",
-                                LOCATION_METHOD_CPS,
-                                LOCATION_METHOD_CPS,
-                                LOCATION_METHOD_CPS,
-                                G_PARAM_READABLE);
-
-       properties[PROP_POS_INTERVAL] = g_param_spec_uint ("pos-interval",
-                               "cps position interval prop",
-                               "cps position interval data",
-                               LOCATION_UPDATE_INTERVAL_MIN,
-                               LOCATION_UPDATE_INTERVAL_MAX,
-                               LOCATION_UPDATE_INTERVAL_DEFAULT,
-                               G_PARAM_READWRITE);
-
-       properties[PROP_VEL_INTERVAL] = g_param_spec_uint ("vel-interval",
-                       "cps velocity interval prop",
-                       "cps velocity interval data",
-                       LOCATION_UPDATE_INTERVAL_MIN,
-                       LOCATION_UPDATE_INTERVAL_MAX,
-                       LOCATION_UPDATE_INTERVAL_DEFAULT,
-                       G_PARAM_READWRITE);
-
-       properties[PROP_BOUNDARY] = g_param_spec_pointer ("boundary",
-                       "cps boundary prop",
-                       "cps boundary data",
-                       G_PARAM_READWRITE);
-
-       properties[PROP_REMOVAL_BOUNDARY] = g_param_spec_boxed("removal-boundary",
-                       "cps removal boundary prop",
-                       "cps removal boundary data",
-                       LOCATION_TYPE_BOUNDARY,
-                       G_PARAM_READWRITE);
-
-       g_object_class_install_properties (gobject_class,
-                       PROP_MAX,
-                       properties);
-}
diff --git a/location/manager/location-cps.h b/location/manager/location-cps.h
deleted file mode 100644 (file)
index 355586a..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- *          Genie Kim <daejins.kim@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __LOCATION_CPS_H__
-#define __LOCATION_CPS_H__
-
-#include <glib-object.h>
-
-/**
- * @file location-cps.h
- * @brief This file contains the internal definitions and structures related to CPS.
- */
-
-G_BEGIN_DECLS
-
-#define LOCATION_TYPE_CPS                  (location_cps_get_type ())
-#define LOCATION_CPS(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), LOCATION_TYPE_CPS, LocationCps))
-#define LOCATION_IS_CPS(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LOCATION_TYPE_CPS))
-#define LOCATION_CPS_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), LOCATION_TYPE_CPS, LocationCpsClass))
-#define LOCATION_IS_CPS_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), LOCATION_TYPE_CPS))
-#define LOCATION_CPS_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), LOCATION_TYPE_CPS, LocationCpsClass))
-
-typedef struct _LocationCps        LocationCps;
-typedef struct _LocationCpsClass   LocationCpsClass;
-
-struct _LocationCps
-{
-       GObject parent_instance;
-};
-
-struct _LocationCpsClass
-{
-       GObjectClass parent_class;
-
-       void (* enabled) (guint type);
-       void (* disabled) (guint type);
-       void (* updated) (guint type, gpointer data, gpointer accuracy);
-       void (* zone_in) (gpointer boundary, gpointer position, gpointer accuracy);
-       void (* zone_out) (gpointer boundary, gpointer position, gpointer accuracy);
-};
-
-GType location_cps_get_type (void);
-
-G_END_DECLS
-
-#endif
index 10eb252..495a16e 100644 (file)
@@ -53,15 +53,15 @@ typedef struct _LocationGpsPrivate {
        LocationSatellite*      sat;
        GList*                  boundary_list;
 
-       guint                   pos_timer;
-       guint                   vel_timer;
-
+       guint                   pos_searching_timer;
+       guint                   vel_searching_timer;
 } LocationGpsPrivate;
 
 enum {
        PROP_0,
        PROP_DEV_NAME,
        PROP_METHOD_TYPE,
+       PROP_IS_STARTED,
        PROP_LAST_POSITION,
        PROP_POS_INTERVAL,
        PROP_VEL_INTERVAL,
@@ -181,33 +181,46 @@ gps_status_cb (gboolean enabled,
        LOCATION_LOGD("gps_status_cb");
        g_return_if_fail(self);
        LocationGpsPrivate* priv = GET_PRIVATE(self);
-       enable_signaling(self, signals, &(priv->enabled), enabled, status);
-
-       if (!priv->enabled) {
-               if (priv->pos_timer) g_source_remove (priv->pos_timer);
-               if (priv->vel_timer) g_source_remove (priv->vel_timer);
-               priv->pos_timer = 0;
-               priv->vel_timer = 0;
+       if (!priv->enabled && enabled) {        // Update satellite at searching status.
+               if (priv->pos_searching_timer) g_source_remove (priv->pos_searching_timer);
+               if (priv->vel_searching_timer) g_source_remove (priv->vel_searching_timer);
+               priv->pos_searching_timer = 0;
+               priv->vel_searching_timer = 0;
+               return; // Ignored: Support to get position at enabled callback
+       } else if (priv->enabled == TRUE && enabled == FALSE) {
+               enable_signaling(self, signals, &(priv->enabled), enabled, status);
        }
 }
 
 static void
-gps_position_ext_cb (gboolean enabled,
+gps_location_cb (gboolean enabled,
        LocationPosition *pos,
        LocationVelocity *vel,
        LocationAccuracy *acc,
        gpointer self)
 {
-       LOCATION_LOGD("gps_position_ext_cb");
+       LOCATION_LOGD("gps_location_cb");
        g_return_if_fail(self);
        g_return_if_fail(pos);
        g_return_if_fail(vel);
        g_return_if_fail(acc);
-       LocationGpsPrivate* priv = GET_PRIVATE(self);
 
-       enable_signaling(self, signals, &(priv->enabled), enabled, pos->status);
-       position_signaling(self, signals, &(priv->enabled), priv->pos_interval, TRUE, &(priv->pos_updated_timestamp), &(priv->pos), &(priv->acc), priv->boundary_list, pos, acc);
-       velocity_signaling(self, signals, &(priv->enabled), priv->vel_interval, TRUE, &(priv->vel_updated_timestamp), &(priv->vel), vel, acc);
+       LocationGpsPrivate* priv = GET_PRIVATE(self);
+       location_signaling(self,
+                       signals,
+                       enabled,        // previous status
+                       priv->boundary_list,
+                       pos,
+                       vel,
+                       acc,
+                       priv->pos_interval,
+                       priv->vel_interval,
+                       &(priv->enabled),
+                       &(priv->pos_updated_timestamp),
+                       &(priv->vel_updated_timestamp),
+                       &(priv->pos),
+                       &(priv->vel),
+                       &(priv->acc));
 }
 
 static void
@@ -232,13 +245,13 @@ location_setting_search_cb (keynode_t *key, gpointer self)
        g_return_if_fail (priv->mod->handler);
 
        if (location_setting_get_key_val(key) == VCONFKEY_LOCATION_GPS_SEARCHING) {
-               if (!priv->pos_timer) priv->pos_timer = g_timeout_add (priv->pos_interval * 1000, _position_timeout_cb, self);
-               if (!priv->vel_timer) priv->vel_timer = g_timeout_add (priv->vel_interval * 1000, _velocity_timeout_cb, self);
+               if (!priv->pos_searching_timer) priv->pos_searching_timer = g_timeout_add (priv->pos_interval * 1000, _position_timeout_cb, self);
+               if (!priv->vel_searching_timer) priv->vel_searching_timer = g_timeout_add (priv->vel_interval * 1000, _velocity_timeout_cb, self);
        } else {
-               if (priv->pos_timer) g_source_remove (priv->pos_timer);
-               if (priv->vel_timer) g_source_remove (priv->vel_timer);
-               priv->pos_timer = 0;
-               priv->vel_timer = 0;
+               if (priv->pos_searching_timer) g_source_remove (priv->pos_searching_timer);
+               if (priv->vel_searching_timer) g_source_remove (priv->vel_searching_timer);
+               priv->pos_searching_timer = 0;
+               priv->vel_searching_timer = 0;
        }
 }
 
@@ -264,7 +277,7 @@ location_setting_gps_cb (keynode_t *key,
                }
        } else if (1 == location_setting_get_key_val(key) && priv->mod->ops.start && !priv->is_started) {
                LOCATION_LOGD("location resumed by setting");
-               ret = priv->mod->ops.start (priv->mod->handler, gps_status_cb, gps_position_ext_cb, gps_satellite_cb, self);
+               ret = priv->mod->ops.start (priv->mod->handler, gps_status_cb, gps_location_cb, gps_satellite_cb, self);
                if (ret == LOCATION_ERROR_NONE) {
                        priv->is_started = TRUE;
                }
@@ -287,7 +300,7 @@ location_gps_start (LocationGps *self)
        if (!location_setting_get_int(VCONFKEY_LOCATION_ENABLED)) {
                ret = LOCATION_ERROR_SETTING_OFF;
        } else {
-               ret = priv->mod->ops.start (priv->mod->handler, gps_status_cb, gps_position_ext_cb, gps_satellite_cb, self);
+               ret = priv->mod->ops.start (priv->mod->handler, gps_status_cb, gps_location_cb, gps_satellite_cb, self);
                if (ret == LOCATION_ERROR_NONE) {
                        priv->is_started = TRUE;
                } else {
@@ -324,16 +337,17 @@ location_gps_stop (LocationGps *self)
                }
        }
 
-       if (priv->pos_timer ) g_source_remove (priv->pos_timer);
-       if (priv->vel_timer ) g_source_remove (priv->vel_timer);
-       priv->pos_timer = 0;
-       priv->vel_timer = 0;
+       if (priv->pos_searching_timer ) g_source_remove (priv->pos_searching_timer);
+       if (priv->vel_searching_timer ) g_source_remove (priv->vel_searching_timer);
+       priv->pos_searching_timer = 0;
+       priv->vel_searching_timer = 0;
 
        if(priv->set_noti == TRUE) {
                location_setting_ignore_notify (VCONFKEY_LOCATION_ENABLED, location_setting_gps_cb);
                location_setting_ignore_notify (VCONFKEY_LOCATION_GPS_STATE, location_setting_search_cb);
                priv->set_noti = FALSE;
        }
+
        __reset_pos_data_from_priv(priv);
 
        return ret;
@@ -346,10 +360,10 @@ location_gps_dispose (GObject *gobject)
 
        LocationGpsPrivate* priv = GET_PRIVATE(gobject);
 
-       if (priv->pos_timer) g_source_remove (priv->pos_timer);
-       if (priv->vel_timer) g_source_remove (priv->vel_timer);
-       priv->pos_timer = 0;
-       priv->vel_timer = 0;
+       if (priv->pos_searching_timer) g_source_remove (priv->pos_searching_timer);
+       if (priv->vel_searching_timer) g_source_remove (priv->vel_searching_timer);
+       priv->pos_searching_timer = 0;
+       priv->vel_searching_timer = 0;
 
        if(priv->set_noti == TRUE) {
                location_setting_ignore_notify (VCONFKEY_LOCATION_ENABLED, location_setting_gps_cb);
@@ -440,9 +454,9 @@ location_gps_set_property (GObject *object,
                        else
                                priv->pos_interval = (guint)LOCATION_UPDATE_INTERVAL_DEFAULT;
 
-                       if (priv->pos_timer) {
-                               g_source_remove (priv->pos_timer);
-                               priv->pos_timer = g_timeout_add (priv->pos_interval * 1000, _position_timeout_cb, object);
+                       if (priv->pos_searching_timer) {
+                               g_source_remove (priv->pos_searching_timer);
+                               priv->pos_searching_timer = g_timeout_add (priv->pos_interval * 1000, _position_timeout_cb, object);
                        }
 
                        break;
@@ -459,9 +473,9 @@ location_gps_set_property (GObject *object,
                        else
                                priv->vel_interval = (guint)LOCATION_UPDATE_INTERVAL_DEFAULT;
 
-                       if (priv->vel_timer) {
-                               g_source_remove (priv->vel_timer);
-                               priv->vel_timer = g_timeout_add (priv->vel_interval * 1000, _velocity_timeout_cb, object);
+                       if (priv->vel_searching_timer) {
+                               g_source_remove (priv->vel_searching_timer);
+                               priv->vel_searching_timer = g_timeout_add (priv->vel_interval * 1000, _velocity_timeout_cb, object);
                        }
 
                        break;
@@ -510,6 +524,9 @@ location_gps_get_property (GObject *object,
                case PROP_METHOD_TYPE:
                        g_value_set_int(value, LOCATION_METHOD_GPS);
                        break;
+               case PROP_IS_STARTED:
+                       g_value_set_boolean(value, priv->is_started);
+                       break;
                case PROP_LAST_POSITION:
                        g_value_set_boxed (value, priv->pos);
                        break;
@@ -567,9 +584,7 @@ location_gps_get_position (LocationGps *self,
        g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
        setting_retval_if_fail(VCONFKEY_LOCATION_ENABLED);
 
-       LocModGpsOps ops = priv->mod->ops;
        g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
-       g_return_val_if_fail (ops.get_position, LOCATION_ERROR_NOT_AVAILABLE);
 
        if (priv->is_started != TRUE) {
                LOCATION_LOGD("location is not started");
@@ -735,16 +750,18 @@ static int
 location_gps_get_last_satellite (LocationGps *self,
        LocationSatellite **satellite)
 {
-       LOCATION_LOGD("location_gps_get_last_satellite");
+       return location_gps_get_satellite(self, satellite);
+}
 
-       LocationGpsPrivate *priv = GET_PRIVATE (self);
+static int
+location_gps_set_option (LocationGps *self, const char *option)
+{
+       LOCATION_LOGD("location_gps_set_option");
+       LocationGpsPrivate* priv = GET_PRIVATE(self);
        g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
-       setting_retval_if_fail(VCONFKEY_LOCATION_ENABLED);
-
-       LocModGpsOps ops = priv->mod->ops;
        g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
-       g_return_val_if_fail (ops.get_last_satellite, LOCATION_ERROR_NOT_AVAILABLE);
-       return ops.get_last_satellite(priv->mod->handler, satellite);
+       //g_return_val_if_fail (priv->mod->ops.set_option, LOCATION_ERROR_NOT_AVAILABLE);
+       return LOCATION_ERROR_NONE;
 }
 
 static void
@@ -760,6 +777,7 @@ location_ielement_interface_init (LocationIElementInterface *iface)
        iface->get_last_velocity = (TYPE_GET_VELOCITY)location_gps_get_last_velocity;
        iface->get_satellite = (TYPE_GET_SATELLITE)location_gps_get_satellite;
        iface->get_last_satellite = (TYPE_GET_SATELLITE)location_gps_get_last_satellite;
+       iface->set_option = (TYPE_SET_OPTION)location_gps_set_option;
 }
 
 static void
@@ -789,8 +807,8 @@ location_gps_init (LocationGps *self)
        priv->sat = NULL;
        priv->boundary_list = NULL;
 
-       priv->pos_timer = 0;
-       priv->vel_timer = 0;
+       priv->pos_searching_timer = 0;
+       priv->vel_searching_timer = 0;
 }
 
 static void
@@ -877,6 +895,12 @@ location_gps_class_init (LocationGpsClass *klass)
                        LOCATION_METHOD_GPS,
                        G_PARAM_READABLE);
 
+       properties[PROP_IS_STARTED] = g_param_spec_boolean ("is_started",
+                       "gps is started prop",
+                       "gps is started status",
+                       FALSE,
+                       G_PARAM_READWRITE);
+
        properties[PROP_LAST_POSITION]  = g_param_spec_boxed ("last-position",
                        "gps last position prop",
                        "gps last position data",
@@ -906,7 +930,7 @@ location_gps_class_init (LocationGpsClass *klass)
                        LOCATION_UPDATE_INTERVAL_MAX,
                        LOCATION_UPDATE_INTERVAL_DEFAULT,
                        G_PARAM_READWRITE);
-               ;
+
        properties[PROP_BOUNDARY] = g_param_spec_pointer ("boundary",
                        "gps boundary prop",
                        "gps boundary data",
index fab9bbd..9fae291 100644 (file)
 
 #include "location-gps.h"
 #include "location-wps.h"
-#include "location-cps.h"
 
 typedef struct _LocationHybridPrivate {
-       gboolean is_started;
        gboolean gps_enabled;
        gboolean wps_enabled;
        guint pos_updated_timestamp;
@@ -233,7 +231,6 @@ _velocity_timeout_cb (gpointer data)
        return TRUE;
 }
 
-
 static void
 location_hybrid_state_cb (keynode_t *key, gpointer self)
 {
@@ -300,18 +297,27 @@ hybrid_service_updated (GObject *obj,
                }
 
        }
-       else if ((g_type == LOCATION_TYPE_WPS || g_type == LOCATION_TYPE_CPS) && location_setting_get_int (VCONFKEY_LOCATION_WPS_STATE) == VCONFKEY_LOCATION_WPS_SEARCHING) {
-               LOCATION_LOGD ("Searching WPS or CPS");
+       else if (g_type == LOCATION_TYPE_WPS && location_setting_get_int (VCONFKEY_LOCATION_WPS_STATE) == VCONFKEY_LOCATION_WPS_SEARCHING) {
+               LOCATION_LOGD ("Searching WPS");
                return;
        }
 
        if (hybrid_compare_g_type_method(priv, g_type)) {
                LocationAccuracy *acc = (LocationAccuracy*)accuracy;
                if (type == POSITION_UPDATED) {
-                       position_signaling(self, signals, &(priv->enabled), priv->pos_interval, TRUE, &(priv->pos_updated_timestamp), &(priv->pos), &(priv->acc), priv->boundary_list, pos, acc);
+                       if (priv->pos) location_position_free(priv->pos);
+                       if (priv->acc) location_accuracy_free(priv->acc);
+                       priv->pos = location_position_copy(pos);
+                       priv->acc = location_accuracy_copy(acc);
+                       if (!priv->enabled) {
+                               enable_signaling(self, signals, &(priv->enabled), TRUE, pos->status);
+                       }
+                       position_signaling(self, signals, priv->pos_interval, &(priv->pos_updated_timestamp), priv->boundary_list, pos, acc);
                        LOCATION_LOGW("Position updated. timestamp [%d]", priv->pos->timestamp);
                } else if (type == VELOCITY_UPDATED) {
-                       velocity_signaling(self, signals, &(priv->enabled), priv->vel_interval, TRUE, &(priv->vel_updated_timestamp), &(priv->vel), vel, acc);
+                       if (priv->vel) location_velocity_free(priv->vel);
+                       priv->vel = location_velocity_copy(vel);
+                       velocity_signaling(self, signals, priv->vel_interval, &(priv->vel_updated_timestamp), vel, acc);
                        LOCATION_LOGW("Velocity updated. timestamp [%d]", priv->vel->timestamp);
                }
 
@@ -337,9 +343,6 @@ hybrid_service_enabled (GObject *obj,
                return;
        }
        hybrid_get_update_method(priv);
-       if(priv->gps_enabled || priv->wps_enabled)
-               enable_signaling(self, signals, &(priv->enabled), TRUE, status);
-
 }
 
 static void
@@ -369,9 +372,15 @@ location_hybrid_start (LocationHybrid *self)
 
        int ret_gps = LOCATION_ERROR_NOT_AVAILABLE;
        int ret_wps = LOCATION_ERROR_NOT_AVAILABLE;
+       gboolean gps_started = FALSE;
+       gboolean wps_started = FALSE;
 
        LocationHybridPrivate* priv = GET_PRIVATE(self);
-       if (priv->is_started == TRUE)
+
+       g_object_get(priv->gps, "is_started", &gps_started, NULL);
+       g_object_get(priv->wps, "is_started", &wps_started, NULL);
+
+       if ((gps_started == TRUE) || (wps_started == TRUE))
                return LOCATION_ERROR_NONE;
 
        if (priv->gps) ret_gps = location_start(priv->gps);
@@ -387,8 +396,6 @@ location_hybrid_start (LocationHybrid *self)
                }
        }
 
-       priv->is_started = TRUE;
-
        if (priv->set_noti == FALSE) {
                location_setting_add_notify (VCONFKEY_LOCATION_POSITION_STATE, location_hybrid_state_cb, self);
                priv->set_noti = TRUE;
@@ -403,17 +410,22 @@ location_hybrid_stop (LocationHybrid *self)
        LOCATION_LOGD("location_hybrid_stop");
 
        LocationHybridPrivate* priv = GET_PRIVATE(self);
-       if (priv->is_started == FALSE)
-               return LOCATION_ERROR_NONE;
 
        int ret_gps = LOCATION_ERROR_NOT_AVAILABLE;
        int ret_wps = LOCATION_ERROR_NOT_AVAILABLE;
+       gboolean gps_started = FALSE;
+       gboolean wps_started = FALSE;
+
+       g_object_get(priv->gps, "is_started", &gps_started, NULL);
+       g_object_get(priv->wps, "is_started", &wps_started, NULL);
+
+       if ((gps_started == FALSE) && (wps_started == FALSE)) {
+               return LOCATION_ERROR_NONE;
+       }
 
        if (priv->gps) ret_gps = location_stop(priv->gps);
        if (priv->wps) ret_wps = location_stop(priv->wps);
 
-       priv->is_started = FALSE;
-
        if (ret_gps != LOCATION_ERROR_NONE && ret_wps != LOCATION_ERROR_NONE)
                return LOCATION_ERROR_NOT_AVAILABLE;
 
@@ -873,6 +885,24 @@ location_hybrid_get_last_satellite (LocationHybrid *self,
        return ret;
 }
 
+static int
+location_hybrid_set_option (LocationHybrid *self, const char *option)
+{
+       LOCATION_LOGD("location_hybrid_set_option");
+       LocationHybridPrivate *priv = GET_PRIVATE (self);
+
+       int ret_gps = LOCATION_ERROR_NOT_AVAILABLE;
+       int ret_wps = LOCATION_ERROR_NOT_AVAILABLE;
+
+       if (priv->gps) ret_gps = location_set_option(priv->gps, option);
+       if (priv->wps) ret_wps = location_set_option(priv->wps, option);
+
+       if (ret_gps != LOCATION_ERROR_NONE && ret_wps != LOCATION_ERROR_NONE)
+               return LOCATION_ERROR_NOT_AVAILABLE;
+
+        return LOCATION_ERROR_NONE;
+}
+
 static void
 location_ielement_interface_init (LocationIElementInterface *iface)
 {
@@ -886,6 +916,7 @@ location_ielement_interface_init (LocationIElementInterface *iface)
        iface->get_last_velocity = (TYPE_GET_VELOCITY)location_hybrid_get_last_velocity;
        iface->get_satellite = (TYPE_GET_SATELLITE)location_hybrid_get_satellite;
        iface->get_last_satellite = (TYPE_GET_SATELLITE)location_hybrid_get_last_satellite;
+       iface->set_option = (TYPE_SET_OPTION)location_hybrid_set_option;
 }
 
 static void
@@ -894,7 +925,6 @@ location_hybrid_init (LocationHybrid *self)
        LOCATION_LOGD("location_hybrid_init");
        LocationHybridPrivate* priv = GET_PRIVATE(self);
 
-       priv->is_started = FALSE;
        priv->pos_interval = LOCATION_UPDATE_INTERVAL_DEFAULT;
        priv->vel_interval = LOCATION_UPDATE_INTERVAL_DEFAULT;
        priv->sat_interval = LOCATION_UPDATE_INTERVAL_DEFAULT;
index 3be96bd..2d101c0 100644 (file)
@@ -175,3 +175,10 @@ location_ielement_get_last_velocity (LocationIElement *self,
        g_return_val_if_fail (LOCATION_IELEMENT_GET_INTERFACE (self)->get_last_velocity, LOCATION_ERROR_NOT_AVAILABLE);
        return LOCATION_IELEMENT_GET_INTERFACE (self)->get_last_velocity (self, velocity, accuracy);
 }
+
+int
+location_ielement_set_option (LocationIElement *self, const char *option)
+{
+       g_return_val_if_fail (LOCATION_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
+       return LOCATION_IELEMENT_GET_INTERFACE (self)->set_option (self, option);
+}
\ No newline at end of file
index c9a95b8..53d95a7 100644 (file)
@@ -61,6 +61,7 @@ typedef int (*TYPE_GET_POSITION)(LocationIElement *self, LocationPosition **posi
 typedef int (*TYPE_GET_POSITION_EXT)(LocationIElement *self, LocationPosition **position, LocationVelocity **velocity, LocationAccuracy **accuracy);
 typedef int (*TYPE_GET_VELOCITY)(LocationIElement *self, LocationVelocity **velocity, LocationAccuracy **accuracy);
 typedef int (*TYPE_GET_SATELLITE)(LocationIElement *self, LocationSatellite **satellite);
+typedef int (*TYPE_SET_OPTION)(LocationIElement *self, const char *option);
 
 struct _LocationIElementInterface
 {
@@ -76,6 +77,7 @@ struct _LocationIElementInterface
        TYPE_GET_VELOCITY get_last_velocity;
        TYPE_GET_SATELLITE get_satellite;
        TYPE_GET_SATELLITE get_last_satellite;
+       TYPE_SET_OPTION set_option;
 };
 
 GType location_ielement_get_type (void);
@@ -88,6 +90,7 @@ int location_ielement_get_velocity (LocationIElement *self, LocationVelocity **v
 int location_ielement_get_last_velocity (LocationIElement *self, LocationVelocity **velocity, LocationAccuracy **accuracy);
 int location_ielement_get_satellite (LocationIElement *self, LocationSatellite **satellite);
 int location_ielement_get_last_satellite (LocationIElement *self, LocationSatellite **satellite);
+int location_ielement_set_option (LocationIElement *self, const char *option);
 
 G_END_DECLS
 
index 1bf57e0..b57542c 100644 (file)
@@ -104,7 +104,7 @@ location_position_copy (const LocationPosition *position)
 }
 
 /* Vincenty formula. WGS-84 */
-EXPORT_API     int
+EXPORT_API int
 location_get_distance(const LocationPosition *pos1, const LocationPosition *pos2, gulong *distance)
 {
        g_return_val_if_fail(pos1, LOCATION_ERROR_PARAMETER);
index 33ded5e..24e7813 100644 (file)
@@ -51,15 +51,11 @@ enable_signaling (LocationObject *obj,
 void
 position_signaling (LocationObject *obj,
        guint32 signals[LAST_SIGNAL],
-       gboolean *prev_enabled,
        int interval,
-       gboolean emit,
        guint *updated_timestamp,
-       LocationPosition **prev_pos,
-       LocationAccuracy **prev_acc,
        GList *prev_bound,
-       const LocationPosition *pos,
-       const LocationAccuracy *acc)
+       LocationPosition *pos,
+       LocationAccuracy *acc)
 {
        g_return_if_fail(pos);
        g_return_if_fail(acc);
@@ -73,14 +69,7 @@ position_signaling (LocationObject *obj,
 
        if (!pos->timestamp)    return;
 
-       if (*prev_pos) location_position_free (*prev_pos);
-       if (*prev_acc) location_accuracy_free (*prev_acc);
-
-       *prev_pos = location_position_copy(pos);
-       *prev_acc = location_accuracy_copy (acc);
-       LOCATION_LOGD("timestamp[%d], lat [%f], lon [%f]", (*prev_pos)->timestamp, (*prev_pos)->latitude, (*prev_pos)->longitude);
-
-       if (emit && pos->timestamp - *updated_timestamp >= interval) {
+       if (pos->timestamp - *updated_timestamp >= interval) {
                LOCATION_LOGD("POSITION SERVICE_UPDATED");
                g_signal_emit(obj, signals[SERVICE_UPDATED], 0, POSITION_UPDATED, pos, acc);
                *updated_timestamp = pos->timestamp;
@@ -110,13 +99,10 @@ position_signaling (LocationObject *obj,
 void
 velocity_signaling (LocationObject *obj,
        guint32 signals[LAST_SIGNAL],
-       gboolean *prev_enabled,
        int interval,
-       gboolean emit,
        guint *updated_timestamp,
-       LocationVelocity **prev_vel,
-       const LocationVelocity *vel,
-       const LocationAccuracy *acc)
+       LocationVelocity *vel,
+       LocationAccuracy *acc)
 {
        g_return_if_fail(obj);
        g_return_if_fail(signals);
@@ -124,12 +110,7 @@ velocity_signaling (LocationObject *obj,
 
        if (!vel->timestamp) return;
 
-       if (*prev_vel) location_velocity_free (*prev_vel);
-
-       *prev_vel = location_velocity_copy (vel);
-       LOCATION_LOGD("timestamp[%d]", (*prev_vel)->timestamp);
-
-       if (emit && vel->timestamp - *updated_timestamp >= interval) {
+       if (vel->timestamp - *updated_timestamp >= interval) {
                LOCATION_LOGD("VELOCITY SERVICE_UPDATED");
                g_signal_emit(obj, signals[SERVICE_UPDATED], 0, VELOCITY_UPDATED, vel, acc);
                *updated_timestamp = vel->timestamp;
@@ -137,6 +118,41 @@ velocity_signaling (LocationObject *obj,
 }
 
 void
+location_signaling (LocationObject *obj,
+       guint32 signals[LAST_SIGNAL],
+       gboolean enabled,
+       GList *boundary_list,
+       LocationPosition *cur_pos,
+       LocationVelocity *cur_vel,
+       LocationAccuracy *cur_acc,
+       guint pos_interval,                     // interval : support an update interval
+       guint vel_interval,
+       gboolean *prev_enabled,
+       guint *prev_pos_timestamp,      
+       guint *prev_vel_timestamp,
+       LocationPosition **prev_pos,    // prev : keeping lastest info.
+       LocationVelocity **prev_vel,
+       LocationAccuracy **prev_acc)
+{
+       if (!cur_pos->timestamp) {
+               LOCATION_LOGD("Invalid location with timestamp, 0");
+               return;
+       }
+
+       if (*prev_pos) location_position_free(*prev_pos);
+       if (*prev_vel) location_velocity_free(*prev_vel);
+       if (*prev_acc) location_accuracy_free(*prev_acc);
+
+       *prev_pos = location_position_copy (cur_pos);
+       *prev_vel = location_velocity_copy (cur_vel);
+       *prev_acc = location_accuracy_copy (cur_acc);
+
+       enable_signaling (obj, signals, prev_enabled, enabled, cur_pos->status);
+       position_signaling (obj, signals, pos_interval, prev_pos_timestamp, boundary_list, cur_pos, cur_acc);
+       velocity_signaling (obj, signals, vel_interval, prev_vel_timestamp, cur_vel, cur_acc);
+}
+
+void
 satellite_signaling(LocationObject *obj,
        guint32 signals[LAST_SIGNAL],
        gboolean *prev_enabled,
@@ -144,7 +160,7 @@ satellite_signaling(LocationObject *obj,
        gboolean emit,
        guint *updated_timestamp,
        LocationSatellite **prev_sat,
-       const LocationSatellite *sat)
+       LocationSatellite *sat)
 {
        g_return_if_fail(obj);
        g_return_if_fail(signals);
@@ -160,5 +176,4 @@ satellite_signaling(LocationObject *obj,
                g_signal_emit(obj, signals[SERVICE_UPDATED], 0, SATELLITE_UPDATED, sat, NULL);
                *updated_timestamp = sat->timestamp;
        }
-
-}
+}
\ No newline at end of file
index b1f0231..51eaa57 100644 (file)
@@ -35,19 +35,24 @@ G_BEGIN_DECLS
 void enable_signaling (LocationObject *obj, guint32 signals[LAST_SIGNAL], gboolean *prev_enabled, gboolean enabled, LocationStatus status);
 
 void position_signaling (LocationObject *obj, guint32 signals[LAST_SIGNAL],
-               gboolean *prev_enabled, int interval, gboolean emit,
-               guint *updated_interval, LocationPosition **prev_pos, LocationAccuracy **prev_acc, 
-               GList *prev_bound, const LocationPosition *pos, const LocationAccuracy *acc);
+               int interval, guint *updated_interval,
+               GList *prev_bound, LocationPosition *pos, LocationAccuracy *acc);
 
 void velocity_signaling (LocationObject* obj, guint32 signals[LAST_SIGNAL],
-               gboolean *prev_enabled, int interval, gboolean emit,
-               guint *updated_timestamp, LocationVelocity **prev_vel,
-               const LocationVelocity *vel, const LocationAccuracy *acc);
+               int interval, guint *updated_timestamp,
+               LocationVelocity *vel, LocationAccuracy *acc);
 
 void satellite_signaling(LocationObject *obj, guint32 signals[LAST_SIGNAL],
                gboolean *prev_enabled, int interval, gboolean emit,
                guint *updated_timestamp, LocationSatellite **pre_sat,
-               const LocationSatellite *sat);
+               LocationSatellite *sat);
+
+void location_signaling (LocationObject *obj, guint32 signals[LAST_SIGNAL],
+               gboolean enabled, GList *boundary_list,
+               LocationPosition *cur_pos, LocationVelocity *cur_vel, LocationAccuracy *cur_acc,
+               guint pos_interval, guint vel_interval,
+               gboolean *prev_enabled, guint *prev_pos_timestamp, guint *prev_vel_timestamp,
+               LocationPosition **prev_pos, LocationVelocity **prev_vel, LocationAccuracy **prev_acc);
 
 G_END_DECLS
 
index 511102c..affd355 100644 (file)
@@ -50,13 +50,12 @@ typedef struct _LocationWpsPrivate {
        LocationVelocity *vel;
        LocationAccuracy *acc;
        GList *boundary_list;
-       guint           pos_timer;
-       guint           vel_timer;
 } LocationWpsPrivate;
 
 enum {
        PROP_0,
        PROP_METHOD_TYPE,
+       PROP_IS_STARTED,
        PROP_LAST_POSITION,
        PROP_POS_INTERVAL,
        PROP_VEL_INTERVAL,
@@ -76,68 +75,6 @@ G_DEFINE_TYPE_WITH_CODE (LocationWps, location_wps, G_TYPE_OBJECT,
                          G_IMPLEMENT_INTERFACE (LOCATION_TYPE_IELEMENT,
                          location_ielement_interface_init));
 
-static gboolean
-_position_timeout_cb (gpointer data)
-{
-       GObject *object = (GObject *)data;
-       LocationWpsPrivate *priv = GET_PRIVATE(object);
-       if (!priv) return FALSE;
-
-       LocationPosition *pos = NULL;
-       LocationAccuracy *acc = NULL;
-
-       if (priv->pos) {
-               pos = location_position_copy(priv->pos);
-       } else {
-               pos = location_position_new (0, 0.0, 0.0, 0.0, LOCATION_STATUS_NO_FIX);
-       }
-
-       if (priv->acc) {
-               acc = location_accuracy_copy (priv->acc);
-       } else {
-               acc = location_accuracy_new (LOCATION_ACCURACY_LEVEL_NONE, 0.0, 0.0);
-       }
-
-       LOCATION_LOGD("POSITION SERVICE_UPDATED");
-       g_signal_emit(object, signals[SERVICE_UPDATED], 0, POSITION_UPDATED, pos, acc);
-
-       location_position_free (pos);
-       location_accuracy_free (acc);
-
-       return TRUE;
-}
-
-static gboolean
-_velocity_timeout_cb (gpointer data)
-{
-       GObject *object = (GObject *)data;
-       LocationWpsPrivate *priv = GET_PRIVATE(object);
-       if (!priv) return FALSE;
-
-       LocationVelocity *vel = NULL;
-       LocationAccuracy *acc = NULL;
-
-       if (priv->vel) {
-               vel = location_velocity_copy(priv->vel);
-       } else {
-               vel = location_velocity_new (0, 0.0, 0.0, 0.0);
-       }
-
-       if (priv->acc) {
-               acc = location_accuracy_copy (priv->acc);
-       } else {
-               acc = location_accuracy_new (LOCATION_ACCURACY_LEVEL_NONE, 0.0, 0.0);
-       }
-
-       LOCATION_LOGD("POSITION SERVICE_UPDATED");
-       g_signal_emit(object, signals[SERVICE_UPDATED], 0, VELOCITY_UPDATED, vel, acc);
-
-       location_velocity_free (vel);
-       location_accuracy_free (acc);
-
-       return TRUE;
-}
-
 static void
 __reset_pos_data_from_priv(LocationWpsPrivate *priv)
 {
@@ -166,41 +103,40 @@ wps_status_cb (gboolean enabled,
        LOCATION_LOGD("wps_status_cb");
        g_return_if_fail(self);
        LocationWpsPrivate* priv = GET_PRIVATE(self);
-       enable_signaling(self, signals, &(priv->enabled), enabled, status);
-       if (!priv->enabled) {
-               if (priv->pos_timer) {
-                       g_source_remove (priv->pos_timer);
-                       priv->pos_timer = 0;
-               }
-               if (priv->vel_timer) {
-                       g_source_remove (priv->vel_timer);
-                       priv->vel_timer = 0;
-               }
+       if (priv->enabled == TRUE && enabled == FALSE) {
+               enable_signaling(self, signals, &(priv->enabled), enabled, status);
        }
 }
 
 static void
-wps_position_ext_cb (gboolean enabled,
+wps_location_cb (gboolean enabled,
        LocationPosition *pos,
        LocationVelocity *vel,
        LocationAccuracy *acc,
        gpointer self)
 {
-       LOCATION_LOGD("wps_position_ext_cb");
+       LOCATION_LOGD("wps_location_cb");
        g_return_if_fail(self);
        g_return_if_fail(pos);
        g_return_if_fail(vel);
        g_return_if_fail(acc);
        LocationWpsPrivate* priv = GET_PRIVATE(self);
 
-       if (!priv->enabled && enabled) {
-               if (!priv->pos_timer) priv->pos_timer = g_timeout_add_seconds (priv->pos_interval, _position_timeout_cb, self);
-               if (!priv->vel_timer) priv->vel_timer = g_timeout_add_seconds (priv->vel_interval, _velocity_timeout_cb, self);
-       }
-
-       enable_signaling(self, signals, &(priv->enabled), enabled, pos->status);
-       position_signaling(self, signals, &(priv->enabled), priv->pos_interval, FALSE, &(priv->pos_updated_timestamp), &(priv->pos), &(priv->acc), priv->boundary_list, pos, acc);
-       velocity_signaling(self, signals, &(priv->enabled), priv->vel_interval, FALSE, &(priv->vel_updated_timestamp), &(priv->vel), vel, acc);
+       location_signaling(self,
+                               signals,
+                               enabled,
+                               priv->boundary_list,
+                               pos,
+                               vel,
+                               acc,
+                               priv->pos_interval,
+                               priv->vel_interval,
+                               &(priv->enabled),
+                               &(priv->pos_updated_timestamp),
+                               &(priv->vel_updated_timestamp),
+                               &(priv->pos),
+                               &(priv->vel),
+                               &(priv->acc));
 }
 
 static void
@@ -228,7 +164,7 @@ location_setting_wps_cb(keynode_t *key,
        else {
                if (1 == location_setting_get_int(VCONFKEY_LOCATION_NETWORK_ENABLED) && priv->mod->ops.start && !priv->is_started) {
                        LOCATION_LOGD("location resumed by setting");
-                       ret = priv->mod->ops.start (priv->mod->handler, wps_status_cb, wps_position_ext_cb, NULL, self);
+                       ret = priv->mod->ops.start (priv->mod->handler, wps_status_cb, wps_location_cb, NULL, self);
                        if (ret == LOCATION_ERROR_NONE) {
                                priv->is_started = TRUE;
                        }
@@ -253,7 +189,7 @@ location_wps_start (LocationWps *self)
        if (!location_setting_get_int(VCONFKEY_LOCATION_NETWORK_ENABLED)) {
                ret = LOCATION_ERROR_SETTING_OFF;
        } else {
-               ret = priv->mod->ops.start (priv->mod->handler, wps_status_cb, wps_position_ext_cb, NULL, self);
+               ret = priv->mod->ops.start (priv->mod->handler, wps_status_cb, wps_location_cb, NULL, self);
                if (ret == LOCATION_ERROR_NONE) {
                        priv->is_started = TRUE;
                }
@@ -295,6 +231,7 @@ location_wps_stop (LocationWps *self)
                location_setting_ignore_notify (VCONFKEY_LOCATION_NETWORK_ENABLED, location_setting_wps_cb);
                priv->set_noti = FALSE;
        }
+
        __reset_pos_data_from_priv(priv);
 
        return ret;
@@ -310,15 +247,6 @@ location_wps_dispose (GObject *gobject)
                location_setting_ignore_notify (VCONFKEY_LOCATION_NETWORK_ENABLED, location_setting_wps_cb);
                priv->set_noti = FALSE;
 
-               if (priv->pos_timer) {
-                       g_source_remove (priv->pos_timer);
-                       priv->pos_timer = 0;
-               }
-               if (priv->vel_timer) {
-                       g_source_remove (priv->vel_timer);
-                       priv->vel_timer = 0;
-               }
-
        }
 
        G_OBJECT_CLASS (location_wps_parent_class)->dispose (gobject);
@@ -355,9 +283,9 @@ location_wps_finalize (GObject *gobject)
 
 static void
 location_wps_set_property (GObject *object,
-       guint property_id,
-       const GValue *value,
-       GParamSpec *pspec)
+               guint property_id,
+               const GValue *value,
+               GParamSpec *pspec)
 {
        LocationWpsPrivate* priv = GET_PRIVATE(object);
        int ret = 0;
@@ -367,13 +295,13 @@ location_wps_set_property (GObject *object,
                        GList *boundary_list = (GList *)g_list_copy(g_value_get_pointer(value));
                        ret = set_prop_boundary(&priv->boundary_list, boundary_list);
                        if(ret != 0) LOCATION_LOGD("Set boundary. Error[%d]", ret);
-                       break;
+                               break;
                }
                case PROP_REMOVAL_BOUNDARY: {
                        LocationBoundary *req_boundary = (LocationBoundary*) g_value_dup_boxed(value);
                        ret = set_prop_removal_boundary(&priv->boundary_list, req_boundary);
                        if(ret != 0) LOCATION_LOGD("Set removal boundary. Error[%d]", ret);
-                       break;
+                               break;
                }
                case PROP_POS_INTERVAL: {
                        guint interval = g_value_get_uint(value);
@@ -386,11 +314,6 @@ location_wps_set_property (GObject *object,
                        else
                                priv->pos_interval = (guint)LOCATION_UPDATE_INTERVAL_DEFAULT;
 
-                       if (priv->pos_timer) {
-                               g_source_remove (priv->pos_timer);
-                               priv->pos_timer = g_timeout_add_seconds (priv->pos_interval, _position_timeout_cb, object);
-                       }
-
                        break;
                }
                case PROP_VEL_INTERVAL: {
@@ -401,14 +324,9 @@ location_wps_set_property (GObject *object,
                                else
                                        priv->vel_interval = (guint)LOCATION_UPDATE_INTERVAL_MAX;
                        }
-                       else
+                       else {
                                priv->vel_interval = (guint)LOCATION_UPDATE_INTERVAL_DEFAULT;
-
-                       if (priv->vel_timer) {
-                               g_source_remove (priv->vel_timer);
-                               priv->vel_timer = g_timeout_add_seconds (priv->vel_interval, _velocity_timeout_cb, object);
                        }
-
                        break;
                }
                default:
@@ -419,9 +337,9 @@ location_wps_set_property (GObject *object,
 
 static void
 location_wps_get_property (GObject *object,
-       guint property_id,
-       GValue *value,
-       GParamSpec *pspec)
+               guint property_id,
+               GValue *value,
+               GParamSpec *pspec)
 {
        LocationWpsPrivate *priv = GET_PRIVATE (object);
 
@@ -429,6 +347,9 @@ location_wps_get_property (GObject *object,
                case PROP_METHOD_TYPE:
                        g_value_set_int(value, LOCATION_METHOD_WPS);
                        break;
+               case PROP_IS_STARTED:
+                       g_value_set_boolean(value, priv->is_started);
+                       break;
                case PROP_LAST_POSITION:
                        g_value_set_boxed (value, priv->pos);
                        break;
@@ -610,6 +531,17 @@ location_wps_get_last_satellite (LocationWps *self,
        return LOCATION_ERROR_NOT_SUPPORTED;
 }
 
+static int
+location_wps_set_option (LocationWps *self, const char *option)
+{
+       LOCATION_LOGD("location_wps_set_option");
+       LocationWpsPrivate* priv = GET_PRIVATE(self);
+       g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
+       g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
+       //g_return_val_if_fail (priv->mod->ops.set_option, LOCATION_ERROR_NOT_AVAILABLE);
+       return LOCATION_ERROR_NONE;
+}
+
 static void
 location_ielement_interface_init (LocationIElementInterface *iface)
 {
@@ -623,6 +555,7 @@ location_ielement_interface_init (LocationIElementInterface *iface)
        iface->get_last_velocity = (TYPE_GET_VELOCITY)location_wps_get_last_velocity;
        iface->get_satellite = (TYPE_GET_SATELLITE)location_wps_get_satellite;
        iface->get_last_satellite = (TYPE_GET_SATELLITE)location_wps_get_last_satellite;
+       iface->set_option = (TYPE_SET_OPTION)location_wps_set_option;
 }
 
 static void
@@ -649,8 +582,6 @@ location_wps_init (LocationWps *self)
        priv->acc = NULL;
        priv->boundary_list = NULL;
 
-       priv->pos_timer = 0;
-       priv->vel_timer = 0;
 }
 
 static void
@@ -731,6 +662,12 @@ location_wps_class_init (LocationWpsClass *klass)
                        LOCATION_METHOD_WPS,
                        G_PARAM_READABLE);
 
+       properties[PROP_IS_STARTED] = g_param_spec_boolean ("is_started",
+                       "wps is started prop",
+                       "wps is started status",
+                       FALSE,
+                       G_PARAM_READWRITE);
+
        properties[PROP_LAST_POSITION] = g_param_spec_boxed ("last-position",
                        "wps last position prop",
                        "wps last position data",
index 958a137..ca6a2e2 100644 (file)
@@ -35,7 +35,6 @@
 #include "location-hybrid.h"
 #include "location-gps.h"
 #include "location-wps.h"
-#include "location-cps.h"
 #include "location-position.h"
 #include "map-service.h"
 #include "module-internal.h"
@@ -73,8 +72,6 @@ location_new (LocationMethod method)
                        self = g_object_new (LOCATION_TYPE_WPS, NULL);
                        break;
                case LOCATION_METHOD_CPS:
-                       self = g_object_new (LOCATION_TYPE_CPS, NULL);
-                       break;
                default:
                        break;
        }
@@ -99,10 +96,6 @@ location_start (LocationObject *obj)
        g_return_val_if_fail (G_OBJECT_TYPE(obj) != MAP_TYPE_SERVICE, LOCATION_ERROR_PARAMETER);
 
        int ret = LOCATION_ERROR_NONE;
-       if (location_application_enabled() == FALSE) {
-               LOCATION_LOGD("Application does not have permission");
-               return LOCATION_ERROR_NOT_ALLOWED;
-       }
        ret = location_ielement_start (LOCATION_IELEMENT(obj));
        if (ret != LOCATION_ERROR_NONE) LOCATION_LOGD("Fail to start. Error [%d]", ret);
 
@@ -138,8 +131,6 @@ location_is_supported_method(LocationMethod method)
                is_supported = module_is_supported("wps");
                break;
        case LOCATION_METHOD_CPS:
-               is_supported = module_is_supported("cps");
-               break;
        default:
                break;
        }
@@ -335,33 +326,17 @@ location_set_accessibility_state (LocationAccessState state)
        return ret;
 }
 
-
 EXPORT_API int
 location_send_command(const char *cmd)
 {
        g_return_val_if_fail (cmd, LOCATION_ERROR_PARAMETER);
-       int ret = LOCATION_ERROR_NOT_AVAILABLE;
-
-       if (0 == g_strcmp0(cmd, "ADD_APPLIST")) {
-               if (location_application_add_app_to_applist () == FALSE) {
-                       LOCATION_LOGD("Fail to add to applist");
-                       ret = LOCATION_ERROR_UNKNOWN;
-               } else {
-                       ret = LOCATION_ERROR_NONE;
-               }
-       } else if (0 == g_strcmp0(cmd, "ACCESSIBILITY:1")) {
-               ret = location_set_accessibility_state(LOCATION_ACCESS_ALLOWED);
-               if (ret != LOCATION_ERROR_NONE) {
-                       LOCATION_LOGD("Fail to set ACCESSIBILITY:1 [ret = %d]", ret);
-               }
-       } else if (0 == g_strcmp0(cmd, "ACCESSIBILITY:0")) {
-               ret = location_set_accessibility_state(LOCATION_ACCESS_DENIED);
-               if (ret != LOCATION_ERROR_NONE) {
-                       LOCATION_LOGD("Fail to set ACCESSIBILITY:0 [ret = %d]", ret);
-               }
-       } else {
-               LOCATION_LOGD("Invalid CMD[%s]", cmd);
-       }
+       return LOCATION_ACCESS_NONE;
+}
 
+EXPORT_API int
+location_set_option (LocationObject *obj, const char *option)
+{
+       g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
+       int ret = LOCATION_ERROR_NONE;
        return ret;
 }
index 2a0c947..d42ae19 100644 (file)
@@ -856,7 +856,6 @@ int location_get_accessibility_state (LocationAccessState *state);
 /**
  * @brief
  * Send command to the server.
- * @remarks This functions is not implemneted yet.
  * @pre
  * #location_init should be called before.\n
  * Calling application must have glib or ecore main loop.\n
@@ -871,6 +870,23 @@ int location_get_accessibility_state (LocationAccessState *state);
 int location_send_command(const char *cmd);
 
 /**
+ * @brief
+ * Set option of server.
+ * @pre
+ * #location_init should be called before.\n
+ * Calling application must have glib or ecore main loop.\n
+ * Calling application must have an active data connection.
+ * @post None.
+ * @param [in] obj - a #LocationObject created by #location_new
+ * @param [in] option - a #char
+ * @return int
+ * @retval 0                              Success
+ *
+ * Please refer #LocationError for more information.
+ */
+int location_set_option(LocationObject *obj, const char *option);
+
+/**
  * @} @}
  */
 
index 42bcf9e..c935fb1 100644 (file)
@@ -4,7 +4,7 @@
  * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- *          Genie Kim <daejins.kim@samsung.com>
+ *          Genie Kim <daejins.kim@samsung.com>, Madhu Sudhan<madhu.panga@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 #include "config.h"
 #endif
 
+#include "location-geocode.h"
 #include "location-log.h"
 
+
+struct _LocationGeocodePreference {
+       guint max_result_cnt;                            ///< Maximum number of results
+       gchar* item;
+       GHashTable *properties;
+};
+
+
+EXPORT_API LocationGeocodePreference *
+location_geocode_pref_new (void)
+{
+       LocationGeocodePreference *pref = g_slice_new0 (LocationGeocodePreference);
+       g_return_val_if_fail(pref, NULL);
+
+       pref->max_result_cnt = 0;
+       pref->properties = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+
+       return pref;
+}
+
+EXPORT_API void
+location_geocode_pref_free (LocationGeocodePreference * pref)
+{
+       g_return_if_fail(pref);
+
+       if (pref->properties) g_hash_table_destroy (pref->properties);
+
+       g_slice_free(LocationGeocodePreference, pref);
+}
+
+EXPORT_API gpointer
+location_geocode_pref_get_property (const LocationGeocodePreference *pref, gconstpointer key)
+{
+       g_return_val_if_fail (pref, NULL);
+       g_return_val_if_fail (key, NULL);
+
+       if (!pref->properties) return NULL;
+
+       return g_hash_table_lookup (pref->properties, key);
+}
+
+EXPORT_API gboolean
+location_geocode_pref_set_property (LocationGeocodePreference *pref, gconstpointer key, gconstpointer value)
+{
+       g_return_val_if_fail(pref, FALSE);
+       g_return_val_if_fail(key, FALSE);
+       g_return_val_if_fail(pref->properties, FALSE);
+
+       if (value) {
+               gchar *re_key = g_strdup (key);
+               gchar *re_val = g_strdup (value);
+               g_hash_table_insert (pref->properties, re_key, re_val);
+       } else  g_hash_table_remove (pref->properties, key);
+
+       return TRUE;
+}
+
+EXPORT_API guint
+location_geocode_pref_get_max_result (const LocationGeocodePreference *pref)
+{
+       g_return_val_if_fail(pref, 0);
+
+       return pref->max_result_cnt;
+}
+
+EXPORT_API gboolean
+location_geocode_pref_set_max_result (LocationGeocodePreference *pref, guint max_num)
+{
+       g_return_val_if_fail(pref, FALSE);
+       g_return_val_if_fail(max_num > 0, FALSE);
+
+       pref->max_result_cnt = max_num;
+
+       return TRUE;
+}
+static void geocode_pref_property_copy_cb (gpointer key, gpointer value, gpointer user_data)
+{
+       g_return_if_fail (key);
+       g_return_if_fail (value);
+       g_return_if_fail (user_data);
+
+       LocationGeocodePreference *pref = (LocationGeocodePreference *) user_data;
+       if (pref->properties) {
+               gchar *re_key = g_strdup (key);
+               gchar *re_val = g_strdup (value);
+               g_hash_table_insert (pref->properties, re_key, re_val);
+       }
+}
+
+EXPORT_API LocationGeocodePreference *
+location_geocode_pref_copy (LocationGeocodePreference *pref)
+{
+       LocationGeocodePreference *new_pref = location_geocode_pref_new();
+       g_return_val_if_fail (new_pref, NULL);
+
+       location_geocode_pref_set_max_result(new_pref, location_geocode_pref_get_max_result(pref));
+
+       g_hash_table_foreach (pref->properties, geocode_pref_property_copy_cb ,new_pref);
+
+       return new_pref;
+}
index 348a79b..6da2bc3 100644 (file)
@@ -4,7 +4,7 @@
  * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- *          Genie Kim <daejins.kim@samsung.com>
+ *          Genie Kim <daejins.kim@samsung.com> , Madhu Sudhan<madhu.panga@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -34,6 +34,98 @@ G_BEGIN_DECLS
  * @}
  */
 
+/**
+ * @brief Retrive LocationPreperence that the given LocationGeocodePreference inherits.
+ */
+
+/**
+ * @brief Create a new LocationGeocodePreference
+ * @remarks None.
+ * @pre None
+ * @post None.
+ * @return #LocationGeocodePreference
+ * @retval NULL              if error occured
+ * @see location_location_geocode_pref_free
+ *
+ */
+LocationGeocodePreference *location_geocode_pref_new (void);
+
+/**
+ * @brief Free a LocationGeocodePreference
+ * @remarks None.
+ * @pre #location_geocode_pref_new should be called before.
+ * @post None.
+ * @param [in] pref - #LocationGeocodePreference
+ * @return void
+ * @retval NULL              if error occured
+ * @see location_location_geocode_pref_set_pref
+ */
+void location_geocode_pref_free (LocationGeocodePreference * pref);
+
+/**
+ * @brief Get the property of geocode preference
+ * @remarks None.
+ * @pre #location_geocode_pref_new should be called before.
+ * @post None.
+ * @param [in] pref - #LocationGeocodePreference
+ * @param [in] key - gconstpointer
+ * @return gconstpointer
+ * @retval property value
+ * @see location_geocode_pref_set_property
+ */
+gpointer location_geocode_pref_get_property (const LocationGeocodePreference *pref, gconstpointer key);
+
+/**
+ * @brief Set property of geocode preference.
+ * @remarks The previous value of the #LocationGeocodePreference matching to key will be removed if an value is NULL.
+ * @pre #location_geocode_pref_new should be called before.
+ * @post None.
+ * @param [in] pref - #LocationGeocodePreference
+ * @param [in] key - gconstpoiner
+ * @param [in] value - gconstpointer or NULL if reset
+ * @return gboolean
+ * @retval TRUE              if success
+ * @see location_geocode_pref_get_property
+ */
+gboolean location_geocode_pref_set_property (LocationGeocodePreference *pref, gconstpointer key, gconstpointer value);
+
+/**
+ * @brief Set the maximum number of results for geocode service.
+ * @remarks None.
+ * @pre #location_geocode_pref_new should be called before.
+ * @post None.
+ * @param [in] pref - #LocationGeocodePreference
+ * @param [in] max_num - #guint
+ * @return gboolean
+ * @retval TRUE              if success
+ * @see location_geocode_pref_get_max_result
+ */
+gboolean location_geocode_pref_set_max_result (LocationGeocodePreference * pref, guint max_num);
+
+/**
+ * @brief Get the maximum number of results for geocode service.
+ * @remarks None.
+ * @pre #location_geocode_pref_new should be called before.
+ * @post None.
+ * @param [in] pref - #LocationGeocodePreference
+ * @return guint
+ * @retval 0              if error occured
+ * @see location_geocode_pref_set_max_result
+ */
+guint location_geocode_pref_get_max_result (const LocationGeocodePreference * pref);
+
+/**
+ * @brief Copy a LocationGeocodePreference
+ * @remarks None.
+ * @pre None
+ * @post None.
+ * @return #LocationGeocodePreference
+ * @retval NULL if error occured
+ * @see location_location_geocode_pref_free
+ *
+ */
+LocationGeocodePreference *location_geocode_pref_copy(LocationGeocodePreference *pref);
+
 G_END_DECLS
 
 #endif
index 69e0c5f..b139d70 100644 (file)
@@ -175,40 +175,40 @@ gboolean location_landmark_set_url (LocationLandmark *landmark, GList *url);
  * @remarks The previous categories of the #LocationLandmark will be removed if a category is NULL.
  * @pre None.
  * @post None.
- * @param [in] landmark - a #LocationLandmark
+ * @param [out] landmark - a #LocationLandmark
  * @param [in] category - a GList
  * @return gboolean
  * @retval  TRUE if success
  * @see location_landmark_get_category
  */
-gboolean location_landmark_set_category (const LocationLandmark *landmark, GList *category);
+gboolean location_landmark_set_category (LocationLandmark *landmark, GList *category);
 
 /**
  * @brief Set the phone number of the given #LocationLandmark
  * @remarks The previous phone number of the #LocationLandmark will be removed if a number is NULL.
  * @pre None.
  * @post None.
- * @param [in] landmark - a #LocationLandmark
+ * @param [out] landmark - a #LocationLandmark
  * @param [in] number - a gchar
  * @return gboolean
  * @retval  TRUE if success
  * @see location_landmark_get_phone_number
  */
-gboolean location_landmark_set_phone_number (const LocationLandmark *landmark, const gchar *number);
+gboolean location_landmark_set_phone_number (LocationLandmark *landmark, const gchar *number);
 
 /**
  * @brief Set the property data of the given #LocationLandmark
  * @remarks The previous value of the #LocationLandmark matching to key will be removed if a value is NULL.
  * @pre None.
  * @post None.
- * @param [in] landmark - a #LocationLandmark
+ * @param [out] landmark - a #LocationLandmark
  * @param [in] key - a gconstpointer
  * @param [in] value - a gconstpointer
  * @return gboolean
  * @retval  TRUE if success
  * @see location_landmark_get_property
  */
-gboolean location_landmark_set_property (const LocationLandmark *landmark, gconstpointer key, gconstpointer value);
+gboolean location_landmark_set_property (LocationLandmark *landmark, gconstpointer key, gconstpointer value);
 
 /**
  * @brief Set url of the given #LocationLandmarkUrl
@@ -237,6 +237,523 @@ gboolean location_landmark_url_set_url_path (LocationLandmarkUrl *url, const gch
 gboolean location_landmark_url_set_description (LocationLandmarkUrl *url, const gchar *desc);
 
 /**
+ * @brief Set the rating of the given #LocationLandmark
+ * @remarks The previous description of the #LocationLandmark will be removed if a desc is NULL.
+ * @pre None.
+ * @post None.
+ * @param [in] landmark - a #LocationLandmark
+ * @param [in] rating - a #LandmarkRating
+ * @return gboolean
+ * @retval  TRUE if success
+ * @see  location_landmark_get_ratings
+ */
+gboolean location_landmark_set_rating (LocationLandmark *landmark, const LandmarkRating *rating);
+
+/**
+ * @brief Set the rating' count of the given #LandmarkRating
+ * @pre None.
+ * @post None.
+ * @param [in] rating - a #LandmarkRating
+ * @param [in] count - a gint
+ * @return gboolean
+ * @retval  TRUE if success
+ * @see landmark_ratings_get_count
+ */
+gboolean landmark_rating_set_count (LandmarkRating *rating, gint count);
+
+/**
+ * @brief Set the rating' average of the given #LandmarkRating
+ * @pre None.
+ * @post None.
+ * @param [in] rating - a #LandmarkRating
+ * @param [in] average - a gdouble
+ * @return gboolean
+ * @retval  TRUE if success
+ * @see landmark_ratings_get_average
+ */
+gboolean landmark_rating_set_average(LandmarkRating *rating, gdouble average);
+
+/**
+ * @brief Set the attribute' label of the given #LocationLandmark
+ * @pre None.
+ * @post None.
+ * @param [in] attribute - a #LandmarkAttribute
+ * @param [in] label - a gchar
+ * @return gboolean
+ * @retval  TRUE if success
+ * @see landmark_attributes_get_label
+ */
+gboolean landmark_attribute_set_label(LandmarkAttribute *attribute, const gchar *label);
+
+/**
+ * @brief Set the attribute' text of the given #LocationLandmark
+ * @pre None.
+ * @post None.
+ * @param [in] attribute - a #LandmarkAttribute
+ * @param [in] text - a gchar
+ * @return gboolean
+ * @retval  TRUE if success
+ * @see landmark_attributes_get_text
+ */
+gboolean landmark_attribute_set_text(LandmarkAttribute *attribute, const gchar *text);
+
+/**
+ * @brief Set the attribute' identifier of the given #LocationLandmark
+ * @pre None.
+ * @post None.
+ * @param [in] attribute - a #LandmarkAttribute
+ * @param [in] identifier - a gchar
+ * @return gboolean
+ * @retval  TRUE if success
+ * @see landmark_attributes_get_identifier
+ */
+gboolean landmark_attribute_set_identifier(LandmarkAttribute *attribute, const gchar *identifier);
+
+/**
+ * @brief Set the attribute of the given #LocationLandmark
+ * @pre None.
+ * @post None.
+ * @param [in] landmark - a #LocationLandmark
+ * @param [in] attribute - a glist
+ * @return gboolean
+ * @retval  TRUE if success
+ * @see  location_landmark_get_attributes
+ */
+gboolean location_landmark_set_attribute(LocationLandmark *landmark, GList *attribute);
+
+/**
+ * @brief Set the contact detail type of the given #LandmarkContact
+ * @pre None.
+ * @post None.
+ * @param [in] contact - a #LandmarkContact
+ * @param [in] type - a gchar pointer
+ * @return gboolean
+ * @retval     TRUE if success
+ * @see landmark_contacts_get_type
+ */
+gboolean landmark_contact_set_type(LandmarkContact *contact, const gchar *type);
+
+/**
+ * @brief Set the contact detail label of the given #LandmarkContact
+ * @pre None.
+ * @post None.
+ * @param [in] contact - a #LandmarkContact
+ * @param [in] label - a gchar pointer
+ * @return gboolean
+ * @retval     TRUE if success
+ * @see landmark_contacts_get_label
+ */
+gboolean landmark_contact_set_label(LandmarkContact *contact, const gchar *label);
+
+/**
+ * @brief Set the contact detail value of the given #LandmarkContact
+ * @pre None.
+ * @post None.
+ * @param [in] contact - a #LandmarkContact
+ * @param [in] value - a gchar pointer
+ * @return gboolean
+ * @retval     TRUE if success
+ * @see landmark_contacts_get_value
+ */
+gboolean landmark_contact_set_value(LandmarkContact *contact, const gchar *value);
+
+/**
+ * @brief Set the contact details of the given #LocationLandmark
+ * @pre None.
+ * @post None.
+ * @param [in] landmark - a #LocationLandmark
+ * @param [in] contact - a glist
+ * @return gboolean
+ * @retval     TRUE if success
+ * @see location_landmark_get_contacts
+ */
+gboolean location_landmark_set_contact(LocationLandmark *landmark, GList *contact);
+
+/**
+ * @brief Set the supplier link of the given #LocationLandmark
+ * @pre None.
+ * @post None.
+ * @param [in] landmark - a #LocationLandmark
+ * @param [in] link - a gchar
+ * @return gboolean
+ * @retval     TRUE if success
+ * @see location_landmark_get_supplier
+ */
+gboolean location_landmark_set_supplier(LocationLandmark *landmark, const LandmarkLinkObject *supplier);
+
+/**
+ * @brief Set the media list of the given #LandmarkMedia
+ * @pre None.
+ * @post None.
+ * @param [in] media - a #LandmarkMedia
+ * @param [in] attribution - a gchar
+ * @return gboolean
+ * @retval     TRUE if success
+ * @see landmark_media_get_attribution
+ */
+gboolean  landmark_media_set_attribution (LandmarkMedia *media, const gchar *attribution);
+
+/**
+ * @brief Set the media list of the given #LandmarkMedia
+ * @pre None.
+ * @post None.
+ * @param [in] media - a #LandmarkMedia
+ * @param [in] supplier - a #LandmarkLinkObject
+ * @return gboolean
+ * @retval     TRUE if success
+ * @see landmark_media_get_media_supplier
+ */
+gboolean landmark_media_set_media_supplier(LandmarkMedia *media, const LandmarkLinkObject *mediaSupplier);
+
+/**
+ * @brief Set the media list of the given #LandmarkMedia
+ * @pre None.
+ * @post None.
+ * @param [in] media - a #LandmarkMedia
+ * @param [in] via - a #LandmarkLinkObject
+ * @return gboolean
+ * @retval     TRUE if success
+ * @see landmark_media_get_via
+ */
+gboolean landmark_media_set_via(LandmarkMedia *media, const LandmarkLinkObject *via);
+
+/**
+ * @brief Set the editorial list of the given #LocationLandmark
+ * @pre None.
+ * @post None.
+ * @param [in] landmark - a #LocationLandmark
+ * @param [in] editorial - a glist
+ * @return gboolean
+ * @retval     TRUE if success
+ * @see location_landmark_get_editorials
+ */
+gboolean location_landmark_set_editorial(LocationLandmark *landmark, GList *editorial);
+
+/**
+ * @brief Set the editorial list of the given #LandmarkEditorial
+ * @pre None.
+ * @post None.
+ * @param [in] editorial - a #LandmarkEditorial
+ * @param [in] media - a #LandmarkMedia
+ * @return gboolean
+ * @retval     TRUE if success
+ * @see location_landmark_get_editorials
+ */
+gboolean landmark_editorial_set_media(LandmarkEditorial *editorial, const LandmarkMedia *media);
+
+/**
+ * @brief Set the  description of the given #LandmarkEditorial
+ * @pre None.
+ * @post None.
+ * @param [in] editorial - a #LandmarkEditorial
+ * @param [in] description - a gchar
+ * @return gboolean
+ * @retval     TRUE if success
+ * @see location_landmark_editorials_get_attribution
+ */
+gboolean landmark_editorial_set_description(LandmarkEditorial *editorial, const gchar *description);
+
+/**
+ * @brief Set the  language of the given #LandmarkEditorial
+ * @pre None.
+ * @post None.
+ * @param [in] editorial - a #LandmarkEditorial
+ * @param [in] language - a gchar
+ * @return gboolean
+ * @retval     TRUE if success
+ * @see location_landmark_editorials_get_attribution
+ */
+gboolean landmark_editorial_set_language(LandmarkEditorial *editorial, const gchar *language);
+
+/**
+ * @brief Set the attribution of the given #LandmarkImage
+ * @pre None.
+ * @post None.
+ * @param [in] image - a #LandmarkImage
+ * @param [in] media - a #LandmarkMedia
+ * @return gboolean
+ * @retval     TRUE if success
+ * @see location_landmark_get_images
+ */
+gboolean landmark_image_set_media(LandmarkImage *image, const LandmarkMedia *media);
+
+/**
+ * @brief Set the attribution of the given #LandmarkImage
+ * @pre None.
+ * @post None.
+ * @param [in] image - a #LandmarkImage
+ * @param [in] image - a glist
+ * @return gboolean
+ * @retval     TRUE if success
+ * @see landmark_images_get_url
+ */
+gboolean landmark_image_set_url(LandmarkImage *image, const gchar *url);
+
+/**
+ * @brief Set the attribution of the given #LandmarkImage
+ * @pre None.
+ * @post None.
+ * @param [in] image - a #LandmarkImage
+ * @param [in] image - a glist
+ * @return gboolean
+ * @retval     TRUE if success
+ * @see location_landmark_get_images
+ */
+gboolean landmark_image_set_id(LandmarkImage *image, const gchar *identifier);
+
+/**
+ * @brief Set the attribution of the given #LandmarkImage
+ * @pre None.
+ * @post None.
+ * @param [in] image - a #LandmarkImage
+ * @param [in] image - a glist
+ * @return gboolean
+ * @retval     TRUE if success
+ * @see landmark_images_get_width
+ */
+gboolean landmark_image_set_width(LandmarkImage *image, guint width);
+
+/**
+ * @brief Set the attribution of the given #LandmarkImage
+ * @pre None.
+ * @post None.
+ * @param [in] image - a #LandmarkImage
+ * @param [in] image - a glist
+ * @return gboolean
+ * @retval     TRUE if success
+ * @see landmark_images_get_height
+ */
+gboolean landmark_image_set_height(LandmarkImage *image, guint height);
+
+/**
+ * @brief Set the attribution of the given #LandmarkImage
+ * @pre None.
+ * @post None.
+ * @param [in] image - a #LandmarkImage
+ * @param [in] image - a glist
+ * @return gboolean
+ * @retval     TRUE if success
+ * @see location_landmark_get_images
+ */
+gboolean landmark_image_set_image_user(LandmarkImage *image, const LandmarkLinkObject *imageUser);
+
+/**
+ * @brief Set the image list of the given #LocationLandmark
+ * @pre None.
+ * @post None.
+ * @param [in] landmark - a #LocationLandmark
+ * @param [in] image - a glist
+ * @return gboolean
+ * @retval     TRUE if success
+ * @see location_landmark_get_images
+ */
+gboolean location_landmark_set_image(LocationLandmark *landmark, GList *image);
+
+/**
+ * @brief Set the review list of the given #LandmarkMedia
+ * @pre None.
+ * @post None.
+ * @param [in] review - a #LandmarkReview
+ * @param [in] media - a #LandmarkMedia
+ * @return gboolean
+ * @retval     TRUE if success
+ * @see landmark_reviews_get_media
+ */
+gboolean landmark_review_set_media(LandmarkReview *review, const LandmarkMedia *media);
+
+/**
+ * @brief Set the date of the given #LandmarkReview
+ * @pre None.
+ * @post None.
+ * @param [in] review - a #LandmarkReview
+ * @param [in] date - a  gchar
+ * @return gboolean
+ * @retval     TRUE if success
+ * @see landmark_reviews_get_date
+ */
+gboolean landmark_review_set_date(LandmarkReview *review, const gchar *date);
+
+/**
+ * @brief Set the title of the given #LandmarkReview
+ * @pre None.
+ * @post None.
+ * @param [in] review - a #LandmarkReview
+ * @param [in] title - a gchar
+ * @return gboolean
+ * @retval     TRUE if success
+ * @see landmark_reviews_get_title
+ */
+gboolean landmark_review_set_title(LandmarkReview *review, const gchar *title);
+
+/**
+ * @brief Set the rating of the given #LandmarkReview
+ * @pre None.
+ * @post None.
+ * @param [in] review - a #LandmarkReview
+ * @param [in] rating - a gdouble
+ * @return gboolean
+ * @retval     TRUE if success
+ * @see landmark_reviews_get_rating
+ */
+gboolean landmark_review_set_rating(LandmarkReview *review, gdouble rating);
+
+/**
+ * @brief Set the rating of the given #LandmarkReview
+ * @pre None.
+ * @post None.
+ * @param [in] review - a #LandmarkReview
+ * @param [in] description - a gchar
+ * @return gboolean
+ * @retval     TRUE if success
+ * @see landmark_reviews_get_description
+ */
+gboolean landmark_review_set_description(LandmarkReview *review, const gchar *description);
+
+/**
+ * @brief Set the language  of the given #LandmarkReview
+ * @pre None.
+ * @post None.
+ * @param [in] review - a #LandmarkReview
+ * @param [in] language - a gchar
+ * @return gboolean
+ * @retval     TRUE if success
+ * @see landmark_reviews_get_language
+ */
+gboolean landmark_review_set_language(LandmarkReview *review, const gchar *language);
+
+/**
+ * @brief Set the language  of the given #LandmarkReview
+ * @pre None.
+ * @post None.
+ * @param [in] review - a #LandmarkReview
+ * @param [in] user - a #LandmarkLinkObject
+ * @return gboolean
+ * @retval     TRUE if success
+ * @see landmark_reviews_get_review_user
+ */
+gboolean landmark_review_set_review_user(LandmarkReview *review, const LandmarkLinkObject *reviewUser);
+
+/**
+ * @brief Set the review  of the given #landmark
+ * @pre None.
+ * @post None.
+ * @param [in] landmark - a #LocationLandmark
+ * @param [in] review - a #GList
+ * @return gboolean
+ * @retval     TRUE if success
+ * @see location_landmark_get_reviews
+ */
+gboolean location_landmark_set_review(LocationLandmark *landmark, GList *review);
+
+/**
+ * @brief Set the linkObject  of the given #LocationLandmark
+ * @pre None.
+ * @post None.
+ * @param [in] landmark - a #LocationLandmark
+ * @param [in] linkObject - a #LandmarkLinkObject
+ * @return gboolean
+ * @retval     TRUE if success
+ * @see location_landmark_get_related
+ */
+gboolean location_landmark_set_related(LocationLandmark *landmark, const LandmarkLinkObject *related);
+
+/**
+ * @brief Set the id of the given #LandmarkCategory
+ * @pre None.
+ * @post None.
+ * @param [in] category - a #LandmarkCategory
+ * @param [in] id - a gchar
+ * @return gboolean
+ * @retval     TRUE if success
+ * @see landmark_category_get_id
+ */
+gboolean landmark_category_set_id (LandmarkCategory *category,  const gchar *id);
+
+/**
+ * @brief Set the name of the given #LandmarkCategory
+ * @pre None.
+ * @post None.
+ * @param [in] category - a #LandmarkCategory
+ * @param [in] name - a gchar
+ * @return gboolean
+ * @retval     TRUE if success
+ * @see landmark_category_get_name
+ */
+gboolean landmark_category_set_name (LandmarkCategory *category,  const gchar *name);
+
+/**
+ * @brief Set the url of the given #LandmarkCategory
+ * @pre None.
+ * @post None.
+ * @param [in] category - a #LandmarkCategory
+ * @param [in] url - a gchar
+ * @return gboolean
+ * @retval     TRUE if success
+ * @see landmark_category_get_url
+ */
+gboolean landmark_category_set_url (LandmarkCategory *category,  const gchar *url);
+
+/**
+ * @brief Set the subcategories of the given #LandmarkCategory
+ * @pre None.
+ * @post None.
+ * @param [in] category - a #LandmarkCategory
+ * @param [in] subcategories - a #GList
+ * @return gboolean
+ * @retval     TRUE if success
+ * @see landmark_category_get_subcategories
+ */
+gboolean landmark_category_set_subcategories (LandmarkCategory *category, GList *subcategories);
+
+/**
+ * @brief Set the value  of the given #LandmarkLinkObject
+ * @pre None.
+ * @post None.
+ * @param [in] link - a #LandmarkLinkObject
+ * @param [in] value - a gchar
+ * @return gboolean
+ * @retval     TRUE if success
+ * @see landmark_linkobject_get_link_string
+ */
+gboolean landmark_linkobject_set_link_string(LandmarkLinkObject *link, const gchar *linkString);
+
+/**
+ * @brief Set the value  of the given #LandmarkLinkObject
+ * @pre None.
+ * @post None.
+ * @param [in] link - a #LandmarkLinkObject
+ * @param [in] type - a gchar
+ * @return gboolean
+ * @retval     TRUE if success
+ * @see landmark_linkobject_get_type
+ */
+gboolean landmark_linkobject_set_type(LandmarkLinkObject *link, const gchar *type);
+
+/**
+ * @brief Set the value  of the given #LandmarkLinkObject
+ * @pre None.
+ * @post None.
+ * @param [in] link - a #LandmarkLinkObject
+ * @param [in] name - a gchar
+ * @return gboolean
+ * @retval     TRUE if success
+ * @see landmark_linkobject_get_name
+ */
+gboolean landmark_linkobject_set_name(LandmarkLinkObject *link, const gchar *name);
+
+/**
+ * @brief Set the id  of the given #LandmarkLinkObject
+ * @pre None.
+ * @post None.
+ * @param [in] link - a #LandmarkLinkObject
+ * @param [in] id - a gchar
+ * @return gboolean
+ * @retval     TRUE if success
+ * @see landmark_linkobject_get_id
+ */
+gboolean landmark_linkobject_set_id(LandmarkLinkObject *link, const gchar *id);
+
+/**
  * @} @}
  */
 
index 89b2794..5aa1910 100644 (file)
 #include "location-types.h"
 #include "map-service.h"
 
+#include "location-landmark.h"
+#include "location-landmark-ext.h"
+
+
+struct _LandmarkAttribute {
+       gchar *label;
+       gchar *text;
+       gchar *id;
+};
+
+struct _LandmarkContact {
+       gchar *type;            ///< the contact detail type
+       gchar *label;           ///< the contact detail label
+       gchar *value;           ///< the contact detail value
+};
+
+struct _LandmarkLinkObject {
+       gchar *linkString;      ///< a string containing the link string
+       gchar *type;            ///< a value representing the link type
+       gchar *name;            ///< the link name
+       gchar *id;              ///< the identifier of the given link object
+};
+
+
+struct _LandmarkMedia {
+       gchar *attribution;     ///< the attribution text
+       LandmarkLinkObject *mediaSupplier;      ///< information about the supplier of the media
+       LandmarkLinkObject *via;                   ///< the external link through which the media item was sourced (not the original owner/creator)
+};
+
+struct _LandmarkCategory {
+       gchar *name;               ///< the name of the category
+       gchar *id;                     ///< the category id
+       GList *subcategories;  ///< a list containing the child categories
+       gchar *url;                ///<  the category URL
+};
+
+struct _LandmarkImage {
+       LandmarkMedia *media; ///< media items information
+       gchar *url;               ///< the image URL
+       gchar *id;                ///< the id of the image
+       guint width;              ///< the width of the image
+       guint height;             ///< the height of the image
+       LandmarkLinkObject *imageUser;  ///< the image user link
+};
+
+struct _LandmarkEditorial {
+       LandmarkMedia *media; ///< media items information
+       gchar *description;   ///< the description (text of the given editorial)
+       gchar *language;      ///< the language of the editorial
+};
+
+struct _LandmarkReview {
+       LandmarkMedia *media;///< media items information
+       gchar *date;             ///< the review date
+       gchar *title;            ///< the review title
+       gdouble rating;          ///< the review rating
+       gchar *description;  ///< the review description (text)
+       gchar *language;     ///< the review language
+       LandmarkLinkObject *reviewUser; ///< the user (a link to the user's Web site)
+};
+
+struct _LandmarkRating {
+       gint count;
+       gdouble average;    ///< rating average score
+};
+
 struct _LocationLandmark {
 
        guint id;                       ///< Unique identifier of the landmark
-       guint priority;                 ///< Degree of importance of the landmark (Between HIGHEST_LANDMARK_PRIORITY and LOWEST_LANDMARK_PRIORITY)
-       gchar *name;                    ///< Name of landmark
-       LocationPosition *position;             ///< Positon of the landmark, may be null if not known
+       guint priority;         ///< Degree of importance of the landmark (Between HIGHEST_LANDMARK_PRIORITY and LOWEST_LANDMARK_PRIORITY)
+       gchar *name;            ///< Name of landmark
+       LocationPosition *position;     ///< Positon of the landmark, may be null if not known
        LocationAddress *addr;          ///< Textual address information of the landmark, may be null if not
-       LocationBoundary *bbox; ///< Coverage area of the landmark, may be null if not available
-       guint timestamp;                ///< Time when the landmark data was last updated (updated by system and used to facilitate tracking)
+       LocationBoundary *bbox;     ///< Coverage area of the landmark, may be null if not available
+       guint timestamp;                    ///< Time when the landmark data was last updated (updated by system and used to facilitate tracking)
 
-       gchar *author;                  ///< Provider of the landmark data, may be null
-       gchar *store;                   ///< Name of landmark store that the landmark belongs to
+       gchar *author;                      ///< Provider of the landmark data, may be null
+       gchar *store;                       ///< Name of landmark store that the landmark belongs to
        gchar *phone_number;            ///< Nhone number of the landmark, may be null
-       GList *category;                ///< Categories to which the landmark belongs to
-       GList  *url;                    ///< Url to additional content (Optional)
-       gchar *desc;                    ///< Description of the landmark, may be null if not available
+       GList *category;                    ///< Categories to which the landmark belongs to
+       GList  *url;                        ///< Url to additional content (Optional)
+       gchar *desc;                        ///< Description of the landmark, may be null if not available
 
        GHashTable *properties;         ///< Extra info of the landmark
-
+       LandmarkRating *rating;   ///< the rating for the given place.
+       GList *attribute;                   ///<  list of LandmarkAttribute, place attribute
+       GList *contact;                     ///< list of LandmarkContact, contact details
+       LandmarkLinkObject *supplier;///< a link to the supplier of information about the given place
+       GList *editorial;                   ///<  a list of list editorial relating to the given place
+       GList *image;                       ///< a list of image relating to the given place
+       GList *review;                      ///< a list of review relating to the given place
+       LandmarkLinkObject *related;///< related places (for example "recommended" places)
 };
 
 struct _LocationLandmarkUrl {
-       gchar *path;                    ///< Url of landmark url info
-       gchar *desc;                    ///< Description of landmark url info
+       gchar *path;                        ///< Url of landmark url info
+       gchar *desc;                        ///< Description of landmark url info
 };
 
 EXPORT_API guint
@@ -164,7 +238,9 @@ location_landmark_get_property (const LocationLandmark *landmark, gconstpointer
 {
        g_return_val_if_fail(landmark, NULL);
        g_return_val_if_fail(key, NULL);
-       if (!landmark->properties) return NULL;
+       if (!landmark->properties) {
+               return NULL;
+       }
 
        return g_hash_table_lookup (landmark->properties, key);
 }
@@ -188,7 +264,9 @@ location_landmark_set_name (LocationLandmark *landmark, const gchar *name)
                g_free(landmark->name);
                landmark->name = NULL;
        }
-       if (name) landmark->name = g_strdup (name);
+       if (name) {
+               landmark->name = g_strdup (name);
+       }
 
        return TRUE;
 }
@@ -203,7 +281,9 @@ location_landmark_set_position (LocationLandmark *landmark, const LocationPositi
                landmark->position = NULL;
        }
 
-       if (position) landmark->position = location_position_copy (position);
+       if (position) {
+               landmark->position = location_position_copy (position);
+       }
 
        return TRUE;
 
@@ -219,7 +299,9 @@ location_landmark_set_address (LocationLandmark *landmark, const LocationAddress
                landmark->addr = NULL;
        }
 
-       if (addr) landmark->addr = location_address_copy (addr);
+       if (addr) {
+               landmark->addr = location_address_copy (addr);
+       }
 
        return TRUE;
 
@@ -235,7 +317,9 @@ location_landmark_set_description (LocationLandmark *landmark, const gchar *desc
                landmark->desc = NULL;
        }
 
-       if (desc) landmark->desc = g_strdup (desc);
+       if (desc) {
+               landmark->desc = g_strdup (desc);
+       }
 
        return TRUE;
 }
@@ -271,7 +355,9 @@ location_landmark_set_bounding_box (LocationLandmark *landmark, const LocationBo
                landmark->bbox = NULL;
        }
 
-       if (bbox) landmark->bbox = location_boundary_copy (bbox);
+       if (bbox) {
+               landmark->bbox = location_boundary_copy (bbox);
+       }
 
        return TRUE;
 }
@@ -285,11 +371,59 @@ location_landmark_set_author (LocationLandmark *landmark, const gchar *author)
                g_free(landmark->author);
                landmark->author = NULL;
        }
-       if (author) landmark->author = g_strdup (author);
+       if (author) {
+               landmark->author = g_strdup (author);
+       }
+
+       return TRUE;
+}
+
+EXPORT_API gboolean
+location_landmark_url_set_url_path (LocationLandmarkUrl *url, const gchar *path)
+{
+       g_return_val_if_fail (url, FALSE);
+
+       if (url->path) {
+               g_free(url->path);
+               url->path = NULL;
+       }
+
+       if (path) {
+               url->path = g_strdup (path);
+       }
+
+       return TRUE;
+}
+
+EXPORT_API gboolean
+location_landmark_url_set_description (LocationLandmarkUrl *url, const gchar *desc)
+{
+       g_return_val_if_fail (url, FALSE);
+
+       if (url->desc) {
+               g_free(url->desc);
+               url->desc = NULL;
+       }
+
+       if (desc) {
+               url->desc = g_strdup (desc);
+       }
 
        return TRUE;
 }
 
+
+EXPORT_API void
+location_landmark_url_free (LocationLandmarkUrl * url)
+{
+       g_return_if_fail (url);
+
+       location_landmark_url_set_url_path(url, NULL);
+       location_landmark_url_set_description(url, NULL);
+
+       g_slice_free(LocationLandmarkUrl, url);
+}
+
 static void landmark_url_foreach_free (gpointer data)
 {
        g_return_if_fail(data);
@@ -307,7 +441,9 @@ static void landmark_foreach_url_copy (gpointer data, gpointer user_data)
        LocationLandmarkUrl *url = (LocationLandmarkUrl *)data;
        LocationLandmark *landmark = (LocationLandmark *) user_data;
 
-       if(!url || !landmark) return;
+       if(!url || !landmark) {
+               return;
+       }
 
        landmark->url = g_list_append(landmark->url, url);
 }
@@ -322,29 +458,159 @@ location_landmark_set_url (LocationLandmark *landmark, GList *url)
                landmark->url = NULL;
        }
 
-       if (url) g_list_foreach (url, landmark_foreach_url_copy, landmark);
+       if (url) {
+               g_list_foreach (url, landmark_foreach_url_copy, landmark);
+       }
 
        return TRUE;
 }
 
+EXPORT_API void landmark_category_free (LandmarkCategory *category)
+{
+       g_return_if_fail (category);
+
+       landmark_category_set_name(category, NULL);
+       landmark_category_set_id (category, NULL);
+       landmark_category_set_subcategories (category, NULL);
+       landmark_category_set_url(category, NULL);
+
+       g_slice_free(LandmarkCategory, category);
+}
+
+static void landmark_category_foreach_free (gpointer data)
+{
+       g_return_if_fail(data);
+
+       LandmarkCategory *category = (LandmarkCategory *)data;
+
+       landmark_category_free (category);
+}
+
+
+EXPORT_API LandmarkCategory *landmark_category_new (void)
+{
+       LandmarkCategory *category = g_slice_new0 (LandmarkCategory);
+       g_return_val_if_fail(category, NULL);
+
+       return category;
+}
+
 static void landmark_foreach_copy_category (gpointer data, gpointer user_data)
 {
        g_return_if_fail (data);
        g_return_if_fail (user_data);
 
-       gchar *category_name = (gchar *)data;
+       LandmarkCategory *category = (LandmarkCategory *)data;
        LocationLandmark *landmark = (LocationLandmark *) user_data;
+       landmark->category = g_list_append (landmark->category, landmark_category_copy(category));
+}
+
+
+EXPORT_API gboolean landmark_category_set_id (LandmarkCategory *category,  const gchar *id)
+{
+       g_return_val_if_fail(category, FALSE);
+       if (category->id) {
+               g_free(category->id);
+               category->id = NULL;
+       }
+
+       if (id) {
+               category->id = g_strdup (id);
+       }
 
-       landmark->category = g_list_append (landmark->category, g_strdup(category_name));
+       return TRUE;
 }
 
-static void landmark_free_category (gpointer data)
+EXPORT_API gchar *landmark_category_get_id (const LandmarkCategory *category)
 {
-       g_return_if_fail (data);
+       g_return_val_if_fail(category, NULL);
+
+       return category->id;
+}
+
+
+EXPORT_API gboolean landmark_category_set_name (LandmarkCategory *category,  const gchar *name)
+{
+       g_return_val_if_fail(category, FALSE);
+
+       if (category->name) {
+               g_free(category->name);
+               category->name = NULL;
+       }
+
+       if (name) {
+               category->name = g_strdup (name);
+       }
+
+       return TRUE;
+}
+
+EXPORT_API gchar *landmark_category_get_name (const LandmarkCategory *category)
+{
+       g_return_val_if_fail(category, NULL);
+
+       return category->name;
+}
+
+EXPORT_API gboolean landmark_category_set_url (LandmarkCategory *category,  const gchar *url)
+{
+       g_return_val_if_fail(category, FALSE);
+       if (category->url) {
+               g_free(category->url);
+               category->url = NULL;
+       }
+
+       if (url) {
+               category->url = g_strdup (url);
+       }
+
+       return TRUE;
+}
+
+EXPORT_API gchar *landmark_category_get_url (const LandmarkCategory *category)
+{
+       g_return_val_if_fail(category, NULL);
+
+       return category->url;
+}
+
+EXPORT_API gboolean landmark_category_set_subcategories (LandmarkCategory *category, GList *subcategories)
+{
+       g_return_val_if_fail(category, FALSE);
 
-       gchar * category_name = (gchar *)data;
+       if (category->subcategories) {
+               g_list_free_full(category->subcategories, landmark_category_foreach_free);
+               category->subcategories = NULL;
+       }
+
+       if (subcategories) {
+               g_list_foreach ((GList*) subcategories, landmark_foreach_copy_category, category);
+       }
+
+       return TRUE;
+}
+
+
+EXPORT_API GList *landmark_category_get_subcategories (const LandmarkCategory *category)
+{
+       g_return_val_if_fail(category, NULL);
+
+       return  category->subcategories;
+}
+
+EXPORT_API LandmarkCategory *landmark_category_copy (const LandmarkCategory *category)
+{
+       g_return_val_if_fail(category, NULL);
+
+       LandmarkCategory *new_category = landmark_category_new();
+       g_return_val_if_fail(new_category, NULL);
 
-       g_free (category_name);
+       landmark_category_set_id (new_category,  landmark_category_get_id (category));
+       landmark_category_set_url (new_category,  landmark_category_get_url (category));
+       landmark_category_set_name (new_category,  landmark_category_get_name (category));
+       landmark_category_set_subcategories (new_category,  landmark_category_get_subcategories (category));
+
+       return new_category;
 }
 
 EXPORT_API gboolean
@@ -353,11 +619,13 @@ location_landmark_set_category (LocationLandmark *landmark, GList *category)
        g_return_val_if_fail(landmark, FALSE);
 
        if (landmark->category) {
-               g_list_free_full(landmark->category, landmark_free_category);
+               g_list_free_full(landmark->category, landmark_category_foreach_free);
                landmark->category = NULL;
        }
 
-       if (category) g_list_foreach ((GList*) category, landmark_foreach_copy_category, landmark);
+       if (category) {
+               g_list_foreach ((GList*) category, landmark_foreach_copy_category, landmark);
+       }
 
        return TRUE;
 }
@@ -372,7 +640,10 @@ location_landmark_set_phone_number (LocationLandmark *landmark, const gchar *num
                g_free(landmark->phone_number);
                landmark->phone_number = NULL;
        }
-       if (number) landmark->phone_number = g_strdup (number);
+
+       if (number) {
+               landmark->phone_number = g_strdup (number);
+       }
 
        return TRUE;
 }
@@ -382,14 +653,17 @@ location_landmark_set_property(LocationLandmark *landmark, gconstpointer key, gc
 {
        g_return_val_if_fail(landmark, FALSE);
        g_return_val_if_fail(key, FALSE);
-       if (!landmark->properties) return FALSE;
+       if (!landmark->properties) {
+               return FALSE;
+       }
 
        if (value) {
                gchar *re_key = g_strdup (key);
                gchar *re_val = g_strdup (value);
                g_hash_table_insert(landmark->properties, re_key, re_val);
+       } else {
+               g_hash_table_remove (landmark->properties, key);
        }
-       else g_hash_table_remove (landmark->properties, key);
 
        return TRUE;
 }
@@ -410,119 +684,1329 @@ location_landmark_url_get_description (const LocationLandmarkUrl *url)
        return url->desc;
 }
 
-EXPORT_API gboolean
-location_landmark_url_set_url_path (LocationLandmarkUrl *url, const gchar *path)
+EXPORT_API LocationLandmarkUrl *
+location_landmark_url_new (void)
 {
-       g_return_val_if_fail (url, FALSE);
+       LocationLandmarkUrl *url = g_slice_new0 (LocationLandmarkUrl);
+       g_return_val_if_fail(url, NULL);
 
-       if (url->path) {
-               g_free(url->path);
-               url->path = NULL;
-       }
+       return url;
+}
 
-       if (path) url->path = g_strdup (path);
+EXPORT_API LocationLandmarkUrl *
+location_landmark_url_copy (const LocationLandmarkUrl *url)
+{
+       g_return_val_if_fail(url, NULL);
 
-       return TRUE;
+       LocationLandmarkUrl *new_url = location_landmark_url_new();
+
+       location_landmark_url_set_url_path(new_url, location_landmark_url_get_url_path(url));
+       location_landmark_url_set_description(new_url, location_landmark_url_get_description(url));
+
+       return new_url;
 }
 
-EXPORT_API gboolean
-location_landmark_url_set_description (LocationLandmarkUrl *url, const gchar *desc)
+EXPORT_API LocationLandmark *
+location_landmark_new (void)
 {
-       g_return_val_if_fail (url, FALSE);
-
-       if (url->desc) {
-               g_free(url->desc);
-               url->desc = NULL;
+       LocationLandmark *landmark = g_slice_new0 (LocationLandmark);
+       if (!landmark) {
+               return NULL;
        }
 
-       if (desc) url->desc = g_strdup (desc);
+       landmark->properties = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
+
+       return landmark;
+}
+
+EXPORT_API gboolean landmark_rating_set_count (LandmarkRating *rating, gint count)
+{
+       g_return_val_if_fail(rating, FALSE);
+       g_return_val_if_fail(count >= 0, FALSE);
+
+       rating->count = count;
 
        return TRUE;
 }
 
-EXPORT_API LocationLandmarkUrl *
-location_landmark_url_new (void)
+EXPORT_API gint landmark_rating_get_count(const LandmarkRating *rating)
 {
-       LocationLandmarkUrl *url = g_slice_new0 (LocationLandmarkUrl);
-       if(!url) return NULL;
+       g_return_val_if_fail(rating, 0);
+
+       return rating->count;
+}
+
+EXPORT_API gboolean landmark_rating_set_average(LandmarkRating *rating, gdouble average)
+{
+       g_return_val_if_fail(rating, FALSE);
 
+       rating->average = average;
 
-       return url;
+       return TRUE;
 }
 
-EXPORT_API void
-location_landmark_url_free (LocationLandmarkUrl * url)
+EXPORT_API gdouble landmark_rating_get_average(const LandmarkRating *rating)
 {
-       g_return_if_fail (url);
+       g_return_val_if_fail(rating, 0);
 
+       return rating->average;
+}
 
-       location_landmark_url_set_url_path(url, NULL);
-       location_landmark_url_set_description(url, NULL);
+EXPORT_API LandmarkRating *landmark_rating_new (void)
+{
+       LandmarkRating *rating = g_slice_new0 (LandmarkRating);
+       g_return_val_if_fail(rating, NULL);
 
-       g_slice_free(LocationLandmarkUrl, url);
+       return rating;
 }
 
-EXPORT_API LocationLandmarkUrl *
-location_landmark_url_copy (const LocationLandmarkUrl *url)
+EXPORT_API void landmark_rating_free (LandmarkRating *rating)
 {
-       g_return_val_if_fail(url, NULL);
+       g_return_if_fail (rating);
 
-       LocationLandmarkUrl *new_url = location_landmark_url_new();
+       landmark_rating_set_count(rating, 0);
+       landmark_rating_set_average(rating, 0);
 
-       location_landmark_url_set_url_path(new_url, location_landmark_url_get_url_path(url));
-       location_landmark_url_set_description(new_url, location_landmark_url_get_description(url));
+       g_slice_free(LandmarkRating, rating);
+}
 
-       return new_url;
+EXPORT_API LandmarkRating *landmark_rating_copy(const LandmarkRating *rating)
+{
+       g_return_val_if_fail (rating, NULL);
+       LandmarkRating *new_ratings = landmark_rating_new();
+       g_return_val_if_fail (new_ratings, NULL);
+
+       landmark_rating_set_count(new_ratings, landmark_rating_get_count(rating));
+       landmark_rating_set_average(new_ratings, landmark_rating_get_average(rating));
+
+       return new_ratings;
 }
 
-EXPORT_API LocationLandmark *
-location_landmark_new (void)
+EXPORT_API gboolean location_landmark_set_rating(LocationLandmark *landmark, const LandmarkRating *rating)
 {
-       LocationLandmark *landmark = g_slice_new0 (LocationLandmark);
-       if (!landmark) return NULL;
+       g_return_val_if_fail (landmark, FALSE);
 
-       landmark->properties = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
+       if (landmark->rating) {
+               g_slice_free(LandmarkRating, landmark->rating);
+               landmark->rating = NULL;
+       }
 
-       return landmark;
+       if (rating) {
+               landmark->rating = landmark_rating_copy (rating);
+       }
+
+       return TRUE;
 }
 
-EXPORT_API LocationLandmark *
-location_landmark_copy (const LocationLandmark *landmark)
+
+EXPORT_API LandmarkRating *location_landmark_get_rating(const LocationLandmark *landmark)
 {
        g_return_val_if_fail (landmark, NULL);
 
-       LocationLandmark *new_landmark = location_landmark_new();
-       if (!new_landmark) return NULL;
+       return landmark->rating;
+}
 
-       location_landmark_set_id(new_landmark, location_landmark_get_id(landmark));
-       location_landmark_set_name (new_landmark, location_landmark_get_name (landmark));
-       location_landmark_set_position (new_landmark, location_landmark_get_position(landmark));
-       location_landmark_set_address (new_landmark, location_landmark_get_address (landmark));
-       location_landmark_set_description (new_landmark, location_landmark_get_description(landmark));
-       location_landmark_set_timestamp (new_landmark, location_landmark_get_timestamp(landmark));
-       location_landmark_set_priority (new_landmark, location_landmark_get_priority(landmark));
-       location_landmark_set_bounding_box (new_landmark, location_landmark_get_bounding_box(landmark));
-       location_landmark_set_author (new_landmark, location_landmark_get_author(landmark));
-       location_landmark_set_url(new_landmark, location_landmark_get_url(landmark));
+EXPORT_API gboolean landmark_attribute_set_label(LandmarkAttribute *attribute, const gchar *label)
+{
+       g_return_val_if_fail(attribute, FALSE);
 
-       return new_landmark;
+       if (attribute->label) {
+               g_free(attribute->label);
+               attribute->label = NULL;
+       }
+
+       if (label) {
+               attribute->label = g_strdup (label);
+       }
+
+       return TRUE;
 }
 
-EXPORT_API void
-location_landmark_free (LocationLandmark *landmark)
+EXPORT_API gchar *landmark_attribute_get_label(const LandmarkAttribute *attribute)
 {
-       g_return_if_fail (landmark);
+       g_return_val_if_fail(attribute, NULL);
 
-       location_landmark_set_id(landmark, 0);
-       location_landmark_set_name (landmark, NULL);
-       location_landmark_set_position (landmark, NULL);
-       location_landmark_set_address (landmark, NULL);
-       location_landmark_set_description (landmark, NULL);
+       return attribute->label;
+}
+
+
+EXPORT_API gboolean  landmark_attribute_set_text(LandmarkAttribute *attribute, const gchar *text)
+{
+       g_return_val_if_fail(attribute, FALSE);
+
+       if (attribute->text) {
+               g_free(attribute->text);
+               attribute->text = NULL;
+       }
+
+       if (text) {
+               attribute->text = g_strdup (text);
+       }
+
+       return TRUE;
+}
+EXPORT_API gchar *landmark_attribute_get_text(const LandmarkAttribute *attribute)
+{
+       g_return_val_if_fail(attribute, NULL);
+
+       return attribute->text;
+}
+
+EXPORT_API gboolean landmark_attribute_set_identifier(LandmarkAttribute *attribute, const gchar *identifier)
+{
+       g_return_val_if_fail(attribute, FALSE);
+
+       if (attribute->id) {
+               g_free(attribute->id);
+               attribute->id = NULL;
+       }
+
+       if (identifier) {
+               attribute->id = g_strdup (identifier);
+       }
+
+       return TRUE;
+}
+
+EXPORT_API gchar *landmark_attribute_get_identifier (const LandmarkAttribute *attribute)
+{
+       g_return_val_if_fail(attribute, NULL);
+
+       return attribute->id;
+}
+
+EXPORT_API LandmarkAttribute *landmark_attribute_new (void)
+{
+       LandmarkAttribute *attribute = g_slice_new0 (LandmarkAttribute);
+       g_return_val_if_fail(attribute, NULL);
+
+       return attribute;
+}
+
+EXPORT_API void landmark_attribute_free (LandmarkAttribute *attribute)
+{
+       g_return_if_fail (attribute);
+
+       landmark_attribute_set_label(attribute, NULL);
+       landmark_attribute_set_text(attribute, NULL);
+       landmark_attribute_set_identifier(attribute, NULL);
+
+       g_slice_free(LandmarkAttribute, attribute);
+}
+
+EXPORT_API LandmarkAttribute *landmark_attribute_copy(const LandmarkAttribute *attribute)
+{
+       g_return_val_if_fail(attribute, NULL);
+
+       LandmarkAttribute *new_attribute = landmark_attribute_new();
+       g_return_val_if_fail(new_attribute, NULL);
+
+       landmark_attribute_set_label(new_attribute, landmark_attribute_get_label(attribute));
+       landmark_attribute_set_text(new_attribute, landmark_attribute_get_text(attribute));
+       landmark_attribute_set_identifier(new_attribute, landmark_attribute_get_identifier(attribute));
+
+       return new_attribute;
+}
+
+static void landmark_attribute_foreach_copy (gpointer data, gpointer user_data)
+{
+       g_return_if_fail (data);
+       g_return_if_fail (user_data);
+
+       LandmarkAttribute *attribute = (LandmarkAttribute *)data;
+       LocationLandmark *landmark = (LocationLandmark *)user_data;
+
+       landmark->attribute = g_list_append (landmark->attribute, landmark_attribute_copy(attribute));
+}
+
+EXPORT_API gboolean landmark_contact_set_type(LandmarkContact *contact, const gchar *type)
+{
+       g_return_val_if_fail(contact, FALSE);
+
+       if (contact->type) {
+               g_free(contact->type);
+               contact->type = NULL;
+       }
+
+       if (type) {
+               contact->type = g_strdup (type);
+       }
+
+       return TRUE;
+}
+
+EXPORT_API gchar *landmark_contact_get_type(const LandmarkContact *contact)
+{
+       g_return_val_if_fail(contact, NULL);
+
+       return contact->type;
+}
+
+EXPORT_API gboolean landmark_contact_set_label(LandmarkContact *contact, const gchar *label)
+{
+       g_return_val_if_fail(contact, FALSE);
+
+       if (contact->label) {
+               g_free(contact->label);
+               contact->label = NULL;
+       }
+
+       if (label) {
+               contact->label = g_strdup (label);
+       }
+
+       return TRUE;
+}
+
+EXPORT_API gchar *landmark_contact_get_label(const LandmarkContact *contact)
+{
+       g_return_val_if_fail(contact, NULL);
+
+       return contact->label;
+}
+
+EXPORT_API gboolean landmark_contact_set_value(LandmarkContact *contact, const gchar *value)
+{
+       g_return_val_if_fail(contact, FALSE);
+       if (contact->value) {
+               g_free(contact->value);
+               contact->value = NULL;
+       }
+
+       if (value) {
+               contact->value = g_strdup (value);
+       }
+
+       return TRUE;
+}
+
+EXPORT_API gchar *landmark_contact_get_value(const LandmarkContact *contact)
+{
+       g_return_val_if_fail(contact, NULL);
+
+       return contact->value;
+}
+
+static void landmark_attribute_foreach_free (gpointer data)
+{
+       g_return_if_fail(data);
+
+       LandmarkAttribute *attribute = (LandmarkAttribute *)data;
+
+       landmark_attribute_free (attribute);
+}
+
+EXPORT_API gboolean location_landmark_set_attribute(LocationLandmark *landmark, GList *attribute)
+{
+       g_return_val_if_fail(landmark, FALSE);
+
+       if (landmark->attribute) {
+               g_list_free_full(landmark->attribute, landmark_attribute_foreach_free);
+               landmark->attribute = NULL;
+       }
+
+       if (attribute) {
+               g_list_foreach (attribute, landmark_attribute_foreach_copy, landmark);
+       }
+
+       return TRUE;
+}
+
+EXPORT_API GList *location_landmark_get_attribute(const LocationLandmark *landmark)
+{
+       g_return_val_if_fail(landmark, NULL);
+
+       return landmark->attribute;
+}
+
+
+EXPORT_API void landmark_contact_free (LandmarkContact *contact)
+{
+       g_return_if_fail (contact);
+
+       landmark_contact_set_type(contact, NULL);
+       landmark_contact_set_label(contact, NULL);
+       landmark_contact_set_value(contact, NULL);
+
+       g_slice_free(LandmarkContact, contact);
+}
+
+static void landmark_contact_foreach_free (gpointer data)
+{
+       g_return_if_fail(data);
+       LandmarkContact *contact = (LandmarkContact *)data;
+
+       landmark_contact_free (contact);
+}
+
+EXPORT_API LandmarkContact *landmark_contact_new (void)
+{
+       LandmarkContact *contact = g_slice_new0 (LandmarkContact);
+       g_return_val_if_fail(contact, NULL);
+
+       return contact;
+}
+
+EXPORT_API LandmarkContact *landmark_contact_copy (const LandmarkContact *contact)
+{
+       g_return_val_if_fail(contact, NULL);
+
+       LandmarkContact *new_contact = landmark_contact_new();
+       g_return_val_if_fail(new_contact, NULL);
+
+       landmark_contact_set_type(new_contact, landmark_contact_get_type(contact));
+       landmark_contact_set_label(new_contact, landmark_contact_get_label(contact));
+       landmark_contact_set_value(new_contact, landmark_contact_get_value(contact));
+
+       return new_contact;
+}
+
+static void landmark_contact_foreach_copy (gpointer data, gpointer user_data)
+{
+       g_return_if_fail (data);
+       g_return_if_fail (user_data);
+       LandmarkContact *contact = (LandmarkContact *)data;
+       LocationLandmark *landmark = (LocationLandmark *)user_data;
+
+       landmark->contact = g_list_append (landmark->contact, landmark_contact_copy(contact));
+}
+
+EXPORT_API gboolean location_landmark_set_contact(LocationLandmark *landmark, GList *contact)
+{
+       g_return_val_if_fail(landmark, FALSE);
+
+       if (landmark->contact) {
+               g_list_free_full(landmark->contact, landmark_contact_foreach_free);
+               landmark->contact = NULL;
+       }
+
+       if (contact) {
+               g_list_foreach (contact, landmark_contact_foreach_copy, landmark);
+       }
+
+       return TRUE;
+}
+
+EXPORT_API GList *location_landmark_get_contact(const LocationLandmark *landmark)
+{
+       g_return_val_if_fail(landmark, NULL);
+
+       return landmark->contact;
+}
+
+EXPORT_API gchar *landmark_linkobject_get_link_string(const LandmarkLinkObject *link)
+{
+       g_return_val_if_fail(link, NULL);
+
+       return link->linkString;
+}
+
+EXPORT_API gboolean landmark_linkobject_set_link_string(LandmarkLinkObject *link, const gchar *linkString)
+{
+       g_return_val_if_fail(link, FALSE);
+       if (link->linkString) {
+               g_free(link->linkString);
+               link->linkString = NULL;
+       }
+
+       if (linkString) {
+               link->linkString = g_strdup (linkString);
+       }
+
+       return TRUE;
+}
+
+EXPORT_API gchar *landmark_linkobject_get_type(const LandmarkLinkObject *link)
+{
+       g_return_val_if_fail(link, NULL);
+
+       return link->type;
+}
+
+EXPORT_API gboolean landmark_linkobject_set_type(LandmarkLinkObject *link, const gchar *type)
+{
+       g_return_val_if_fail(link, FALSE);
+       if (link->type) {
+               g_free(link->type);
+               link->type = NULL;
+       }
+
+       if (type) {
+               link->type = g_strdup (type);
+       }
+
+       return TRUE;
+}
+
+EXPORT_API gchar *landmark_linkobject_get_name(const LandmarkLinkObject *link)
+{
+       g_return_val_if_fail(link, NULL);
+
+       return link->name;
+}
+
+EXPORT_API gboolean landmark_linkobject_set_name(LandmarkLinkObject *link, const gchar *name)
+{
+       g_return_val_if_fail(link, FALSE);
+       if (link->name) {
+               g_free(link->name);
+               link->name = NULL;
+       }
+
+       if (name) {
+               link->name = g_strdup (name);
+       }
+
+       return TRUE;
+}
+
+EXPORT_API gchar *landmark_linkobject_get_id(const LandmarkLinkObject *link)
+{
+       g_return_val_if_fail(link, NULL);
+
+       return link->id;
+}
+
+EXPORT_API gboolean landmark_linkobject_set_id(LandmarkLinkObject *link, const gchar *value)
+{
+       g_return_val_if_fail(link, FALSE);
+       if (link->id) {
+               g_free(link->id);
+               link->id = NULL;
+       }
+
+       if (value) {
+               link->id = g_strdup (value);
+       }
+
+       return TRUE;
+}
+
+EXPORT_API LandmarkLinkObject *landmark_linkobject_new (void)
+{
+       LandmarkLinkObject *link = g_slice_new0 (LandmarkLinkObject);
+       g_return_val_if_fail(link, NULL);
+
+       return link;
+}
+
+EXPORT_API LandmarkLinkObject *landmark_linkobject_copy (const LandmarkLinkObject *link)
+{
+       g_return_val_if_fail(link, NULL);
+
+       LandmarkLinkObject *new_link = landmark_linkobject_new();
+       g_return_val_if_fail(new_link, NULL);
+
+       landmark_linkobject_set_link_string(new_link, landmark_linkobject_get_link_string(link));
+       landmark_linkobject_set_type(new_link, landmark_linkobject_get_type(link));
+       landmark_linkobject_set_name(new_link, landmark_linkobject_get_name(link));
+       landmark_linkobject_set_id(new_link, landmark_linkobject_get_id(link));
+
+       return new_link;
+}
+
+EXPORT_API void landmark_linkobject_free (LandmarkLinkObject *linkObject)
+{
+       g_return_if_fail(linkObject);
+
+       landmark_linkobject_set_link_string(linkObject, NULL);
+       landmark_linkobject_set_type(linkObject, NULL);
+       landmark_linkobject_set_name(linkObject, NULL);
+       landmark_linkobject_set_id(linkObject, NULL);
+       g_slice_free(LandmarkLinkObject, linkObject);
+}
+
+EXPORT_API  gboolean location_landmark_set_supplier(LocationLandmark *landmark, const LandmarkLinkObject *supplier)
+{
+       g_return_val_if_fail (landmark, FALSE);
+
+       if (landmark->supplier) {
+               landmark_linkobject_free(landmark->supplier);
+               landmark->supplier = NULL;
+       }
+
+       if (supplier) {
+               landmark->supplier = landmark_linkobject_copy(supplier);
+       }
+
+       return TRUE;
+}
+
+EXPORT_API LandmarkLinkObject *location_landmark_get_supplier(const LocationLandmark *landmark)
+{
+       g_return_val_if_fail(landmark, NULL);
+
+       return landmark->supplier;
+}
+
+EXPORT_API GList *location_landmark_get_editorial(const LocationLandmark *landmark)
+{
+       g_return_val_if_fail(landmark, NULL);
+
+       return landmark->editorial;
+}
+
+EXPORT_API gboolean  landmark_media_set_attribution (LandmarkMedia *media, const gchar *attribution)
+{
+       g_return_val_if_fail(media, FALSE);
+
+       if (media->attribution) {
+               g_free(media->attribution);
+               media->attribution = NULL;
+       }
+
+       media->attribution = g_strdup (attribution);
+
+       return TRUE;
+}
+
+EXPORT_API gchar *landmark_media_get_attribution(const LandmarkMedia *media)
+{
+       g_return_val_if_fail(media, NULL);
+
+       return media->attribution;
+}
+
+EXPORT_API gboolean landmark_media_set_media_supplier(LandmarkMedia *media, const LandmarkLinkObject *mediaSupplier)
+{
+       g_return_val_if_fail(media, FALSE);
+
+       if (media->mediaSupplier) {
+               landmark_linkobject_free(media->mediaSupplier);
+               media->mediaSupplier = NULL;
+       }
+
+       if (mediaSupplier) {
+               media->mediaSupplier = landmark_linkobject_copy(mediaSupplier);
+       }
+
+       return TRUE;
+}
+
+EXPORT_API LandmarkLinkObject *landmark_media_get_media_supplier(const LandmarkMedia *media)
+{
+       g_return_val_if_fail(media, NULL);
+
+       return media->mediaSupplier;
+}
+
+EXPORT_API gboolean landmark_media_set_via(LandmarkMedia *media, const LandmarkLinkObject *via)
+{
+       g_return_val_if_fail(media, FALSE);
+
+       if (media->via) {
+               landmark_linkobject_free(media->via);
+               media->via = NULL;
+       }
+
+       if (via) {
+               media->via = landmark_linkobject_copy(via);
+       }
+
+       return TRUE;
+}
+
+EXPORT_API LandmarkLinkObject *landmark_media_get_via(const LandmarkMedia *media)
+{
+       g_return_val_if_fail(media, NULL);
+
+       return media->via;
+}
+
+EXPORT_API void landmark_media_free (LandmarkMedia *media)
+{
+       g_return_if_fail(media);
+
+       landmark_media_set_attribution(media, NULL);
+       landmark_media_set_media_supplier(media, NULL);
+       landmark_media_set_via(media, NULL);
+
+       g_slice_free(LandmarkMedia, media);
+}
+
+EXPORT_API LandmarkMedia *landmark_media_new (void)
+{
+       LandmarkMedia *media = g_slice_new0 (LandmarkMedia);
+       g_return_val_if_fail(media, NULL);
+
+       return media;
+}
+
+EXPORT_API LandmarkMedia *landmark_media_copy (const LandmarkMedia *media)
+{
+       g_return_val_if_fail(media, NULL);
+
+       LandmarkMedia *new_media = landmark_media_new();
+       g_return_val_if_fail(new_media, NULL);
+
+       landmark_media_set_attribution(new_media, landmark_media_get_attribution(media));
+       landmark_media_set_media_supplier(new_media, landmark_media_get_media_supplier(media));
+       landmark_media_set_via(new_media, landmark_media_get_via(media));
+
+       return new_media;
+}
+
+EXPORT_API gboolean landmark_editorial_set_media(LandmarkEditorial *editorial, const LandmarkMedia *media)
+{
+       g_return_val_if_fail(editorial, FALSE);
+
+       if (editorial->media) {
+               landmark_media_free(editorial->media);
+               editorial->media = NULL;
+       }
+
+       if (media) {
+               editorial->media = landmark_media_copy(media);
+       }
+
+       return TRUE;
+}
+
+EXPORT_API LandmarkMedia *landmark_editorial_get_media(const LandmarkEditorial *editorial)
+{
+       g_return_val_if_fail(editorial, NULL);
+
+       return editorial->media;
+}
+
+EXPORT_API gboolean landmark_editorial_set_description(LandmarkEditorial *editorial, const gchar *description)
+{
+       g_return_val_if_fail(editorial, FALSE);
+
+       if (editorial->description) {
+               g_free(editorial->description);
+               editorial->description = NULL;
+       }
+
+       if (description) {
+               editorial->description = g_strdup (description);
+       }
+
+       return TRUE;
+}
+
+EXPORT_API gchar *landmark_editorial_get_description(const LandmarkEditorial *editorial)
+{
+       g_return_val_if_fail(editorial, NULL);
+
+       return editorial->description;
+}
+
+EXPORT_API gboolean landmark_editorial_set_language(LandmarkEditorial *editorial, const gchar *language)
+{
+       g_return_val_if_fail(editorial, FALSE);
+
+       if (editorial->language) {
+               g_free(editorial->language);
+               editorial->language = NULL;
+       }
+
+       if (language) {
+               editorial->language = g_strdup (language);
+       }
+
+       return TRUE;
+}
+
+EXPORT_API gchar *landmark_editorial_get_language(const LandmarkEditorial *editorial)
+{
+       g_return_val_if_fail(editorial, NULL);
+
+       return editorial->language;
+}
+
+
+EXPORT_API void landmark_editorial_free (LandmarkEditorial *editorial)
+{
+       g_return_if_fail (editorial);
+
+       landmark_editorial_set_media(editorial, NULL);
+       landmark_editorial_set_description(editorial, NULL);
+       landmark_editorial_set_language(editorial, NULL);
+
+       g_slice_free(LandmarkEditorial, editorial);
+}
+
+static void landmark_editorial_foreach_free (gpointer data)
+{
+       g_return_if_fail(data);
+
+       LandmarkEditorial *editorial = (LandmarkEditorial *)data;
+
+       landmark_editorial_free (editorial);
+}
+
+EXPORT_API LandmarkEditorial *landmark_editorial_new (void)
+{
+       LandmarkEditorial *editorial = g_slice_new0 (LandmarkEditorial);
+       g_return_val_if_fail(editorial, NULL);
+
+       return editorial;
+}
+
+
+EXPORT_API LandmarkEditorial *landmark_editorial_copy (const LandmarkEditorial *editorial)
+{
+       g_return_val_if_fail(editorial, NULL);
+
+       LandmarkEditorial *new_editorial = landmark_editorial_new();
+       g_return_val_if_fail(new_editorial, NULL);
+
+       landmark_editorial_set_media(new_editorial, landmark_editorial_get_media(editorial));
+       landmark_editorial_set_description(new_editorial, landmark_editorial_get_description(editorial));
+       landmark_editorial_set_language(new_editorial, landmark_editorial_get_language(editorial));
+
+       return new_editorial;
+}
+
+static void landmark_editorial_foreach_copy (gpointer data, gpointer user_data)
+{
+       g_return_if_fail (data);
+       g_return_if_fail (user_data);
+       LandmarkEditorial *editorial = (LandmarkEditorial *)data;
+       LocationLandmark *landmark = (LocationLandmark *)user_data;
+
+       landmark->editorial = g_list_append (landmark->editorial, landmark_editorial_copy(editorial));
+}
+
+EXPORT_API gboolean location_landmark_set_editorial(LocationLandmark *landmark, GList *editorial)
+{
+       g_return_val_if_fail(landmark, FALSE);
+
+       if (landmark->editorial) {
+               g_list_free_full(landmark->editorial, landmark_editorial_foreach_free);
+               landmark->editorial = NULL;
+       }
+
+       if (editorial) {
+               g_list_foreach (editorial, landmark_editorial_foreach_copy, landmark);
+       }
+
+       return TRUE;
+}
+
+EXPORT_API GList *location_landmark_get_image(const LocationLandmark *landmark)
+{
+       g_return_val_if_fail(landmark, NULL);
+
+       return landmark->image;
+}
+
+EXPORT_API gboolean landmark_image_set_media(LandmarkImage *image, const LandmarkMedia *media)
+{
+       g_return_val_if_fail(image, FALSE);
+
+       if (image->media) {
+               landmark_media_free(image->media);
+               image->media = NULL;
+       }
+
+       if (media) {
+               image->media = landmark_media_copy(media);
+       }
+
+       return TRUE;
+}
+
+EXPORT_API LandmarkMedia *landmark_image_get_media(const LandmarkImage *image)
+{
+       g_return_val_if_fail(image, NULL);
+
+       return image->media;
+}
+
+EXPORT_API gboolean landmark_image_set_url(LandmarkImage *image, const gchar *url)
+{
+       g_return_val_if_fail(image, FALSE);
+
+       if (image->url) {
+               g_free(image->url);
+               image->url = NULL;
+       }
+
+       if (url) {
+               image->url = g_strdup (url);
+       }
+
+       return TRUE;
+}
+
+EXPORT_API gchar *landmark_image_get_url(const LandmarkImage *image)
+{
+       g_return_val_if_fail(image, NULL);
+
+       return  image->url;
+}
+
+EXPORT_API gboolean landmark_image_set_id(LandmarkImage *image, const gchar *identifier)
+{
+       g_return_val_if_fail(image, FALSE);
+
+       if (image->id) {
+               g_free(image->id);
+               image->id = NULL;
+       }
+
+       if (identifier) {
+               image->id = g_strdup (identifier);
+       }
+
+       return TRUE;
+}
+
+EXPORT_API gchar *landmark_image_get_id(const LandmarkImage *image)
+{
+       g_return_val_if_fail(image, NULL);
+
+       return  image->id;
+}
+
+EXPORT_API gboolean landmark_image_set_width(LandmarkImage *image, guint width)
+{
+       g_return_val_if_fail(image, FALSE);
+
+       image->width = width;
+
+       return TRUE;
+}
+
+EXPORT_API guint landmark_image_get_width(const LandmarkImage *image)
+{
+       g_return_val_if_fail(image, 0);
+
+       return  image->width;
+}
+
+EXPORT_API gboolean landmark_image_set_height(LandmarkImage *image, guint height)
+{
+       g_return_val_if_fail(image, FALSE);
+
+       image->height= height;
+
+       return TRUE;
+}
+
+EXPORT_API guint landmark_image_get_height(const LandmarkImage *image)
+{
+       g_return_val_if_fail(image, 0);
+
+       return  image->height;
+}
+
+EXPORT_API gboolean landmark_image_set_image_user(LandmarkImage *image, const LandmarkLinkObject *imageUser)
+{
+       g_return_val_if_fail(image, FALSE);
+
+       if (image->imageUser) {
+               landmark_linkobject_free(image->imageUser);
+               image->imageUser = NULL;
+       }
+
+       if (imageUser) {
+               image->imageUser = landmark_linkobject_copy(imageUser);
+       }
+
+       return TRUE;
+}
+
+EXPORT_API LandmarkLinkObject *landmark_image_get_image_user(const LandmarkImage *image)
+{
+       g_return_val_if_fail(image, NULL);
+
+       return  image->imageUser;
+}
+
+EXPORT_API void landmark_image_free (LandmarkImage *image)
+{
+       g_return_if_fail (image);
+
+       landmark_image_set_media(image, NULL);
+       landmark_image_set_url(image, NULL);
+       landmark_image_set_id(image, NULL);
+       landmark_image_set_width(image, 0);
+       landmark_image_set_height(image, 0);
+       landmark_image_set_image_user(image, NULL);
+
+       g_slice_free(LandmarkImage, image);
+}
+
+static void landmark_image_foreach_free (gpointer data)
+{
+       g_return_if_fail(data);
+       LandmarkImage *image = (LandmarkImage *)data;
+
+       landmark_image_free (image);
+}
+
+EXPORT_API LandmarkImage *landmark_image_new (void)
+{
+       LandmarkImage *image = g_slice_new0 (LandmarkImage);
+       g_return_val_if_fail(image, NULL);
+
+       return image;
+}
+
+EXPORT_API LandmarkImage *landmark_image_copy (const LandmarkImage *image)
+{
+       g_return_val_if_fail(image, NULL);
+
+       LandmarkImage *new_image = landmark_image_new();
+       g_return_val_if_fail(new_image, NULL);
+
+       landmark_image_set_media(new_image, landmark_image_get_media(image));
+       landmark_image_set_url(new_image, landmark_image_get_url(image));
+       landmark_image_set_id(new_image, landmark_image_get_id(image));
+       landmark_image_set_width(new_image, landmark_image_get_width(image));
+       landmark_image_set_height(new_image, landmark_image_get_height(image));
+       landmark_image_set_image_user(new_image, landmark_image_get_image_user(image));
+
+       return new_image;
+}
+
+static void landmark_image_foreach_copy (gpointer data, gpointer user_data)
+{
+       g_return_if_fail (data);
+       g_return_if_fail (user_data);
+       LandmarkImage *image = (LandmarkImage *)data;
+       LocationLandmark *landmark = (LocationLandmark *)user_data;
+
+       landmark->image = g_list_append (landmark->image, landmark_image_copy(image));
+}
+
+EXPORT_API gboolean location_landmark_set_image(LocationLandmark *landmark, GList *image)
+{
+       g_return_val_if_fail(landmark, FALSE);
+
+       if (landmark->image) {
+               g_list_free_full(landmark->image, landmark_image_foreach_free);
+               landmark->image = NULL;
+       }
+
+       if (image) {
+               g_list_foreach (image, landmark_image_foreach_copy, landmark);
+       }
+
+       return TRUE;
+}
+
+EXPORT_API GList *location_landmark_get_review(const LocationLandmark *landmark)
+{
+       g_return_val_if_fail(landmark, NULL);
+
+       return landmark->review;
+}
+
+EXPORT_API gboolean landmark_review_set_media(LandmarkReview *review, const LandmarkMedia *media)
+{
+       g_return_val_if_fail(review, FALSE);
+
+       if (review->media) {
+               landmark_media_free(review->media);
+               review->media = NULL;
+       }
+
+       if (media) {
+               review->media = landmark_media_copy(media);
+       }
+
+       return TRUE;
+}
+
+EXPORT_API LandmarkMedia *landmark_review_get_media(const LandmarkReview *review)
+{
+       g_return_val_if_fail(review, NULL);
+
+       return review->media;
+}
+
+EXPORT_API gboolean landmark_review_set_date(LandmarkReview *review, const gchar *date)
+{
+       g_return_val_if_fail(review, FALSE);
+
+       if (review->date) {
+               g_free(review->date);
+               review->date = NULL;
+       }
+
+       if (date) {
+               review->date = g_strdup (date);
+       }
+
+       return TRUE;
+}
+
+EXPORT_API gchar *landmark_review_get_date(const LandmarkReview *review)
+{
+       g_return_val_if_fail(review, NULL);
+
+       return review->date;
+}
+
+EXPORT_API gboolean landmark_review_set_title(LandmarkReview *review, const gchar *title)
+{
+       g_return_val_if_fail(review, FALSE);
+
+       if (review->title) {
+               g_free(review->title);
+               review->title = NULL;
+       }
+
+       if (title) {
+               review->title = g_strdup (title);
+       }
+
+       return TRUE;
+}
+
+EXPORT_API gchar *landmark_review_get_title(const LandmarkReview *review)
+{
+       g_return_val_if_fail(review, NULL);
+
+       return review->title;
+}
+
+
+EXPORT_API gboolean landmark_review_set_rating(LandmarkReview *review, gdouble rating)
+{
+       g_return_val_if_fail(review, FALSE);
+       g_return_val_if_fail(rating >= 0, FALSE);
+
+       review->rating = rating;
+
+       return TRUE;
+}
+
+EXPORT_API gdouble landmark_review_get_rating(const LandmarkReview *review)
+{
+       g_return_val_if_fail(review, 0);
+
+       return review->rating;
+}
+
+EXPORT_API gboolean landmark_review_set_description(LandmarkReview *review, const gchar *description)
+{
+       g_return_val_if_fail(review, FALSE);
+
+       if (review->description) {
+               g_free(review->description);
+               review->description = NULL;
+       }
+
+       if (description) {
+               review->description = g_strdup (description);
+       }
+
+       return TRUE;
+}
+
+EXPORT_API gchar *landmark_review_get_description(const LandmarkReview *review)
+{
+       g_return_val_if_fail(review, NULL);
+
+       return review->description;
+}
+
+EXPORT_API gboolean landmark_review_set_language(LandmarkReview *review, const gchar *language)
+{
+       g_return_val_if_fail(review, FALSE);
+
+       if (review->language) {
+               g_free(review->language);
+               review->language = NULL;
+       }
+
+       if (language) {
+               review->language = g_strdup (language);
+       }
+
+       return TRUE;
+}
+
+EXPORT_API gchar *landmark_review_get_language(const LandmarkReview *review)
+{
+       g_return_val_if_fail(review, NULL);
+
+       return review->language;
+}
+
+EXPORT_API gboolean landmark_review_set_review_user(LandmarkReview *review, const LandmarkLinkObject *reviewUser)
+{
+       g_return_val_if_fail(review, FALSE);
+
+       if (review->reviewUser) {
+               landmark_linkobject_free(review->reviewUser);
+               review->reviewUser = NULL;
+       }
+
+       if (reviewUser) {
+               review->reviewUser = landmark_linkobject_copy(reviewUser);
+       }
+
+       return TRUE;
+}
+
+EXPORT_API LandmarkLinkObject *landmark_review_get_review_user(const LandmarkReview *review)
+{
+       g_return_val_if_fail(review, NULL);
+
+       return review->reviewUser;
+}
+
+EXPORT_API void landmark_review_free (LandmarkReview *review)
+{
+       g_return_if_fail (review);
+
+       landmark_review_set_media(review, NULL);
+       landmark_review_set_date(review, NULL);
+       landmark_review_set_title(review, NULL);
+       landmark_review_set_rating(review, 0);
+       landmark_review_set_description(review, NULL);
+       landmark_review_set_language(review, NULL);
+       landmark_review_set_review_user(review, NULL);
+
+       g_slice_free(LandmarkReview, review);
+}
+
+
+static void landmark_review_foreach_free (gpointer data)
+{
+       g_return_if_fail(data);
+       LandmarkReview *review = (LandmarkReview *)data;
+
+       landmark_review_free (review);
+}
+
+EXPORT_API LandmarkReview *landmark_review_new (void)
+{
+       LandmarkReview *review = g_slice_new0 (LandmarkReview);
+       g_return_val_if_fail(review, NULL);
+
+       return review;
+}
+
+EXPORT_API LandmarkReview *landmark_review_copy (const LandmarkReview *review)
+{
+       g_return_val_if_fail(review, NULL);
+
+       LandmarkReview *new_reviews = landmark_review_new();
+       g_return_val_if_fail(new_reviews, NULL);
+
+       landmark_review_set_media(new_reviews, landmark_review_get_media(review));
+       landmark_review_set_date(new_reviews, landmark_review_get_date(review));
+       landmark_review_set_title(new_reviews, landmark_review_get_title(review));
+       landmark_review_set_rating(new_reviews, landmark_review_get_rating(review));
+       landmark_review_set_description(new_reviews, landmark_review_get_description(review));
+       landmark_review_set_language(new_reviews, landmark_review_get_language(review));
+       landmark_review_set_review_user(new_reviews, landmark_review_get_review_user(review));
+
+       return new_reviews;
+}
+
+static void landmark_review_foreach_copy (gpointer data, gpointer user_data)
+{
+       g_return_if_fail (data);
+       g_return_if_fail (user_data);
+
+       LandmarkReview *review = (LandmarkReview *)data;
+       LocationLandmark *landmark = (LocationLandmark *)user_data;
+
+       landmark->review = g_list_append (landmark->review, landmark_review_copy(review));
+}
+
+
+EXPORT_API gboolean location_landmark_set_review(LocationLandmark *landmark, GList *review)
+{
+       g_return_val_if_fail(landmark, FALSE);
+
+       if (landmark->review) {
+               g_list_free_full(landmark->review, landmark_review_foreach_free);
+               landmark->review = NULL;
+       }
+
+       if (review) {
+               g_list_foreach (review, landmark_review_foreach_copy, landmark);
+       }
+
+       return TRUE;
+}
+EXPORT_API  gboolean location_landmark_set_related(LocationLandmark *landmark, const LandmarkLinkObject *related)
+{
+       g_return_val_if_fail (landmark, FALSE);
+
+       if (landmark->related) {
+               landmark_linkobject_free(landmark->related);
+               landmark->related = NULL;
+       }
+
+       if (related) {
+               landmark->related = landmark_linkobject_copy(related);
+       }
+
+       return TRUE;
+}
+
+EXPORT_API LandmarkLinkObject *location_landmark_get_related(const LocationLandmark *landmark)
+{
+       g_return_val_if_fail(landmark, NULL);
+
+       return landmark->related;
+}
+
+EXPORT_API LocationLandmark *
+location_landmark_copy (const LocationLandmark *landmark)
+{
+       g_return_val_if_fail (landmark, NULL);
+
+       LocationLandmark *new_landmark = location_landmark_new();
+       if (!new_landmark) return NULL;
+
+       location_landmark_set_id(new_landmark, location_landmark_get_id(landmark));
+       location_landmark_set_name (new_landmark, location_landmark_get_name (landmark));
+       location_landmark_set_position (new_landmark, location_landmark_get_position(landmark));
+       location_landmark_set_address (new_landmark, location_landmark_get_address (landmark));
+       location_landmark_set_description (new_landmark, location_landmark_get_description(landmark));
+       location_landmark_set_timestamp (new_landmark, location_landmark_get_timestamp(landmark));
+       location_landmark_set_priority (new_landmark, location_landmark_get_priority(landmark));
+       location_landmark_set_bounding_box (new_landmark, location_landmark_get_bounding_box(landmark));
+       location_landmark_set_author (new_landmark, location_landmark_get_author(landmark));
+       location_landmark_set_url(new_landmark, location_landmark_get_url(landmark));
+
+       location_landmark_set_rating(new_landmark,location_landmark_get_rating(landmark));
+       location_landmark_set_attribute(new_landmark, location_landmark_get_attribute(landmark));
+       location_landmark_set_contact(new_landmark, location_landmark_get_contact(landmark));
+       location_landmark_set_supplier(new_landmark, location_landmark_get_supplier(landmark));
+       location_landmark_set_editorial(new_landmark, location_landmark_get_editorial(landmark));
+       location_landmark_set_image(new_landmark, location_landmark_get_image(landmark));
+       location_landmark_set_review(new_landmark, location_landmark_get_review(landmark));
+       location_landmark_set_related(new_landmark, location_landmark_get_related(landmark));
+
+       return new_landmark;
+}
+
+EXPORT_API void
+location_landmark_free (LocationLandmark *landmark)
+{
+       g_return_if_fail (landmark);
+
+       location_landmark_set_id(landmark, 0);
+       location_landmark_set_name (landmark, NULL);
+       location_landmark_set_position (landmark, NULL);
+       location_landmark_set_address (landmark, NULL);
+       location_landmark_set_description (landmark, NULL);
        location_landmark_set_timestamp (landmark, 0);
        location_landmark_set_priority (landmark, 0);
        location_landmark_set_bounding_box (landmark, NULL);
        location_landmark_set_author (landmark, NULL);
        location_landmark_set_url(landmark, NULL);
 
+       location_landmark_set_rating(landmark, NULL);
+       location_landmark_set_attribute(landmark, NULL);
+       location_landmark_set_contact(landmark, NULL);
+       location_landmark_set_supplier(landmark, NULL);
+       location_landmark_set_editorial(landmark, NULL);
+       location_landmark_set_image(landmark, NULL);
+       location_landmark_set_review(landmark, NULL);
+       location_landmark_set_related(landmark, NULL);
+
        g_slice_free (LocationLandmark, landmark);
 }
index 44c0754..37a22ad 100644 (file)
@@ -139,6 +139,355 @@ gchar *location_landmark_url_get_url_path (const LocationLandmarkUrl *url);
 gchar *location_landmark_url_get_description (const LocationLandmarkUrl *url);
 
 /**
+ * @brief Get the rating of the given #LocationLandmark
+ */
+LandmarkRating  *location_landmark_get_rating(const LocationLandmark *landmark);
+
+
+/**
+ * @brief Get the rating' count of the given #LocationLandmark
+ */
+gint landmark_rating_get_count(const LandmarkRating *rating);
+
+/**
+ * @brief Get the rating' average of the given #LocationLandmark
+ */
+gdouble  landmark_rating_get_average(const LandmarkRating *rating);
+
+/**
+ * @brief Create a new LandmarkRating
+ */
+LandmarkRating *landmark_rating_new (void);
+
+/**
+ * @brief Copy the given LandmarkRating
+ */
+LandmarkRating *landmark_rating_copy(const LandmarkRating *rating);
+
+/**
+ * @brief Free the given rating
+ */
+void landmark_rating_free (LandmarkRating *rating);
+
+/**
+ * @brief Free the given media
+ */
+void landmark_media_free (LandmarkMedia *media);
+
+/**
+ * @brief Create a new media
+ */
+LandmarkMedia *landmark_media_new (void);
+
+/**
+ * @brief Get the attribute label of the given #LandmarkAttribute
+ */
+gchar *landmark_attribute_get_label(const LandmarkAttribute *attribute);
+
+/**
+ * @brief Get the attribute text of the given #LandmarkAttribute
+ */
+gchar *landmark_attribute_get_text(const LandmarkAttribute *attribute);
+
+/**
+ * @brief Get the attribute id of the given #LandmarkAttribute
+ */
+gchar *landmark_attribute_get_identifier(const LandmarkAttribute *attribute);
+
+/**
+ * @brief Create a new #LandmarkAttribute
+ */
+LandmarkAttribute *landmark_attribute_new (void);
+
+/**
+ * @brief Free the given attribute
+ */
+void landmark_attribute_free (LandmarkAttribute *attribute);
+
+/**
+ * @brief Copy the given attribute
+ */
+LandmarkAttribute *landmark_attribute_copy(const LandmarkAttribute *attribute);
+
+/**
+ * @brief Get the attribute list of the given #LocationLandmark
+ */
+GList *location_landmark_get_attribute(const LocationLandmark *landmark);
+
+/**
+ * @brief Free the given contact
+ */
+void landmark_contact_free (LandmarkContact *contact);
+
+/**
+ * @brief Create a new  #LandmarkContact
+ */
+LandmarkContact *landmark_contact_new (void);
+
+/**
+ * @brief Copy the given contact
+ */
+LandmarkContact *landmark_contact_copy (const LandmarkContact *contact);
+
+/**
+ * @brief Get the contact list of the given #LocationLandmark
+ */
+GList *location_landmark_get_contact(const LocationLandmark *landmark);
+
+/**
+ * @brief Create a new  #LandmarkLinkObject
+ */
+LandmarkLinkObject *landmark_linkobject_new (void);
+
+/**
+ * @brief Copy the given link
+ */
+LandmarkLinkObject *landmark_linkobject_copy (const LandmarkLinkObject *link);
+
+/**
+ * @brief Free the given linkObject
+ */
+void landmark_linkobject_free (LandmarkLinkObject *linkObject);
+
+
+/**
+ * @brief Get the link of the given #LandmarkLinkObject
+ */
+gchar *landmark_linkobject_get_link_string(const LandmarkLinkObject *link);
+
+
+/**
+ * @brief Get the type of the given #LandmarkLinkObject
+ */
+gchar *landmark_linkobject_get_type(const LandmarkLinkObject *link);
+
+/**
+ * @brief Get the name of the given #LandmarkLinkObject
+ */
+gchar *landmark_linkobject_get_name(const LandmarkLinkObject *link);
+
+/**
+ * @brief Get the id of the given #LandmarkLinkObject
+ */
+gchar *landmark_linkobject_get_id(const LandmarkLinkObject *link);
+
+/**
+ * @brief Get the contact detail type of the given #LandmarkContact
+ */
+gchar *landmark_contact_get_type(const LandmarkContact *contact);
+
+/**
+ * @brief Get the contact detail label of the given #LandmarkContact
+ */
+gchar *landmark_contact_get_label(const LandmarkContact *contact);
+
+/**
+ * @brief Get the contact detail value of the given #LandmarkContact
+ */
+gchar *landmark_contact_get_value(const LandmarkContact *contact);
+
+/**
+ * @brief Get the supplier link of the given #LocationLandmark
+ */
+LandmarkLinkObject  *location_landmark_get_supplier(const LocationLandmark *landmark);
+
+/**
+ * @brief Get the attribution text of the given #LandmarkMedia
+ */
+gchar *landmark_media_get_attribution(const LandmarkMedia *media);
+
+/**
+ * @brief Get the supplier link of the given #LandmarkMedia
+ */
+LandmarkLinkObject *landmark_media_get_media_supplier(const LandmarkMedia *media);
+
+/**
+ * @brief Get the via link of the given #LandmarkMedia
+ */
+LandmarkLinkObject *landmark_media_get_via(const LandmarkMedia *media);
+
+/**
+ * @brief Get the attribution text of the given #LandmarkEditorial
+ */
+LandmarkMedia *landmark_editorial_get_media(const LandmarkEditorial *editorial);
+
+/**
+ * @brief Get the description of the given #LandmarkEditorial
+ */
+gchar *landmark_editorial_get_description(const LandmarkEditorial *editorial);
+
+/**
+ * @brief Get the language of the given #LandmarkEditorial
+ */
+gchar *landmark_editorial_get_language(const LandmarkEditorial *editorial);
+
+/**
+ * @brief Free the given editorial
+ */
+void landmark_editorial_free (LandmarkEditorial *editorial);
+
+/**
+ * @brief Create a new #LandmarkEditorial
+ */
+LandmarkEditorial *landmark_editorial_new (void);
+
+/**
+ * @brief Copy the given editorial
+ */
+LandmarkEditorial *landmark_editorial_copy (const LandmarkEditorial *editorial);
+
+/**
+ * @brief Get the media of the given #LandmarkImage
+ */
+LandmarkMedia *landmark_image_get_media(const LandmarkImage *image);
+
+/**
+ * @brief Get the url of the given #LandmarkImage
+ */
+gchar *landmark_image_get_url(const LandmarkImage *image);
+
+/**
+ * @brief Get the id of the given #LandmarkImage
+ */
+gchar *landmark_image_get_id(const LandmarkImage *image);
+
+/**
+ * @brief Get the width of the given #LandmarkImage
+ */
+guint landmark_image_get_width(const LandmarkImage *image);
+
+/**
+ * @brief Get the height of the given #LandmarkImage
+ */
+guint landmark_image_get_height(const LandmarkImage *image);
+
+/**
+ * @brief Get the user of the given #LandmarkImage
+ */
+LandmarkLinkObject *landmark_image_get_image_user(const LandmarkImage *image);
+
+/**
+ * @brief Free the given image
+ */
+void landmark_image_free (LandmarkImage *image);
+
+/**
+ * @brief Create a new  #LandmarkLinkObject
+ */
+LandmarkImage *landmark_image_new (void);
+
+/**
+ * @brief Copy the given image
+ */
+LandmarkImage *landmark_image_copy (const LandmarkImage *image);
+
+
+/**
+ * @brief Get the editorial list of the given #LocationLandmark
+ */
+GList *location_landmark_get_editorial(const LocationLandmark *landmark);
+
+/**
+ * @brief Get the image list of the given #LocationLandmark
+ */
+GList *location_landmark_get_image(const LocationLandmark *landmark);
+
+/**
+ * @brief Get the media of the given #LandmarkReview
+ */
+LandmarkMedia *landmark_review_get_media(const LandmarkReview *review);
+
+/**
+ * @brief Get the date of the given #LandmarkReview
+ */
+gchar *landmark_review_get_date(const LandmarkReview *review);
+
+/**
+ * @brief Get the title of the given #LandmarkReview
+ */
+gchar *landmark_review_get_title(const LandmarkReview *review);
+
+/**
+ * @brief Get the rating  of the given #LandmarkReview
+ */
+gdouble landmark_review_get_rating(const LandmarkReview *review);
+
+/**
+ * @brief Get the description of the given #LandmarkReview
+ */
+gchar *landmark_review_get_description(const LandmarkReview *review);
+
+/**
+ * @brief Get the language of the given #LandmarkReview
+ */
+gchar *landmark_review_get_language(const LandmarkReview *review);
+
+/**
+ * @brief Get the user of the given #LandmarkReview
+ */
+LandmarkLinkObject *landmark_review_get_review_user(const LandmarkReview *review);
+
+/**
+ * @brief Free the given editorial
+ */
+void landmark_review_free (LandmarkReview *review);
+
+/**
+ * @brief Create a new  #LandmarkReview
+ */
+LandmarkReview *landmark_review_new (void);
+
+/**
+ * @brief Copy the given review
+ */
+LandmarkReview *landmark_review_copy (const LandmarkReview *review);
+
+/**
+ * @brief Get the review list of the given #LocationLandmark
+ */
+GList *location_landmark_get_review(const LocationLandmark *landmark);
+
+/**
+ * @brief Get the related link of the given #LocationLandmark
+ */
+LandmarkLinkObject *location_landmark_get_related(const LocationLandmark *landmark);
+
+/**
+ * @brief Create a new  #LandmarkCategory
+ */
+LandmarkCategory *landmark_category_new (void);
+
+/**
+ * @brief Copy the given category
+ */
+LandmarkCategory *landmark_category_copy (const LandmarkCategory *category);
+
+/**
+ * @brief Free the given category
+ */
+void landmark_category_free (LandmarkCategory *category);
+
+/**
+ * @brief Get the id of the given #LandmarkCategory
+ */
+gchar *landmark_category_get_id (const LandmarkCategory *category);
+
+/**
+ * @brief Get the name of the given #LandmarkCategory
+ */
+gchar *landmark_category_get_name (const LandmarkCategory *category);
+
+/**
+ * @brief Get the url of the given #LandmarkCategory
+ */
+gchar *landmark_category_get_url (const LandmarkCategory *category);
+
+/**
+ * @brief Get the subcategories list of the given #LandmarkCategory
+ */
+GList *landmark_category_get_subcategories (const LandmarkCategory *category);
+
+/**
   * @} @}
   */
 
index 147936e..6d35ed0 100644 (file)
@@ -102,28 +102,46 @@ int
 location_map_ielement_get_geocode_async (LocationMapIElement *self,
        const LocationAddress *address,
        const LocationMapPref *svc_pref,
+       const LocationGeocodePreference *pref,
        LocationPositionCB callback,
-       gpointer userdata)
+       gpointer userdata,
+       guint * req_id)
 {
        g_return_val_if_fail (LOCATION_MAP_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
        g_return_val_if_fail (address, LOCATION_ERROR_PARAMETER);
        g_return_val_if_fail (callback, LOCATION_ERROR_PARAMETER);
+       g_return_val_if_fail (pref, LOCATION_ERROR_PARAMETER);
+       g_return_val_if_fail (req_id, LOCATION_ERROR_PARAMETER);
        g_return_val_if_fail (LOCATION_MAP_IELEMENT_GET_INTERFACE (self)->get_geocode_async, LOCATION_ERROR_NOT_AVAILABLE);
-       return LOCATION_MAP_IELEMENT_GET_INTERFACE (self)->get_geocode_async (self, address, svc_pref, callback, userdata);
+       return LOCATION_MAP_IELEMENT_GET_INTERFACE (self)->get_geocode_async (self, address, svc_pref, pref, callback, userdata,req_id);
 }
 
 int
 location_map_ielement_get_geocode_freeform_async (LocationMapIElement *self,
        const gchar *address,
        const LocationMapPref *svc_pref,
+       const LocationGeocodePreference *pref,
        LocationPositionCB callback,
-       gpointer userdata)
+       gpointer userdata,
+       guint * req_id)
 {
        g_return_val_if_fail (LOCATION_MAP_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
        g_return_val_if_fail (address, LOCATION_ERROR_PARAMETER);
        g_return_val_if_fail (callback, LOCATION_ERROR_PARAMETER);
+       g_return_val_if_fail (pref, LOCATION_ERROR_PARAMETER);
+       g_return_val_if_fail (req_id, LOCATION_ERROR_PARAMETER);
        g_return_val_if_fail (LOCATION_MAP_IELEMENT_GET_INTERFACE (self)->get_geocode_freeform_async, LOCATION_ERROR_NOT_AVAILABLE);
-       return LOCATION_MAP_IELEMENT_GET_INTERFACE (self)->get_geocode_freeform_async (self, address, svc_pref, callback, userdata);
+
+       return LOCATION_MAP_IELEMENT_GET_INTERFACE (self)->get_geocode_freeform_async (self, address, svc_pref,pref, callback, userdata,req_id);
+}
+
+int
+location_map_ielement_cancel_geocode_request (LocationMapIElement *self, guint req_id)
+{
+       g_return_val_if_fail (LOCATION_MAP_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
+       g_return_val_if_fail (LOCATION_MAP_IELEMENT_GET_INTERFACE (self)->cancel_geocode_request, LOCATION_ERROR_NOT_AVAILABLE);
+
+       return LOCATION_MAP_IELEMENT_GET_INTERFACE (self)->cancel_geocode_request (self, req_id);
 }
 
 int
@@ -131,13 +149,16 @@ location_map_ielement_get_reversegeocode_async (LocationMapIElement *self,
        const LocationPosition *position,
        const LocationMapPref *svc_pref,
        LocationAddressCB callback,
-       gpointer userdata)
+       gpointer userdata,
+       guint * req_id)
 {
        g_return_val_if_fail (LOCATION_MAP_IS_IELEMENT (self), LOCATION_ERROR_PARAMETER);
        g_return_val_if_fail (position, LOCATION_ERROR_PARAMETER);
        g_return_val_if_fail (callback, LOCATION_ERROR_PARAMETER);
+       g_return_val_if_fail (req_id, LOCATION_ERROR_PARAMETER);
        g_return_val_if_fail (LOCATION_MAP_IELEMENT_GET_INTERFACE (self)->get_reversegeocode_async, LOCATION_ERROR_NOT_AVAILABLE);
-       return LOCATION_MAP_IELEMENT_GET_INTERFACE (self)->get_reversegeocode_async (self, position, svc_pref, callback, userdata);
+
+       return LOCATION_MAP_IELEMENT_GET_INTERFACE (self)->get_reversegeocode_async (self, position, svc_pref, callback, userdata,req_id);
 }
 
 int
index 36f17d1..549307b 100644 (file)
@@ -44,9 +44,10 @@ typedef struct _LocationMapIElementInterface LocationMapIElementInterface;
 typedef int (*TYPE_GET_GEOCODE)(LocationMapIElement *self, const LocationAddress *address, const LocationMapPref *svc_pref, GList **position_list, GList **accuracy_list);
 typedef int (*TYPE_GET_GEOCODE_FREEFORM)(LocationMapIElement *self, const gchar *address, const LocationMapPref *svc_pref, GList **position_list, GList **accuracy_list);
 typedef int (*TYPE_GET_REVERSEGEOCODE)(LocationMapIElement *self, const LocationPosition *position, const LocationMapPref *svc_pref, LocationAddress **address, LocationAccuracy **accuracy);
-typedef int (*TYPE_GET_GEOCODE_ASYNC)(LocationMapIElement *self, const LocationAddress *address, const LocationMapPref *svc_pref, LocationPositionCB callback, gpointer userdata);
-typedef int (*TYPE_GET_GEOCODE_FREEFORM_ASYNC)(LocationMapIElement *self, const gchar *address,  const LocationMapPref *svc_pref, LocationPositionCB callback, gpointer userdata);
-typedef int (*TYPE_GET_REVERSEGEOCODE_ASYNC)(LocationMapIElement *self, const LocationPosition *position, const LocationMapPref *svc_pref, LocationAddressCB callback, gpointer userdata);
+typedef int (*TYPE_GET_GEOCODE_ASYNC)(LocationMapIElement *self, const LocationAddress *address, const LocationMapPref *svc_pref, const LocationGeocodePreference * pref, LocationPositionCB callback, gpointer userdata, guint *req_id);
+typedef int (*TYPE_GET_GEOCODE_FREEFORM_ASYNC)(LocationMapIElement *self, const gchar *address,  const LocationMapPref *svc_pref, const LocationGeocodePreference * pref, LocationPositionCB callback, gpointer userdata, guint *req_id);
+typedef int (*TYPE_CANCEL_GEOCODE_REQUEST) (LocationMapIElement *self, guint req_id);
+typedef int (*TYPE_GET_REVERSEGEOCODE_ASYNC)(LocationMapIElement *self, const LocationPosition *position, const LocationMapPref *svc_pref, LocationAddressCB callback, gpointer userdata, guint *req_id);
 typedef int (*TYPE_SEARCH_POI) (LocationMapIElement *self, const LocationPOIFilter * filter, const LocationPosition *position, const LocationMapPref *svc_pref, const LocationPOIPreference * pref, LocationPOICB cb, const gpointer user_data, guint *req_id);
 typedef int (*TYPE_SEARCH_POI_BY_AREA) (LocationMapIElement *self, const LocationPOIFilter *filter, const LocationBoundary * boundary, const LocationMapPref *svc_pref, const LocationPOIPreference * pref, LocationPOICB cb, const gpointer user_data, guint *req_id);
 typedef int (*TYPE_SEARCH_POI_BY_ADDR) (LocationMapIElement *self, const LocationPOIFilter *filter, const LocationAddress * address, const LocationMapPref *svc_pref, const LocationPOIPreference * pref, LocationPOICB cb, const gpointer user_data, guint *req_id);
@@ -66,6 +67,7 @@ struct _LocationMapIElementInterface
        TYPE_GET_REVERSEGEOCODE get_reversegeocode;
        TYPE_GET_GEOCODE_ASYNC get_geocode_async;
        TYPE_GET_GEOCODE_FREEFORM_ASYNC get_geocode_freeform_async;
+       TYPE_CANCEL_GEOCODE_REQUEST cancel_geocode_request;
        TYPE_GET_REVERSEGEOCODE_ASYNC get_reversegeocode_async;
        TYPE_SEARCH_POI search_poi;
        TYPE_SEARCH_POI_BY_AREA search_poi_by_area;
@@ -83,9 +85,10 @@ GType location_map_ielement_get_type (void);
 int location_map_ielement_get_geocode (LocationMapIElement *self, const LocationAddress *address, const LocationMapPref *svc_pref, GList **position_list, GList **accuracy_list);
 int location_map_ielement_get_geocode_freeform (LocationMapIElement *self, const gchar *address, const LocationMapPref *svc_pref, GList **position_list, GList **accuracy_list);
 int location_map_ielement_get_reversegeocode (LocationMapIElement *self, const LocationPosition *position, const LocationMapPref *svc_pref, LocationAddress **address, LocationAccuracy **accuracy);
-int location_map_ielement_get_geocode_async (LocationMapIElement *self, const LocationAddress *address, const LocationMapPref *svc_pref, LocationPositionCB callback, gpointer userdata);
-int location_map_ielement_get_geocode_freeform_async (LocationMapIElement *self, const gchar *address, const LocationMapPref *svc_pref, LocationPositionCB callback, gpointer userdata);
-int location_map_ielement_get_reversegeocode_async (LocationMapIElement *self, const LocationPosition *position, const LocationMapPref *svc_pref, LocationAddressCB callback, gpointer userdata);
+int location_map_ielement_get_geocode_async (LocationMapIElement *self, const LocationAddress *address, const LocationMapPref *svc_pref,const LocationGeocodePreference *pref, LocationPositionCB callback, gpointer userdata, guint * req_id);
+int location_map_ielement_get_geocode_freeform_async (LocationMapIElement *self, const gchar *address, const LocationMapPref *svc_pref,const LocationGeocodePreference *pref, LocationPositionCB callback, gpointer userdata, guint * req_id);
+int location_map_ielement_cancel_geocode_request (LocationMapIElement *self, guint req_id);
+int location_map_ielement_get_reversegeocode_async (LocationMapIElement *self, const LocationPosition *position, const LocationMapPref *svc_pref, LocationAddressCB callback, gpointer userdata, guint * req_id);
 int location_map_ielement_search_poi (LocationMapIElement *self, const LocationPOIFilter * filter, const LocationPosition *position, const LocationMapPref *svc_pref, const LocationPOIPreference * pref, LocationPOICB cb, const gpointer user_data, guint * req_id);
 int location_map_ielement_search_poi_by_area (LocationMapIElement *self, const LocationPOIFilter * filter, const LocationBoundary * boundary, const LocationMapPref *svc_pref, const LocationPOIPreference * pref, LocationPOICB cb, const gpointer user_data, guint * req_id);
 int location_map_ielement_search_poi_by_address (LocationMapIElement *self, const LocationPOIFilter * filter, const LocationAddress * address, const LocationMapPref *svc_pref, const LocationPOIPreference * pref, LocationPOICB cb, const gpointer user_data, guint * req_id);
index ac46346..9de4dd5 100644 (file)
 
 struct _LocationMapPref {
        gchar *provider_name;                ///< Name of the service provier
-    gchar *language;            ///< Language of the service preference.
-    gchar *country;                            ///< Country of the service preference.
-    gchar *distance_unit;          ///< Distance unit of the service preference.
-    GHashTable *properties;       ///< properties of the service preference.
+       gchar *language;            ///< Language of the service preference.
+       gchar *country;                         ///< Country of the service preference.
+       gchar *distance_unit;          ///< Distance unit of the service preference.
+       gchar* maps_key;                 ///< Maps Key of the service preference.
+       GHashTable *properties;       ///< properties of the service preference.
+
+       ConnectivityMode connectivity_mode;     ///<Connection mode tells whether to search online, offline or both.
 };
 
 EXPORT_API GList *
@@ -165,6 +168,36 @@ location_map_pref_set_property (LocationMapPref *pref, gconstpointer key, gconst
        return TRUE;
 }
 
+/**
+ * @brief Set maps key to be used in the service request.
+ */
+EXPORT_API gboolean 
+location_map_pref_set_maps_key(LocationMapPref *pref, const char* maps_key)
+{
+       g_return_val_if_fail (pref, FALSE);
+       g_return_val_if_fail (maps_key, FALSE);
+
+       if (pref->maps_key) {
+               g_free (pref->maps_key);
+               pref->maps_key = NULL;
+       }
+
+       if (maps_key) pref->maps_key = g_strdup(maps_key);
+
+       return TRUE;
+}
+
+/**
+ * @brief Get maps key to be used in the service request.
+ */
+EXPORT_API gchar *
+location_map_pref_get_maps_key(const LocationMapPref *pref)
+{
+       g_return_val_if_fail (pref, NULL);
+
+       return pref->maps_key;
+}
+
 EXPORT_API LocationMapPref *
 location_map_pref_new (void)
 {
index bf2da81..9a8e738 100644 (file)
@@ -108,6 +108,16 @@ LocationMapPref * location_map_pref_copy (LocationMapPref *pref);
 void location_map_pref_free (LocationMapPref *pref);
 
 /**
+ * @brief Set maps key to be used in the service request.
+ */
+gboolean location_map_pref_set_maps_key(LocationMapPref *pref, const char* maps_key);
+
+/**
+ * @brief Get maps key to be used in the service request.
+ */
+gchar *location_map_pref_get_maps_key(const LocationMapPref *pref);
+
+/**
  * @} @}
  */
 
index 1b35f31..e91fe78 100644 (file)
@@ -137,17 +137,21 @@ location_map_get_address_from_position (LocationMapObject *obj,
 EXPORT_API int
 location_map_get_position_from_address_async (LocationMapObject *obj,
        const LocationAddress *address,
+       const LocationGeocodePreference *pref,
        LocationPositionCB callback,
-       gpointer userdata)
+       gpointer userdata,
+       guint * req_id)
 {
        g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
        g_return_val_if_fail (G_OBJECT_TYPE(obj) == MAP_TYPE_SERVICE, LOCATION_ERROR_NOT_AVAILABLE);
        g_return_val_if_fail (is_connected_network(), LOCATION_ERROR_NETWORK_NOT_CONNECTED);
+       g_return_val_if_fail (req_id, LOCATION_ERROR_PARAMETER);
+       g_return_val_if_fail (pref, LOCATION_ERROR_PARAMETER);
 
        int ret = LOCATION_ERROR_NONE;
        LocationMapPref *svc_pref = location_map_get_service_pref (obj);
 
-       ret = location_map_ielement_get_geocode_async (LOCATION_MAP_IELEMENT(obj), address, svc_pref, callback, userdata);
+       ret = location_map_ielement_get_geocode_async (LOCATION_MAP_IELEMENT(obj), address, svc_pref,pref, callback, userdata,req_id);
        location_map_pref_free(svc_pref);
 
        return ret;
@@ -157,36 +161,53 @@ location_map_get_position_from_address_async (LocationMapObject *obj,
 EXPORT_API int
 location_map_get_position_from_freeformed_address_async (LocationMapObject *obj,
        const gchar *address,
+       const LocationGeocodePreference *pref,
        LocationPositionCB callback,
-       gpointer userdata)
+       gpointer userdata,
+       guint * req_id)
 {
        g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
        g_return_val_if_fail (G_OBJECT_TYPE(obj) == MAP_TYPE_SERVICE, LOCATION_ERROR_NOT_AVAILABLE);
        g_return_val_if_fail (is_connected_network(), LOCATION_ERROR_NETWORK_NOT_CONNECTED);
+       g_return_val_if_fail (req_id, LOCATION_ERROR_PARAMETER);
+       g_return_val_if_fail (pref, LOCATION_ERROR_PARAMETER);
 
        int ret = LOCATION_ERROR_NONE;
        LocationMapPref *svc_pref = location_map_get_service_pref (obj);
 
-       ret = location_map_ielement_get_geocode_freeform_async (LOCATION_MAP_IELEMENT(obj), address, svc_pref, callback, userdata);
+       ret = location_map_ielement_get_geocode_freeform_async (LOCATION_MAP_IELEMENT(obj), address, svc_pref,pref, callback, userdata,req_id);
        location_map_pref_free(svc_pref);
 
        return ret;
 }
 
 EXPORT_API int
+location_map_cancel_geocode_request (LocationMapObject *obj, guint req_id)
+{
+       g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
+       g_return_val_if_fail (G_OBJECT_TYPE(obj) == MAP_TYPE_SERVICE, LOCATION_ERROR_NOT_AVAILABLE);
+       g_return_val_if_fail (req_id, LOCATION_ERROR_PARAMETER);
+       g_return_val_if_fail (is_connected_network(), LOCATION_ERROR_NETWORK_NOT_CONNECTED);
+
+       return location_map_ielement_cancel_geocode_request (LOCATION_MAP_IELEMENT(obj), req_id);
+}
+
+EXPORT_API int
 location_map_get_address_from_position_async (LocationMapObject *obj,
        const LocationPosition *position,
        LocationAddressCB callback,
-       gpointer userdata)
+       gpointer userdata,
+       guint * req_id)
 {
        g_return_val_if_fail (obj, LOCATION_ERROR_PARAMETER);
        g_return_val_if_fail (G_OBJECT_TYPE(obj) == MAP_TYPE_SERVICE, LOCATION_ERROR_NOT_AVAILABLE);
        g_return_val_if_fail (is_connected_network(), LOCATION_ERROR_NETWORK_NOT_CONNECTED);
+       g_return_val_if_fail (req_id, LOCATION_ERROR_PARAMETER);
 
        int ret = LOCATION_ERROR_NONE;
        LocationMapPref *svc_pref = location_map_get_service_pref (obj);
 
-       ret = location_map_ielement_get_reversegeocode_async (LOCATION_MAP_IELEMENT(obj), position, svc_pref, callback, userdata);
+       ret = location_map_ielement_get_reversegeocode_async (LOCATION_MAP_IELEMENT(obj), position, svc_pref, callback, userdata,req_id);
        location_map_pref_free(svc_pref);
 
        return ret;
index be1f701..5dd9903 100644 (file)
@@ -229,7 +229,7 @@ void get_position_from_address(LocationMapObject* loc)
 }
  * @endcode
  */
-int location_map_get_position_from_address_async (LocationMapObject *obj, const LocationAddress *address, LocationPositionCB callback, gpointer userdata);
+ int location_map_get_position_from_address_async (LocationMapObject *obj,     const LocationAddress *address,const LocationGeocodePreference *pref,LocationPositionCB callback,gpointer userdata,guint * req_id);
 
 /**
  * @brief
@@ -397,7 +397,8 @@ void get_position_from_address(LocationMapObject* loc)
 }
  * @endcode
  */
-int location_map_get_position_from_freeformed_address_async (LocationMapObject *obj, const gchar *address, LocationPositionCB callback,        gpointer userdata);
+ int location_map_cancel_geocode_request (LocationMapObject *obj, guint req_id);
+int location_map_get_position_from_freeformed_address_async (LocationMapObject *obj, const gchar *address,const LocationGeocodePreference *pref, LocationPositionCB callback,gpointer userdata, guint * req_id);
 
 /**
  * @brief
@@ -511,7 +512,7 @@ void get_address_from_position(LocationMapObject* loc)
 }
  * @endcode
  */
-int location_map_get_address_from_position_async (LocationMapObject *obj, const LocationPosition *position,    LocationAddressCB callback, gpointer userdata);
+int location_map_get_address_from_position_async (LocationMapObject *obj, const LocationPosition *position,    LocationAddressCB callback, gpointer userdata, guint * req_id);
 
 /**
  * @brief Request a search service from service provider.
index 55c2b3a..6366352 100644 (file)
@@ -673,6 +673,19 @@ gboolean location_route_element_set_average_speed_m_s(LocationRoadElement *step,
 gboolean location_route_element_set_number_of_lanes(LocationRoadElement *step, const guint num_of_lanes);
 
 /**
+ * @brief Set the value indicating the estimated time of arrival (ETA) and suggested departure time for the route
+ * @remarks The service provider should support route service.
+ * @pre  None.
+ * @post None.
+ * @param [in]  eta_validity - estimated time of arrival (ETA)
+ * @param [in]  element- a #LocationRoadElement
+ * @return gboolean
+ * @retval TRUE                              if success
+ * @see  location_route_element_get_number_of_lanes
+ */
+gboolean location_route_element_set_eta_validity(LocationRoadElement *element, RouteETAValidity eta_validity);
+
+/**
  * @brief set if the road is allowed only for pedestrians.
  * @remarks The service provider should support route service.
  * @pre  None.
index 7fe92ad..4d4d630 100644 (file)
@@ -724,7 +724,9 @@ location_route_set_origin (LocationRoute *route, const LocationPosition* origin)
                route->origin = NULL;
        }
 
-       if (origin) route->origin = location_position_copy(origin);
+       if (origin) {
+               route->origin = location_position_copy(origin);
+       }
 
        return TRUE;
 }
@@ -887,7 +889,9 @@ location_route_copy (const LocationRoute *route)
 
        g_list_foreach(route->segment, route_segment_foreach_copy, new_route);
 
-       if (route->properties) g_hash_table_foreach (route->properties, route_property_copy_cb, new_route);
+       if (route->properties) {
+               g_hash_table_foreach (route->properties, route_property_copy_cb, new_route);
+       }
 
        return new_route;
 }
@@ -2325,6 +2329,21 @@ EXPORT_API gboolean location_route_element_set_element_travel_time(LocationRoadE
        return TRUE;
 }
 
+EXPORT_API gboolean location_route_element_set_eta_validity(LocationRoadElement *element, RouteETAValidity eta_validity)
+{
+       g_return_val_if_fail (element, FALSE);
+
+       element->ETA_validity = eta_validity;
+       return TRUE;
+}
+
+EXPORT_API RouteETAValidity location_route_element_get_eta_validity(const LocationRoadElement *element)
+{
+       g_return_val_if_fail (element, FALSE);
+
+       return element->ETA_validity;
+}
+
 EXPORT_API gchar *location_route_element_get_transit_destination(const LocationRoadElement *element)
 {
        g_return_val_if_fail (element, NULL);
@@ -2521,7 +2540,7 @@ EXPORT_API LocationRouteTransitStop *location_route_element_get_transit_arrival_
 
 EXPORT_API gboolean location_route_element_set_transit_arrival_station(LocationRoadElement *element, const LocationRouteTransitStop *arrival_stop)
 {
-       g_return_val_if_fail (element, NULL);
+       g_return_val_if_fail (element, FALSE);
 
        if (element->transit_arrival_station) {
                location_route_transit_stop_free(element->transit_arrival_station);
index 69a9e5b..84e048d 100644 (file)
@@ -1490,6 +1490,18 @@ guint location_route_element_get_element_start_time(const LocationRoadElement *s
 guint location_route_element_get_element_travel_time(const LocationRoadElement *step);
 
 /**
+ * @brief Get the estimated time of arrival (ETA) and suggested departure time for the route.
+ * @remarks The service provider should support route service.
+ * @pre  None.
+ * @post None.
+ * @param [in] step - a #LocationRoadElement
+ * @return the estimated time of arrival (ETA) and suggested departure time for the route.
+ * @retval
+ * @see  location_route_element_set_eta_validity
+ */
+RouteETAValidity location_route_element_get_eta_validity(const LocationRoadElement *step);
+
+/**
  * @brief Get the destination of this run.
  * @remarks The service provider should support route service.
  * @pre  None.
index 342ac30..7032bcd 100644 (file)
@@ -79,30 +79,43 @@ int
 map_service_get_geocode_async (LocationMapIElement *self,
        const LocationAddress *address,
        const LocationMapPref *svc_pref,
+       const LocationGeocodePreference *pref,
        LocationPositionCB callback,
-       gpointer userdata)
+       gpointer userdata, guint *req_id)
 {
        LOCATION_LOGD("map_service_get_geocode_async");
        MapServicePrivate* priv = GET_PRIVATE(self);
        g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
        g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
        g_return_val_if_fail (priv->mod->ops.get_geocode_async, LOCATION_ERROR_NOT_AVAILABLE);
-       return (priv->mod->ops.get_geocode_async)(priv->mod->handler, address, svc_pref, callback, userdata);
+       return (priv->mod->ops.get_geocode_async)(priv->mod->handler, address, svc_pref, pref, callback, userdata,req_id);
 }
 
 int
 map_service_get_geocode_freeform_async (LocationMapIElement *self,
        const gchar *address,
        const LocationMapPref *svc_pref,
+       const LocationGeocodePreference *pref,
        LocationPositionCB callback,
-       gpointer userdata)
+       gpointer userdata, guint *req_id)
 {
        LOCATION_LOGD("map_service_get_geocode_freeform_async");
        MapServicePrivate* priv = GET_PRIVATE(self);
        g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
        g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
        g_return_val_if_fail (priv->mod->ops.get_geocode_freetext_async, LOCATION_ERROR_NOT_AVAILABLE);
-       return (priv->mod->ops.get_geocode_freetext_async)(priv->mod->handler, address, svc_pref, callback, userdata);
+       return (priv->mod->ops.get_geocode_freetext_async)(priv->mod->handler, address, svc_pref, pref, callback, userdata,req_id);
+}
+
+int
+map_service_cancel_geocode_request (LocationMapIElement *self, guint req_id)
+{
+       LOCATION_LOGD("map_service_cancel_geocode_request");
+       MapServicePrivate* priv = GET_PRIVATE(self);
+       g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
+       g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
+       g_return_val_if_fail (priv->mod->ops.cancel_geocode_request, LOCATION_ERROR_NOT_AVAILABLE);
+       return (priv->mod->ops.cancel_geocode_request)(priv->mod->handler, req_id);
 }
 
 int
@@ -110,14 +123,14 @@ map_service_get_reversegeocode_async (LocationMapIElement *self,
        const LocationPosition *position,
        const LocationMapPref *svc_pref,
        LocationAddressCB callback,
-       gpointer userdata)
+       gpointer userdata, guint *req_id)
 {
        LOCATION_LOGD("map_service_get_reversegeocode_async");
        MapServicePrivate* priv = GET_PRIVATE(self);
        g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
        g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
        g_return_val_if_fail (priv->mod->ops.get_reverse_geocode_async, LOCATION_ERROR_NOT_AVAILABLE);
-       return (priv->mod->ops.get_reverse_geocode_async)(priv->mod->handler, position, svc_pref, callback, userdata);
+       return (priv->mod->ops.get_reverse_geocode_async)(priv->mod->handler, position, svc_pref, callback, userdata, req_id);
 }
 
 int
index b99a922..2611819 100644 (file)
@@ -42,6 +42,8 @@ int map_service_get_geocode_async (LocationMapIElement *self, const LocationAddr
 
 int map_service_get_geocode_freeform_async (LocationMapIElement *self, const gchar *address, const LocationMapPref *svc_pref, LocationPositionCB callback, gpointer userdata);
 
+int map_service_cancel_geocode_request (LocationMapIElement *self, guint req_id);
+
 int map_service_get_reversegeocode_async (LocationMapIElement *self, const LocationPosition *position, const LocationMapPref *svc_pref, LocationAddressCB callback, gpointer userdata);
 
 int map_service_search_poi (LocationMapIElement *self,
index d578a1d..3eae08c 100644 (file)
@@ -192,6 +192,7 @@ map_service_ielement_interface_init (LocationMapIElementInterface *iface)
        iface->get_reversegeocode = (TYPE_GET_REVERSEGEOCODE)map_service_get_reversegeocode;
        iface->get_geocode_async = (TYPE_GET_GEOCODE_ASYNC)map_service_get_geocode_async;
        iface->get_geocode_freeform_async = (TYPE_GET_GEOCODE_FREEFORM_ASYNC)map_service_get_geocode_freeform_async;
+       iface->cancel_geocode_request = (TYPE_CANCEL_GEOCODE_REQUEST) map_service_cancel_geocode_request;
        iface->get_reversegeocode_async = (TYPE_GET_REVERSEGEOCODE_ASYNC)map_service_get_reversegeocode_async;
        iface->search_poi = (TYPE_SEARCH_POI) map_service_search_poi;
        iface->search_poi_by_area = (TYPE_SEARCH_POI_BY_AREA) map_service_search_poi_by_area;
index c53596b..d517f09 100644 (file)
@@ -16,6 +16,5 @@ liblocation_module_la_CFLAGS = \
                                                        -I${srcdir}/../${MANAGER_DIR} \\r
                                                        -I${srcdir}/../${MODULE_DIR} \\r
                                                        -I${srcdir}/../${MAP_SERVICE_DIR} \\r
-                                                       -DLIBPREFIX=\"$(libdir)\" \\r
                                                        $(LOCATION_CFLAGS)\r
 \r
index d21dae9..3bdcf32 100644 (file)
@@ -59,11 +59,13 @@ typedef struct{
        ///< This is used for getting a geocode by using a free-fromed address from a plug-in.
        int (*get_reverse_geocode)(gpointer handle, const LocationPosition *position, const LocationMapPref *svc_pref, LocationAddress **address, LocationAccuracy **accuracy);
        ///< This is used for getting a reverse geocode from a plug-in.
-       int (*get_geocode_async)(gpointer handle, const LocationAddress *address, const LocationMapPref *svc_pref, LocationPositionCB callback, gpointer userdata);
+       int (*get_geocode_async)(gpointer handle, const LocationAddress *address, const LocationMapPref *svc_pref, const LocationGeocodePreference *pref, LocationPositionCB callback, gpointer userdata, guint * req_id);
        ///< This is used for getting a geocode from a plug-in asynchronously.
-       int (*get_geocode_freetext_async)(gpointer handle, const gchar *address, const LocationMapPref *svc_pref, LocationPositionCB callback, gpointer userdata);
+       int (*get_geocode_freetext_async)(gpointer handle, const gchar *address, const LocationMapPref *svc_pref, const LocationGeocodePreference *pref, LocationPositionCB callback, gpointer userdata, guint * req_id);
        ///< This is used for getting a geocode by using a free-fromed address from a plug-in asynchronously.
-       int (*get_reverse_geocode_async)(gpointer handle, const LocationPosition *position, const LocationMapPref *svc_pref, LocationAddressCB callback, gpointer userdata);
+       int (*cancel_geocode_request) (gpointer handle, guint req_id);
+       ///< This is used for cancel geocode request from a plug-in.
+       int (*get_reverse_geocode_async)(gpointer handle, const LocationPosition *position, const LocationMapPref *svc_pref, LocationAddressCB callback, gpointer userdata, guint * req_id);
        ///< This is used for getting a reverse geocode from a plug-in asynchronously.
        int (*search_poi) (gpointer handle, const LocationPOIFilter *filter, const LocationPosition *position, const LocationMapPref *svc_pref, const LocationPOIPreference *pref, LocationPOICB cb, const gpointer user_data, guint * req_id);
        ///< This is used for searching poi with the position from a plug-in asynchronously.
@@ -126,16 +128,6 @@ typedef struct{
 } LocModWpsOps;
 
 /**
- * @brief This represents APIs declared in a CPS plug-in for location CPS modules.
- */
-typedef struct{
-       int (*start)(gpointer handle, LocModStatusCB status_cb, LocModPositionExtCB pos_ext_cb, LocModSatelliteCB sat_cb, gpointer userdata);   ///< This is used for starting a WPS service from a plug-in. #LocModStatusCB, #LocModPositionExtCB and #LocModSatelliteCB(Not used) are given from a location framework to a plug-in for asynchronous signaling.
-       int (*stop)(gpointer handle);
-       int (*get_position)(gpointer handle, LocationPosition **position, LocationVelocity **velocity, LocationAccuracy **accuracy);   ///< This is used for getting a position from a plug-in.
-       int (*get_last_position)(gpointer handle, LocationPosition **position, LocationVelocity **velocity, LocationAccuracy **accuracy);   ///< This is used for getting a last position from a plug-in.
-} LocModCpsOps;
-
-/**
  * @brief This is used for exported APIs in a plug-in for a location framework.
  */
 #define LOCATION_MODULE_API __attribute__((visibility("default"))) G_MODULE_EXPORT
index d5d7081..e4d0fdd 100644 (file)
@@ -32,7 +32,7 @@
 #include "location-log.h"
 
 #define MAX_MODULE_INDEX 3
-const char* MODULE_PATH_PREFIX = LIBPREFIX "/location/module";
+const char* MODULE_PATH_PREFIX = "/usr/lib/location/module";
 
 static GMod*
 gmod_new (const char* module_name, gboolean is_resident)
@@ -50,7 +50,6 @@ gmod_new (const char* module_name, gboolean is_resident)
        if(!gmod->path){
                g_free(gmod->name);
                g_free(gmod);
-               gmod->name = NULL;
                return NULL;
        }
        gmod->module = g_module_open(gmod->path, G_MODULE_BIND_LAZY);
@@ -58,9 +57,6 @@ gmod_new (const char* module_name, gboolean is_resident)
                g_free(gmod->name);
                g_free(gmod->path);
                g_free(gmod);
-               gmod->name = NULL;
-               gmod->path = NULL;
-
                return NULL;
        }
        if(is_resident)
@@ -83,7 +79,7 @@ gmod_free (GMod* gmod)
 
 static gboolean
 gmod_find_sym (GMod* gmod,
-       gpointer* init_func, gpointer* shutdown_func)
+               gpointer* init_func, gpointer* shutdown_func)
 {
        char sym[256];
        g_stpcpy(sym, "init");
@@ -160,18 +156,6 @@ mod_new (const char* module_name)
                        ret_mod = NULL;
                }else
                        ret_mod = (gpointer)_mod;
-       }else if(g_str_has_prefix(module_name, "cps")){
-               LocationCpsMod* _mod = g_new0(LocationCpsMod, 1);
-               _mod->gmod = gmod;
-               _mod->init = init;
-               _mod->shutdown= shutdown;
-               _mod->handler= _mod->init(&(_mod->ops));
-               if(!_mod->handler){
-                       LOCATION_LOGW("module init failed");
-                       gmod_free(_mod->gmod);
-                       ret_mod = NULL;
-               }else
-                       ret_mod = (gpointer)_mod;
        }else{
                LOCATION_LOGW("module name (%s) is wrong", module_name);
                ret_mod = NULL;
@@ -182,7 +166,7 @@ mod_new (const char* module_name)
 
 static void
 mod_free (gpointer mod,
-       const char* module_name)
+               const char* module_name)
 {
        if(!mod || !module_name)
                return;
@@ -217,16 +201,6 @@ mod_free (gpointer mod,
                _mod->shutdown= NULL;
                gmod_free(_mod->gmod);
                _mod->gmod = NULL;
-       }else if(0 == g_strcmp0(module_name, "cps")){
-               LocationCpsMod* _mod = (LocationCpsMod*)mod;
-               if(_mod->shutdown && _mod->handler){
-                       _mod->shutdown(_mod->handler);
-               }
-               _mod->handler = NULL;
-               _mod->init = NULL;
-               _mod->shutdown= NULL;
-               gmod_free(_mod->gmod);
-               _mod->gmod = NULL;
        }else
                LOCATION_LOGW("module name (%s) is wrong", module_name);
 
@@ -255,17 +229,15 @@ gboolean module_init (void)
        return TRUE;
 }
 
-void
-module_free (gpointer mod,
-       const char* module_name)
+void module_free (gpointer mod,
+               const char* module_name)
 {
        if(!mod || !module_name)
                return;
        mod_free(mod, module_name);
 }
 
-gpointer
-module_new (const char* module_name)
+gpointer module_new (const char* module_name)
 {
        if(!module_name)
                return NULL;
@@ -295,8 +267,7 @@ module_new (const char* module_name)
        return mod;
 }
 
-gboolean
-module_is_supported(const char *module_name)
+gboolean module_is_supported(const char *module_name)
 {
        if(!module_name)
                return FALSE;
@@ -325,8 +296,7 @@ module_is_supported(const char *module_name)
        return found;
 }
 
-gchar *
-mod_get_realpath (const gchar *module_name)
+gchar * mod_get_realpath (const gchar *module_name)
 {
        gchar origin_path[PATH_MAX] = {0, };
        gchar link_path[PATH_MAX] = {0, };
index a782062..3a07ee8 100644 (file)
@@ -60,14 +60,6 @@ typedef struct{
        LocModWpsOps ops;
 } LocationWpsMod;
 
-typedef struct{
-       GMod* gmod;     
-       gpointer handler;
-       gpointer (*init)(LocModCpsOps* ops);
-       void (*shutdown)(gpointer handle);
-       LocModCpsOps ops;
-} LocationCpsMod;
-
 G_BEGIN_DECLS
 
 gboolean module_init(void);
index 57975ec..7bfe859 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       libslp-location
 Summary:    Location Based Service
-Version:    0.4.7
+Version:    0.5.3
 Release:    1
 Group:      System/Libraries
 License:    Apache Licensc, Version 2.0
index 6da5435..14528fb 100644 (file)
@@ -1,11 +1,10 @@
 dir_location = $(top_srcdir)/location
-noinst_PROGRAMS = location-api-test gps-test wps-test hybrid-test cps-test\
+noinst_PROGRAMS = location-api-test gps-test wps-test hybrid-test\
                                  position-sample-gps velocity-sample nmea-sample satellite-sample property-sample zone-sample address-sample map-service-test
 
 gps_test_SOURCES =  gps-test.c
 wps_test_SOURCES =  wps-test.c
 hybrid_test_SOURCES =  hybrid-test.c
-cps_test_SOURCES =  cps-test.c
 position_sample_gps_SOURCES =   position-sample-gps.c
 velocity_sample_SOURCES = velocity-sample.c
 nmea_sample_SOURCES = nmea-sample.c
index 8b155fc..add8846 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <gconf/gconf-client.h>
 #include <location.h>
+#include <location-geocode.h>
 #include <location-map-service.h>
 
 static GMainLoop *loop = NULL;
@@ -125,26 +126,31 @@ cb_service_enabled (GObject *self,
 static gboolean
 async_request (gpointer loc)
 {
+       guint req_id = 0;
+       LocationGeocodePreference *pref =location_geocode_pref_new();
+       location_geocode_pref_set_max_result(pref, 25);
+
        LocationAddress *addr = location_address_new ("1", "Post Street", NULL, "san jose", "ca", NULL, "95113",NULL,NULL,NULL);
-       LocationError err = location_map_get_position_from_address_async(loc, addr, cb_position_from_address, loc);
+       LocationError err = location_map_get_position_from_address_async(loc, addr,pref, cb_position_from_address, loc,&req_id);
        if (LOCATION_ERROR_NONE == err)
                g_debug("location_map_get_position_from_address_async() success");
        else g_warning ("location_map_get_position_from_address_async() failed> error code:%d", err);
        location_address_free (addr);
 
        gchar *addr_str = g_strdup("4 N 2nd Street 95113");
-       err = location_map_get_position_from_freeformed_address_async(loc, addr_str, cb_position_from_freeformed_address, loc);
+       err = location_map_get_position_from_freeformed_address_async(loc, addr_str,pref, cb_position_from_freeformed_address, loc,&req_id);
        if (LOCATION_ERROR_NONE == err)
                g_debug("location_map_get_position_from_freeformed_address_async() success");
        else g_warning ("location_map_get_position_from_freeformed_address_async() failed> error code:%d", err);
        g_free(addr_str);
 
        LocationPosition *pos = location_position_new (0, 37.3322, -121.8720, 0, LOCATION_STATUS_2D_FIX);
-       err = location_map_get_address_from_position_async(loc, pos, cb_address_from_position, loc);
+       err = location_map_get_address_from_position_async(loc, pos,cb_address_from_position, loc,&req_id);
        if (LOCATION_ERROR_NONE == err)
                g_debug("location_map_get_address_from_position_async() success");
        else g_warning ("location_map_get_address_from_position_async() failed> error code:%d", err);
        location_position_free (pos);
+       location_geocode_pref_free(pref);
        return FALSE;
 }
 
diff --git a/tests/cps-test.c b/tests/cps-test.c
deleted file mode 100644 (file)
index 1547fbb..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- *          Genie Kim <daejins.kim@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <glib.h>
-#include <location.h>
-
-int
-main (int argc, char *argv[])
-{
-       LocationObject *loc = NULL;
-
-       // If application is executed by AUL, this is not needed.
-       g_setenv("PKG_NAME", "org.tizen.cps-test", 1);
-
-       location_init ();
-
-       loc  = location_new (LOCATION_METHOD_CPS);
-       if (!loc) {
-               g_debug("location_new failed");
-               return -1;
-       }
-
-       LocationMethod method = LOCATION_METHOD_NONE;
-       g_object_get(loc, "method", &method, NULL);
-       g_debug("Get property>> method:%d", method);
-
-       LocationAccuracy *acc = NULL;
-       LocationPosition *pos = NULL;
-
-       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");
-
-       g_object_get(loc, "last-position", &pos, NULL);
-       if (pos) {
-               g_debug ("Get property>> last-position> time: %d, lat: %f, long: %f, alt: %f, status: %d",
-                       pos->timestamp, pos->latitude, pos->longitude, pos->altitude, pos->status);
-               location_position_free(pos);
-       } else  g_warning("failed to get property> last-position");
-
-       location_free (loc);
-       return 0;
-}
-
index 03bee4a..8e6df40 100644 (file)
@@ -110,9 +110,6 @@ static void GetMethod(char str[STR_MAX], LocationMethod method)
                case LOCATION_METHOD_GPS:
                        g_utf8_strncpy(str, "LOCATION_METHOD_GPS", STR_MAX);
                        break;
-               case LOCATION_METHOD_CPS:
-                       g_utf8_strncpy(str, "LOCATION_METHOD_CPS", STR_MAX);
-                       break;
                case LOCATION_METHOD_WPS:
                        g_utf8_strncpy(str, "LOCATION_METHOD_WPS", STR_MAX);
                        break;
@@ -255,9 +252,6 @@ static void PrintProperty (LocationObject* loc)
                g_object_get(loc, "pos-interval", &pos_interval, NULL);
                g_object_get(loc, "vel-interval", &vel_interval, NULL);
        }
-       else if (method == LOCATION_METHOD_CPS) {
-               g_object_get(loc, "pos-interval", &pos_interval, NULL);
-       }
        g_printf("Position interval : [%u], Velocity interval [%u], Satellite interval [%u]\n", pos_interval, vel_interval, sat_interval);
 
        g_printf("\nSignals: ");
@@ -463,7 +457,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]\n");
+                       g_printf("LOCATION_METHOD_HYBRID[0] LOCATION_METHOD_GPS[1] LOCATION_METHOD_WPS[2]\n");
                        g_printf("Select Location Method: ");
                        LocationMethod method = PromptInt();
                        location_obj = location_new(method);
@@ -616,7 +610,7 @@ int main(int argc, char** argv)
                        char input[8] = {0, };
                        gboolean is_supported = FALSE;
 
-                       g_printf("0.Hybrid 1.GPS 2.WPS 3.CPS\n");
+                       g_printf("0.Hybrid 1.GPS 2.WPS\n");
                        g_printf("Select Method :");
                        str = fgets(input, 8, stdin);
                        method = atoi(input);
@@ -632,11 +626,6 @@ int main(int argc, char** argv)
                                case LOCATION_METHOD_WPS:
                                        is_supported = location_is_supported_method(LOCATION_METHOD_WPS);
                                        break;
-
-                               case LOCATION_METHOD_CPS:
-                                       is_supported = location_is_supported_method(LOCATION_METHOD_CPS);
-                                       break;
-
                                default:
                                        break;
 
index 22d8f3b..2986734 100644 (file)
@@ -26,6 +26,7 @@
 #include <gconf/gconf-client.h>
 #include <location-map-service.h>
 #include "location-api-test-util.h"
+#include "location-geocode.h"
 
 #define STR_MAX        128
 LocationMapObject* map_obj = NULL;
@@ -203,6 +204,7 @@ static void _print_property (gpointer data, gpointer user_data)
 static void
 __plugin_print_poi_list (gpointer data, gpointer user_data)
 {
+       int i=0;
        LocationLandmark *landmark = (LocationLandmark *)data;
        LocationPosition *pos = location_landmark_get_position (landmark);
        LocationAddress *addr = location_landmark_get_address (landmark);
@@ -214,7 +216,25 @@ __plugin_print_poi_list (gpointer data, gpointer user_data)
                        pos->latitude, pos->longitude,
                        addr->building_number, addr->city, addr->country_code, addr->district,
                        addr->postal_code);
-
+       g_printf("Supplier details : [NAME: %s],[LINK: %s],[ID:%s],[TYPE: %s]",
+                       landmark_linkobject_get_name(location_landmark_get_supplier( landmark)),
+                       landmark_linkobject_get_link_string(location_landmark_get_supplier( landmark)),
+                       landmark_linkobject_get_id(location_landmark_get_supplier( landmark)),
+                       landmark_linkobject_get_type(location_landmark_get_supplier( landmark)));
+       g_printf("Related  details : [NAME: %s],[LINK: %s],[ID:%s],[TYPE: %s]",
+                       landmark_linkobject_get_name(location_landmark_get_related( landmark)),
+                       landmark_linkobject_get_link_string(location_landmark_get_related( landmark)),
+                       landmark_linkobject_get_id(location_landmark_get_related( landmark)),
+                       landmark_linkobject_get_type(location_landmark_get_related( landmark)));
+       g_printf("Rating details : [AVG: %d],[COUNT:%d]",
+                       landmark_rating_get_average(location_landmark_get_rating(landmark)),
+                       landmark_rating_get_count(location_landmark_get_rating(landmark)));
+       for(i=0;i<g_list_length(location_landmark_get_editorial(landmark));i++)
+       {
+               LandmarkEditorial * editorial=g_list_nth_data(location_landmark_get_editorial(landmark),i);
+               g_printf("Editorials : [Desc: %s] [LANG: %s]",
+               landmark_editorial_get_description(editorial),landmark_editorial_get_language(editorial));
+       }
        GList *key_list = location_landmark_get_property_key(landmark);
        if (key_list) {
                g_list_foreach(key_list, _print_property, landmark);
@@ -768,12 +788,19 @@ typedef struct {
 static gboolean idle_position_from_address_async(gpointer data)
 {
        IdleData* idle_data = (IdleData*)data;
+       guint req_id = 0;
        char str[STR_MAX];
-       int ret = location_map_get_position_from_address_async(idle_data->obj, idle_data->addr, idle_data->pos_cb, idle_data->user_data);
+       LocationGeocodePreference *pref = location_geocode_pref_new();
+       int ret = location_map_get_position_from_address_async(idle_data->obj, idle_data->addr,pref, idle_data->pos_cb, idle_data->user_data,&req_id);
        GetLocationError(str, ret);
-       g_printf("location_get_position_from_address_async: returned value [%s]\n", str);
+       if(ret != LOCATION_ERROR_NONE) {
+                       g_printf("Fail location_get_position_from_address_async Error[%s]\n", str);
+       } else {
+                       g_printf("location_get_position_from_address_async, req_id %d\n", req_id);
+       }
        location_address_free(idle_data->addr);
        g_free(idle_data);
+       location_geocode_pref_free(pref);
        return FALSE;
 }
 
@@ -781,11 +808,18 @@ static gboolean idle_position_from_freefromed_address_async(gpointer data)
 {
        IdleData* idle_data = (IdleData*)data;
        char str[STR_MAX];
-       int ret = location_map_get_position_from_freeformed_address_async(idle_data->obj, idle_data->str_addr, idle_data->pos_cb, idle_data->user_data);
+       guint req_id = 0;
+       LocationGeocodePreference *pref = location_geocode_pref_new();
+       int ret = location_map_get_position_from_freeformed_address_async(idle_data->obj, idle_data->str_addr,pref, idle_data->pos_cb, idle_data->user_data,&req_id);
        GetLocationError(str, ret);
-       g_printf("location_get_position_from_freeformed_address_async: returned value [%s]\n", str);
+       if(ret != LOCATION_ERROR_NONE) {
+                       g_printf("Fail location_get_position_from_freeformed_address_async Error[%s]\n", str);
+       } else {
+                       g_printf("location_get_position_from_freeformed_address_async, req_id %d\n", req_id);
+       }
        g_free(idle_data->str_addr);
        g_free(idle_data);
+       location_geocode_pref_free(pref);
        return FALSE;
 }
 
@@ -793,9 +827,14 @@ static gboolean idle_address_from_position_async(gpointer data)
 {
        IdleData* idle_data = (IdleData*)data;
        char str[STR_MAX];
-       int ret = location_map_get_address_from_position_async(idle_data->obj, idle_data->pos, idle_data->addr_cb, idle_data->user_data);
+       guint reqid = 0;
+       int ret = location_map_get_address_from_position_async(idle_data->obj, idle_data->pos,idle_data->addr_cb, idle_data->user_data,&reqid);
        GetLocationError(str, ret);
-       g_printf("location_map_get_address_from_position_async: returned value [%s]\n", str);
+       if(ret != LOCATION_ERROR_NONE) {
+                       g_printf("Fail location_map_get_address_from_position_async Error[%s]\n", str);
+       } else {
+                       g_printf("location_map_get_address_from_position_async, req_id %d\n", reqid);
+       }
        location_position_free(idle_data->pos);
        g_free(idle_data);
        return FALSE;
@@ -804,16 +843,18 @@ static gboolean idle_location_map_get_position_from_address_async(gpointer data)
 {
        g_printf("+++idle location map get position from address async begin\n");
        IdleData* idle_data = (IdleData*)data;
+       guint req_id = 0;
+       char str[STR_MAX];
+       LocationGeocodePreference *pref = location_geocode_pref_new();
+       LocationError err = location_map_get_position_from_address_async(idle_data->obj,idle_data->addr,pref,idle_data->pos_cb,idle_data->user_data,&req_id);
 
-       LocationError err = location_map_get_position_from_address_async(idle_data->obj,idle_data->addr,idle_data->pos_cb,idle_data->user_data);
-
-       if (LOCATION_ERROR_NONE == err){
-                       g_debug("location_map_get_position_from_address_async() success");
-               }
-       else{
-                       g_warning ("location_map_get_position_from_address_async() failed> error code:%d", err);
-               }
+       if(err != LOCATION_ERROR_NONE) {
+                       g_printf("Fail location_get_position_from_address_async Error[%s]\n", str);
+       } else {
+                       g_printf("location_get_position_from_address_async, req_id %d\n", req_id);
+       }
        g_free(idle_data);
+       location_geocode_pref_free(pref);
        g_printf("---idle location map get position from address async  end\n");
        return FALSE;
 }
@@ -877,6 +918,7 @@ static void print_menu()
        g_printf("16.  location_map_get_supported_providers \n");
        g_printf("17.  location_map_get_default_provider \n");
        g_printf("18.  location_map_set_provider \n");
+       g_printf("19.  location_map_cancel_geocode_request. \n");
        g_printf("99.  change map provider to default\n");
        g_printf("99a. change map provider to decarta\n");
        g_printf("99b. change map provider to osm\n");
@@ -1081,7 +1123,7 @@ int main(int argc, char** argv)
                }else if(0 == g_strcmp0("7a", strOpt)) {
                        g_printf("location_map_search_poi_with_category\n");
                        LocationPOIFilter *filter = location_poi_filter_new();
-                       location_poi_filter_set(filter, "CATEGORY", "restaurant");
+                       location_poi_filter_set(filter, "CATEGORY", "eat_drink");
 
                        LocationPOIPreference *pref = location_poi_pref_new();
                        location_poi_pref_set_max_result(pref, 5);
@@ -1562,6 +1604,21 @@ int main(int argc, char** argv)
                        else {
                                g_printf ("Fail to set provider [%d]\n", opt);
                        }
+               }
+               else if(0 == g_strcmp0("19", strOpt)) {
+                       int req_id;
+                       int len = 0;
+
+                       g_printf("Input ReqID : ");
+                       len = scanf("%d", &req_id);
+
+                       ret = location_map_cancel_geocode_request(map_obj, req_id);
+                       GetLocationError(str, ret);
+                       if (ret != LOCATION_ERROR_NONE) {
+                               g_printf("Fail to cancel Geocode request. Error[%s]\n", str);
+                       }
+                       else
+                               g_printf("location_map_cancel_geocode_request, req_id %d\n", req_id);
                }else if (0 == g_strcmp0 ("99", strOpt)) {
                        if (map_obj) {
                                g_object_set (map_obj, "provider", NULL, NULL);