MAP_SERVICE_PREF_PROPERTY,
MAP_SERVICE_GEOCODE_TYPE,
+ MAP_SERVICE_GEOCODE_PREF_PROPERTY,
MAP_SERVICE_REVERSE_GEOCODE_TYPE,
MAP_SERVICE_POI_TYPE,
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;
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;
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
return 1;
}
-int
+EXPORT_API int
location_accuracy_level_compare(const LocationAccuracy *accuracy1, const LocationAccuracy *accuracy2)
{
g_return_val_if_fail(accuracy1, -1);
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "location-setting.h"
-#include "location-log.h"
-
-#include "module-internal.h"
-
-#include "location-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);
-}
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __LOCATION_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
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,
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
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;
}
}
}
} 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;
}
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 {
}
}
- 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;
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);
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;
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;
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;
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");
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
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
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
LOCATION_METHOD_GPS,
G_PARAM_READABLE);
+ properties[PROP_IS_STARTED] = g_param_spec_boolean ("is_started",
+ "gps is started prop",
+ "gps is started status",
+ FALSE,
+ G_PARAM_READWRITE);
+
properties[PROP_LAST_POSITION] = g_param_spec_boxed ("last-position",
"gps last position prop",
"gps last position data",
LOCATION_UPDATE_INTERVAL_MAX,
LOCATION_UPDATE_INTERVAL_DEFAULT,
G_PARAM_READWRITE);
- ;
+
properties[PROP_BOUNDARY] = g_param_spec_pointer ("boundary",
"gps boundary prop",
"gps boundary data",
#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;
return TRUE;
}
-
static void
location_hybrid_state_cb (keynode_t *key, gpointer self)
{
}
}
- 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);
}
return;
}
hybrid_get_update_method(priv);
- if(priv->gps_enabled || priv->wps_enabled)
- enable_signaling(self, signals, &(priv->enabled), TRUE, status);
-
}
static void
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);
}
}
- 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;
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;
return ret;
}
+static int
+location_hybrid_set_option (LocationHybrid *self, const char *option)
+{
+ LOCATION_LOGD("location_hybrid_set_option");
+ LocationHybridPrivate *priv = GET_PRIVATE (self);
+
+ int ret_gps = LOCATION_ERROR_NOT_AVAILABLE;
+ int ret_wps = LOCATION_ERROR_NOT_AVAILABLE;
+
+ if (priv->gps) ret_gps = location_set_option(priv->gps, option);
+ if (priv->wps) ret_wps = location_set_option(priv->wps, option);
+
+ if (ret_gps != LOCATION_ERROR_NONE && ret_wps != LOCATION_ERROR_NONE)
+ return LOCATION_ERROR_NOT_AVAILABLE;
+
+ return LOCATION_ERROR_NONE;
+}
+
static void
location_ielement_interface_init (LocationIElementInterface *iface)
{
iface->get_last_velocity = (TYPE_GET_VELOCITY)location_hybrid_get_last_velocity;
iface->get_satellite = (TYPE_GET_SATELLITE)location_hybrid_get_satellite;
iface->get_last_satellite = (TYPE_GET_SATELLITE)location_hybrid_get_last_satellite;
+ iface->set_option = (TYPE_SET_OPTION)location_hybrid_set_option;
}
static void
LOCATION_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;
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
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
{
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);
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
}
/* 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);
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);
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;
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);
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;
}
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,
gboolean emit,
guint *updated_timestamp,
LocationSatellite **prev_sat,
- const LocationSatellite *sat)
+ LocationSatellite *sat)
{
g_return_if_fail(obj);
g_return_if_fail(signals);
g_signal_emit(obj, signals[SERVICE_UPDATED], 0, SATELLITE_UPDATED, sat, NULL);
*updated_timestamp = sat->timestamp;
}
-
-}
+}
\ No newline at end of file
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
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,
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)
{
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
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;
}
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;
}
location_setting_ignore_notify (VCONFKEY_LOCATION_NETWORK_ENABLED, location_setting_wps_cb);
priv->set_noti = FALSE;
}
+
__reset_pos_data_from_priv(priv);
return ret;
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);
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;
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);
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: {
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:
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);
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;
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)
{
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
priv->acc = NULL;
priv->boundary_list = NULL;
- priv->pos_timer = 0;
- priv->vel_timer = 0;
}
static void
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",
#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"
self = g_object_new (LOCATION_TYPE_WPS, NULL);
break;
case LOCATION_METHOD_CPS:
- self = g_object_new (LOCATION_TYPE_CPS, NULL);
- break;
default:
break;
}
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);
is_supported = module_is_supported("wps");
break;
case LOCATION_METHOD_CPS:
- is_supported = module_is_supported("cps");
- break;
default:
break;
}
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;
}
/**
* @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
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);
+
+/**
* @} @}
*/
* 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;
+}
* 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.
* @}
*/
+/**
+ * @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
* @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
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);
+
+/**
* @} @}
*/
#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
{
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);
}
g_free(landmark->name);
landmark->name = NULL;
}
- if (name) landmark->name = g_strdup (name);
+ if (name) {
+ landmark->name = g_strdup (name);
+ }
return TRUE;
}
landmark->position = NULL;
}
- if (position) landmark->position = location_position_copy (position);
+ if (position) {
+ landmark->position = location_position_copy (position);
+ }
return TRUE;
landmark->addr = NULL;
}
- if (addr) landmark->addr = location_address_copy (addr);
+ if (addr) {
+ landmark->addr = location_address_copy (addr);
+ }
return TRUE;
landmark->desc = NULL;
}
- if (desc) landmark->desc = g_strdup (desc);
+ if (desc) {
+ landmark->desc = g_strdup (desc);
+ }
return TRUE;
}
landmark->bbox = NULL;
}
- if (bbox) landmark->bbox = location_boundary_copy (bbox);
+ if (bbox) {
+ landmark->bbox = location_boundary_copy (bbox);
+ }
return TRUE;
}
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);
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);
}
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
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;
}
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;
}
{
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;
}
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);
}
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);
+
+/**
* @} @}
*/
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
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
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);
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;
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);
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 *
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)
{
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);
+
+/**
* @} @}
*/
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;
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;
}
* @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
}
* @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
}
* @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.
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.
route->origin = NULL;
}
- if (origin) route->origin = location_position_copy(origin);
+ if (origin) {
+ route->origin = location_position_copy(origin);
+ }
return TRUE;
}
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;
}
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);
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);
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.
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
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
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,
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;
-I${srcdir}/../${MANAGER_DIR} \\r
-I${srcdir}/../${MODULE_DIR} \\r
-I${srcdir}/../${MAP_SERVICE_DIR} \\r
- -DLIBPREFIX=\"$(libdir)\" \\r
$(LOCATION_CFLAGS)\r
\r
///< 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.
} 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
#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)
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);
g_free(gmod->name);
g_free(gmod->path);
g_free(gmod);
- gmod->name = NULL;
- gmod->path = NULL;
-
return NULL;
}
if(is_resident)
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");
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;
static void
mod_free (gpointer mod,
- const char* module_name)
+ const char* module_name)
{
if(!mod || !module_name)
return;
_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);
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;
return mod;
}
-gboolean
-module_is_supported(const char *module_name)
+gboolean module_is_supported(const char *module_name)
{
if(!module_name)
return FALSE;
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, };
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);
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
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
#include <gconf/gconf-client.h>
#include <location.h>
+#include <location-geocode.h>
#include <location-map-service.h>
static GMainLoop *loop = NULL;
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;
}
+++ /dev/null
-/*
- * libslp-location
- *
- * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
- * Genie Kim <daejins.kim@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <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;
-}
-
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;
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: ");
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);
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);
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;
#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;
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);
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);
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;
}
{
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;
}
{
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;
{
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;
}
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");
}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);
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);