--- /dev/null
+*.[oa]
+*~
+*.bak
+*.old
+test/CMakeFiles
+test/CMakeFiles/*
+test/CMakeCache.txt
+test/cmake_install.cmake
+test/Makefile
+test/maps_test
+test/*.xml
--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+SET(fw_name "capi-maps-service")
+
+PROJECT(${fw_name})
+
+SET(CMAKE_INSTALL_PREFIX /usr)
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+
+SET(INC_DIR include)
+SET(INTERNAL_INC_DIR
+ src
+ src/api
+ src/plugin
+ src/session
+ )
+INCLUDE_DIRECTORIES(${INC_DIR} ${INTERNAL_INC_DIR})
+
+SET(dependents "glib-2.0 gmodule-2.0 dlog capi-base-common security-privilege-checker")
+SET(pc_dependents "capi-base-common")
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(${fw_name} REQUIRED ${dependents})
+FOREACH(flag ${${fw_name}_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror -g -fdump-rtl-expand")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror -fvisibility=hidden -fvisibility-inlines-hidden")
+SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
+
+#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror -g -fPIC -fdump-rtl-expand -std=c++0x")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror -fvisibility=hidden")
+SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
+
+IF("${ARCH}" STREQUAL "arm")
+ ADD_DEFINITIONS("-DTARGET")
+ENDIF("${ARCH}" STREQUAL "arm")
+
+ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+ADD_DEFINITIONS("-DEXPORT_API=__attribute__((visibility(\"default\")))")
+#ADD_DEFINITIONS("-DTIZEN_DEBUG")
+
+SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined -Wl,--as-needed")
+
+aux_source_directory(src SOURCES)
+aux_source_directory(src/api SOURCES_API)
+aux_source_directory(src/plugin SOURCES_PLUGIN)
+aux_source_directory(src/session SOURCES_SESSION)
+ADD_LIBRARY(${fw_name} SHARED ${SOURCES} ${SOURCES_API} ${SOURCES_PLUGIN} ${SOURCES_SESSION})
+
+TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS})
+
+SET_TARGET_PROPERTIES(${fw_name}
+ PROPERTIES
+ VERSION ${FULLVER}
+ SOVERSION ${MAJORVER}
+ CLEAN_DIRECT_OUTPUT 1
+ )
+
+INSTALL(TARGETS ${fw_name} DESTINATION ${LIBDIR})
+INSTALL(
+ DIRECTORY ${INC_DIR}/ DESTINATION include/maps
+ FILES_MATCHING
+ # *_plugin.h" are needed by plugin
+ # PATTERN "*_plugin.h" EXCLUDE
+ PATTERN "${INC_DIR}/*.h"
+ )
+
+SET(PC_NAME ${fw_name})
+SET(PC_DESCRIPTION "Tizen Maps Library")
+SET(PC_REQUIRED ${pc_dependents})
+SET(PC_LDFLAGS -l${fw_name})
+SET(PC_INCLUDE /usr/include/maps)
+
+CONFIGURE_FILE(
+ ${fw_name}.pc.in
+ ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc
+ @ONLY
+ )
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION ${LIBDIR}/pkgconfig)
+
+#Please don't release the below comment when you submit.
+#Please release the below comment, if you want to test code in local.
+#It is not good for security and increases binary size.
+#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror -fvisibility=default")
+#ADD_SUBDIRECTORY(test)
+
+IF(UNIX)
+
+ ADD_CUSTOM_TARGET (distclean @echo cleaning for source distribution)
+ ADD_CUSTOM_COMMAND(
+ DEPENDS clean
+ COMMENT "distribution clean"
+ COMMAND find
+ ARGS .
+ -not -name config.cmake -and \(
+ -name tester.c -or
+ -name Testing -or
+ -name CMakeFiles -or
+ -name cmake.depends -or
+ -name cmake.check_depends -or
+ -name CMakeCache.txt -or
+ -name cmake.check_cache -or
+ -name *.cmake -or
+ -name Makefile -or
+ -name core -or
+ -name core.* -or
+ -name gmon.out -or
+ -name install_manifest.txt -or
+ -name *.pc -or
+ -name *~ \)
+ | grep -v TC | xargs rm -rf
+ TARGET distclean
+ VERBATIM
+ )
+
+ENDIF(UNIX)
+
--- /dev/null
+Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+
+ 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.
+
--- /dev/null
+[Version] capi-maps-service_0.4.6
+[Date] 16 September 2015
+[Title] Added -fvisibility=hidden to make EXPORT_API useful.
+[Developer] Young-Ae Kang <youngae.kang@samsung.com>
+
+[Version] capi-maps-service_0.4.5
+[Date] 14 September 2015
+[Title] [Bug Fixes] Added missing EXPORT_API macros to maps_place_filter.cpp.
+[Developer] Alexey Shulga <a.shulga@samsung.com>
+
+[Version] capi-maps-service_0.4.4
+[Date] 02 September 2015
+[Title] [ACR-394] Two more privilege are needed.
+[Developer] Young-Ae Kang <youngae.kang@samsung.com>
+
+[Version] capi-maps-service_0.4.3
+[Date] 27 July 2015
+[Title] Corrected order of error checking in Maps Service API, added "maps-service" privilege checking
+[Developer] Alexey Shulga <a.shulga@samsung.com>
+
+[Version] capi-maps-service_0.4.2
+[Date] 22 July 2015
+[Title] Removed "resident" mode of plugin binaries; it allowed to release memory properly when many instances of Maps Service are used
+[Developer] Alexey Shulga <a.shulga@samsung.com>
+
+[Version] capi-maps-service_0.4.1
+[Date] 17 July 2015
+[Title] Changed parameter checks in Maps API requsts: preference allowed to be NULL
+[Developer] Alexey Shulga <a.shulga@samsung.com>
+
+[Version] capi-maps-service_0.4.0
+[Date] 14 July 2015
+[Title] [ACR-309] [2.4][capi-maps-service][Modify] Visibility of some APIs of Maps was changed
+[Developer] Young-Ae Kang <youngae.kang@samsung.com>
+
+[Version] capi-maps-service_0.3.2
+[Date] 27 May 2015
+[Title] [ACR-248][2.4][capi-maps-service][Modify] The name of API was changed.
+[Developer] Young-Ae Kang <youngae.kang@samsung.com>
+
+[Version] capi-maps-service_0.3.1
+[Date] 14 April 2015
+[Title] Sources prepared for Prevent analysis
+[Developer] Alexey Shulga <a.shulga@samsung.com>
+
+[Version] capi-maps-service_0.3.0
+[Date] 09 April 2015
+[Title] Initial release
+[Developer] Alexey Shulga <a.shulga@samsung.com>
--- /dev/null
+<manifest>
+ <request>
+ <domain name="_"/>
+ </request>
+</manifest>
--- /dev/null
+#Package Information for pkg-config
+
+prefix=@PREFIX@
+exec_prefix=/usr
+libdir=/usr/lib
+includedir=@PC_INCLUDE@
+
+Name: @PC_NAME@
+Description: @PC_DESCRIPTION@
+Version: @VERSION@
+Requires: @PC_REQUIRED@
+Libs: -L${libdir} @PC_LDFLAGS@
+Cflags: -I${includedir}
+
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * 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 __MAPS_PLUGIN_DOC_H__
+#define __MAPS_PLUGIN_DOC_H__
+/**
+ * @ingroup CAPI_LOCATION_FRAMEWORK
+ * @defgroup CAPI_MAPS_PLUGIN_MODULE Maps Plugin
+ *
+ * @brief The Maps Plugin provides maps service providers with interfaces
+ * to realize Maps Service APIs.
+ *
+ * @section CAPI_MAPS_PLUGIN_MODULE_HEADER Required Header
+ * \#include <maps_plugin.h>
+
+ * @section CAPI_MAPS_PLUGIN_MODULE_OVERVIEW Overview
+ *
+ * The Maps Plugin provides maps service providers with interfaces to realize
+ * Maps Service APIs.
+ */
+#endif /*__MAPS_PLUGIN_DOC_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * 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 __MAPS_SERVICE_DOC_H__
+#define __MAPS_SERVICE_DOC_H__
+
+/**
+ * @ingroup CAPI_LOCATION_FRAMEWORK
+ * @defgroup CAPI_MAPS_SERVICE_MODULE Maps Service
+ *
+ * @brief The Maps Service provides an Application Developer with Maps
+ * Service APIs
+ *
+ * @section CAPI_MAPS_SERVICE_MODULE_HEADER Required Header
+ * \#include <maps_service.h>
+ *
+ * @section CAPI_MAPS_SERVICE_MODULE_OVERVIEW Overview
+ *
+ * Maps API provides a developer with a set of functions, helping to create Maps
+ * aware applications\n
+ * Maps API comprises following features:
+ * - Geocoding and reverse geocoding
+ * - Discovering Place information
+ * - Calculating Route
+ * .
+ *
+ * Maps API allows a Developer to choose one of Map Providers which are being
+ * included as plugins
+ *
+ *
+ *
+ * @section CAPI_MAPS_SERVICE_MODULE_FEATURE Features
+ *
+ * Geocoding
+ * - The Maps Geocoding API allows mapping an address to its geographical
+ * location defined in terms of latitude and longitude; the input can be a
+ * qualified and structured address or a free-formed search text with full or
+ * partial address information.
+ * - The example below shows a structured address:
+ * - housenumber=117,
+ * - street=Invaliden street
+ * - city=Berlin,
+ * - postalcode=10115,
+ * - country=Germany,
+ * - state=Berlin
+ * .
+ * .
+ *
+ * Reverse Geocoding
+ * - The Maps Reverse Geocoding API allows to inverse mapping a geographical
+ * location (longitude, latitude) to an address; it can be used to answer the
+ * question "Where am I?".
+ * .
+ *
+ * Route
+ * - The Maps Route API provides ways to calculate a route that defines a path
+ * between a start and a destination and may, optionally, pass through specific
+ * intermediate locations.
+ * - Route Preferences:
+ * - Travel Mode (car, pedestrian, public transit, truck),
+ * - Optimization (fastest, shortest),
+ * - Avoid/Prefer Preferences (toll road, motorway, ferry, public transit,
+ * tunnel, dirt road, parks, car-pool lane).
+ * - Route Calculations
+ * - Way points and preferences as input values,
+ * - Route geometry and maneuver (instructions for guidance) as result values:
+ * - Geometry consists of points that visually represent the determined route,
+ * - Maneuver contains turn-by-turn instruction and position.
+ * .
+ * .
+ * .
+ * Places
+ * - The Maps Place API allows you to find place information
+ * - Place search
+ * - Depending on the location context, the number of relevant places might
+ * be large. Therefore this query may not only return places, but also
+ * suggestions for additional filter criteria that allow users to interactively
+* refine the classes of places they are interested in.
+ *
+ * - Nearby Search: search for places within a specified area.
+ * You can refine your search request by supplying keywords, Name of Points
+ * of Interests, or Proximity
+ *
+ * - Category Search: search for popular places for the given location context
+ * and matching the category filter criteria.
+ * You can refine your search request by specifying the categories of place
+ * you are searching for.
+ *
+ * - Result item type of searching
+ * - id, name, location, distance, URI, rating, category.
+ * .
+ * - Place information allows to fetch details about a place. The following
+ * place content is supported:
+ * - Base Attribute includes name, location, categories, contacts, id, ratings,
+ * icon path, image content, review content, and editorial content.
+ * - Extended Attribute refers to opening hours, payment methods, annual
+ * closings, disabled access.
+ * .
+ * .
+ * The developer is allowed to choose one of map providers by manipulating map
+ * plug-ins.
+ *
+ * @if WEARABLE
+ * @section CAPI_MAPS_SERVICE_MODULE_FEATURE Related Features
+ * This API is related with the following features:
+ * - http://tizen.org/feature/network.internet
+ *
+ * It is recommended to design feature related codes in your application for
+ * reliability.\n
+ *
+ * You can check if a device supports the related features for this API by using
+ * @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of
+ * your application.\n
+ *
+ * To ensure your application is only running on the device with specific
+ * features, please define the features in your manifest file using the manifest
+ * editor in the SDK.\n
+ *
+ * More details on featuring your application can be found from
+ * <a href="https://developer.tizen.org/development/tools/native-tools/manifest-text-editor#feature"><b>Feature Element</b>.</a>
+ * @endif
+ */
+
+#endif /*__MAPS_SERVICE_DOC_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_ADDRESS_H__
+#define __MAPS_ADDRESS_H__
+
+/**
+ * @ingroup CAPI_MAPS_SERVICE_MODULE
+ * @defgroup CAPI_MAPS_ADDRESS_MODULE Address
+ *
+ * @file maps_address.h
+ * @brief This file contains the functions related to address information.
+ *
+ * @addtogroup CAPI_MAPS_ADDRESS_MODULE
+ * @{
+ * @brief This provides APIs related to Address information used in Geocoding
+ * and Reverse Geocoding
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief The Address handle.
+ * @details The Address handle can be obtained via call of
+ * maps_address_create().
+ * @remarks To release the handle use maps_address_destroy().
+ * \n To clone the handle use maps_address_clone().
+ * @since_tizen 2.4
+ *
+ * @see maps_address_create()
+ * @see maps_address_destroy()
+ * @see maps_address_clone()
+ */
+typedef void *maps_address_h;
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Creates a new address handle.
+ * @details This function creates a new address handle and allocates all
+ * needed resources.
+ * @since_tizen 2.4
+ * @remarks @a address must be released using maps_address_destroy().
+ * \n @a address may be cloned using maps_address_clone().
+ *
+ * @param[out] address The address handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_address_destroy()
+ * @see maps_address_clone()
+ */
+int maps_address_create(maps_address_h *address);
+
+/**
+ * @brief Destroys the address handle and releases all its resources.
+ * @details This function destroys the address handle and releases all its
+ * resources.
+ * @since_tizen 2.4
+ *
+ * @param[in] address The address handle to destroy
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a address is created using maps_address_create().
+ *
+ * @see maps_address_create()
+ * @see maps_address_clone()
+ */
+int maps_address_destroy(maps_address_h address);
+
+/**
+ * @brief Clones the address handle.
+ * @details This function clones the address handle @a origin and all its
+ * resources.
+ * \n Address handle @a origin may be created using maps_address_create().
+ * @since_tizen 2.4
+ * @remarks @a cloned must be released using maps_address_destroy().
+ *
+ * @param[in] origin The original address handle
+ * @param[out] cloned A cloned address handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a origin is created using maps_address_create().
+ *
+ * @see maps_address_create()
+ * @see maps_address_destroy()
+ */
+int maps_address_clone(const maps_address_h origin, maps_address_h *cloned);
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Gets the building number of the address handle.
+ * @details This function gets the building number of the address handle.
+ * @since_tizen 2.4
+ * @remarks @a building_number must be released using free().
+ *
+ * @param[in] address The address handle
+ * @param[out] building_number The building number of the address handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a address is created using maps_address_create().
+ *
+ * @see maps_address_set_building_number()
+ * @see maps_address_create()
+ */
+int maps_address_get_building_number(const maps_address_h address,
+ char **building_number);
+
+/**
+ * @brief Gets the street name of the address handle.
+ * @details This function gets the street name of the address handle.
+ * @since_tizen 2.4
+ * @remarks @a street must be released using free().
+ *
+ * @param[in] address The address handle
+ * @param[out] street The street name of the address handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a address is created using maps_address_create().
+ *
+ * @see maps_address_set_street()
+ * @see maps_address_create()
+ */
+int maps_address_get_street(const maps_address_h address, char **street);
+
+/**
+ * @brief Gets the district name of the address handle.
+ * @details This function gets the district name of the address handle.
+ * @since_tizen 2.4
+ * @remarks @a district must be released using free().
+ *
+ * @param[in] address The address handle
+ * @param[out] district The district name of the address handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a address is created using maps_address_create().
+ *
+ * @see maps_address_set_district()
+ * @see maps_address_create()
+ */
+int maps_address_get_district(const maps_address_h address, char **district);
+
+/**
+ * @brief Gets the city name of the address handle.
+ * @details This function gets the city name of the address handle.
+ * @since_tizen 2.4
+ * @remarks @a city must be released using free().
+ *
+ * @param[in] address The address handle
+ * @param[out] city The city name of the address handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a address is created using maps_address_create().
+ *
+ * @see maps_address_set_city()
+ * @see maps_address_create()
+ */
+int maps_address_get_city(const maps_address_h address, char **city);
+
+/**
+ * @brief Gets the state name of the address handle
+ * @details This function gets the state name of the address handle.
+ * @since_tizen 2.4
+ * @remarks @a state must be released using free().
+ *
+ * @param[in] address The address handle
+ * @param[out] state The state name of the address handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a address is created using maps_address_create().
+ *
+ * @see maps_address_set_state()
+ * @see maps_address_create()
+ */
+int maps_address_get_state(const maps_address_h address, char **state);
+
+/**
+ * @brief Gets the country name of the address handle.
+ * @details This function gets the country name of the address handle.
+ * @since_tizen 2.4
+ * @remarks @a country must be released using free().
+ *
+ * @param[in] address The address handle
+ * @param[out] country The country name of the address handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a address is created using maps_address_create().
+ *
+ * @see maps_address_set_country()
+ * @see maps_address_create()
+ */
+int maps_address_get_country(const maps_address_h address, char **country);
+
+/**
+ * @brief Gets the country code of the address handle.
+ * @details This function gets the country code of the address handle.
+ * @since_tizen 2.4
+ * @remarks @a country_code must be released using free().
+ *
+ * @param[in] address The address handle
+ * @param[out] country_code The country code of the address handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a address is created using maps_address_create().
+ *
+ * @see maps_address_set_country_code()
+ * @see maps_address_create()
+ */
+int maps_address_get_country_code(const maps_address_h address,
+ char **country_code);
+
+/**
+ * @brief Gets the county of the address handle.
+ * @details This function gets the county of the address handle.
+ * @since_tizen 2.4
+ * @remarks @a county must be released using free().
+ *
+ * @param[in] address The address handle
+ * @param[out] county The county of the address handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a address is created using maps_address_create().
+ *
+ * @see maps_address_set_county()
+ * @see maps_address_create()
+ */
+int maps_address_get_county(const maps_address_h address, char **county);
+
+/**
+ * @brief Gets the postal code of the address handle.
+ * @details This function gets the postal code of the address handle.
+ * @since_tizen 2.4
+ * @remarks @a postal_code must be released using free().
+ *
+ * @param[in] address The address handle
+ * @param[out] postal_code The postal code of the address handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a address is created using maps_address_create().
+ *
+ * @see maps_address_set_postal_code()
+ * @see maps_address_create()
+ */
+int maps_address_get_postal_code(const maps_address_h address,
+ char **postal_code);
+
+/**
+ * @brief Gets the free text of the address handle.
+ * @details This function gets the free text of the address handle.
+ * @since_tizen 2.4
+ * @remarks @a freetext must be released using free().
+ *
+ * @param[in] address The address handle
+ * @param[out] freetext The free text of the address handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a address is created using maps_address_create().
+ *
+ * @see maps_address_set_freetext()
+ * @see maps_address_create()
+ */
+int maps_address_get_freetext(const maps_address_h address, char **freetext);
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Sets the building number of the address handle.
+ * @details This function sets the building number of the address handle.
+ * @since_tizen 2.4
+ *
+ * @param[in] address The address handle
+ * @param[in] building_number The building number to be set
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a address is created using maps_address_create().
+ *
+ * @see maps_address_create()
+ * @see maps_address_get_number()
+ */
+int maps_address_set_building_number(maps_address_h address,
+ const char *building_number);
+
+/**
+ * @brief Sets the street name of the address handle.
+ * @details This function sets the street name of the address handle.
+ * @since_tizen 2.4
+ *
+ * @param[in] address The address handle
+ * @param[in] street The street name to be set
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a address is created using maps_address_create().
+ *
+ * @see maps_address_create()
+ * @see maps_address_get_street()
+ */
+int maps_address_set_street(maps_address_h address, const char *street);
+
+/**
+ * @brief Sets the district name of the address handle.
+ * @details This function sets the district name of the address handle.
+ * @since_tizen 2.4
+ *
+ * @param[in] address The address handle
+ * @param[in] district The district name to be set
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a address is created using maps_address_create().
+ *
+ * @see maps_address_create()
+ * @see maps_address_get_district()
+ */
+int maps_address_set_district(maps_address_h address, const char *district);
+
+/**
+ * @brief Sets the city name of the address handle.
+ * @details This function sets the city name of the address handle.
+ * @since_tizen 2.4
+ *
+ * @param[in] address The address handle
+ * @param[in] city The city name to be set
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a address is created using maps_address_create().
+ *
+ * @see maps_address_create()
+ * @see maps_address_get_city()
+ */
+int maps_address_set_city(maps_address_h address, const char *city);
+
+/**
+ * @brief Sets the state name of the address handle.
+ * @details This function sets the state name of the address handle.
+ * @since_tizen 2.4
+ *
+ * @param[in] address The address handle
+ * @param[in] state The state name to be set
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a address is created using maps_address_create().
+ *
+ * @see maps_address_create()
+ * @see maps_address_get_state()
+ */
+int maps_address_set_state(maps_address_h address, const char *state);
+
+/**
+ * @brief Sets the country name of the address handle.
+ * @details This function sets the country name of the address handle.
+ * @since_tizen 2.4
+ *
+ * @param[in] address The address handle
+ * @param[in] country The country name to be set
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a address is created using maps_address_create().
+ *
+ * @see maps_address_create()
+ * @see maps_address_get_country()
+ */
+int maps_address_set_country(maps_address_h address, const char *country);
+
+/**
+ * @brief Sets the country code of the address handle.
+ * @details This function sets the country code of the address handle.
+ * @since_tizen 2.4
+ *
+ * @param[in] address The address handle
+ * @param[in] country_code The country code to be set
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a address is created using maps_address_create().
+ *
+ * @see maps_address_create()
+ * @see maps_address_get_country_code()
+ */
+int maps_address_set_country_code(maps_address_h address,
+ const char *country_code);
+
+/**
+ * @brief Sets the county of the address handle.
+ * @details This function sets the county of the address handle.
+ * @since_tizen 2.4
+ *
+ * @param[in] address The address handle
+ * @param[in] county The county to be set
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a address is created using maps_address_create().
+ *
+ * @see maps_address_create()
+ * @see maps_address_get_county()
+ */
+int maps_address_set_county(maps_address_h address, const char *county);
+
+/**
+ * @brief Sets the postal code of the address handle.
+ * @details This function sets the postal code of the address handle.
+ * @since_tizen 2.4
+ *
+ * @param[in] address The address handle
+ * @param[in] postal_code The postal code to be set
+ * @return 0, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a address is created using maps_address_create().
+ *
+ * @see maps_address_create()
+ * @see maps_address_get_postal_code()
+ */
+int maps_address_set_postal_code(maps_address_h address,
+ const char *postal_code);
+
+/**
+ * @brief Sets the free text of the address handle.
+ * @details This function sets the free text of the address handle.
+ * @since_tizen 2.4
+ *
+ * @param[in] address The address handle
+ * @param[in] freetext The free text to be set
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a address is created using maps_address_create().
+ *
+ * @see maps_address_create()
+ * @see maps_address_get_freetext()
+ */
+int maps_address_set_freetext(maps_address_h address, const char *freetext);
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+#endif /* __MAPS_ADDRESS_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_GEOAREA_H__
+#define __MAPS_GEOAREA_H__
+
+#include <maps_coordinates.h>
+
+/**
+ * @ingroup CAPI_MAPS_SERVICE_MODULE
+ * @defgroup CAPI_MAPS_GEOAREA_MODULE Area
+ *
+ * @file maps_area.h
+ * @brief This file contains the definitions, structures, and functions related
+ * to area information.
+ *
+ * @addtogroup CAPI_MAPS_GEOAREA_MODULE
+ * @{
+ * @brief This provides APIs related to geographical area.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Handle of the Geographical Area.
+ * @details The Geographical Area handle can be obtained via call of
+ * maps_area_create_rectangle() or maps_area_create_circle().
+ * @since_tizen 2.4
+ * \n To release the handle use maps_area_destroy().
+ * \n To clone the handle use maps_area_clone().
+ * @since_tizen 2.4
+ *
+ * @see maps_area_create_rectangle()
+ * @see maps_area_create_circle()
+ * @see maps_area_destroy()
+ * @see maps_area_clone()
+ */
+typedef void *maps_area_h;
+
+/**
+ * @brief Enumeration of supported types of the Geographical Area.
+ * @details This enumeration represents allowed geographical type of
+ * Geographical Area: rectangular and circular.
+ * \n This enumeration is used in #maps_area_s.
+ * @since_tizen 2.4
+ *
+ * @see maps_area_s
+ */
+typedef enum {
+ MAPS_AREA_NONE = 0, /**< Undefined geographical area type. */
+ MAPS_AREA_RECTANGLE, /**< Rectangular geographical area type. */
+ MAPS_AREA_CIRCLE, /**< Circle geographical area type. */
+} maps_area_type_e;
+
+/**
+ * @brief Structure of the rectangular Geographical Area.
+ * @details This structure represents a rectangular Geographical Area,
+ * specified with left top and right bottom coordinates.
+ * \n This structure is used in #maps_area_s.
+ * @since_tizen 2.4
+ *
+ * @see maps_area_s
+ */
+typedef struct _maps_area_rectangle_s {
+ maps_coordinates_s top_left; /**< The top left position
+ of rectangle. */
+ maps_coordinates_s bottom_right; /**< The bottom right position
+ of rectangle. */
+} maps_area_rectangle_s;
+
+/**
+ * @brief Structure of the circular Geographical Area, specified with a
+ * center coordinates and a radius.
+ * @details This structure represents a circular Geographical Area.
+ * \n This structure is used in #maps_area_s.
+ * @since_tizen 2.4
+ *
+ * @see maps_area_s
+ */
+typedef struct _maps_area_circle_s {
+
+ maps_coordinates_s center; /**< The center position of a circle. */
+ double radius; /**< The radius of a circle. */
+} maps_area_circle_s;
+
+/**
+ * @brief Structure of the Geographical Area.
+ * @details This structure represents a Geographical Area, specified with a
+ * type, circular or rectangular, and appropriate coordinates and radius.
+ * @since_tizen 2.4
+ *
+ * @see maps_area_type_e
+ * @see maps_area_rectangle_s
+ * @see maps_area_circle_s
+ */
+typedef struct _maps_area_s {
+ maps_area_type_e type; /**< The area type of this information. */
+ union {
+ maps_area_rectangle_s rect; /**< The geographical
+ information of a rectangle. */
+ maps_area_circle_s circle; /**< The geographical
+ information of a circle. */
+ };
+} maps_area_s;
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Creates a rectangular type of new Geographical Area with a
+ * specified information.
+ * @details This function creates a rectangular type of new #maps_area_s with a
+ * specified left top and right bottom coordinates.
+ * @since_tizen 2.4
+ * @remarks @a area must be released using maps_area_destroy().
+ * \n @a area may be cloned using maps_area_clone().
+ * \n @a top_left and @a bottom_right must be released using
+ * maps_coordinates_destroy().
+ *
+ * @param[in] top_left The left top position
+ * @param[in] bottom_right The right bottom position
+ * @param[out] area The area handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a top_left and @a bottom_right are created using
+ * maps_coordinates_create().
+ *
+ * @see maps_area_clone()
+ * @see maps_area_destroy()
+ * @see maps_area_create_circle()
+ * @see maps_area_s
+ * @see maps_coordinates_create()
+ * @see maps_coordinates_destroy()
+ */
+int maps_area_create_rectangle(const maps_coordinates_h top_left,
+ const maps_coordinates_h bottom_right,
+ maps_area_h *area);
+
+/**
+ * @brief Creates a circular type of new Geographical Area with a
+ * specified information.
+ * @details This function creates a circular type of new #maps_area_s
+ * Geographical Area with a specified center coordinates and a radius.
+ * @since_tizen 2.4
+ * @remarks @a area must be released using maps_area_destroy().
+ * \n @a top_left and @a bottom_right must be released using
+ * maps_coordinates_destroy().
+ *
+ * @param[in] center The central position of the area
+ * @param[in] radius The radius of the area
+ * @param[out] area The area handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a center is created using maps_coordinates_create().
+ *
+ * @see maps_area_clone()
+ * @see maps_area_destroy()
+ * @see maps_area_create_rectangle()
+ * @see maps_area_s
+ * @see maps_coordinates_create()
+ * @see maps_coordinates_destroy()
+ */
+int maps_area_create_circle(const maps_coordinates_h center,
+ const double radius, maps_area_h *area);
+
+/**
+ * @brief Destroys the Geographical Area and releases all its resources.
+ * @details This function destroys the Geographical Area #maps_area_s and
+ * releases all its resources.
+ * @since_tizen 2.4
+ *
+ * @param[in] area The area #maps_area_s
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a area can be created using maps_area_create_rectangle() or
+ * maps_area_create_circle().
+ *
+ * @see maps_area_create_rectangle()
+ * @see maps_area_create_circle()
+ */
+int maps_area_destroy(maps_area_h area);
+
+/**
+ * @brief Clones the Geographical Area.
+ * @details This function makes a clone of the @a origin Geographical Area of
+ * type #maps_area_s.
+ * @since_tizen 2.4
+ * @remarks @a cloned must be released using maps_area_destroy().
+ *
+ * @param[in] origin The area #maps_area_s to be copied
+ * @param[out] cloned The cloned area #maps_area_s handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a origin is created using maps_area_create_rectangle() or
+ * maps_area_create_circle().
+ *
+ * @see maps_area_create_rectangle()
+ * @see maps_area_create_circle()
+ * @see maps_area_destroy()
+ * @see maps_area_s
+ */
+int maps_area_clone(const maps_area_h origin, maps_area_h *cloned);
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+#endif /* __MAPS_GOEAREA_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_COORDINATES_H__
+#define __MAPS_COORDINATES_H__
+
+/**
+ * @ingroup CAPI_MAPS_SERVICE_MODULE
+ * @defgroup CAPI_MAPS_COORDS_MODULE Coordinates
+ *
+ * @file maps_coordinates.h
+ * @brief This file contains the functions related to Geographical Coordinates.
+ * @addtogroup CAPI_MAPS_COORDS_MODULE
+ * @{
+ * @brief This provides APIs related to Geographical Coordinates
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Handle of the Geographical Coordinates.
+ * @details The Geographical Coordinates handle can be obtained via call of
+ * maps_coordinates_create().
+ * @since_tizen 2.4
+ * @remarks To release the handle use maps_coordinates_destroy().
+ * \n To clone the handle use maps_coordinates_clone().
+ *
+ * @see maps_coordinates_create()
+ * @see maps_coordinates_destroy()
+ * @see maps_coordinates_clone()
+ */
+typedef void *maps_coordinates_h;
+
+/**
+ * @brief Structure of the Geographical Coordinates.
+ * @details This structure represents a Geographical Coordinates, specified with
+ * a @a latitude and @a longitude values.
+ * \n The @a latitude must be in range of [-90.0, 90.0].
+ * \n The @a longitude must be in range of [-180.0, 180.0].
+ * @since_tizen 2.4
+ * @remarks #maps_coordinates_h is a void pointer to the #maps_coordinates_s.
+ *
+ * @see maps_coordinates_h
+ * @see maps_coordinates_create
+ * @see maps_coordinates_clone
+ * @see maps_coordinates_destroy
+ */
+typedef struct _maps_coordinates_s {
+ double latitude; /**< The latitude [-90.0 ~ 90.0] (degrees) */
+ double longitude; /**< The longitude [-180.0 ~ 180.0] (degrees) */
+} maps_coordinates_s;
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Creates a new instance of Geographical Coordinates and initiates
+ * a handle with it.
+ * @details This function creates @a coordinates, a new instance of Geographical
+ * Coordinates of type #maps_coordinates_s
+ * with a specified @a latitude and @a longitude.
+ * \n New handle is assigned with this instance.
+ * @since_tizen 2.4
+ * @remarks @a coordinates must be released using maps_coordinates_destroy().
+ * \n @a coordinates may be cloned using maps_coordinates_clone().
+ *
+ * @param[in] latitude Latitude
+ * @param[in] longitude Longitude
+ * @param[out] coordinates The coordinate handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_coordinates_clone()
+ * @see maps_coordinates_destroy()
+ * @see maps_coordinates_s
+ */
+int maps_coordinates_create(const double latitude, const double longitude,
+ maps_coordinates_h *coordinates);
+
+/**
+ * @brief Destroys the Geographical Coordinates and releases all its
+ * resources.
+ * @details This function destroys the Geographical Coordinates
+ * #maps_coordinates_s and releases all its resources.
+ * @since_tizen 2.4
+ *
+ * @param[in] coordinates The coordinate handle to destroy
+ * @return 0 on coordinates, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a coordinates are created using maps_coordinates_create_rectangle().
+ *
+ * @see maps_coordinates_create()
+ * @see maps_coordinates_clone()
+ */
+int maps_coordinates_destroy(maps_coordinates_h coordinates);
+
+/**
+ * @brief Clones the Geographical Coordinates.
+ * @details This function makes a clone of the @a origin Geographical
+ * Coordinates of type #maps_coordinates_s.
+ * @since_tizen 2.4
+ * @remarks @a cloned must be released using maps_coordinates_destroy().
+ *
+ * @param[in] origin The original coordinate handle
+ * @param[out] cloned A cloned coordinate handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a origin is created using maps_coordinates_create().
+ *
+ * @see maps_coordinates_create()
+ * @see maps_coordinates_destroy()
+ * @see maps_coordinates_s
+ */
+int maps_coordinates_clone(const maps_coordinates_h origin,
+ maps_coordinates_h *cloned);
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Gets the latitude of the coordinates.
+ * @details This function gets the @a latitude value of the coordinates handle.
+ * @since_tizen 2.4
+ *
+ * @param[in] coordinates The coordinate handle
+ * @param[out] latitude The latitude of the coordinate handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a coordinates are created using maps_coordinates_create().
+ *
+ * @see maps_coordinates_create()
+ * @see maps_coordinates_set_latitude()
+ */
+int maps_coordinates_get_latitude(const maps_coordinates_h coordinates,
+ double *latitude);
+
+/**
+ * @brief Gets the longitude of the coordinates.
+ * @details This function gets the @a longitude value of the coordinates handle.
+ * @since_tizen 2.4
+ *
+ * @param[in] coordinates The coordinate handle
+ * @param[out] longitude The longitude of the coordinate handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a coordinates are created using maps_coordinates_create().
+ *
+ * @see maps_coordinates_create()
+ * @see maps_coordinates_set_longitude()
+ */
+int maps_coordinates_get_longitude(const maps_coordinates_h coordinates,
+ double *longitude);
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Sets the latitude of the coordinates.
+ * @details This function sets the @a latitude value of the coordinates handle.
+ * @since_tizen 2.4
+ *
+ * @param[in] coordinates The coordinate handle
+ * @param[in] latitude The latitude of the coordinate handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a coordinates are created using maps_coordinates_create().
+ *
+ * @see maps_coordinates_create()
+ * @see maps_coordinates_get_latitude()
+ */
+int maps_coordinates_set_latitude(maps_coordinates_h coordinates,
+ const double latitude);
+
+/**
+ * @brief Sets the longitude of the coordinates.
+ * @details This function sets the @a longitude value of the coordinates handle.
+ * @since_tizen 2.4
+ *
+ * @param[in] coordinates The coordinate handle
+ * @param[out] longitude The longitude of the coordinate handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a coordinates are created using maps_coordinates_create().
+ *
+ * @see maps_coordinates_create()
+ * @see maps_coordinates_get_longitude()
+ */
+int maps_coordinates_set_longitude(maps_coordinates_h coordinates,
+ const double longitude);
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+#endif /* __MAPS_COORDINATES_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_ERROR_H__
+#define __MAPS_ERROR_H__
+
+#include <tizen_type.h>
+#include <tizen_error.h>
+
+/**
+ * @ingroup CAPI_MAPS_SERVICE_MODULE
+ * @defgroup CAPI_MAPS_ERROR_MODULE Errors
+ *
+ * @file maps_error.h
+ * @brief This file contains the list of errors of Maps API
+ *
+ * @addtogroup CAPI_MAPS_ERROR_MODULE
+ * @{
+ * @brief This provides a list of Maps API errors
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Enumerations of error codes for Maps Service and Plug-ins
+ * @since_tizen 2.4
+ */
+typedef enum _maps_error_e {
+ MAPS_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
+ MAPS_ERROR_PERMISSION_DENIED =
+ TIZEN_ERROR_PERMISSION_DENIED, /**< Permission Denied */
+ MAPS_ERROR_OUT_OF_MEMORY =
+ TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
+ MAPS_ERROR_INVALID_PARAMETER =
+ TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
+ MAPS_ERROR_NOT_SUPPORTED =
+ TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported */
+ MAPS_ERROR_CONNECTION_TIME_OUT =
+ TIZEN_ERROR_CONNECTION_TIME_OUT,/**< Timeout error, no answer */
+ MAPS_ERROR_NETWORK_UNREACHABLE =
+ TIZEN_ERROR_NETWORK_UNREACHABLE,/**< Network unavailable*/
+ MAPS_ERROR_INVALID_OPERATION =
+ TIZEN_ERROR_INVALID_OPERATION, /**< Operation is not valid */
+ MAPS_ERROR_KEY_NOT_AVAILABLE =
+ TIZEN_ERROR_KEY_NOT_AVAILABLE, /**< Invalid key */
+ MAPS_ERROR_RESOURCE_BUSY =
+ TIZEN_ERROR_RESOURCE_BUSY, /**< Maps Service busy */
+ MAPS_ERROR_CANCELED =
+ TIZEN_ERROR_CANCELED, /**< Maps Service
+ request aborted */
+ MAPS_ERROR_UNKNOWN =
+ TIZEN_ERROR_UNKNOWN, /**< Unknown error */
+ MAPS_ERROR_SERVICE_NOT_AVAILABLE =
+ TIZEN_ERROR_MAPS_SERVICE | 0x01,/**< Service
+ unavailable */
+ MAPS_ERROR_NOT_FOUND =
+ TIZEN_ERROR_MAPS_SERVICE | 0x02/**< Result not found */
+} maps_error_e;
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+#endif /* __MAPS_ERROR_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_SERVICE_API_EXTRA_TYPES_H__
+#define __MAPS_SERVICE_API_EXTRA_TYPES_H__
+
+#include <tizen_type.h>
+
+/**
+ * @ingroup CAPI_MAPS_PLUGIN_AND_PROVIDERS_MODULE
+ * @defgroup CAPI_MAPS_CONTAINERS_MODULE Container Data Types
+ *
+ * @file maps_extra_types.h
+ * @brief This file contains definitions and functions of useful data types.
+ *
+ * @addtogroup CAPI_MAPS_CONTAINERS_MODULE
+ * @{
+ * @brief This provides variable Maps Service data types, such as lists and hash
+ * tables.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @ingroup CAPI_MAPS_CONTAINERS_MODULE
+ * @defgroup CAPI_MAPS_CONTAINERS_MODULE_ITEM_LIST Maps Item Lists
+ *
+ * @file maps_extra_types.h
+ * @brief This section contains API for using List of item pointers.
+ *
+ * @addtogroup CAPI_MAPS_CONTAINERS_MODULE_ITEM_LIST
+ * @{
+ * @brief This provides API for using List of item pointers.
+ */
+
+/**
+ * @brief Item List handle.
+ * @details The Item List handle can be obtained via call of
+ * maps_item_list_create().
+ * @remarks To release the handle use maps_item_list_destroy().
+ * \n To clone the handle use maps_item_list_clone().
+ * \n The items of the list may be iterated using maps_item_list_foreach().
+ * \n To append an item to the list use maps_item_list_append().
+ * \n The items of the list may be removed maps_item_list_remove_all().
+ * @since_tizen 2.4
+ *
+ * @see maps_item_list_create()
+ * @see maps_item_list_destroy()
+ * @see maps_item_list_clone()
+ */
+typedef void *maps_item_list_h;
+
+/**
+ * @brief Creates a new list of item pointers.
+ * @details This function creates a new instance of item pointer list, associate
+ * a new handle with it and allocates all needed resources.
+ * @since_tizen 2.4
+ * @remarks @a list must be released using maps_item_list_destroy().
+ * \n @a list may be cloned using maps_item_list_clone().
+ *
+ * @param[out] list The handle of newly created list
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_item_list_destroy()
+ * @see maps_item_list_clone()
+ */
+int maps_item_list_create(maps_item_list_h *list);
+
+/**
+ * @brief Destroys the list handle and releases all its resources.
+ * @details This function destroys the list handle and releases all its
+ * resources.
+ * @since_tizen 2.4
+ *
+ * @param[in] list The handle of list to be deleted
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a list is created using maps_item_list_create().
+ *
+ * @see maps_item_list_create()
+ * @see maps_item_list_clone()
+ */
+int maps_item_list_destroy(maps_item_list_h list);
+
+/**
+ * @brief Clone function, making a copy of a list item.
+ * @details This function is called once for each item of the given list while
+ * the list is being cloned during the maps_item_list_clone() procedure.
+ * @since_tizen 2.4
+ * @remarks If this function returns the value different from MAPS_ERROR_NONE,
+ * the cloned item will not be appended to the list.
+ *
+ * @param[in] origin The pointer to the item which is to be cloned
+ * @param[out] cloned The pointer to the clone of the specified item
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre maps_item_list_clone() will invoke this callback.
+ *
+ * @see maps_item_list_clone()
+ */
+typedef int (*maps_item_list_clone_cb) (void *origin, void **cloned);
+
+/**
+ * @brief Clones the list of item pointers.
+ * @details This function clones the list of item pointers @a origin and all its
+ * resources.
+ * \n The list handle @a origin may be created using maps_item_list_create().
+ * @since_tizen 2.4
+ * @remarks @a cloned must be released using maps_item_list_destroy().
+ *
+ * @param[in] origin The handle of list to be cloned
+ * @param[in] clone_func The #maps_item_list_clone_cb function used to
+ * clone an element of a list
+ * @param[out] cloned The handle of the newly cloned list
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a origin is created using maps_item_list_create().
+ * @post #maps_item_list_clone_cb is used to clone each item of the list.
+ *
+ * @see maps_item_list_create()
+ * @see maps_item_list_destroy()
+ */
+int maps_item_list_clone(const maps_item_list_h origin,
+ maps_item_list_clone_cb clone_func,
+ maps_item_list_h *cloned);
+
+/**
+ * @brief Appends an item to the list.
+ * @details This function appends an item @a data to the list of item pointers
+ * @a list.
+ * @since_tizen 2.4
+ *
+ * @param[in] list The handle of list
+ * @param[in] data The item pointer to be pointed to the list
+ * @param[in] clone_func The function for cloning the added list value
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a list is created using maps_item_list_create().
+ *
+ * @see maps_item_list_foreach()
+ * @see maps_item_list_remove_all()
+ * @see maps_item_list_create()
+ */
+int maps_item_list_append(maps_item_list_h list, const void *data,
+ maps_item_list_clone_cb clone_func);
+
+/**
+ * @brief Called once for each item while iterating through the given
+ * list.
+ * @details This function is called once for each item of the given list while
+ * the list is being iterated
+ * during the maps_item_list_foreach() procedure.
+ * @since_tizen 2.4
+ * @remarks The @a data must be released by you.
+ *
+ * @param[in] index The current index of item
+ * @param[in] total The total amount of items
+ * @param[in] data The pointer to the list item
+ * @param[in] user_data The user data passed from
+ * maps_item_list_foreach()
+ * @return @c true to continue with the next iteration of the loop, \n @c
+ * false to break out of the loop
+ *
+ * @pre maps_item_list_foreach() will invoke this callback.
+ *
+ * @see maps_item_list_foreach()
+ */
+typedef bool(*maps_item_list_foreach_cb) (int index, int total, void *data,
+ void *user_data);
+
+/**
+ * @brief Gets the items of the specified list.
+ * @details This function delivers items of a specified list via
+ * maps_item_list_foreach_cb() callback.
+ * @since_tizen 2.4
+ *
+ * @param[in] list The handle of list
+ * @param[in] clone_func The function for cloning the list values
+ * @param[in] callback The callback to be invoked for delivering each
+ * list item
+ * @param[in] user_data The user data to be passed to the callback
+ * function
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NOT_FOUND Result not found
+ *
+ * @pre @a list is created using maps_item_list_create().
+ * @post This function invokes maps_item_list_foreach_cb() to deliver list
+ * items.
+ *
+ * @see maps_item_list_foreach_cb()
+ * @see maps_item_list_append()
+ * @see maps_service_create()
+ */
+int maps_item_list_foreach(maps_item_list_h list,
+ maps_item_list_clone_cb clone_func,
+ maps_item_list_foreach_cb callback,
+ void *user_data);
+
+/**
+ * @brief Free function, destroying a list item.
+ * @details This function is called once for each item of the given list while
+ * the list is being destroyed
+ * during the maps_item_list_remove_all() procedures.
+ * @since_tizen 2.4
+ * @remarks The return of this function is ignored.
+ *
+ * @param[in] data The pointer to the list item which is to be
+ * destroyed
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre maps_item_list_remove_all() will invoke this callback.
+ *
+ * @see maps_item_list_remove_all()
+ */
+typedef int (*maps_item_list_free_cb) (void *data);
+
+/**
+ * @brief Removes and destroys all list items
+ * @details This function removes all items of the @a list and releases
+ * resources, assigned with them.
+ * @since_tizen 2.4
+ * @remarks Each item is destroyed with #maps_item_list_free_cb. If this
+ * callback is NULL, items will not be destroyed.
+ *
+ * @param[in] list The handle of list
+ * @param[in] free_func The callback to be invoked for destroying each
+ * list item
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a list is created using maps_item_list_create().
+ * @post #maps_item_list_free_cb is used to destroy each item of the list.
+ *
+ * @see maps_item_list_free_cb()
+ * @see maps_item_list_create()
+ */
+int maps_item_list_remove_all(maps_item_list_h list,
+ maps_item_list_free_cb free_func);
+
+/**
+ * @}
+ */
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @ingroup CAPI_MAPS_CONTAINERS_MODULE
+ * @defgroup CAPI_MAPS_CONTAINERS_MODULE_STRING_HASHTABLE Maps String Hash Tables
+ *
+ * @file maps_extra_types.h
+ * @brief This section contains API for using Hash Table of strings.
+ *
+ * @addtogroup CAPI_MAPS_CONTAINERS_MODULE_STRING_HASHTABLE
+ * @{
+ * @brief This provides API for using Hash Table of strings.
+ */
+
+/**
+ * @brief The handle of Hash Table of strings.
+ * @details The handle of Hash Table of strings can be obtained via call of
+ * maps_string_hashtable_create().
+ * @remarks To release the handle use maps_string_hashtable_destroy().
+ * \n To clone the handle use maps_string_hashtable_clone().
+ * \n To assign the value to a key use maps_string_hashtable_set().
+ * \n The value, assigned with a specified key may be obtained using
+ * maps_string_hashtable_get().
+ * \n All key-value pairs of the table may be iterated using
+ * maps_string_hashtable_foreach().
+ * \n The key-value pair may be removed form the table using
+ * maps_string_hashtable_remove().
+ * \n To check if key is added to the table use
+ * maps_string_hashtable_contains().
+ * @since_tizen 2.4
+ *
+ * @see maps_string_hashtable_create()
+ * @see maps_string_hashtable_destroy()
+ * @see maps_string_hashtable_clone()
+ */
+typedef void *maps_string_hashtable_h;
+
+/**
+ * @brief Creates a new Hash Table of strings.
+ * @details This function creates a new instance of Hash Table of strings,
+ * associate a new handle with it and allocates all needed resources.
+ * @since_tizen 2.4
+ * @remarks @a table must be released using maps_string_hashtable_destroy().
+ * \n @a table may be cloned using maps_string_hashtable_clone().
+ *
+ * @param[out] table The handle of newly created table
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_string_hashtable_clone()
+ * @see maps_string_hashtable_destroy()
+ */
+int maps_string_hashtable_create(maps_string_hashtable_h *table);
+
+/**
+ * @brief Destroys the Hash Table of strings and releases all its
+ * resources.
+ * @details This function destroys the Hash Table handle and releases all its
+ * resources.
+ * @since_tizen 2.4
+ * @remarks All strings stored in the table will be released.
+ *
+ * @param[in] table The handle of table to be destroyed
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a table is created using maps_string_hashtable_create().
+ *
+ * @see maps_string_hashtable_create()
+ * @see maps_string_hashtable_clone()
+ */
+int maps_string_hashtable_destroy(maps_string_hashtable_h table);
+
+/**
+ * @brief Clones the Hash Table of strings.
+ * @details This function clones the Hash Table of strings @a origin and all its
+ * resources.
+ * \n The list handle @a origin may be created using
+ * maps_string_hashtable_create().
+ * @since_tizen 2.4
+ * @remarks @a cloned must be released using maps_string_hashtable_destroy().
+ *
+ * @param[in] origin The handle of the table to be cloned
+ * @param[out] cloned The handle of the cloned table
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a table is created using maps_string_hashtable_create().
+ *
+ * @see maps_string_hashtable_create()
+ * @see maps_string_hashtable_destroy()
+ */
+int maps_string_hashtable_clone(const maps_string_hashtable_h origin,
+ maps_string_hashtable_h *cloned);
+
+/**
+ * @brief Sets the association between string key and value in the table.
+ * @details This function sets the association between string key and value in
+ * the Hash Table.
+ * @since_tizen 2.4
+ *
+ * @param[in] table The handle of the table
+ * @param[in] key The string value of "key"
+ * @param[in] value The string value of "value"
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a table is created using maps_string_hashtable_create().
+ *
+ * @see maps_string_hashtable_get()
+ * @see maps_string_hashtable_remove()
+ * @see maps_string_hashtable_create()
+ */
+int maps_string_hashtable_set(maps_string_hashtable_h table, const char *key,
+ const char *value);
+
+/**
+ * @brief Gets the string value associated with a string key in the table.
+ * @details This function gets the string value associated with a string key in
+ * the Hash Table.
+ * @since_tizen 2.4
+ * @remark The @a value must be released using free().
+ *
+ * @param[in] table The handle of the table
+ * @param[in] key The string value of "key"
+ * @param[out] value The string value of "value"
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a table is created using maps_string_hashtable_create().
+ *
+ * @see maps_string_hashtable_set()
+ * @see maps_string_hashtable_remove()
+ * @see maps_string_hashtable_create()
+ */
+int maps_string_hashtable_get(maps_string_hashtable_h table, const char *key,
+ char **value);
+
+/**
+ * @brief Removes the key-value pair from the table.
+ * @details This function removes the key-value pair from the Hash Table.
+ * @since_tizen 2.4
+ * @remarks The resources, used by item will be released automatically.
+ *
+ * @param[in] table The handle of the table
+ * @param[in] key The string value of "key"
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a table is created using maps_string_hashtable_create().
+ *
+ * @see maps_string_hashtable_set()
+ * @see maps_string_hashtable_get()
+ * @see maps_string_hashtable_create()
+ */
+int maps_string_hashtable_remove(maps_string_hashtable_h table,
+ const char *key);
+
+/**
+ * @brief Called once for each key-value pair while iterating through
+ * the given table.
+ * @details This function is called once for each key-value pair of the given
+ * table while the table is being iterated
+ * during the maps_string_hashtable_foreach() procedure.
+ * @since_tizen 2.4
+ * @remarks The @a key and @a value must be released using free().
+ *
+ * @param[in] index The current index of item
+ * @param[in] total The total amount of items
+ * @param[in] key The string value of "key"
+ * @param[in] value The string value of "value"
+ * @param[in] user_data The user data passed from
+ * maps_string_hashtable_foreach()
+ * @return @c true to continue with the next iteration of the loop, \n @c
+ * false to break out of the loop
+ *
+ * @pre maps_string_hashtable_foreach() will invoke this callback.
+ *
+ * @see maps_string_hashtable_foreach()
+ */
+typedef bool(*maps_string_hashtable_foreach_cb) (int index, int total,
+ char *key, char *value,
+ void *user_data);
+
+/**
+ * @brief Gets the key-value pairs of the specified table.
+ * @details This function delivers key-value pairs of a specified table via
+ * maps_string_hashtable_foreach_cb() callback.
+ * @since_tizen 2.4
+ *
+ * @param[in] table The handle of table
+ * @param[in] callback The callback to be invoked for delivering each
+ * key-value pair
+ * @param[in] user_data The user data to be passed to the callback
+ * function
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NOT_FOUND Result not found
+ *
+ * @pre @a table is created using maps_string_hashtable_create().
+ * @post This function invokes maps_string_hashtable_foreach_cb() to deliver
+ * key-value pairs.
+ *
+ * @see maps_string_hashtable_foreach_cb()
+ * @see maps_string_hashtable_set()
+ * @see maps_string_hashtable_get()
+ * @see maps_string_hashtable_create()
+ */
+int maps_string_hashtable_foreach(maps_string_hashtable_h table,
+ maps_string_hashtable_foreach_cb callback,
+ void *user_data);
+
+/**
+ * @brief Checks if key is in hash_table.
+ * @details This function checks if the specified key is in the Hash Table of
+ * strings.
+ * @since_tizen 2.4
+ *
+ * @param[in] table The handle of the table
+ * @param[in] key The string value of "key"
+ * @param[out] contains The flag of key presence
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a table is created using maps_string_hashtable_create().
+ *
+ * @see maps_string_hashtable_set()
+ * @see maps_string_hashtable_get()
+ * @see maps_string_hashtable_create()
+ */
+int maps_string_hashtable_contains(maps_string_hashtable_h table,
+ const char *key, bool *contains);
+
+/**
+ * @}
+ */
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @ingroup CAPI_MAPS_CONTAINERS_MODULE
+ * @defgroup CAPI_MAPS_CONTAINERS_MODULE_ITEM_HASHTABLE Maps Item Hash Tables
+ *
+ * @file maps_extra_types.h
+ * @brief This section contains API for using Hash Table of arbitrary items.
+ *
+ * @addtogroup CAPI_MAPS_CONTAINERS_MODULE_ITEM_HASHTABLE
+ * @{
+ * @brief This provides API for using Hash Table of arbitrary items.
+ */
+
+/**
+ * @brief The handle of Hash Table of arbitrary items.
+ * @details The handle of Hash Table of arbitrary items can be obtained via call
+ * of maps_item_hashtable_create().
+ * @remarks To release the handle use maps_item_hashtable_destroy().
+ * \n To clone the handle use maps_item_hashtable_clone().
+ * \n To assign the value to a key use maps_item_hashtable_set().
+ * \n The value, assigned with a specified key may be obtained using
+ * maps_item_hashtable_get().
+ * \n All key-value pairs of the table may be iterated using
+ * maps_item_hashtable_foreach().
+ * \n The key-value pair may be removed form the table using
+ * maps_item_hashtable_remove().
+ * \n To check if key is added to the table use
+ * maps_item_hashtable_contains().
+ * @since_tizen 2.4
+ *
+ * @see maps_item_hashtable_create()
+ * @see maps_item_hashtable_destroy()
+ * @see maps_item_hashtable_clone()
+ */
+typedef void *maps_item_hashtable_h;
+
+/**
+ * @brief Creates a new Hash Table of arbitrary items.
+ * @details This function creates a new instance of Hash Table of arbitrary
+ * items, associate a new handle with it and allocates all needed resources.
+ * @since_tizen 2.4
+ * @remarks @a table must be released using maps_item_hashtable_destroy().
+ * \n @a table may be cloned using maps_item_hashtable_clone().
+ *
+ * @param[out] table The handle of newly created table
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_item_hashtable_clone()
+ * @see maps_item_hashtable_destroy()
+ */
+int maps_item_hashtable_create(maps_item_hashtable_h *table);
+
+/**
+* @brief Destroys the Hash Table of arbitrary items and releases all its
+* resources.
+ * @details This function destroys the Hash Table handle and releases all its
+ * resources.
+ * @since_tizen 2.4
+ * @remarks All items stored in the table will be released with corresponding
+ * functions, specified during maps_item_hashtable_set().
+ *
+ * @param[in] table The handle of table to be destroyed
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a table is created using maps_item_hashtable_create().
+ *
+ * @see maps_item_hashtable_create()
+ * @see maps_item_hashtable_clone()
+ */
+int maps_item_hashtable_destroy(maps_item_hashtable_h table);
+
+/**
+ * @brief Clones the Hash Table of arbitrary items.
+ * @details This function clones the Hash Table of arbitrary items @a origin and
+ * all its resources.
+ * \n The list handle @a origin may be created using
+ * maps_item_hashtable_create().
+ * @since_tizen 2.4
+ * @remarks @a cloned must be released using maps_item_hashtable_destroy().
+ *
+ * @param[in] origin The handle of the table to be cloned
+ * @param[out] cloned The handle of the cloned table
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a table is created using maps_item_hashtable_create().
+ *
+ * @see maps_item_hashtable_create()
+ * @see maps_item_hashtable_destroy()
+ */
+int maps_item_hashtable_clone(const maps_item_hashtable_h origin,
+ maps_item_hashtable_h *cloned);
+
+/**
+ * @brief Clone function, making a copy of a Hash Table item.
+ * @details This function is called once for each item of the given Hash Table
+ * while it is being cloned during the maps_item_hashtable_clone() procedure.
+ * \n This function must be assigned while adding new item to the table using
+ * maps_item_hashtable_set().
+ * @since_tizen 2.4
+ * @remarks If this function returns the value different from MAPS_ERROR_NONE,
+ * the cloned item will not be appended to the list.
+ *
+ * @param[in] origin The pointer to the item which is to be cloned
+ * @param[out] cloned The pointer to the clone of the specified item
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre maps_item_hashtable_clone() will invoke this callback.
+ * @pre This function must be passed as parameter of using
+ * maps_item_hashtable_set().
+ *
+ * @see maps_item_hashtable_clone()
+ * @see maps_item_hashtable_set()
+ */
+typedef int (*maps_item_hashtable_clone_cb) (void *origin, void **cloned);
+
+/**
+ * @brief Free function, destroying an item of the Hash Table.
+ * @details This function is called once for each item of the given Hash Table
+ * while this item is to be destroyed during maps_item_hashtable_destroy().
+ * \n It is also called while the item is removed with
+ * maps_item_hashtable_remove()
+ * or the item value is exchanged with a new one with maps_item_hashtable_set().
+ * @since_tizen 2.4
+ * @remarks The return of this function is ignored.
+ *
+ * @param[in] data The pointer to the table item which is to be
+ * destroyed
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre maps_item_hashtable_destroy(), maps_item_hashtable_remove() or
+ * maps_item_hashtable_set() will invoke this callback.
+ *
+ * @see maps_item_hashtable_destroy()
+ * @see maps_item_hashtable_remove()
+ * @see maps_item_hashtable_set()
+ */
+typedef int (*maps_item_hashtable_free_cb) (void *data);
+
+/**
+ * @brief Clones the table item of string type (char*).
+ * @details This is a helper function of type #maps_item_hashtable_clone_cb,
+ * which is useful while adding to the table an item of string type (char*).
+ * This function is intended to be passed as the @a clone_func argument in the
+ * maps_item_hashtable_set().
+ * @since_tizen 2.4
+ * @remarks This function will be called implicitly in the
+ * maps_item_hashtable_clone() procedure.
+ *
+ * @param[in] origin The pointer of the item to be cloned
+ * @param[out] cloned The pointer of the clone
+ * @return void pointer of a copy string
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre maps_item_hashtable_clone() will invoke this callback.
+ *
+ * @see maps_item_hashtable_clone_cb()
+ * @see maps_item_hashtable_clone()
+ * @see maps_item_hashtable_set()
+ * @see maps_item_hashtable_free_string()
+ */
+int maps_item_hashtable_clone_string(void *origin, void **cloned);
+
+/**
+ * @brief Destroys the table item of string type (char*).
+ * @details This is a helper function of type #maps_item_hashtable_free_cb,
+ * which is useful while adding to the table an item of string type (char*).
+ * This function is intended to be passed as the @a free_func argument in the
+ * maps_item_hashtable_set().
+ * @since_tizen 2.4
+ * @remarks This function will be called implicitly in the
+ * maps_item_hashtable_destroy(), maps_item_hashtable_remove(),
+ * maps_item_hashtable_set() procedures.
+ * \n The return of this function is ignored.
+ *
+ * @param[in] data The pointer of the item
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre maps_item_hashtable_destroy(), maps_item_hashtable_remove() or
+ * maps_item_hashtable_set() will invoke this callback.
+ *
+ * @see maps_item_hashtable_free_cb()
+ * @see maps_item_hashtable_set()
+ * @see maps_item_hashtable_destroy()
+ * @see maps_item_hashtable_remove()
+ * @see maps_item_hashtable_clone_string()
+ */
+int maps_item_hashtable_free_string(void *data);
+
+/**
+ * @brief Clones the table item of integer type (int*).
+ * @details This is a helper function of type #maps_item_hashtable_clone_cb,
+ * which is useful while adding to the table an item of integer type (int*).
+ * This function is intended to be passed as the @a clone_func argument in the
+ * maps_item_hashtable_set().
+ * @since_tizen 2.4
+ * @remarks This function will be called implicitly in the
+ * maps_item_hashtable_clone() procedure.
+ *
+ * @param[in] origin The pointer of the item to be cloned
+ * @param[out] cloned The pointer of the clone
+ * @return void pointer of a copy integer
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre maps_item_hashtable_clone() will invoke this callback.
+ *
+ * @see maps_item_hashtable_clone_cb()
+ * @see maps_item_hashtable_set()
+ * @see maps_item_hashtable_free_int()
+ */
+int maps_item_hashtable_clone_int(void *origin, void **cloned);
+
+/**
+ * @brief Destroys the table item of integer type (int*).
+ * @details This is a helper function of type #maps_item_hashtable_free_cb,
+ * which is useful while adding to the table an item of integer type (int*).
+ * This function is intended to be passed as the @a free_func argument in the
+ * maps_item_hashtable_set().
+ * @since_tizen 2.4
+ * @remarks This function will be called implicitly in the
+ * maps_item_hashtable_destroy(), maps_item_hashtable_remove(),
+ * maps_item_hashtable_set() procedures.
+ * \n The return of this function is ignored.
+ *
+ * @param[in] data The pointer of the item
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre maps_item_hashtable_destroy(), maps_item_hashtable_remove() or
+ * maps_item_hashtable_set() will invoke this callback.
+ *
+ * @see maps_item_hashtable_free_cb()
+ * @see maps_item_hashtable_set()
+ * @see maps_item_hashtable_destroy()
+ * @see maps_item_hashtable_remove()
+ * @see maps_item_hashtable_clone_int()
+ */
+int maps_item_hashtable_free_int(void *data);
+
+/**
+* @brief Clones the table item of floating point numeric type (double*).
+ * @details This is a helper function of type #maps_item_hashtable_clone_cb,
+ * which is useful while adding to the table an item of floating point numeric
+ * type (double*). This function is intended to be passed as the @a
+ * clone_func argument in the maps_item_hashtable_set().
+ * @since_tizen 2.4
+ * @remarks This function will be called implicitly in the
+ * maps_item_hashtable_clone() procedure.
+ *
+ * @param[in] origin The pointer of the item to be cloned
+ * @param[out] cloned The pointer of the clone
+ * @return void pointer of a copy floating point number
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre maps_item_hashtable_clone() will invoke this callback.
+ *
+ * @see maps_item_hashtable_clone_cb()
+ * @see maps_item_hashtable_set()
+ * @see maps_item_hashtable_free_float()
+ */
+int maps_item_hashtable_clone_float(void *origin, void **cloned);
+
+/**
+ * @brief Destroys the table item of floating point numeric type
+ * (double*).
+ * @details This is a helper function of type #maps_item_hashtable_free_cb,
+ * which is useful while adding to the table an item of floating point numeric
+ * type (double*).
+ * This function is intended to be passed as the @a free_func argument in the
+ * maps_item_hashtable_set().
+ * @since_tizen 2.4
+ * @remarks This function will be called implicitly in the
+ * maps_item_hashtable_destroy(), maps_item_hashtable_remove(),
+ * maps_item_hashtable_set() procedures.
+ * \n The return of this function is ignored.
+ *
+ * @param[in] data The pointer of the item
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre maps_item_hashtable_destroy(), maps_item_hashtable_remove() or
+ * maps_item_hashtable_set() will invoke this callback.
+ *
+ * @see maps_item_hashtable_free_cb()
+ * @see maps_item_hashtable_set()
+ * @see maps_item_hashtable_destroy()
+ * @see maps_item_hashtable_remove()
+ * @see maps_item_hashtable_clone_float()
+ */
+int maps_item_hashtable_free_float(void *data);
+
+/**
+ * @brief Sets the association between string key and string (char*)
+ * value in the table.
+ * @details This function sets the association between string key and string
+ * value in the Hash Table.
+ * @since_tizen 2.4
+ * @remark New instances of key and value will be put to the table. The key and
+ * value must be released.
+ * \n This function uses implicitly maps_item_hashtable_clone_string() and
+ * maps_item_hashtable_free_string().
+ *
+ * @param[in] table The handle of the table
+ * @param[in] key The string value of "key"
+ * @param[in] value The string (char*) value
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a table is created using maps_item_hashtable_create().
+ *
+ * @see maps_item_hashtable_get()
+ * @see maps_item_hashtable_remove()
+ * @see maps_item_hashtable_create()
+ * @see maps_item_hashtable_get_string()
+ * @see maps_item_hashtable_clone_string()
+ * @see maps_item_hashtable_free_string()
+ */
+int maps_item_hashtable_set_string(maps_item_hashtable_h table,
+ const char *key, const char *value);
+
+ /**
+ * @brief Sets the association between string key and integer value in the
+ * table.
+ * @details This function sets the association between string key and integer
+ * value in the Hash Table.
+ * @since_tizen 2.4
+ * @remark New instances of key and value will be put to the table. The key and
+ * value must be released.
+ * \n This function uses implicitly maps_item_hashtable_clone_int() and
+ * maps_item_hashtable_free_int().
+ *
+ * @param[in] table The handle of the table
+ * @param[in] key The string value of "key"
+ * @param[in] value The integer value
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a table is created using maps_item_hashtable_create().
+ *
+ * @see maps_item_hashtable_get()
+ * @see maps_item_hashtable_remove()
+ * @see maps_item_hashtable_create()
+ * @see maps_item_hashtable_get_int()
+ * @see maps_item_hashtable_clone_int()
+ * @see maps_item_hashtable_free_int()
+ */
+int maps_item_hashtable_set_int(maps_item_hashtable_h table, const char *key,
+ const int value);
+
+/**
+ * @brief Sets the association between string key and floating point
+ * numeric value in the table.
+ * @details This function sets the association between string key and floating
+ * point numeric value in the Hash Table.
+ * @since_tizen 2.4
+ * @remark New instances of key and value will be put to the table. The key and
+ * value must be released.
+ * \n This function uses implicitly maps_item_hashtable_clone_int() and
+ * maps_item_hashtable_free_int().
+ *
+ * @param[in] table The handle of the table
+ * @param[in] key The string value of "key"
+ * @param[in] value The floating point numeric value
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a table is created using maps_item_hashtable_create().
+ *
+ * @see maps_item_hashtable_get()
+ * @see maps_item_hashtable_remove()
+ * @see maps_item_hashtable_create()
+ * @see maps_item_hashtable_get_float()
+ * @see maps_item_hashtable_clone_float()
+ * @see maps_item_hashtable_free_float()
+ */
+int maps_item_hashtable_set_float(maps_item_hashtable_h table,
+ const char *key, const double value);
+
+/**
+ * @brief Sets the association between key and value in the table.
+ * @details This function sets the association between string key and
+ * arbitrary typed value in the Hash Table.
+ * \n To allow the Hash Table manage arbitrary types properly, @a clone_func of
+ * type #maps_item_hashtable_clone_cb as well as @a free_func of type
+ * #maps_item_hashtable_free_cb must be specified. Those functions will be
+ * called implicitly during procedures of cloning, exchanging and removing
+ * Hash Table items.
+ * \n For the convenience there are defined cloning and freeing functions of
+ * basic types:
+ * - maps_item_hashtable_clone_string() and maps_item_hashtable_free_string()
+ * for string values of type (char*)
+ * - maps_item_hashtable_clone_int() and maps_item_hashtable_free_int() for
+ * integer values of type (int)
+ * - maps_item_hashtable_clone_float() and maps_item_hashtable_free_float() for
+ * floating point numeric values of type (double)
+ * .
+ * However for listed basic types it is recommended to use following convenience
+ * macros which applies those functions implicitly:
+ * - maps_item_hashtable_set_string()
+ * - maps_item_hashtable_set_int()
+ * - maps_item_hashtable_set_float()
+ * .
+ * @since_tizen 2.4
+ * @remark New instances of key and value will be put to the table. The @a key
+ * and @a value must be released.
+ *
+ * @param[in] table The handle of the table
+ * @param[in] key The string value of "key"
+ * @param[in] value The value
+ * @param[in] clone_func The function for cloning the value
+ * @param[in] free_func The function for freeing the value
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a table is created using maps_item_hashtable_create().
+ *
+ * @see maps_item_hashtable_get()
+ * @see maps_item_hashtable_remove()
+ * @see maps_item_hashtable_clone_string()
+ * @see maps_item_hashtable_clone_int()
+ * @see maps_item_hashtable_clone_float()
+ * @see maps_item_hashtable_free_string()
+ * @see maps_item_hashtable_free_int()
+ * @see maps_item_hashtable_free_float()
+ * @see maps_item_hashtable_set_string()
+ * @see maps_item_hashtable_set_int()
+ * @see maps_item_hashtable_set_float()
+ * @see maps_item_hashtable_create()
+ */
+int maps_item_hashtable_set(maps_item_hashtable_h table, const char *key,
+ const void *value,
+ maps_item_hashtable_clone_cb clone_func,
+ maps_item_hashtable_free_cb free_func);
+
+/**
+ * @brief Gets the association between string key and string (char*)
+ * value in the table.
+ * @details This function gets the association between string key and string
+ * value in the Hash Table.
+ * @since_tizen 2.4
+ * @remark @a value must be released using free().
+ *
+ * @param[in] table The handle of the table
+ * @param[in] key The string value of "key"
+ * @param[out] value The string (char*) value
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a table is created using maps_item_hashtable_create().
+ *
+ * @see maps_item_hashtable_get()
+ * @see maps_item_hashtable_remove()
+ * @see maps_item_hashtable_create()
+ * @see maps_item_hashtable_set_string()
+ * @see maps_item_hashtable_clone_string()
+ * @see maps_item_hashtable_free_string()
+ */
+int maps_item_hashtable_get_string(maps_item_hashtable_h table,
+ const char *key, char **value);
+
+/**
+ * @brief Gets the association between string key and integer value in the
+ * table.
+ * @details This function gets the association between string key and integer
+ * value in the Hash Table.
+ * @since_tizen 2.4
+ *
+ * @param[in] table The handle of the table
+ * @param[in] key The string value of "key"
+ * @param[out] value The integer value
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a table is created using maps_item_hashtable_create().
+ *
+ * @see maps_item_hashtable_get()
+ * @see maps_item_hashtable_remove()
+ * @see maps_item_hashtable_create()
+ * @see maps_item_hashtable_set_int()
+ * @see maps_item_hashtable_clone_int()
+ * @see maps_item_hashtable_free_int()
+ */
+int maps_item_hashtable_get_int(maps_item_hashtable_h table, const char *key,
+ int *value);
+
+/**
+ * @brief Gets the association between string key and floating point
+ * numeric value in the table.
+ * @details This function gets the association between string key and floating
+ * point numeric value in the Hash Table.
+ * @since_tizen 2.4
+ *
+ * @param[in] table The handle of the table
+ * @param[in] key The string value of "key"
+ * @param[out] value The floating point numeric value
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a table is created using maps_item_hashtable_create().
+ *
+ * @see maps_item_hashtable_get()
+ * @see maps_item_hashtable_remove()
+ * @see maps_item_hashtable_create()
+ * @see maps_item_hashtable_set_float()
+ * @see maps_item_hashtable_clone_float()
+ * @see maps_item_hashtable_free_float()
+ */
+int maps_item_hashtable_get_float(maps_item_hashtable_h table,
+ const char *key, double *value);
+
+/**
+ * @brief Gets the value associated with a string key in the table.
+ * @details This function gets the value associated with a string key in the
+ * Hash Table.
+ * @since_tizen 2.4
+ * @remark Th @a value must be released by you.
+ *
+ * @param[in] table The handle of the table
+ * @param[in] key The string value of "key"
+ * @param[out] value The corresponding value of "value"
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a table is created using maps_item_hashtable_create().
+ *
+ * @see maps_item_hashtable_set()
+ * @see maps_item_hashtable_remove()
+ * @see maps_item_hashtable_create()
+ */
+int maps_item_hashtable_get(maps_item_hashtable_h table, const char *key,
+ void **value);
+
+/**
+ * @brief Removes the key-value pair from the table.
+ * @details This function removes the key-value pair from the Hash Table.
+ * @since_tizen 2.4
+ * @remarks The resources, used by item will be released automatically.
+ *
+ * @param[in] table The handle of the table
+ * @param[in] key The string value of "key"
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a table is created using maps_item_hashtable_create().
+ *
+ * @see maps_item_hashtable_set()
+ * @see maps_item_hashtable_get()
+ * @see maps_item_hashtable_create()
+
+ */
+int maps_item_hashtable_remove(maps_item_hashtable_h table, const char *key);
+
+/**
+ * @brief Called once for each key-value pair while iterating through the
+ * given table.
+ * @details This function is called once for each key-value pair of the given
+ * table while the table is being iterated
+ * during the maps_item_hashtable_foreach() procedure.
+ * @since_tizen 2.4
+ * @remarks The @a key and @a value must be released by you.
+ *
+ * @param[in] index The current index of item
+ * @param[in] total The total amount of items
+ * @param[in] key The string value of "key"
+ * @param[in] value The corresponding value of "value"
+ * @param[in] user_data The user data passed from
+ * maps_item_hashtable_foreach()
+ * @return @c true to continue with the next iteration of the loop, \n @c
+ * false to break out of the loop
+ *
+ * @pre maps_item_hashtable_foreach() will invoke this callback.
+ *
+ * @see maps_item_hashtable_foreach()
+ */
+typedef bool(*maps_item_hashtable_foreach_cb) (int index, int total,
+ char *key, void *value,
+ void *user_data);
+
+/**
+ * @brief Gets the key-value pairs of the specified table.
+ * @details This function delivers key-value pairs of a specified table via
+ * maps_item_hashtable_foreach_cb() callback.
+ * @since_tizen 2.4
+ *
+ * @param[in] table The handle of table
+ * @param[in] callback The callback to be invoked for delivering each
+ * key-value pair
+ * @param[in] user_data The user data to be passed to the callback
+ * function
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NOT_FOUND Result not found
+ *
+ * @pre @a table is created using maps_item_hashtable_create().
+ * @post This function invokes maps_item_hashtable_foreach_cb() to deliver
+ * key-value pairs.
+ *
+ * @see maps_item_hashtable_foreach_cb()
+ * @see maps_item_hashtable_set()
+ * @see maps_item_hashtable_get()
+ * @see maps_item_hashtable_create()
+ */
+int maps_item_hashtable_foreach(maps_item_hashtable_h table,
+ maps_item_hashtable_foreach_cb callback,
+ void *user_data);
+
+/**
+ * @brief Checks if key is in hash_table.
+ * @details This function checks if the specified key is in the Hash Table.
+ * @since_tizen 2.4
+ *
+ * @param[in] table The handle of the table
+ * @param[in] key The string value of "key"
+ * @param[out] contains The flag of key presence
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a table is created using maps_item_hashtable_create().
+ *
+ * @see maps_item_hashtable_set()
+ * @see maps_item_hashtable_get()
+ * @see maps_item_hashtable_create()
+
+ */
+int maps_item_hashtable_contains(maps_item_hashtable_h table, const char *key,
+ bool *contains);
+
+/**
+ * @}
+ */
+
+/*----------------------------------------------------------------------------*/
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+#endif /* __MAPS_SERVICE_API_EXTRA_TYPES_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_PLACE_H__
+#define __MAPS_PLACE_H__
+
+#include <tizen_type.h>
+#include <maps_address.h>
+#include <maps_place_category.h>
+#include <maps_place_attribute.h>
+#include <maps_place_contact.h>
+#include <maps_place_editorial.h>
+#include <maps_place_link_object.h>
+#include <maps_place_image.h>
+#include <maps_place_review.h>
+#include <maps_place_rating.h>
+#include <maps_coordinates.h>
+
+/**
+ * @ingroup CAPI_MAPS_PLACE_MODULE
+ * @defgroup CAPI_MAPS_PLACE_DATA_MODULE Place
+ *
+ * @file maps_place.h
+ * @brief This file contains the functions related to Place information.
+ *
+ * @addtogroup CAPI_MAPS_PLACE_DATA_MODULE
+ * @{
+ * @brief This provides APIs related to Place information, used in Place
+ * Discovery and Search.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief The Place handle
+ * @details The handle of Place instance.
+ * @remarks To release the handle use maps_place_destroy().
+ * \n To clone the handle use maps_place_clone().
+ * @since_tizen 2.4
+ *
+ * @see maps_place_destroy()
+ * @see maps_place_clone()
+ */
+typedef void *maps_place_h;
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Called when requesting the list of Place Properties.
+ * @details This callback is invoked while iterating through the list of Place
+ * Properties.
+ * @since_tizen 2.4
+ * @remarks @a key and @a value must be released using free() and corresponding
+ * release method for property value correspondingly.
+ *
+ * @param[in] index The current index of property
+ * @param[in] total The total amount of properties
+ * @param[in] key The key of property
+ * @param[in] value The value of property
+ * @param[in] uesr_data The user data passed from
+ * maps_place_foreach_property()
+ * @return @c true to continue with the next iteration of the loop, \n @c
+ * false to break out of the loop
+ *
+ * @pre maps_place_foreach_property() will invoke this callback.
+ *
+ * @see maps_place_foreach_property()
+ */
+typedef bool(*maps_place_properties_cb) (int index, int total, char *key,
+ void *value, void *user_data);
+
+/**
+ * @brief Called when requesting the list of Place Categories.
+ * @details This callback is invoked while iterating through the list of Place
+ * Categories.
+ * @since_tizen 2.4
+ * @remarks @a category is valid only in this function and must be released
+ * using maps_place_category_destroy().
+ * \n To use @a category outside this function, clone it with
+ * maps_place_category_clone().
+ *
+ * @param[in] index The current index of category
+ * @param[in] total The total amount of categories
+ * @param[in] category The place category handle
+ * @param[in] uesr_data The user data passed from
+ * maps_place_foreach_category()
+ * @return @c true to continue with the next iteration of the loop, \n @c
+ * false to break out of the loop
+ *
+ * @pre maps_place_foreach_category() will invoke this callback.
+ *
+ * @see maps_place_foreach_category()
+ * @see #maps_place_category_h
+ */
+typedef bool(*maps_place_categories_cb) (int index, int total,
+ maps_place_category_h category,
+ void *user_data);
+
+/**
+ * @brief Called when requesting the list of Place Attributes.
+ * @details This callback is invoked while iterating through the list of Place
+ * Attributes.
+ * @since_tizen 2.4
+ * @remarks @a attribute is valid only in this function and must be released
+ * using maps_place_attribute_destroy().
+ * \n To use @a attribute outside this function, clone it with
+ * maps_place_attribute_clone().
+ *
+ * @param[in] index The current index of attribute
+ * @param[in] total The total amount of attributes
+ * @param[in] attribute The place attribute handle
+ * @param[in] uesr_data The user data passed from the
+ * maps_place_foreach_attribute()
+ * @return @c true to continue with the next iteration of the loop, \n @c
+ * false to break out of the loop
+ *
+ * @pre maps_place_foreach_attribute() will invoke this callback.
+ *
+ * @see maps_place_foreach_attribute()
+ * @see #maps_place_attribute_h
+ */
+typedef bool(*maps_place_attributes_cb) (int index, int total,
+ maps_place_attribute_h attribute,
+ void *user_data);
+
+/**
+ * @brief Called when requesting the list of Place Contacts.
+ * @details This callback is invoked while iterating through the list of Place
+ * Contacts.
+ * @since_tizen 2.4
+ * @remarks @a contact is valid only in this function and must be released using
+ * maps_place_contact_destroy().
+ * \n To use @a contact outside this function, clone it with
+ * maps_place_contact_clone().
+ *
+ * @param[in] index The current index of contact
+ * @param[in] total The total amount of contacts
+ * @param[in] contact The place contact handle
+ * @param[in] uesr_data The user data passed from the
+ * maps_place_foreach_contact()
+ * @return @c true to continue with the next iteration of the loop, \n @c
+ * false to break out of the loop
+ *
+ * @pre maps_place_foreach_contact() will invoke this callback.
+ *
+ * @see maps_place_foreach_contact()
+ * @see #maps_place_contact_h
+ */
+typedef bool(*maps_place_contacts_cb) (int index, int total,
+ maps_place_contact_h contact,
+ void *user_data);
+
+/**
+ * @brief Called when requesting the list of Place Editorial.
+ * @details This callback is invoked while iterating through the list of Place
+ * Editorials.
+ * @since_tizen 2.4
+ * @remarks @a editorial is valid only in this function and must be released
+ * using maps_place_editorial_destroy().
+ * \n To use @a editorial outside this function, clone it with
+ * maps_place_editorial_clone().
+ *
+ * @param[in] index The current index of editorial
+ * @param[in] total The total amount of editorials
+ * @param[in] editorial The place editorial handle
+ * @param[in] uesr_data The user data passed from the
+ * maps_place_foreach_editorial()
+ * @return @c true to continue with the next iteration of the loop, \n @c
+ * false to break out of the loop
+ *
+ * @pre maps_place_foreach_editorial() will invoke this callback.
+ *
+ * @see maps_place_foreach_editorial()
+ * @see #maps_place_editorial_h
+ */
+
+typedef bool(*maps_place_editorials_cb) (int index, int total,
+ maps_place_editorial_h editorial,
+ void *user_data);
+/**
+ * @brief Called when requesting the list of Place Image.
+ * @details This callback is invoked while iterating through the list of Place
+ * Images.
+ * @since_tizen 2.4
+ * @remarks @a image is valid only in this function and must be released using
+ * maps_place_image_destroy().
+ * \n To use @a image outside this function, clone it with
+ * maps_place_image_clone().
+ *
+ * @param[in] index The current index of image
+ * @param[in] total The total amount of images
+ * @param[in] image The place image handle
+ * @param[in] uesr_data The user data passed from the
+ * maps_place_foreach_image()
+ * @return @c true to continue with the next iteration of the loop, \n @c
+ * false to break out of the loop
+ *
+ * @pre maps_place_foreach_image() will invoke this callback.
+ *
+ * @see maps_place_foreach_image()
+ * @see #maps_place_image_h
+ */
+typedef bool(*maps_place_images_cb) (int index, int total,
+ maps_place_image_h image,
+ void *user_data);
+
+/**
+ * @brief Called when requesting the list of Place Review.
+ * @details This callback is invoked while iterating through the list of Place
+ * Reviews.
+ * @since_tizen 2.4
+ * @remarks @a review is valid only in this function and must be released using
+ * maps_place_review_destroy().
+ * \n To use @a review outside this function, clone it with
+ * maps_place_review_clone().
+ *
+ * @param[in] index The current index of review
+ * @param[in] total The total amount of reviews
+ * @param[in] review The place review handle
+ * @param[in] uesr_data The user data passed from the
+ * maps_place_foreach_review()
+ * @return @c true to continue with the next iteration of the loop, \n @c
+ * false to break out of the loop
+ *
+ * @pre maps_place_foreach_review() will invoke this callback.
+ *
+ * @see maps_place_foreach_review()
+ * @see #maps_place_image_h
+ */
+typedef bool(*maps_place_reviews_cb) (int index, int total,
+ maps_place_review_h review,
+ void *user_data);
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Destroys the place handle and releases all its resources.
+ * @details This function destroys the place handle and releases all its
+ * resources.
+ * @since_tizen 2.4
+ *
+ * @param[in] place The place handle to destroy
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_place_clone()
+ */
+int maps_place_destroy(maps_place_h place);
+
+/**
+ * @brief Clones the place handle.
+ * @details This function clones the place handle @a origin and all its
+ * resources.
+ * @since_tizen 2.4
+ * @remarks @a cloned must be released using maps_place_destroy().
+ *
+ * @param[in] origin The original place handle
+ * @param[out] cloned A cloned place handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_place_destroy()
+ */
+int maps_place_clone(const maps_place_h origin, maps_place_h *cloned);
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Gets the place id.
+ * @details This function gets the place id.
+ * @since_tizen 2.4
+ * @remarks @a id must be released using free().
+ *
+ * @param[in] place The place handle
+ * @param[out] id The place id
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_place_get_id(const maps_place_h place, char **id);
+
+/**
+ * @brief Gets the place name.
+ * @details This function gets the place name.
+ * @since_tizen 2.4
+ * @remarks @a name must be released using free().
+ *
+ * @param[in] place The place handle
+ * @param[out] name The place name
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_place_get_name(const maps_place_h place, char **name);
+
+/**
+ * @brief Gets the place view URI.
+ * @details This function gets the place view URI.
+ * @since_tizen 2.4
+ * @remarks @a uri must be released using free().
+ *
+ * @param[in] place The place handle
+ * @param[out] uri The place view URI
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_place_get_uri(const maps_place_h place, char **uri);
+
+/**
+ * @brief Gets the place location.
+ * @details This function gets the place location.
+ * @since_tizen 2.4
+ * @remarks @a location must be released using maps_coordinates_destroy().
+ *
+ * @param[in] place The place handle
+ * @param[out] location The place location
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_place_get_location(const maps_place_h place,
+ maps_coordinates_h *location);
+
+/**
+ * @brief Gets the place distance from the center of the location.
+ * @details This function gets the place distance from the center of the
+ * location.
+ * @since_tizen 2.4
+ *
+ * @param[in] place The place handle
+ * @param[out] distance The place distance
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_place_get_distance(const maps_place_h place, int *distance);
+
+/**
+ * @brief Gets the place address.
+ * @details This function gets the place address.
+ * @since_tizen 2.4
+ * @remarks @a address must be released using maps_address_destroy().
+ *
+ * @param[in] place The place handle
+ * @param[out] address The place address
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ */
+int maps_place_get_address(const maps_place_h place,
+ maps_address_h *address);
+
+/**
+ * @brief Gets the place rating.
+ * @details This function gets the place rating.
+ * @since_tizen 2.4
+ * @remarks @a rating must be released using maps_place_rating_destroy().
+ *
+ * @param[in] place The place handle
+ * @param[out] rating The place rating handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ */
+int maps_place_get_rating(const maps_place_h place,
+ maps_place_rating_h *rating);
+
+/**
+ * @brief Retrieves all properties.
+ * @details This function retrieves all place properties.
+ * @since_tizen 2.4
+ * @remarks The properties will be delivered via maps_place_properties_cb().
+ *
+ * @param[in] place The place handle
+ * @param[in] callback The callback function to invoke
+ * @param[in] user_data The user data to be passed to the callback
+ * function
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NOT_FOUND Result not found
+ *
+ * @post This function invokes maps_place_properties_cb() repeatedly to retrieve
+ * each property.
+ *
+ * @see maps_place_properties_cb()
+ */
+int maps_place_foreach_property(const maps_place_h place,
+ maps_place_properties_cb callback,
+ void *user_data);
+
+/**
+ * @brief Retrieves all categories
+ * @details This function retrieves all place categories.
+ * @since_tizen 2.4
+ * @remarks The categories will be delivered via maps_place_categories_cb().
+ *
+ * @param[in] place The place handle
+ * @param[in] callback The callback function to invoke
+ * @param[in] user_data The user data to be passed to the callback
+ * function
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NOT_FOUND Result not found
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @post This function invokes maps_place_categories_cb() repeatedly to retrieve
+ * each category.
+ *
+ * @see maps_place_categories_cb()
+ */
+int maps_place_foreach_category(const maps_place_h place,
+ maps_place_categories_cb callback,
+ void *user_data);
+
+/**
+ * @brief Retrieves all attributes.
+ * @details This function retrieves all place attributes.
+ * @since_tizen 2.4
+ * @remarks The attributes will be delivered via maps_place_attributes_cb().
+ *
+ * @param[in] place The place handle
+ * @param[in] callback The callback function to invoke
+ * @param[in] user_data The user data to be passed to the callback
+ * function
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NOT_FOUND Result not found
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @post This function invokes maps_place_attributes_cb() repeatedly to retrieve
+ * each attribute.
+ *
+ * @see maps_place_attributes_cb()
+ */
+int maps_place_foreach_attribute(const maps_place_h place,
+ maps_place_attributes_cb callback,
+ void *user_data);
+
+/**
+ * @brief Retrieves all contacts.
+ * @details This function retrieves all place contacts.
+ * @since_tizen 2.4
+ * @remarks The contacts will be delivered via maps_place_contacts_cb().
+ *
+ * @param[in] place The place handle
+ * @param[in] callback The callback function to invoke
+ * @param[in] user_data The user data to be passed to the callback
+ * function
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NOT_FOUND Result not found
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @post This function invokes maps_place_contacts_cb() repeatedly to retrieve
+ * each contact.
+ *
+ * @see maps_place_contacts_cb()
+ */
+int maps_place_foreach_contact(const maps_place_h place,
+ maps_place_contacts_cb callback,
+ void *user_data);
+
+/**
+ * @brief Retrieves all editorials.
+ * @details This function retrieves all place editorials.
+ * @since_tizen 2.4
+ * @remarks The editorials will be delivered via maps_place_editorials_cb().
+ *
+ * @param[in] place The place handle
+ * @param[in] callback The callback function to invoke
+ * @param[in] user_data The user data to be passed to the callback
+ * function
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NOT_FOUND Result not found
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @post This function invokes maps_place_editorials_cb() repeatedly to retrieve
+ * each editorial.
+ *
+ * @see maps_place_editorials_cb()
+ */
+int maps_place_foreach_editorial(const maps_place_h place,
+ maps_place_editorials_cb callback,
+ void *user_data);
+
+/**
+ * @brief Retrieves all images.
+ * @details This function retrieves all place images.
+ * @since_tizen 2.4
+ * @remarks The images will be delivered via maps_place_images_cb().
+ *
+ * @param[in] place The place handle
+ * @param[in] callback The callback function to invoke
+ * @param[in] user_data The user data to be passed to the callback
+ * function
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NOT_FOUND Result not found
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @post This function invokes maps_place_images_cb() repeatedly to retrieve
+ * each image.
+ *
+ * @see maps_place_images_cb()
+ */
+int maps_place_foreach_image(const maps_place_h place,
+ maps_place_images_cb callback, void *user_data);
+
+/**
+ * @brief Retrieves all reviews.
+ * @details This function retrieves all place reviews.
+ * @since_tizen 2.4
+ * @remarks The reviews will be delivered via maps_place_reviews_cb().
+ *
+ * @param[in] place The place handle
+ * @param[in] callback The callback function to invoke
+ * @param[in] user_data The user data to be passed to the callback
+ * function
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NOT_FOUND Result not found
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @post This function invokes maps_place_reviews_cb() repeatedly to retrieve
+ * each review.
+ *
+ * @see maps_place_reviews_cb()
+ */
+int maps_place_foreach_review(const maps_place_h place,
+ maps_place_reviews_cb callback,
+ void *user_data);
+
+/**
+ * @brief Gets the place supplier link.
+ * @details This function gets the place supplier link.
+ * @since_tizen 2.4
+ * @remarks @a supplier must be released using maps_place_link_object_destroy().
+ *
+ * @param[in] place The place handle image
+ * @param[out] supplier The place supplier link
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ */
+int maps_place_get_supplier_link(const maps_place_image_h place,
+ maps_place_link_object_h *supplier);
+
+/**
+ * @brief Gets the place related link.
+ * @details This function gets the place related link.
+ * @since_tizen 2.4
+ * @remarks @a related must be released using maps_place_link_object_destroy().
+ *
+ * @param[in] place The place handle image
+ * @param[out] related The place related link
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ */
+int maps_place_get_related_link(const maps_place_image_h place,
+ maps_place_link_object_h *related);
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+#endif /* __MAPS_PLACE_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_PLACE_ATTRIBUTE_H__
+#define __MAPS_PLACE_ATTRIBUTE_H__
+
+/**
+ * @ingroup CAPI_MAPS_PLACE_MODULE
+ * @defgroup CAPI_MAPS_PLACE_ATTRIBUTE_MODULE Attribute
+ *
+ * @file maps_place_attribute.h
+ * @brief This file contains the functions related to Place Attributes
+ * information.
+ *
+ * @addtogroup CAPI_MAPS_PLACE_ATTRIBUTE_MODULE
+ * @{
+ * @brief This provides APIs related to Place Attributes information, used in
+ * Place Discovery and Search.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief The Place Attribute handle
+ * @details The handle of Place Attribute instance.
+ * @remarks To release the handle use maps_place_attribute_destroy().
+ * \n To clone the handle use maps_place_attribute_clone().
+ * @since_tizen 2.4
+ *
+ * @see maps_place_attribute_destroy()
+ * @see maps_place_attribute_clone()
+ */
+typedef void *maps_place_attribute_h;
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Destroys the place attribute handle and releases all its
+ * resources.
+ * @details This function destroys the place attribute handle and releases all
+ * its resources.
+ * @since_tizen 2.4
+ *
+ * @param[in] attribute The place attribute handle to destroy
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_place_attribute_clone()
+ */
+int maps_place_attribute_destroy(maps_place_attribute_h attribute);
+
+/**
+ * @brief Clones the place attribute handle.
+ * @details This function clones the place attribute handle @a origin and all
+ * its resources.
+ * @since_tizen 2.4
+ * @remarks @a cloned must be released using maps_place_attribute_destroy().
+ *
+ * @param[in] origin The original place attribute handle
+ * @param[out] cloned A cloned place attribute handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_place_attribute_destroy()
+ */
+int maps_place_attribute_clone(const maps_place_attribute_h origin,
+ maps_place_attribute_h *cloned);
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Gets the place attribute id.
+ * @details This function gets the place attribute id.
+ * @since_tizen 2.4
+ * @remarks @a id must be released using free().
+ *
+ * @param[in] attribute The handle to place attribute
+ * @param[out] id The place attribute id
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_place_attribute_get_id(const maps_place_attribute_h attribute,
+ char **id);
+
+/**
+ * @brief Gets the place link object label.
+ * @details This function gets the place link object label.
+ * @since_tizen 2.4
+ * @remarks @a label must be released using free().
+ *
+ * @param[in] attribute The handle to place attribute
+ * @param[out] label The place attribute label
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_place_attribute_get_label(const maps_place_attribute_h attribute,
+ char **label);
+
+/**
+ * @brief Gets the place attribute text.
+ * @details This function gets the place attribute text.
+ * @since_tizen 2.4
+ * @remarks @a text must be released using free().
+ *
+ * @param[in] attribute The handle to place attribute
+ * @param[out] text The place attribute text
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_place_attribute_get_text(const maps_place_attribute_h attribute,
+ char **text);
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+#endif /* __MAPS_PLACE_ATTRIBUTE_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_PLACE_ATTRIBUTE_PLUGIN_H__
+#define __MAPS_PLACE_ATTRIBUTE_PLUGIN_H__
+
+#include <maps_place_attribute.h>
+
+/**
+ * @ingroup CAPI_MAPS_PLUGIN_PLACE_MODULE
+ * @defgroup CAPI_MAPS_PLUGIN_PLACE_ATTRIBUTE_MODULE Attribute
+ *
+ * @file maps_place_attribute_plugin.h
+ * @brief This file contains the functions related to Place Attributes
+ * information, needed in plug-in development.
+ *
+ * @addtogroup CAPI_MAPS_PLUGIN_PLACE_ATTRIBUTE_MODULE
+ * @{
+ * @brief This provides APIs related to Place Attributes information,
+ * used in Place Discovery and Search, needed in plug-in development.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Creates a new place attribute handle.
+ * @details This function creates a new place attribute handle and allocates all
+ * needed resources.
+ * @since_tizen 2.4
+ * @remarks @a place attribute must be released using
+ * maps_place_attribute_destroy().
+ * \n @a attribute may be cloned using maps_place_attribute_clone().
+ *
+ * @param[out] attribute A handle of a new place attribute on success
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_place_attribute_destroy()
+ * @see maps_place_attribute_clone()
+ */
+int maps_place_attribute_create(maps_place_attribute_h *attribute);
+
+/**
+ * @brief Sets the place attribute id.
+ * @details This function sets the place attribute id.
+ * @since_tizen 2.4
+ *
+ * @param[in] attribute The handle to place attribute
+ * @param[in] id The place attribute id
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a attribute is created using maps_place_attribute_create().
+ *
+ * @see maps_place_attribute_create()
+ * @see maps_place_attribute_get_id()
+ */
+int maps_place_attribute_set_id(maps_place_attribute_h attribute,
+ const char *id);
+
+/**
+ * @brief Sets the place attribute label.
+ * @details This function sets the place attribute label.
+ * @since_tizen 2.4
+ *
+ * @param[in] attribute The handle to place attribute
+ * @param[in] label The place attribute label
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a attribute is created using maps_place_attribute_create().
+ *
+ * @see maps_place_attribute_create()
+ * @see maps_place_attribute_get_label()
+ */
+int maps_place_attribute_set_label(maps_place_attribute_h attribute,
+ const char *label);
+
+/**
+ * @brief Sets the place attribute text.
+ * @details This function sets the place attribute text.
+ * @since_tizen 2.4
+ *
+ * @param[in] attribute The handle to place attribute
+ * @param[in] text The place attribute text
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a attribute is created using maps_place_attribute_create().
+ *
+ * @see maps_place_attribute_create()
+ * @see maps_place_attribute_get_text()
+ */
+int maps_place_attribute_set_text(maps_place_attribute_h attribute,
+ const char *text);
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+#endif /* __MAPS_PLACE_ATTRIBUTE_PLUGIN_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_PLACE_CATEGORY_H__
+#define __MAPS_PLACE_CATEGORY_H__
+
+/**
+ * @ingroup CAPI_MAPS_PLACE_MODULE
+ * @defgroup CAPI_MAPS_PLACE_CATEGORY_MODULE Category
+ *
+ * @file maps_place_category.h
+ * @brief This file contains the functions related to Place Category
+ * information.
+ *
+ * @addtogroup CAPI_MAPS_PLACE_CATEGORY_MODULE
+ * @{
+ * @brief This provides APIs related to place Category information, used in
+ * Place Discovery and Search.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief The Place Category handle
+ * @details The handle of Place Category instance.
+ * @remarks To release the handle use maps_place_category_destroy().
+ * \n To clone the handle use maps_place_category_clone().
+ * @since_tizen 2.4
+ *
+ * @see maps_place_category_destroy()
+ * @see maps_place_category_clone()
+ */
+typedef void *maps_place_category_h;
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Creates a new place category handle.
+ * @details This function creates a new place category handle and allocates all
+ * needed resources.
+ * @since_tizen 2.4
+ * @remarks @a category must be released using maps_place_category_destroy().
+ * \n @a category may be cloned using maps_place_category_clone().
+ *
+ * @param[out] category A handle of a new place category on success
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_place_category_destroy()
+ * @see maps_place_category_clone()
+ */
+int maps_place_category_create(maps_place_category_h *category);
+
+
+/**
+ * @brief Clones the place category handle.
+ * @details This function clones the place category handle @a origin and all its
+ * resources.
+ * @since_tizen 2.4
+ * @remarks @a cloned must be released using maps_place_category_destroy().
+ *
+ * @param[in] origin The original place category handle
+ * @param[out] cloned A cloned place category handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_place_category_destroy()
+ */
+int maps_place_category_clone(const maps_place_category_h origin,
+ maps_place_category_h *cloned);
+
+
+/**
+ * @brief Destroys the place category handle and releases all its
+ * resources.
+ * @details This function destroys the place category handle and releases all
+ * its resources.
+ * @since_tizen 2.4
+ *
+ * @param[in] category The place category handle to destroy
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_place_category_clone()
+ */
+int maps_place_category_destroy(maps_place_category_h category);
+
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Sets the place category id.
+ * @details This function sets the place category id.
+ * @since_tizen 2.4
+ *
+ * @param[in] category The handle of place category
+ * @param[in] id The place category id
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a category is created using maps_place_category_create().
+ *
+ * @see maps_place_category_create()
+ * @see maps_place_category_get_id()
+ */
+int maps_place_category_set_id(maps_place_category_h category,
+ const char *id);
+
+
+/**
+ * @brief Sets the place category name.
+ * @details This function sets the place category name.
+ * @since_tizen 2.4
+ *
+ * @param[in] category The handle of place category
+ * @param[in] name The place category name
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a category is created using maps_place_category_create().
+ *
+ * @see maps_place_category_create()
+ * @see maps_place_category_get_name()
+ */
+int maps_place_category_set_name(maps_place_category_h category,
+ const char *name);
+
+
+/**
+ * @brief Sets the place category URL.
+ * @details This function sets the place category URL.
+ * @since_tizen 2.4
+ *
+ * @param[in] category The handle of place category
+ * @param[in] url The place category URL
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a category is created using maps_place_category_create().
+ *
+ * @see maps_place_category_create()
+ * @see maps_place_category_get_url()
+ */
+int maps_place_category_set_url(maps_place_category_h category,
+ const char *url);
+
+
+/**
+ * @brief Gets the place category id.
+ * @details This function gets the place category id.
+ * @since_tizen 2.4
+ * @remarks @a id must be released using free().
+ *
+ * @param[in] category The handle of place category
+ * @param[out] id The place category id
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_place_category_get_id(const maps_place_category_h category,
+ char **id);
+
+/**
+ * @brief Gets the place category name.
+ * @details This function gets the place category name.
+ * @since_tizen 2.4
+ * @remarks @a name must be released using free().
+ *
+ * @param[in] category The handle of place category
+ * @param[out] name The place category name
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_place_category_get_name(const maps_place_category_h category,
+ char **name);
+
+/**
+ * @brief Gets the place category URL.
+ * @details This function gets the place category URL.
+ * @since_tizen 2.4
+ * @remarks @a url must be released using free().
+ *
+ * @param[in] category The handle of place category
+ * @param[out] url The place category URL
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_place_category_get_url(const maps_place_category_h category,
+ char **url);
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+#endif /* __MAPS_PLACE_CATEGORY_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_PLACE_CONTACT_H__
+#define __MAPS_PLACE_CONTACT_H__
+
+/**
+ * @ingroup CAPI_MAPS_PLACE_MODULE
+ * @defgroup CAPI_MAPS_PLACE_CONTACT_MODULE Contact
+ *
+ * @file maps_place_contact.h
+ * @brief This file contains the functions related to Place Contact information.
+ *
+ * @addtogroup CAPI_MAPS_PLACE_CONTACT_MODULE
+ * @{
+ * @brief This provides APIs related to Place Contact, used in Place Discovery
+ * and Search.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief The Place Contact handle
+ * @details The handle of Place Contact instance.
+ * @remarks To release the handle use maps_place_contact_destroy().
+ * \n To clone the handle use maps_place_contact_clone().
+ * @since_tizen 2.4
+ *
+ * @see maps_place_contact_destroy()
+ * @see maps_place_contact_clone()
+ */
+typedef void *maps_place_contact_h;
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Destroys the place contact handle and releases all its
+ * resources.
+ * @details This function destroys the place contact handle and releases all its
+ * resources.
+ * @since_tizen 2.4
+ *
+ * @param[in] contact The place contact handle to destroy
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_place_contact_clone()
+ */
+int maps_place_contact_destroy(maps_place_contact_h contact);
+
+/**
+ * @brief Clones the place contact handle.
+ * @details This function clones the place contact handle @a origin and all its
+ * resources.
+ * @since_tizen 2.4
+ * @remarks @a cloned must be released using maps_place_contact_destroy().
+ *
+ * @param[in] origin The original place contact handle
+ * @param[out] cloned A cloned place contact handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_place_contact_destroy()
+ */
+int maps_place_contact_clone(const maps_place_contact_h origin,
+ maps_place_contact_h *cloned);
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Gets the place contact label.
+ * @details This function gets the place contact label.
+ * @since_tizen 2.4
+ * @remarks @a label must be released using free().
+ *
+ * @param[in] contact The handle to place contact
+ * @param[out] label The place contact label
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_place_contact_get_label(const maps_place_contact_h contact,
+ char **label);
+
+/**
+ * @brief Gets the place contact type.
+ * @details This function gets the place contact type.
+ * @since_tizen 2.4
+ * @remarks @a type must be released using free().
+ *
+ * @param[in] contact The handle to place contact
+ * @param[out] type The place contact type
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_place_contact_get_type(const maps_place_contact_h contact,
+ char **type);
+
+/**
+ * @brief Gets the place contact value.
+ * @details This function gets the place contact value.
+ * @since_tizen 2.4
+ * @remarks @a value must be released using free().
+ *
+ * @param[in] contact The handle to place contact
+ * @param[out] value The place contact value
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_place_contact_get_value(const maps_place_contact_h contact,
+ char **value);
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+#endif /* __MAPS_PLACE_CONTACT_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_PLACE_CONTACT_PLUGIN_H__
+#define __MAPS_PLACE_CONTACT_PLUGIN_H__
+
+#include <maps_place_contact.h>
+
+/**
+ * @ingroup CAPI_MAPS_PLUGIN_PLACE_MODULE
+ * @defgroup CAPI_MAPS_PLUGIN_PLACE_CONTACT_MODULE Contact
+ *
+ * @file maps_place_contact_plugin.h
+ * @brief This file contains the functions related to Place Contact
+ * information, needed in plug-in development.
+ *
+ * @addtogroup CAPI_MAPS_PLUGIN_PLACE_CONTACT_MODULE
+ * @{
+ * @brief This provides APIs related to Place Contact, used in Place
+ * Discovery and Search, needed in plug-in development.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Creates a new place contact handle.
+ * @details This function creates a new place contact handle and allocates all
+ * needed resources.
+ * @since_tizen 2.4
+ * @remarks @a place contact must be released using
+ * maps_place_contact_destroy().
+ * \n @a contact may be cloned using maps_place_contact_clone().
+ *
+ * @param[out] contact A handle of a new place contact on success
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see place_contact_destroy()
+ * @see maps_place_contact_clone()
+ */
+int maps_place_contact_create(maps_place_contact_h *contact);
+
+/**
+ * @brief Sets the place contact label
+ * @details This function sets the place contact label.
+ * @since_tizen 2.4
+ *
+ * @param[in] contact The handle of contact contact
+ * @param[in] label The place contact label
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a contact is created using maps_place_contact_create().
+ *
+ * @see maps_place_contact_create()
+ * @see maps_place_contact_get_label()
+ */
+int maps_place_contact_set_label(maps_place_contact_h contact,
+ const char *label);
+
+/**
+ * @brief Sets the place contact type
+ * @details This function sets the place contact type.
+ * @since_tizen 2.4
+ *
+ * @param[in] contact The handle to place contact
+ * @param[in] type The place contact type
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a contact is created using maps_place_contact_create().
+ *
+ * @see maps_place_contact_create()
+ * @see maps_place_contact_get_type()
+ */
+int maps_place_contact_set_type(maps_place_contact_h contact,
+ const char *type);
+
+/**
+ * @brief Sets the place contact value
+ * @details This function sets the place contact value.
+ * @since_tizen 2.4
+ *
+ * @param[in] contact The handle to place contact
+ * @param[in] value The place contact value
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a contact is created using maps_place_contact_create().
+ *
+ * @see maps_place_contact_create()
+ * @see maps_place_contact_get_value()
+ */
+int maps_place_contact_set_value(maps_place_contact_h contact,
+ const char *value);
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+#endif /* __MAPS_PLACE_CONTACT_PLUGIN_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_PLACE_EDITORIAL_H__
+#define __MAPS_PLACE_EDITORIAL_H__
+
+#include <maps_place_media.h>
+
+/**
+ * @ingroup CAPI_MAPS_PLACE_MODULE
+ * @defgroup CAPI_MAPS_PLACE_EDITORIAL_MODULE Editorial
+ *
+ * @file maps_place_editorial.h
+ * @brief This file contains the functions related to Place Editorial
+ * information.
+ *
+ * @addtogroup CAPI_MAPS_PLACE_EDITORIAL_MODULE
+ * @{
+ * @brief This provides APIs related to Place Editorial information, used in
+ * Place Discovery and Search.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief The Place Editorial handle
+ * @details The handle of Place Editorial instance.
+ * @remarks To release the handle use maps_place_editorial_destroy().
+ * \n To clone the handle use maps_place_editorial_clone().
+ * @since_tizen 2.4
+ *
+ * @see maps_place_editorial_destroy()
+ * @see maps_place_editorial_clone()
+ */
+typedef void *maps_place_editorial_h;
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Destroys the place editorial handle and releases all its
+ * resources.
+ * @details This function destroys the place editorial handle and releases all
+ * its resources.
+ * @since_tizen 2.4
+ *
+ * @param[in] editorial The place editorial handle to destroy
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_place_editorial_clone()
+ */
+int maps_place_editorial_destroy(maps_place_editorial_h editorial);
+
+/**
+ * @brief Clones the place editorial handle.
+ * @details This function clones the place editorial handle @a origin and all
+ * its resources.
+ * @since_tizen 2.4
+ * @remarks @a cloned must be released using maps_place_editorial_destroy().
+ *
+ * @param[in] origin The original place editorial handle
+ * @param[out] cloned A cloned place editorial handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_place_editorial_destroy()
+ */
+int maps_place_editorial_clone(const maps_place_editorial_h origin,
+ maps_place_editorial_h *cloned);
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Gets the place editorial description.
+ * @details This function gets the place editorial description.
+ * @since_tizen 2.4
+ * @remarks @a description must be released using free().
+ *
+ * @param[in] editorial The handle of place editorial
+ * @param[out] description The place editorial description
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_place_editorial_get_description(const maps_place_editorial_h
+ editorial, char **description);
+
+/**
+ * @brief Gets the place editorial language.
+ * @details This function gets the place editorial language.
+ * @since_tizen 2.4
+ * @remarks @a language must be released using free().
+ *
+ * @param[in] editorial The handle of place editorial
+ * @param[out] language The place editorial language
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_place_editorial_get_language(const maps_place_editorial_h editorial,
+ char **language);
+
+/**
+ * @brief Gets the place editorial media.
+ * @details This function gets the place editorial media.
+ * @since_tizen 2.4
+ * @remarks @a media must be released using maps_place_media_destroy().
+ *
+ * @param[in] editorial The handle of place editorial
+ * @param[out] media The place editorial media
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see #maps_place_media_h
+ */
+int maps_place_editorial_get_media(const maps_place_editorial_h editorial,
+ maps_place_media_h *media);
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+#endif /* __MAPS_PLACE_EDITORIAL_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_PLACE_EDITORIAL_PLUGIN_H__
+#define __MAPS_PLACE_EDITORIAL_PLUGIN_H__
+
+#include <maps_place_editorial.h>
+
+/**
+ * @ingroup CAPI_MAPS_PLUGIN_PLACE_MODULE
+ * @defgroup CAPI_MAPS_PLUGIN_PLACE_EDITORIAL_MODULE Editorial
+ *
+ * @file maps_place_editorial_plugin.h
+ * @brief This file contains the functions related to Place Editorial
+ * information, needed in plug-in development.
+ *
+ * @addtogroup CAPI_MAPS_PLUGIN_PLACE_EDITORIAL_MODULE
+ * @{
+ * @brief This provides APIs related to Place Editorial, used in Place
+ * Discovery and Search, needed in plug-in development.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Creates a new place editorial handle.
+ * @details This function creates a new place editorial handle and allocates all
+ * needed resources.
+ * @since_tizen 2.4
+ * @remarks @a editorial must be released using maps_place_editorial_destroy().
+ * \n @a editorial may be cloned using maps_place_editorial_clone().
+ *
+ * @param[out] editorial A handle of a new place editorial on success
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_place_editorial_destroy()
+ * @see maps_place_editorial_clone()
+ */
+int maps_place_editorial_create(maps_place_editorial_h *editorial);
+
+/**
+ * @brief Sets the place editorial description.
+ * @details This function sets the place editorial description.
+ * @since_tizen 2.4
+ *
+ * @param[in] editorial The handle of place editorial
+ * @param[in] description The place editorial description
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a editorial is created using maps_place_editorial_create().
+ *
+ * @see maps_place_editorial_create()
+ * @see maps_place_editorial_get_description()
+ */
+int maps_place_editorial_set_description(maps_place_editorial_h editorial,
+ const char *description);
+
+/**
+ * @brief Sets the place editorial language.
+ * @details This function sets the place editorial language.
+ * @since_tizen 2.4
+ *
+ * @param[in] editorial The handle of place editorial
+ * @param[in] language The place editorial language
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a editorial is created using maps_place_editorial_create().
+ *
+ * @see maps_place_editorial_create()
+ * @see maps_place_editorial_get_language()
+ */
+int maps_place_editorial_set_language(maps_place_editorial_h editorial,
+ const char *language);
+
+/**
+ * @brief Sets the place editorial media.
+ * @details This function sets the place editorial media.
+ * @since_tizen 2.4
+ *
+ * @param[in] editorial The handle of place editorial
+ * @param[in] media The place editorial media
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a editorial is created using maps_place_editorial_create().
+ *
+ * @see maps_place_editorial_create()
+ * @see maps_place_editorial_get_media()
+ * @see maps_place_media_destroy
+ */
+int maps_place_editorial_set_media(maps_place_editorial_h editorial,
+ const maps_place_media_h media);
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+#endif /* __MAPS_PLACE_EDITORIAL_PLUGIN_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_PLACE_FILTER_H__
+#define __MAPS_PLACE_FILTER_H__
+
+#include <maps_place_category.h>
+
+/**
+ * @ingroup CAPI_MAPS_PLACE_MODULE
+ * @defgroup CAPI_MAPS_PLACE_FILTER_MODULE Filter
+ *
+ * @file maps_place_filter.h
+ * @brief This file contains the functions related to Place Filter information.
+ *
+ * @addtogroup CAPI_MAPS_PLACE_FILTER_MODULE
+ * @{
+ * @brief This provides APIs related to Place Filter information, used in Place
+ * Discovery and Search.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief The Place Filter handle
+ * @details The handle of Place Filter instance.
+ * @remarks To release the handle use maps_place_filter_destroy().
+ * \n To clone the handle use maps_place_filter_clone().
+ * @since_tizen 2.4
+ *
+ * @see maps_place_filter_destroy()
+ * @see maps_place_filter_clone()
+ */
+typedef void *maps_place_filter_h;
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Called when requesting the list of Place Filter Properties.
+ * @details This callback is invoked while iterating through the list of Place
+ * Filter Properties.
+ * @since_tizen 2.4
+ * @remarks @a key and @a value must be released using free() and corresponding
+ * release method for property value correspondingly.
+ *
+ * @param[in] index The current index of property
+ * @param[in] total The total amount of properties
+ * @param[in] key The key of property
+ * @param[in] value The value of property
+ * @param[in] uesr_data The user data passed from the
+ * maps_place_filter_foreach_property()
+ * @return @c true to continue with the next iteration of the loop, \n @c
+ * false to break out of the loop
+ *
+ * @pre maps_place_filter_foreach_property() will invoke this callback.
+ *
+ * @see maps_place_filter_foreach_property()
+ */
+typedef bool(*maps_place_filter_properties_cb) (int index, int total,
+ char *key, void *value,
+ void *user_data);
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Creates a new place filter handle.
+ * @details This function creates a new place filter handle and allocates all
+ * needed resources.
+ * @since_tizen 2.4
+ * @remarks @a filter must be released using maps_place_filter_destroy().
+ * \n @a filter may be cloned using maps_place_filter_clone().
+ *
+ * @param[out] filter A handle of a new place filter on success
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_place_filter_destroy()
+ * @see maps_place_filter_clone()
+ */
+int maps_place_filter_create(maps_place_filter_h *filter);
+
+/**
+ * @brief Destroys the place filter handle and releases all its resources.
+ * @details This function destroys the place filter handle and releases all its
+ * resources.
+ * @since_tizen 2.4
+ *
+ * @param[in] filter The place filter handle to destroy
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a filter is created using maps_place_filter_create().
+ *
+ * @see maps_place_filter_create()
+ * @see maps_place_filter_clone()
+ */
+int maps_place_filter_destroy(maps_place_filter_h filter);
+
+/**
+ * @brief Clones the place filter handle.
+ * @details This function clones the place filter handle @a origin and all its
+ * resources.
+ * \n Place filter handle @a origin may be created using
+ * maps_place_filter_create().
+ * @since_tizen 2.4
+ * @remarks @a cloned must be released using maps_place_filter_destroy().
+ *
+ * @param[in] origin The place filter handle to be cloned
+ * @param[out] cloned A handle of a newly cloned place filter on success
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a origin is created using maps_place_filter_create().
+ *
+ * @see maps_place_filter_create()
+ * @see maps_place_filter_destroy()
+ */
+int maps_place_filter_clone(const maps_place_filter_h origin,
+ maps_place_filter_h *cloned);
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Gets the value of the specified key in the place filter.
+ * @details This function gets the value of the specified key in the place
+ * filter.
+ * @since_tizen 2.4
+ * @remarks @a value must be released using free().
+ *
+ * @param[in] filter The handle of the place filter
+ * @param[in] key The key of filter
+ * @param[out] value The filter value
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a filter is created using maps_place_filter_create().
+ *
+ * @see maps_place_filter_set()
+ * @see maps_place_filter_create()
+ */
+int maps_place_filter_get(const maps_place_filter_h filter, const char *key,
+ char **value);
+
+/**
+ * @brief Gets the value of keyword.
+ * @details This function gets the value of keyword.
+ * @since_tizen 2.4
+ * @remarks @a keyword must be released using free().
+ *
+ * @param[in] filter The handle of the place filter
+ * @param[out] keyword The key of filter
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a filter is created using maps_place_filter_create().
+ *
+ * @see maps_place_filter_set_keyword()
+ * @see maps_place_filter_create()
+ */
+int maps_place_filter_get_keyword(const maps_place_filter_h filter,
+ char **keyword);
+
+/**
+ * @brief Gets the place name.
+ * @details This function gets the place name.
+ * @since_tizen 2.4
+ * @remarks @a place_name must be released using free().
+ *
+ * @param[in] filter The handle of the place filter
+ * @param[out] place_name The place name
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a filter is created using maps_place_filter_create().
+ *
+ * @see maps_place_filter_set_place_name()
+ * @see maps_place_filter_create()
+ */
+int maps_place_filter_get_place_name(const maps_place_filter_h filter,
+ char **place_name);
+
+/**
+ * @brief Gets the category.
+ * @details This function gets the category.
+ * \n For allowed values of keys, see the macros above.
+ * @since_tizen 2.4
+ * @remarks @a category must be released using maps_place_category_destroy().
+ *
+ * @param[in] filter The handle of the place filter
+ * @param[out] category The category
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a filter is created using maps_place_filter_create().
+ *
+ * @see maps_place_filter_set_category()
+ * @see maps_place_filter_create()
+ */
+int maps_place_filter_get_category(const maps_place_filter_h filter,
+ maps_place_category_h *category);
+
+/**
+ * @brief Retrieves all filter properties.
+ * @details This function retrieves all place filter properties.
+ * @since_tizen 2.4
+ *
+ * @param[in] filter The handle of the place filter
+ * @param[in] callback The callback function to invoke
+ * @param[in] user_data The user data to be passed to the callback
+ * function
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NOT_FOUND Result not found
+ *
+ * @pre @a filter is created using maps_place_filter_create().
+ *
+ * @post This function invokes maps_place_filter_properties_cb() repeatedly to
+ * retrieve each available filter keys.
+ *
+ * @see maps_place_filter_properties_cb()
+ * @see maps_place_filter_get()
+ * @see maps_place_filter_set()
+ * @see maps_place_filter_create()
+ */
+int maps_place_filter_foreach_property(const maps_place_filter_h filter,
+ maps_place_filter_properties_cb
+ callback, void *user_data);
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Sets the filter value.
+ * @details This function sets the filter value in an assignment with a
+ * specified string key.
+ * @since_tizen 2.4
+ *
+ * @param[in] filter The handle of the place filter
+ * @param[in] key The key of filter
+ * @param[in] value The filter value to set, could be NULL if want remove
+ * value
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a filter is created using maps_place_filter_create().
+ *
+ * @see maps_place_filter_get()
+ * @see maps_place_filter_create()
+ */
+int maps_place_filter_set(maps_place_filter_h filter, const char *key,
+ const char *value);
+
+/**
+ * @brief Sets the keyword.
+ * @details This function sets the keyword.
+ * @since_tizen 2.4
+ *
+ * @param[in] filter The handle of the place filter
+ * @param[in] keyword The keyword
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a filter is created using maps_place_filter_create().
+ *
+ * @see maps_place_filter_get_keyword()
+ * @see maps_place_filter_create()
+ */
+int maps_place_filter_set_keyword(maps_place_filter_h filter,
+ const char *keyword);
+
+/**
+ * @brief Sets the place name.
+ * @details This function sets the place name.
+ * @since_tizen 2.4
+ *
+ * @param[in] filter The handle of the place filter
+ * @param[in] place_name The place name
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a filter is created using maps_place_filter_create().
+ *
+ * @see maps_place_filter_get_place_name()
+ * @see maps_place_filter_create()
+ */
+int maps_place_filter_set_place_name(maps_place_filter_h filter,
+ const char *place_name);
+
+/**
+ * @brief Sets the category.
+ * @details This function sets the place name.
+ * @since_tizen 2.4
+ *
+ * @param[in] filter The handle of the place filter
+ * @param[in] category The category
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a filter is created using maps_place_filter_create().
+ *
+ * @see maps_place_filter_get_category()
+ * @see maps_place_filter_create()
+ */
+int maps_place_filter_set_category(maps_place_filter_h filter,
+ const maps_place_category_h category);
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+#endif /* __MAPS_PLACE_FILTER_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_PLACE_IMAGE_H__
+#define __MAPS_PLACE_IMAGE_H__
+
+#include <maps_place_link_object.h>
+#include <maps_place_media.h>
+
+/**
+ * @ingroup CAPI_MAPS_PLACE_MODULE
+ * @defgroup CAPI_MAPS_PLACE_IMAGE_MODULE Image
+ *
+ * @file maps_place_image.h
+ * @brief This function sets the place category id.
+ *
+ * @addtogroup CAPI_MAPS_PLACE_IMAGE_MODULE
+ * @{
+ * @brief This provides APIs related to Place Image information, used in Place
+ * Discovery and Search.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief The Place Image handle
+ * @details The handle of Place Image instance.
+ * @remarks To release the handle use maps_place_image_destroy().
+ * \n To clone the handle use maps_place_image_clone().
+ * @since_tizen 2.4
+ *
+ * @see maps_place_image_destroy()
+ * @see maps_place_image_clone()
+ */
+typedef void *maps_place_image_h;
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Destroys the place image handle and releases all its resources.
+ * @details This function destroys the place image handle and releases all its
+ * resources.
+ * @since_tizen 2.4
+ *
+ * @param[in] image The place image handle to destroy
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_place_image_clone()
+ */
+int maps_place_image_destroy(maps_place_image_h image);
+
+/**
+ * @brief Clones the place image handle.
+ * @details This function clones the place image handle @a origin and all its
+ * resources.
+ * @since_tizen 2.4
+ * @remarks @a cloned must be released using maps_place_image_destroy().
+ *
+ * @param[in] origin The original place image handle
+ * @param[out] cloned A cloned place image handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_place_image_destroy()
+ */
+int maps_place_image_clone(const maps_place_image_h origin,
+ maps_place_image_h *cloned);
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Gets the place image id.
+ * @details This function gets the place image id.
+ * @since_tizen 2.4
+ * @remarks @a id must be released using free().
+ *
+ * @param[in] image The handle of place image
+ * @param[out] id The place image id
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_place_image_get_id(const maps_place_image_h image, char **id);
+
+/**
+ * @brief Gets the place image URL.
+ * @details This function gets the place image URL.
+ * @since_tizen 2.4
+ * @remarks @a url must be released using free().
+ *
+ * @param[in] image The handle of place image
+ * @param[out] url The place image url
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_place_image_get_url(const maps_place_image_h image, char **url);
+
+/**
+ * @brief Gets the place image width.
+ * @details This function gets the place image width.
+ * @since_tizen 2.4
+ *
+ * @param[in] image The handle of place image
+ * @param[out] width The place image width
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_place_image_get_width(const maps_place_image_h image, int *width);
+
+/**
+ * @brief Gets the place image height.
+ * @details This function gets the place image height.
+ * @since_tizen 2.4
+ *
+ * @param[in] image The handle of place image
+ * @param[out] height The place image height
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_place_image_get_height(const maps_place_image_h image, int *height);
+
+/**
+ * @brief Gets the place image user link.
+ * @details This function gets the place image user link.
+ * @since_tizen 2.4
+ * @remarks @a user must be released using maps_place_link_object_destroy().
+ *
+ * @param[in] image The handle of place image
+ * @param[out] user The place image user link
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see #maps_place_link_object_h
+ */
+int maps_place_image_get_user_link(const maps_place_image_h image,
+ maps_place_link_object_h *user);
+
+/**
+ * @brief Gets the place image media.
+ * @details This function gets the place image media.
+ * @since_tizen 2.4
+ * @remarks @a media must be released using maps_place_media_destroy().
+ *
+ * @param[in] image The handle of place image
+ * @param[out] media The place image media
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see #maps_place_media_h
+ */
+int maps_place_image_get_media(const maps_place_image_h image,
+ maps_place_media_h *media);
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+#endif /* __MAPS_PLACE_IMAGE_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_PLACE_IMAGE_PLUGIN_H__
+#define __MAPS_PLACE_IMAGE_PLUGIN_H__
+
+#include <maps_place_image.h>
+
+/**
+ * @ingroup CAPI_MAPS_PLUGIN_PLACE_MODULE
+ * @defgroup CAPI_MAPS_PLUGIN_PLACE_IMAGE_MODULE Image
+ *
+ * @file maps_place_image_plugin.h
+ * @brief This file contains the functions related to Place Image
+ * information, needed in plug-in development.
+ *
+ * @addtogroup CAPI_MAPS_PLUGIN_PLACE_IMAGE_MODULE
+ * @{
+ * @brief This provides APIs related to Place Image, used in Place
+ * Discovery and Search, needed in plug-in development.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Creates a new place image handle.
+ * @details This function creates a new place image handle and allocates all
+ * needed resources.
+ * @since_tizen 2.4
+ * @remarks @a image must be released using maps_place_image_destroy().
+ * \n @a image may be cloned using maps_place_image_clone().
+ *
+ * @param[out] image A handle of a new place image on success
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_place_image_destroy()
+ * @see maps_place_image_clone()
+ */
+int maps_place_image_create(maps_place_image_h *image);
+
+/**
+ * @brief Sets the place image id.
+ * @details This function sets the place image id.
+ * @since_tizen 2.4
+ *
+ * @param[in] image The handle of place image
+ * @param[in] id The place image id
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a image is created using maps_place_image_create().
+ *
+ * @see maps_place_image_create()
+ * @see maps_place_image_get_id()
+ */
+int maps_place_image_set_id(maps_place_image_h image, const char *id);
+
+/**
+ * @brief Sets the place image URL.
+ * @details This function sets the place image URL.
+ * @since_tizen 2.4
+ *
+ * @param[in] image The handle of place image
+ * @param[in] url The place image url
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a image is created using maps_place_image_create().
+ *
+ * @see maps_place_image_create()
+ * @see maps_place_image_get_url()
+ */
+int maps_place_image_set_url(maps_place_image_h image, const char *url);
+
+/**
+ * @brief Sets the place image width.
+ * @details This function sets the place image width.
+ * @since_tizen 2.4
+ *
+ * @param[in] image The handle of place image
+ * @param[in] width The place image width
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a image is created using maps_place_image_create().
+ *
+ * @see maps_place_image_create()
+ * @see maps_place_image_get_width()
+ */
+int maps_place_image_set_width(maps_place_image_h image, const int width);
+
+/**
+ * @brief Sets the place image height.
+ * @details This function sets the place image height.
+ * @since_tizen 2.4
+ *
+ * @param[in] image The handle of place image
+ * @param[in] height The place image height
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a image is created using maps_place_image_create().
+ *
+ * @see maps_place_image_create()
+ * @see maps_place_image_get_height()
+ */
+int maps_place_image_set_height(maps_place_image_h image, const int height);
+
+/**
+ * @brief Sets the place image user link.
+ * @details This function sets the place image user link.
+ * @since_tizen 2.4
+ *
+ * @param[in] image The handle of place image
+ * @param[in] user The place image user link
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a image is created using maps_place_image_create().
+ *
+ * @see maps_place_image_create()
+ * @see maps_place_image_get_user_link()
+ * @see #maps_place_link_object_h
+ */
+int maps_place_image_set_user_link(maps_place_image_h image,
+ const maps_place_link_object_h user);
+
+/**
+ * @brief Sets the place image media.
+ * @details This function sets the place image media.
+ * @since_tizen 2.4
+ *
+ * @param[in] image The handle of place image
+ * @param[in] media The place image media
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a image is created using maps_place_image_create().
+ *
+ * @see maps_place_image_create()
+ * @see maps_place_image_get_media()
+ * @see #maps_place_media_h
+ */
+int maps_place_image_set_media(maps_place_image_h image,
+ const maps_place_media_h media);
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+#endif /* __MAPS_PLACE_IMAGE_PLUGIN_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_PLACE_LINK_OBJECT_H__
+#define __MAPS_PLACE_LINK_OBJECT_H__
+
+/**
+ * @ingroup CAPI_MAPS_PLACE_MODULE
+ * @defgroup CAPI_MAPS_PLACE_LINK_MODULE Link
+ *
+ * @file maps_place_link_object.h
+ * @brief This file contains the functions related to Place Link Object
+ * information.
+ *
+ * @addtogroup CAPI_MAPS_PLACE_LINK_MODULE
+ * @{
+ * @brief This provides APIs related to Place Link Object information, used in
+ * Place Discovery and Search.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/**
+ * @brief The Place Link Object handle
+ * @details The handle of Place Link Object instance.
+ * @remarks To release the handle use maps_place_link_object_destroy().
+ * \n To clone the handle use maps_place_link_object_clone().
+ * @since_tizen 2.4
+ *
+ * @see maps_place_link_object_destroy()
+ * @see maps_place_link_object_clone()
+ */
+typedef void *maps_place_link_object_h;
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Destroys the place link object handle and releases all its
+ * resources.
+ * @details This function destroys the place link object handle and releases all
+ * its resources.
+ * @since_tizen 2.4
+ *
+ * @param[in] link The place link object handle to destroy
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_place_link_object_clone()
+ */
+int maps_place_link_object_destroy(maps_place_link_object_h link);
+
+/**
+ * @brief Clones the place link object handle.
+ * @details This function clones the place link object handle @a origin and all
+ * its resources.
+ * @since_tizen 2.4
+ * @remarks @a cloned must be released using maps_place_link_object_destroy().
+ *
+ * @param[in] origin The original place link object handle
+ * @param[out] cloned A cloned place link object handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_place_link_object_destroy()
+ */
+int maps_place_link_object_clone(const maps_place_link_object_h origin,
+ maps_place_link_object_h *cloned);
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Gets the place link object id.
+ * @details This function gets the place link object id.
+ * @since_tizen 2.4
+ * @remarks @a id must be released using free().
+ *
+ * @param[in] link The handle of place link object
+ * @param[out] id The place link object id
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_place_link_object_get_id(const maps_place_link_object_h link,
+ char **id);
+
+/**
+ * @brief Gets the place link object name.
+ * @details This function gets the place link object name.
+ * @since_tizen 2.4
+ * @remarks @a name must be released using free().
+ *
+ * @param[in] link The handle of place link object
+ * @param[out] name The place link object name
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_place_link_object_get_name(const maps_place_link_object_h link,
+ char **name);
+
+/**
+ * @brief Gets the place link object string.
+ * @details This function gets the place link object string.
+ * @since_tizen 2.4
+ * @remarks @a string must be released using free().
+ *
+ * @param[in] link The handle of place link object
+ * @param[out] string The place link object string
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_place_link_object_get_string(const maps_place_link_object_h link,
+ char **string);
+
+/**
+ * @brief Gets the place link object type.
+ * @details This function gets the place link object type.
+ * @since_tizen 2.4
+ * @remarks @a type must be released using free().
+ *
+ * @param[in] link The handle of place link object
+ * @param[out] type The place link object type
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_place_link_object_get_type(const maps_place_link_object_h link,
+ char **type);
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+#endif /* __MAPS_PLACE_LINK_OBJECT_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_PLACE_LINK_OBJECT_PLUGIN_H__
+#define __MAPS_PLACE_LINK_OBJECT_PLUGIN_H__
+
+#include <maps_place_link_object.h>
+
+/**
+ * @ingroup CAPI_MAPS_PLUGIN_PLACE_MODULE
+ * @defgroup CAPI_MAPS_PLUGIN_PLACE_LINK_MODULE Link
+ *
+ * @file maps_place_link_object_plugin.h
+ * @brief This file contains the functions related to Place Link Object
+ * information, needed in plug-in development.
+ *
+ * @addtogroup CAPI_MAPS_PLUGIN_PLACE_LINK_MODULE
+ * @{
+ * @brief This provides APIs related to Place Link Object, used in
+ * Place Discovery and Search, needed in plug-in development.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Creates a new place link object handle.
+ * @details This function creates a new place link object handle and allocates
+ * all needed resources.
+ * @since_tizen 2.4
+ * @remarks @a link must be released using maps_place_link_object_destroy().
+ * \n @a link may be cloned using maps_place_link_object_clone().
+ *
+ * @param[out] link A handle of a new place link object on success
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_place_link_object_destroy()
+ * @see maps_place_link_object_clone()
+ */
+int maps_place_link_object_create(maps_place_link_object_h *link);
+
+/**
+ * @brief Sets the place link object id.
+ * @details This function sets the place link object id.
+ * @since_tizen 2.4
+ *
+ * @param[in] link The handle of place link object
+ * @param[in] id The place link object id
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a link is created using maps_place_link_object_create().
+ *
+ * @see maps_place_link_object_create()
+ * @see maps_place_link_object_get_id()
+ */
+int maps_place_link_object_set_id(maps_place_link_object_h link,
+ const char *id);
+
+/**
+ * @brief Sets the place link object string.
+ * @details This function sets the place link object string.
+ * @since_tizen 2.4
+ *
+ * @param[in] link The handle of place link object
+ * @param[in] string The place link object string
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a link is created using maps_place_link_object_create().
+ *
+ * @see maps_place_link_object_create()
+ * @see maps_place_link_object_get_string()
+ */
+int maps_place_link_object_set_string(maps_place_link_object_h link,
+ const char *string);
+
+/**
+ * @brief Sets the place link object type.
+ * @details This function sets the place link object type.
+ * @since_tizen 2.4
+ *
+ * @param[in] link The handle of place link object
+ * @param[in] type The place link object type
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a link is created using maps_place_link_object_create().
+ *
+ * @see maps_place_link_object_create()
+ * @see maps_place_link_object_get_type()
+ */
+int maps_place_link_object_set_type(maps_place_link_object_h link,
+ const char *type);
+
+/**
+ * @brief Sets the place link object name.
+ * @details This function sets the place link object name.
+ * @since_tizen 2.4
+ *
+ * @param[in] link The handle of place link object
+ * @param[in] name The place link object name
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a link is created using maps_place_link_object_create().
+ *
+ * @see maps_place_link_object_create()
+ * @see maps_place_link_object_get_name()
+ */
+int maps_place_link_object_set_name(maps_place_link_object_h link,
+ const char *name);
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+#endif /* __MAPS_PLACE_LINK_OBJECT_PLUGIN_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_PLACE_MEDIA_H__
+#define __MAPS_PLACE_MEDIA_H__
+
+#include <maps_place_link_object.h>
+
+/**
+ * @ingroup CAPI_MAPS_PLACE_MODULE
+ * @defgroup CAPI_MAPS_PLACE_MEDIA_MODULE Media
+ *
+ * @file maps_place_media.h
+ * @brief This file contains the functions related to Place Media information.
+ *
+ * @addtogroup CAPI_MAPS_PLACE_MEDIA_MODULE
+ * @{
+ * @brief This provides APIs related to Place Media information, used in Place
+ * Discovery and Search.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief The Place Media handle
+ * @details The handle of Place Media instance.
+ * @remarks To release the handle use maps_place_media_destroy().
+ * \n To clone the handle use maps_place_media_clone().
+ * @since_tizen 2.4
+ *
+ * @see maps_place_media_destroy()
+ * @see maps_place_media_clone()
+ */
+typedef void *maps_place_media_h;
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Destroys the place media handle and releases all its resources.
+ * @details This function destroys the place media handle and releases all its
+ * resources.
+ * @since_tizen 2.4
+ *
+ * @param[in] media The place media handle to destroy
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_place_media_clone()
+ */
+int maps_place_media_destroy(maps_place_media_h media);
+
+/**
+ * @brief Clones the place media handle.
+ * @details This function clones the place media handle @a origin and all its
+ * resources.
+ * @since_tizen 2.4
+ * @remarks @a cloned must be released using maps_place_media_destroy().
+ *
+ * @param[in] origin The original place media handle
+ * @param[out] cloned A cloned place media handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_place_media_destroy()
+ */
+int maps_place_media_clone(const maps_place_media_h origin,
+ maps_place_media_h *cloned);
+
+/*---------------------------------------------------------------------------*/
+
+/**
+ * @brief Gets the place media attribution.
+ * @details This function gets the place media attribution.
+ * @since_tizen 2.4
+ * @remarks @a attribution must be released using free().
+ *
+ * @param[in] media The handle of place media
+ * @param[out] attribution The place media attribution
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_place_media_get_attribution(const maps_place_media_h media,
+ char **attribution);
+
+/**
+ * @brief Gets the place media supplier link.
+ * @details This function gets the place media supplier link.
+ * @since_tizen 2.4
+ * @remarks @a supplier must be released using maps_place_link_object_destroy().
+ *
+ * @param[in] media The handle of place media
+ * @param[out] supplier The place media supplier link
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see #maps_place_link_object_h
+ */
+int maps_place_media_get_supplier(const maps_place_media_h media,
+ maps_place_link_object_h *supplier);
+
+/**
+ * @brief Gets the place media "via" link.
+ * @details This function gets the place media "via" link.
+ * @since_tizen 2.4
+ * @remarks @a via must be released using maps_place_link_object_destroy().
+ *
+ * @param[in] media The handle of place media
+ * @param[out] via The place media via link
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see #maps_place_link_object_h
+ */
+int maps_place_media_get_via(const maps_place_media_h media,
+ maps_place_link_object_h *via);
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+#endif /* __MAPS_PLACE_MEDIA_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_PLACE_MEDIA_PLUGIN_H__
+#define __MAPS_PLACE_MEDIA_PLUGIN_H__
+
+#include <maps_place_media.h>
+
+/**
+ * @ingroup CAPI_MAPS_PLUGIN_PLACE_MODULE
+ * @defgroup CAPI_MAPS_PLUGIN_PLACE_MEDIA_MODULE Media
+ *
+ * @file maps_place_media_plugin.h
+ * @brief This file contains the functions related to Place Media
+ * information, needed in plug-in development.
+ *
+ * @addtogroup CAPI_MAPS_PLUGIN_PLACE_MEDIA_MODULE
+ * @{
+ * @brief This provides APIs related to Place Media, used in Place
+ * Discovery and Search, needed in plug-in development.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Creates a new place media handle.
+ * @details This function creates a new place media handle and allocates all
+ * needed resources.
+ * @since_tizen 2.4
+ * @remarks @a media must be released using maps_place_media_destroy().
+ * \n @a media may be cloned using maps_place_media_clone().
+ *
+ * @param[out] media A handle of a new place media on success
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_place_media_destroy()
+ * @see maps_place_media_clone()
+ */
+int maps_place_media_create(maps_place_media_h *media);
+
+/**
+ * @brief Sets the place media attribution.
+ * @details This function sets the place media attribution.
+ * @since_tizen 2.4
+ *
+ * @param[in] media The handle of place media
+ * @param[in] attribution The place media attribution
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a media is created using maps_place_media_create().
+ *
+ * @see maps_place_media_create()
+ * @see maps_place_media_get_attribution()
+ */
+int maps_place_media_set_attribution(maps_place_media_h media,
+ const char *attribution);
+
+/**
+ * @brief Sets the place media supplier link.
+ * @details This function sets the place media supplier link.
+ * @since_tizen 2.4
+ *
+ * @param[in] media The handle of place media
+ * @param[in] supplier The place media supplier link
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a media is created using maps_place_media_create().
+ *
+ * @see maps_place_media_create()
+ * @see maps_place_media_get_supplier()
+ */
+int maps_place_media_set_supplier(maps_place_media_h media,
+ const maps_place_link_object_h supplier);
+
+/**
+ * @brief Sets the place media via link.
+ * @details This function sets the place media via link.
+ * @since_tizen 2.4
+ *
+ * @param[in] media The handle of place media
+ * @param[in] via The place media via link
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a media is created using maps_place_media_create().
+ *
+ * @see maps_place_media_create()
+ * @see maps_place_media_get_via()
+ */
+int maps_place_media_set_via(maps_place_media_h media,
+ const maps_place_link_object_h via);
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+#endif /* __MAPS_PLACE_MEDIA_PLUGIN_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_PLACE_PLUGIN_H__
+#define __MAPS_PLACE_PLUGIN_H__
+
+#include <maps_place.h>
+#include <maps_extra_types.h>
+
+/**
+ * @ingroup CAPI_MAPS_PLUGIN_MODULE
+ * @defgroup CAPI_MAPS_PLUGIN_PLACE_MODULE Places
+ */
+
+/**
+ * @ingroup CAPI_MAPS_PLUGIN_PLACE_MODULE
+ * @defgroup CAPI_MAPS_PLUGIN_PLACE_DATA_MODULE Place
+ *
+ * @file maps_place_plugin.h
+ * @brief This file contains the functions related to Place
+ * information, needed in plug-in development.
+ *
+ * @addtogroup CAPI_MAPS_PLUGIN_PLACE_DATA_MODULE
+ * @{
+ * @brief This provides APIs related to Place information, used in
+ * Place Discovery and Search, needed in plug-in development.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Creates a new place handle.
+ * @details This function creates a new place handle and allocates all needed
+ * resources.
+ * @since_tizen 2.4
+ * @remarks @a place must be released using maps_place_destroy().
+ * \n @a place may be cloned using maps_place_clone().
+ *
+ * @param[in] place A handle of a new place on success
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_place_destroy()
+ * @see maps_place_clone()
+ */
+int maps_place_create(maps_place_h *place);
+
+/**
+ * @brief Sets the place id.
+ * @details This function sets the place id.
+ * @since_tizen 2.4
+ *
+ * @param[in] place The handle to place
+ * @param[in] id The place id
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a place is created using maps_place_create().
+ *
+ * @see maps_place_create()
+ * @see maps_place_get_related_link()
+ */
+int maps_place_set_id(maps_place_h place, const char *id);
+
+/**
+ * @brief Sets the place name.
+ * @details This function sets the place name.
+ * @since_tizen 2.4
+ *
+ * @param[in] place The handle to place
+ * @param[in] name The place name
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a place is created using maps_place_create().
+ *
+ * @see maps_place_create()
+ * @see maps_place_get_name()
+ */
+int maps_place_set_name(maps_place_h place, const char *name);
+
+/**
+ * @brief Sets the place location.
+ * @details This function sets the place location.
+ * @since_tizen 2.4
+ *
+ * @param[in] place The handle to place
+ * @param[in] location The place location
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a place is created using maps_place_create().
+ *
+ * @see maps_place_create()
+ * @see maps_place_get_location()
+ */
+int maps_place_set_location(maps_place_h place,
+ const maps_coordinates_h location);
+
+/**
+ * @brief Sets the place distance from the center of the location.
+ * @details This function sets the place distance from the center of the
+ * location.
+ * @since_tizen 2.4
+ *
+ * @param[in] place The handle to place
+ * @param[in] distance The place distance
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a place is created using maps_place_create().
+ *
+ * @see maps_place_create()
+ * @see maps_place_get_distance()
+ */
+int maps_place_set_distance(maps_place_h place, const int distance);
+
+/**
+ * @brief Sets the place address.
+ * @details This function sets the place address.
+ * @since_tizen 2.4
+ *
+ * @param[in] place The handle to place
+ * @param[in] address The place address
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a place is created using maps_place_create().
+ *
+ * @see maps_place_create()
+ * @see maps_place_get_address()
+ */
+int maps_place_set_address(maps_place_h place, const maps_address_h address);
+
+/**
+ * @brief Sets the place categories.
+ * @details This function sets the place categories.
+ * @since_tizen 2.4
+ *
+ * @param[in] place The handle to place
+ * @param[in] categories The place category list
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a place is created using maps_place_create().
+ *
+ * @see maps_place_create()
+ * @see maps_place_foreach_category()
+ */
+int maps_place_set_categories(maps_place_h place,
+ const maps_item_list_h categories);
+
+/**
+ * @brief Sets the place view URI.
+ * @details This function sets the place URI.
+ * @since_tizen 2.4
+ *
+ * @param[in] place The handle to place
+ * @param[in] uri The place view uri
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a place is created using maps_place_create().
+ *
+ * @see maps_place_create()
+ * @see maps_place_get_uri()
+ */
+int maps_place_set_uri(maps_place_h place, const char *uri);
+
+/**
+ * @brief Sets the place attributes.
+ * @details This function sets the place attributes.
+ * @since_tizen 2.4
+ *
+ * @param[in] place The handle to place
+ * @param[in] attributes The place attribute list
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a place is created using maps_place_create().
+ *
+ * @see maps_place_create()
+ * @see maps_place_foreach_attribute()
+ */
+int maps_place_set_attributes(maps_place_h place,
+ const maps_item_list_h attributes);
+
+/**
+ * @brief Sets the place contacts.
+ * @details This function sets the place contacts.
+ * @since_tizen 2.4
+ *
+ * @param[in] place The handle to place
+ * @param[in] contacts The place contact list
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a place is created using maps_place_create().
+ *
+ * @see maps_place_create()
+ * @see maps_place_foreach_contact()
+ */
+int maps_place_set_contacts(maps_place_h place,
+ const maps_item_list_h contacts);
+
+/**
+ * @brief Sets the place editorials.
+ * @details This function sets the place editorials.
+ * @since_tizen 2.4
+ *
+ * @param[in] place The handle to place
+ * @param[in] editorials The place editorial list
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a place is created using maps_place_create().
+ *
+ * @see maps_place_create()
+ * @see maps_place_foreach_editorial()
+ */
+int maps_place_set_editorials(maps_place_h place,
+ const maps_item_list_h editorials);
+
+/**
+ * @brief Sets the place images.
+ * @details This function sets the place images.
+ * @since_tizen 2.4
+ *
+ * @param[in] place The handle to place
+ * @param[in] images The place image list
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a place is created using maps_place_create().
+ *
+ * @see maps_place_create()
+ * @see maps_place_foreach_image()
+ */
+int maps_place_set_images(maps_place_h place, const maps_item_list_h images);
+
+/**
+ * @brief Sets the place review.
+ * @details This function sets the place reviews.
+ * @since_tizen 2.4
+ *
+ * @param[in] place The handle to place
+ * @param[in] reviews The place review list
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a place is created using maps_place_create().
+ *
+ * @see maps_place_create()
+ * @see maps_place_foreach_review()
+ */
+int maps_place_set_reviews(maps_place_h place,
+ const maps_item_list_h reviews);
+
+/**
+ * @brief Sets the place properties.
+ * @details This function sets the place properties.
+ * @since_tizen 2.4
+ *
+ * @param[in] place The handle to place
+ * @param[in] properties The place properties list
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a place is created using maps_place_create().
+ *
+ * @see maps_place_create()
+ * @see maps_place_foreach_property()
+ */
+int maps_place_set_properties(maps_place_h place,
+ const maps_item_hashtable_h properties);
+
+/**
+ * @brief Sets the place rating.
+ * @details This function sets the place rating.
+ * @since_tizen 2.4
+ *
+ * @param[in] place The handle to place image
+ * @param[in] rating The place rating
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a place is created using maps_place_create().
+ *
+ * @see maps_place_create()
+ * @see maps_place_get_rating()
+ */
+int maps_place_set_rating(maps_place_h place,
+ const maps_place_rating_h rating);
+
+/**
+ * @brief Sets the place supplier link.
+ * @details This function sets the place supplier link.
+ * @since_tizen 2.4
+ *
+ * @param[in] place The handle to place image
+ * @param[in] supplier The place supplier link
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a place is created using maps_place_create().
+ *
+ * @see maps_place_create()
+ * @see maps_place_get_supplier_link()
+ */
+int maps_place_set_supplier_link(maps_place_h place,
+ const maps_place_link_object_h supplier);
+
+/**
+ * @brief Sets the place related link.
+ * @details This function sets the place related link.
+ * @since_tizen 2.4
+ *
+ * @param[in] place The handle to place image
+ * @param[in] related The place related link
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a place is created using maps_place_create().
+ *
+ * @see maps_place_create()
+ * @see maps_place_get_related_link()
+ */
+int maps_place_set_related_link(maps_place_h place,
+ const maps_place_link_object_h related);
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+#endif /* __MAPS_PLACE_PLUGIN_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_PLACE_RATING_H__
+#define __MAPS_PLACE_RATING_H__
+
+#include <time.h>
+
+/**
+ * @ingroup CAPI_MAPS_PLACE_MODULE
+ * @defgroup CAPI_MAPS_PLACE_RATING_MODULE Rating
+ *
+ * @file maps_place_rating.h
+ * @brief This file contains the functions related to Place Rating information.
+ *
+ * @addtogroup CAPI_MAPS_PLACE_RATING_MODULE
+ * @{
+ * @brief This provides APIs related to Place Rating information, used in Place
+ * Discovery and Search.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief The Place Rating handle
+ * @details The handle of Place Rating instance.
+ * @remarks To release the handle use maps_place_rating_destroy().
+ * \n To clone the handle use maps_place_rating_clone().
+ * @since_tizen 2.4
+ *
+ * @see maps_place_rating_destroy()
+ * @see maps_place_rating_clone()
+ */
+typedef void *maps_place_rating_h;
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Destroys the place rating handle and releases all its resources.
+ * @details This function destroys the place rating handle and releases all its
+ * resources.
+ * @since_tizen 2.4
+ *
+ * @param[in] rating The place rating handle to destroy
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_place_rating_clone()
+ */
+int maps_place_rating_destroy(maps_place_rating_h rating);
+
+/**
+ * @brief Clones the place rating handle.
+ * @details This function clones the place rating handle @a origin and all its
+ * resources.
+ * @since_tizen 2.4
+ * @remarks @a cloned must be released using maps_place_rating_destroy().
+ *
+ * @param[in] origin The original place rating handle
+ * @param[out] cloned A cloned place rating handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_place_rating_destroy()
+ */
+int maps_place_rating_clone(const maps_place_rating_h origin,
+ maps_place_rating_h *cloned);
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Gets the place rating count.
+ * @details This function gets the place rating count.
+ * @since_tizen 2.4
+ *
+ * @param[in] rating The handle to place rating handle
+ * @param[out] count The place rating count
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_place_rating_get_count(const maps_place_rating_h rating, int *count);
+
+/**
+ * @brief Gets the place rating average.
+ * @details This function gets the place rating average.
+ * @since_tizen 2.4
+ *
+ * @param[in] rating The handle to place rating handle
+ * @param[out] average The place average rating
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_place_rating_get_average(const maps_place_rating_h rating,
+ double *average);
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+#endif /* __MAPS_PLACE_RATING_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_PLACE_RATING_PLUGIN_H__
+#define __MAPS_PLACE_RATING_PLUGIN_H__
+
+#include <maps_place_rating.h>
+
+/**
+ * @ingroup CAPI_MAPS_PLUGIN_PLACE_MODULE
+ * @defgroup CAPI_MAPS_PLUGIN_PLACE_RATING_MODULE Rating
+ *
+ * @file maps_place_rating_plugin.h
+ * @brief This file contains the functions related to Place Rating
+ * information, needed in plug-in development.
+ *
+ * @addtogroup CAPI_MAPS_PLUGIN_PLACE_RATING_MODULE
+ * @{
+ * @brief This provides APIs related to Place Rating, used in Place
+ * Discovery and Search, needed in plug-in development.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Creates a new place rating handle.
+ * @details This function creates a new place rating handle and allocates all
+ * needed resources.
+ * @since_tizen 2.4
+ * @remarks @a rating must be released using maps_place_rating_destroy().
+ * \n @a rating may be cloned using maps_place_rating_clone().
+ *
+ * @param[out] rating A handle of a new place rating on success
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_place_rating_destroy()
+ * @see maps_place_rating_clone()
+ */
+int maps_place_rating_create(maps_place_rating_h *rating);
+
+/**
+ * @brief Sets the place rating count.
+ * @details This function sets the place rating count.
+ * @since_tizen 2.4
+ *
+ * @param[in] rating The handle of place rating
+ * @param[in] count The place rating count
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a rating is created using maps_place_rating_create().
+ *
+ * @see maps_place_rating_create()
+ * @see maps_place_rating_get_count()
+ */
+int maps_place_rating_set_count(maps_place_rating_h rating, const int count);
+
+/**
+ * @brief Sets the place rating average.
+ * @details This function sets the place rating average.
+ * @since_tizen 2.4
+ *
+ * @param[in] rating The handle of place rating
+ * @param[in] average The place rating average
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a rating is created using maps_place_rating_create().
+ *
+ * @see maps_place_rating_create()
+ * @see maps_place_rating_get_average()
+ */
+int maps_place_rating_set_average(maps_place_rating_h rating,
+ const double average);
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+#endif /* __MAPS_PLACE_RATING_PLUGIN_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_PLACE_REVIEW_H__
+#define __MAPS_PLACE_REVIEW_H__
+
+#include <maps_place_media.h>
+#include <maps_place_link_object.h>
+
+/**
+ * @ingroup CAPI_MAPS_PLACE_MODULE
+ * @defgroup CAPI_MAPS_PLACE_REVIEW_MODULE Review
+ *
+ * @file maps_place_review.h
+ * @brief This file contains the functions related to Place Review information.
+ *
+ * @addtogroup CAPI_MAPS_PLACE_REVIEW_MODULE
+ * @{
+ * @brief This provides APIs related to Place Review information, used in Place
+ * Discovery and Search.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief The Place Review handle
+ * @details The handle of Place Review instance.
+ * @remarks To release the handle use maps_place_review_destroy().
+ * \n To clone the handle use maps_place_review_clone().
+ * @since_tizen 2.4
+ *
+ * @see maps_place_review_destroy()
+ * @see maps_place_review_clone()
+ */
+typedef void *maps_place_review_h;
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Destroys the place review handle and releases all its resources.
+ * @details This function destroys the place review handle and releases all its
+ * resources.
+ * @since_tizen 2.4
+ *
+ * @param[in] review The place review handle to destroy
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_place_review_clone()
+ */
+int maps_place_review_destroy(maps_place_review_h review);
+
+/**
+ * @brief Clones the place review handle.
+ * @details This function clones the place review handle @a origin and all its
+ * resources.
+ * @since_tizen 2.4
+ * @remarks @a cloned must be released using maps_place_review_destroy().
+ *
+ * @param[in] origin The original place review handle
+ * @param[out] cloned A cloned place review handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_place_review_destroy()
+ */
+int maps_place_review_clone(const maps_place_review_h origin,
+ maps_place_review_h *cloned);
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Gets the place review date.
+ * @details This function gets the place review date.
+ * @since_tizen 2.4
+ * @remarks @a date must be released using free().
+ *
+ * @param[in] review The handle to place review
+ * @param[out] date The place review date
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_place_review_get_date(const maps_place_review_h review, char **date);
+
+/**
+ * @brief Gets the place review title.
+ * @details This function gets the place review title.
+ * @since_tizen 2.4
+ * @remarks @a title must be released using free().
+ *
+ * @param[in] review The handle to place review
+ * @param[out] title The place review title
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_place_review_get_title(const maps_place_review_h review,
+ char **title);
+
+/**
+ * @brief Gets the place review rating.
+ * @details This function gets the place review rating.
+ * @since_tizen 2.4
+ *
+ * @param[in] review The handle to place review
+ * @param[out] rating The place review rating
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_place_review_get_rating(const maps_place_review_h review,
+ double *rating);
+
+/**
+ * @brief Gets the place review description.
+ * @details This function gets the place review description.
+ * @since_tizen 2.4
+ * @remarks @a description must be released using free().
+ *
+ * @param[in] review The handle to place review
+ * @param[out] description The place review description
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_place_review_get_description(const maps_place_review_h review,
+ char **description);
+
+/**
+ * @brief Gets the place review language.
+ * @details This function gets the place review language.
+ * @since_tizen 2.4
+ * @remarks @a language must be released using free().
+ *
+ * @param[in] review The handle to place review
+ * @param[out] language The place review language
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_place_review_get_language(const maps_place_review_h review,
+ char **language);
+
+/**
+ * @brief Gets the place review media.
+ * @details This function gets the place review media.
+ * @since_tizen 2.4
+ * @remarks @a media must be released using maps_place_media_destroy().
+ *
+ * @param[in] review The handle to place review
+ * @param[out] media The place review media
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see #maps_place_media_h
+ */
+int maps_place_review_get_media(const maps_place_review_h review,
+ maps_place_media_h *media);
+
+/**
+ * @brief Gets the place review user link.
+ * @details This function gets the place review user link.
+ * @since_tizen 2.4
+ * @remarks @a user must be released using maps_place_link_object_destroy().
+ *
+ * @param[in] review The handle to place review
+ * @param[out] user The place review user link
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see #maps_place_link_object_h
+ */
+int maps_place_review_get_user_link(const maps_place_review_h review,
+ maps_place_link_object_h *user);
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+#endif /* __MAPS_PLACE_REVIEW_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_PLACE_REVIEW_PLUGIN_H__
+#define __MAPS_PLACE_REVIEW_PLUGIN_H__
+
+#include <maps_place_media.h>
+#include <maps_place_link_object.h>
+
+#include <maps_place_review.h>
+
+/**
+ * @ingroup CAPI_MAPS_PLUGIN_PLACE_MODULE
+ * @defgroup CAPI_MAPS_PLUGIN_PLACE_REVIEW_MODULE Review
+ *
+ * @file maps_place_review_plugin.h
+ * @brief This file contains the functions related to Place Review
+ * information, needed in plug-in development.
+ *
+ * @addtogroup CAPI_MAPS_PLUGIN_PLACE_REVIEW_MODULE
+ * @{
+ * @brief This provides APIs related to Place Review, used in Place
+ * Discovery and Search, needed in plug-in development.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Creates a new place review handle.
+ * @details This function creates a new place review handle and allocates all
+ * needed resources.
+ * @since_tizen 2.4
+ * @remarks @a review must be released using maps_place_review_destroy().
+ * \n @a review may be cloned using maps_place_review_clone().
+ *
+ * @param[out] review A handle of a new place review on success
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_place_review_destroy()
+ * @see maps_place_review_clone()
+ */
+int maps_place_review_create(maps_place_review_h *review);
+
+/**
+ * @brief Sets the place review date.
+ * @details This function sets the place review date.
+ * @since_tizen 2.4
+ *
+ * @param[in] review The handle to place review
+ * @param[in] date The place review date
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a review is created using maps_place_review_create().
+ *
+ * @see maps_place_review_create()
+ * @see maps_place_review_get_date()
+ */
+int maps_place_review_set_date(maps_place_review_h review, const char *date);
+
+/**
+ * @brief Sets the place review title.
+ * @details This function sets the place review title.
+ * @since_tizen 2.4
+ *
+ * @param[in] review The handle to place review
+ * @param[in] title The place review title
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a review is created using maps_place_review_create().
+ *
+ * @see maps_place_review_create()
+ * @see maps_place_review_get_title()
+ */
+int maps_place_review_set_title(maps_place_review_h review,
+ const char *title);
+
+/**
+ * @brief Sets the place review rating.
+ * @details This function sets the place review rating.
+ * @since_tizen 2.4
+ *
+ * @param[in] review The handle to place review
+ * @param[in] rating The place review rating
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a review is created using maps_place_review_create().
+ *
+ * @see maps_place_review_create()
+ * @see maps_place_review_get_rating()
+ */
+int maps_place_review_set_rating(maps_place_review_h review,
+ const double rating);
+
+/**
+ * @brief Sets the place review description.
+ * @details This function sets the place review description.
+ * @since_tizen 2.4
+ *
+ * @param[in] review The handle to place review
+ * @param[in] description The place review description
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a review is created using maps_place_review_create().
+ *
+ * @see maps_place_review_create()
+ * @see maps_place_review_get_description()
+ */
+int maps_place_review_set_description(maps_place_review_h review,
+ const char *description);
+
+/**
+ * @brief Sets the place review language.
+ * @details This function sets the place review language.
+ * @since_tizen 2.4
+ *
+ * @param[in] review The handle to place review
+ * @param[in] language The place review language
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a review is created using maps_place_review_create().
+ *
+ * @see maps_place_review_create()
+ * @see maps_place_review_get_language()
+ */
+int maps_place_review_set_language(maps_place_review_h review,
+ const char *language);
+
+/**
+ * @brief Sets the place review media.
+ * @details This function sets the place review media.
+ * @since_tizen 2.4
+ *
+ * @param[in] review The handle to place review
+ * @param[in] media The place review media
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a review is created using maps_place_review_create().
+ *
+ * @see maps_place_review_create()
+ * @see maps_place_review_get_media()
+ * @see #maps_place_media_h
+ */
+int maps_place_review_set_media(maps_place_review_h review,
+ const maps_place_media_h media);
+
+/**
+ * @brief Sets the place review user link.
+ * @details This function sets the place review user link.
+ * @since_tizen 2.4
+ *
+ * @param[in] review The handle to place review
+ * @param[in] user The place review user link
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a review is created using maps_place_review_create().
+ *
+ * @see maps_place_review_create()
+ * @see maps_place_review_get_user_link()
+ * @see #maps_place_link_object_h
+ */
+int maps_place_review_set_user_link(maps_place_review_h review,
+ const maps_place_link_object_h user);
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+#endif /* __MAPS_PLACE_REVIEW_PLUGIN_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_PLACE_URL_H__
+#define __MAPS_PLACE_URL_H__
+
+/**
+ * @ingroup CAPI_MAPS_PLACE_MODULE
+ * @defgroup CAPI_MAPS_PLACE_URL_MODULE URL
+ *
+ * @file maps_place_url.h
+ * @brief This file contains the functions related to Place URL information.
+ *
+ * @addtogroup CAPI_MAPS_PLACE_URL_MODULE
+ * @{
+ * @brief This provides APIs related to Place URL information, used in Place
+ * Discovery and Search.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/**
+ * @brief The Place URL handle
+ * @details The handle of Place URL instance.
+ * @remarks To release the handle use maps_place_url_destroy().
+ * \n To clone the handle use maps_place_url_clone().
+ * @since_tizen 2.4
+ *
+ * @see maps_place_url_destroy()
+ * @see maps_place_url_clone()
+ */
+typedef void *maps_place_url_h;
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Destroys the place URL handle and releases all its resources.
+ * @details This function destroys the place URL handle and releases all its
+ * resources.
+ * @since_tizen 2.4
+ *
+ * @param[in] url The place URL handle to destroy
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_place_url_clone()
+ */
+int maps_place_url_destroy(maps_place_url_h url);
+
+/**
+ * @brief Clones the place URL handle.
+ * @details This function clones the place URL handle @a origin and all its
+ * resources.
+ * @since_tizen 2.4
+ * @remarks @a cloned must be released using maps_place_url_destroy().
+ *
+ * @param[in] origin The original place url handle
+ * @param[out] cloned A cloned place url handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_place_url_destroy()
+ */
+int maps_place_url_clone(const maps_place_url_h origin,
+ maps_place_url_h *cloned);
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Gets the place URL path.
+ * @details This function gets the place URL path.
+ * @since_tizen 2.4
+ * @remarks @a path must be released using free().
+ *
+ * @param[in] url The handle to place url handle
+ * @param[out] path The place url path
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_place_url_get_path(const maps_place_url_h url, char **path);
+
+/**
+ * @brief Gets the place URL description.
+ * @details This function gets the place URL description.
+ * @since_tizen 2.4
+ * @remarks @a desc must be released using free().
+ *
+ * @param[in] url The handle to place url handle
+ * @param[out] desc The place url description
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_place_url_get_description(const maps_place_url_h url, char **desc);
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+#endif /* __MAPS_PLACE_URL_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_PLACE_URL_PLUGIN_H__
+#define __MAPS_PLACE_URL_PLUGIN_H__
+
+#include <maps_place_url.h>
+
+/**
+ * @ingroup CAPI_MAPS_PLUGIN_PLACE_MODULE
+ * @defgroup CAPI_MAPS_PLUGIN_PLACE_URL_MODULE URL
+ *
+ * @file maps_place_url_plugin.h
+ * @brief This file contains the functions related to Place URL
+ * information, needed in plug-in development.
+ *
+ * @addtogroup CAPI_MAPS_PLUGIN_PLACE_URL_MODULE
+ * @{
+ * @brief This provides APIs related to Place URL, used in Place
+ * Discovery and Search, needed in plug-in development.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Creates a new place URL handle.
+ * @details This function creates a new place URL handle and allocates all
+ * needed resources.
+ * @since_tizen 2.4
+ * @remarks @a url must be released using maps_place_url_destroy().
+ * \n @a url may be cloned using maps_place_url_clone().
+ *
+ * @param[out] url A handle of a new place URL on success
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_place_url_destroy()
+ * @see maps_place_url_clone()
+ */
+int maps_place_url_create(maps_place_url_h *url);
+
+/**
+ * @brief Sets the place URL path.
+ * @details This function sets the place URL path.
+ * @since_tizen 2.4
+ *
+ * @param[in] url The handle of place URL
+ * @param[in] path The place URL path
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a url is created using maps_place_url_create().
+ *
+ * @see maps_place_url_create()
+ * @see maps_place_url_get_path()
+ */
+int maps_place_url_set_path(maps_place_url_h url, const char *path);
+
+/**
+ * @brief Sets the place URL description.
+ * @details This function sets the place URL description.
+ * @since_tizen 2.4
+ *
+ * @param[in] url The handle of place URL
+ * @param[in] description The place URL description
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a url is created using maps_place_url_create().
+ *
+ * @see maps_place_url_create()
+ * @see maps_place_url_get_description()
+ */
+int maps_place_url_set_description(maps_place_url_h url,
+ const char *description);
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+#endif /* __MAPS_PLACE_URL_PLUGIN_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_PLUGIN_H__
+#define __MAPS_PLUGIN_H__
+
+#include <maps_service.h>
+#include <maps_plugin_info.h>
+#include <maps_extra_types.h>
+
+/**
+ *
+ * @ingroup CAPI_MAPS_PLUGIN_MODULE
+ * @defgroup CAPI_MAPS_PLUGIN_AND_PROVIDERS_MODULE Maps Plugin and Providers
+ *
+ * @file maps_plugin.h
+ * @brief This file contains the top level functions of Maps Plugin API
+ *
+ * @addtogroup CAPI_MAPS_PLUGIN_AND_PROVIDERS_MODULE
+ * @{
+ * @brief This provides APIs related to operations with Maps Plugins
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief The Maps Plugin handle.
+ * @details The handle of Maps Plugin instance.
+ * @since_tizen 2.4
+ */
+typedef void *maps_plugin_h;
+
+/*----------------------------------------------------------------------------*/
+/*
+ * Plugin dedicated functions
+ */
+
+/**
+ * @brief Initialize a new Maps Plugin.
+ * @details A maps plugin handle can be used to access a specified plugin.
+ * @since_tizen 2.4
+ * @remarks @a plugin and it resources must be released in
+ * maps_plugin_shutdown().
+ *
+ * @param[out] plugin A handle of a new plugin on success
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ *
+ * @see maps_plugin_shutdown()
+ */
+int maps_plugin_init(maps_plugin_h *plugin);
+
+/**
+ * @brief Destroys the Maps Plugin handle.
+ * @details This function destroys the maps plugin handle and releases all its
+ * resources.
+ * @since_tizen 2.4
+ *
+ * @param[in] plugin The maps plugin handle to destroy
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_plugin_init()
+ */
+int maps_plugin_shutdown(maps_plugin_h plugin);
+
+/**
+ * @brief Returns a plugin info.
+ * @details This function returns a plugin info.
+ * @since_tizen 2.4
+ *
+ * @param[out] info A plugin info
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ *
+ * @see maps_plugin_init()
+ */
+int maps_plugin_get_info(maps_plugin_info_h *info);
+
+/*----------------------------------------------------------------------------*/
+/*
+ * Maps Provider access key, preference and capabilities
+ */
+
+/**
+ * @brief Sets the Maps Key to be used in the Maps Plugin requests.
+ * @details This function sets the Maps Key which will be used in each Maps
+ * Plugin request to Maps Provider.
+ * @since_tizen 2.4
+ * @remarks To obtain the @a provider_key refer to corresponding Maps Provider
+ * documentation.
+ * \n For HERE Maps refer to https://developer.here.com/,
+ * https://developer.here.com/rest-apis.
+ *
+ * @param[in] provider_key The Maps Key to be used
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @see maps_plugin_get_provider_key()
+ */
+int maps_plugin_set_provider_key(const char *provider_key);
+
+/**
+ * @brief Gets the Maps Key which is to be used in the Maps Service
+ * requests
+ * @details This function gets the Maps Key which is to be used in each Maps
+ * Service request to Maps Provider.
+ * \n Maps key can be set with maps_plugin_set_provider_key().
+ * @since_tizen 2.4
+ * @remarks The string @a provider_key must be released using free().
+ *
+ * @param[out] provider_key The Maps Key
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @see maps_plugin_set_provider_key()
+ */
+int maps_plugin_get_provider_key(char **provider_key);
+
+/**
+ * @brief Sets the Maps Preference.
+ * @details This function sets the Maps Preferences which are used in each Maps
+ * Plugin request to Maps Provider.
+ * @since_tizen 2.4
+ *
+ * @param[in] preference The handle of Maps Preference
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ * @retval #MAPS_ERROR_PERMISSION_DENIED Permission Denied
+ *
+ * @see maps_plugin_get_preference()
+ */
+int maps_plugin_set_preference(maps_item_hashtable_h preference);
+
+/**
+ * @brief Gets the Maps Preference.
+ * @details This function gets the Maps Preferences which are used in each Maps
+ * Plugin request to Maps Provider.
+ * \n Preferences can be set with maps_plugin_set_preference().
+ * @since_tizen 2.4
+ * @remarks @a preference must be released using maps_preference_destroy().
+ *
+ * @param[out] preference The handle of Maps Preference
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @see maps_plugin_set_preference()
+ */
+int maps_plugin_get_preference(maps_item_hashtable_h *preference);
+
+/**
+ * @brief Checks if the Maps Plugin supports a request.
+ * @details This function checks if the Maps Plugin supports a specified
+ * request.
+ * @since_tizen 2.4
+ *
+ * @param[in] service The service to be checked
+ * @param[out] supported Is the service supported
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful, the service is supported
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @pre Call maps_service_create() to create Maps Service and obtain its handle.
+ *
+ * @see maps_service_create()
+ */
+int maps_plugin_is_service_supported(maps_service_e service,
+ bool *supported);
+
+/**
+ * @brief Checks if the Maps Plugin supports a data feature.
+ * @details This function checks if the Maps Plugin supports a specified data
+ * feature.
+ * @since_tizen 2.4
+ *
+ * @param[in] data The data feature to be checked
+ * @param[out] supported Is the data feature supported
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful, the data feature is supported
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @pre Call maps_service_create() to create Maps Service and obtain its handle.
+ *
+ * @see maps_service_create()
+ */
+int maps_plugin_is_data_supported(maps_service_data_e data, bool *supported);
+
+/*----------------------------------------------------------------------------*/
+/*
+ * Geocode
+ */
+
+/**
+ * @brief Gets the position coordinates for a given address.
+ * @details This function obtains position coordinates for a given free-formed
+ * address string.
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/mapservice
+ * @remarks This function requires network access.
+ * \n To cancel the request use maps_plugin_cancel_request().
+ *
+ * @param[in] address The free-formed address
+ * @param[in] preference The set of preferences for processing Geocode
+ * @param[in] callback The callback which will receive position
+ * coordinates
+ * @param[in] user_data The user data to be passed to the callback
+ * function
+ * @param[out] request_id The id of request
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NETWORK_UNREACHABLE Network connection failed
+ * @retval #MAPS_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ * @retval #MAPS_ERROR_PERMISSION_DENIED Permission Denied
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ * @retval #MAPS_ERROR_CONNECTION_TIME_OUT Timeout error, no answer
+ * @retval #MAPS_ERROR_INVALID_OPERATION Operation is not valid
+ * @retval #MAPS_ERROR_NOT_FOUND Result not found
+ * @retval #MAPS_ERROR_KEY_NOT_AVAILABLE Invalid key
+ * @retval #MAPS_ERROR_UNKNOWN Unknown error
+ * @retval #MAPS_ERROR_UNKNOWN Unknown error
+ *
+ * @post It invokes maps_service_geocode_cb() to deliver obtained position
+ * coordinates.
+ *
+ * @see maps_plugin_geocode_inside_area()
+ * @see maps_service_geocode_cb()
+ * @see maps_plugin_cancel_request()
+ * @see maps_plugin_reverse_geocode()
+ */
+int maps_plugin_geocode(const char *address,
+ const maps_item_hashtable_h preference,
+ maps_service_geocode_cb callback, void *user_data,
+ int *request_id);
+
+/**
+ * @brief Gets the position for a given address, within the specified
+ * bounding box.
+ * @details This function obtains position coordinates for a given free-formed
+ * address string within the specified bounding box.
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/mapservice
+ * @remarks This function requires network access.
+ * \n Polygonal bounding box is not supported.
+ * \n To cancel the request use maps_plugin_cancel_request().
+ * \n To check if Maps Provider is capable of Geocoding and which Geocode
+ * preferences are supported see the lists of capacities and preferences above.
+ *
+ * @param[in] address The free-formed address
+ * @param[in] bounds The bounding box
+ * @param[in] preference The set of preferences for processing Geocode
+ * @param[in] callback The callback which will receive position
+ * coordinates
+ * @param[in] user_data The user data to be passed to the callback
+ * function
+ * @param[out] request_id The id of request
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NETWORK_UNREACHABLE Network connection failed
+ * @retval #MAPS_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ * @retval #MAPS_ERROR_PERMISSION_DENIED Permission Denied
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ * @retval #MAPS_ERROR_KEY_NOT_AVAILABLE Invalid key
+ * @retval #MAPS_ERROR_CONNECTION_TIME_OUT Timeout error, no answer
+ * @retval #MAPS_ERROR_INVALID_OPERATION Operation is not valid
+ * @retval #MAPS_ERROR_NOT_FOUND Result not found
+ * @retval #MAPS_ERROR_KEY_NOT_AVAILABLE Invalid key
+ * @retval #MAPS_ERROR_UNKNOWN Unknown error
+ *
+ * @post It invokes maps_service_geocode_cb() to deliver obtained position
+ * coordinates.
+ *
+ * @see maps_plugin_geocode_by_structured_address
+ * @see maps_plugin_geocode_inside_area()
+ * @see maps_service_geocode_cb()
+ * @see maps_plugin_geocode()
+ * @see maps_plugin_cancel_request()
+ * @see maps_plugin_reverse_geocode()
+ */
+int maps_plugin_geocode_inside_area(const char *address,
+ const maps_area_h bounds,
+ const maps_item_hashtable_h preference,
+ maps_service_geocode_cb callback,
+ void *user_data, int *request_id);
+
+/**
+ * @brief Gets the position coordinates for a given address.
+ * @details This function obtains position coordinates for a given structured
+ * address.
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/mapservice
+ * @remarks This function requires network access.
+ * \n To cancel the request use maps_plugin_cancel_request().
+ * \n To check if Maps Provider is capable of Geocoding and which Geocode
+ * preferences are supported see the lists of capacities and preferences above.
+ *
+ * @param[in] address The structured address
+ * @param[in] preference The set of preferences for processing Geocode
+ * @param[in] callback The callback which will receive position
+ * coordinates
+ * @param[in] user_data The user data to be passed to the callback
+ * function
+ * @param[out] request_id The id of request
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NETWORK_UNREACHABLE Network connection failed
+ * @retval #MAPS_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ * @retval #MAPS_ERROR_PERMISSION_DENIED Permission Denied
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ * @retval #MAPS_ERROR_CONNECTION_TIME_OUT Timeout error, no answer
+ * @retval #MAPS_ERROR_INVALID_OPERATION Operation is not valid
+ * @retval #MAPS_ERROR_NOT_FOUND Result not found
+ * @retval #MAPS_ERROR_KEY_NOT_AVAILABLE Invalid key
+ * @retval #MAPS_ERROR_UNKNOWN Unknown error
+ *
+ * @post It invokes maps_service_geocode_cb() to deliver obtained position
+ * coordinates.
+
+ * @see maps_plugin_geocode()
+ * @see maps_plugin_geocode_inside_area()
+ * @see maps_service_geocode_cb()
+ * @see maps_plugin_cancel_request()
+ * @see maps_plugin_reverse_geocode()
+ */
+int maps_plugin_geocode_by_structured_address(const maps_address_h address,
+ const maps_preference_h
+ preference,
+ maps_service_geocode_cb
+ callback, void *user_data,
+ int *request_id);
+
+/**
+ * @brief Gets the address for a given position coordinates.
+ * @details This function obtains structured address information for a given
+ * position coordinates.
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/mapservice
+ * @remarks This function requires network access.
+ * \n To cancel the request use maps_plugin_cancel_request().
+ * \n To check if Maps Provider is capable of Reverse Geocoding and which
+ * Reverse Geocode preferences are supported see the lists of capacities and
+ * preferences above.
+ *
+ * @param[in] latitude The latitude [-90.0 ~ 90.0] (degrees)
+ * @param[in] longitude The longitude [-180.0 ~ 180.0] (degrees)
+ * @param[in] preference The set of preferences for processing Reverse
+ * Geocode
+ * @param[in] callback The callback which will receive address
+ * information
+ * @param[in] user_data The user data to be passed to the callback
+ * function
+ * @param[out] request_id The id of request
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NETWORK_UNREACHABLE Network connection failed
+ * @retval #MAPS_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ * @retval #MAPS_ERROR_PERMISSION_DENIED Permission Denied
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ * @retval #MAPS_ERROR_CONNECTION_TIME_OUT Timeout error, no answer
+ * @retval #MAPS_ERROR_INVALID_OPERATION Operation is not valid
+ * @retval #MAPS_ERROR_NOT_FOUND Result not found
+ * @retval #MAPS_ERROR_KEY_NOT_AVAILABLE Invalid key
+ * @retval #MAPS_ERROR_UNKNOWN Unknown error
+ *
+ * @post This function invokes maps_service_reverse_geocode_cb().
+ *
+ * @see maps_service_reverse_geocode_cb()
+ * @see maps_plugin_cancel_request()
+ * @see maps_plugin_geocode()
+ */
+int maps_plugin_reverse_geocode(double latitude, double longitude,
+ const maps_item_hashtable_h preference,
+ maps_service_reverse_geocode_cb callback,
+ void *user_data, int *request_id);
+
+/*----------------------------------------------------------------------------*/
+/*
+ * Place
+ */
+
+/**
+ * @brief Queries a Place information by a coordinates position and a
+ * distance.
+ * @details This function obtains the Place information for a specified distance
+ * around a given coordinates position.
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/mapservice
+ * @remarks This function requires network access.
+ * \n To cancel the search request use maps_plugin_cancel_request().
+ * \n To check if Maps Provider is capable of Place Search and which Place
+ * preferences are supported see the lists of capacities and preferences above.
+ *
+ * @param[in] position The interested position
+ * @param[in] distance The search area distance
+ * @param[in] filter The filter handle
+ * @param[in] preference The place preference handle
+ * @param[in] callback The result callback
+ * @param[in] user_data The user data to be passed to the callback
+ * function
+ * @param[out] request_id A Request id, can be set to NULL if does not
+ * require operation cancel
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ * @retval #MAPS_ERROR_PERMISSION_DENIED Permission Denied
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ * @retval #MAPS_ERROR_CONNECTION_TIME_OUT Timeout error, no answer
+ * @retval #MAPS_ERROR_INVALID_OPERATION Operation is not valid
+ * @retval #MAPS_ERROR_NOT_FOUND Result not found
+ * @retval #MAPS_ERROR_KEY_NOT_AVAILABLE Invalid key
+ * @retval #MAPS_ERROR_RESOURCE_BUSY Places service busy
+ * @retval #MAPS_ERROR_CANCELED Places service aborted
+ * @retval #MAPS_ERROR_UNKNOWN Unknown error
+ *
+ * @post It invokes maps_service_search_place_cb() to deliver obtained Place
+ * information.
+ *
+ * @see maps_plugin_search_place_by_area()
+ * @see maps_plugin_search_place_by_address()
+ * @see maps_plugin_cancel_request()
+ * @see maps_service_search_place_cb()
+ */
+int maps_plugin_search_place(const maps_coordinates_h position, int distance,
+ const maps_place_filter_h filter,
+ maps_preference_h preference,
+ maps_service_search_place_cb callback,
+ void *user_data, int *request_id);
+
+/**
+ * @brief Queries a Place information by a coordinates boundary.
+ * @details This function obtains the Place information for a specified
+ * coordinates boundary.
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/mapservice
+ * @remarks This function requires network access.
+ * \n @a boundary is supporting only circle type bounds for search.
+ * \n To cancel the search request use maps_plugin_cancel_request().
+ * \n To check if Maps Provider is capable of Place Search and which Place
+ * preferences are supported see the lists of capacities and preferences above.
+ *
+ * @param[in] boundary The interested area
+ * @param[in] filter The filter handle
+ * @param[in] preference The place preference handle
+ * @param[in] callback The result callback
+ * @param[in] user_data The user data to be passed to the callback
+ * function
+ * @param[out] request_id A Request id, can be set to NULL if does not
+ * required operation cancel
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ * @retval #MAPS_ERROR_PERMISSION_DENIED Permission Denied
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ * @retval #MAPS_ERROR_CONNECTION_TIME_OUT Timeout error, no answer
+ * @retval #MAPS_ERROR_INVALID_OPERATION Operation is not valid
+ * @retval #MAPS_ERROR_NOT_FOUND Result not found
+ * @retval #MAPS_ERROR_KEY_NOT_AVAILABLE Invalid key
+ * @retval #MAPS_ERROR_RESOURCE_BUSY Places service busy
+ * @retval #MAPS_ERROR_CANCELED Places service aborted
+ * @retval #MAPS_ERROR_UNKNOWN Unknown error
+ *
+ * @post It invokes maps_service_search_place_cb() to deliver obtained Place
+ * information.
+ *
+ * @see maps_plugin_search_place()
+ * @see maps_plugin_search_place_by_address()
+ * @see maps_plugin_cancel_request()
+ * @see maps_service_search_place_cb()
+ */
+int maps_plugin_search_place_by_area(const maps_area_h boundary,
+ const maps_place_filter_h filter,
+ maps_preference_h preference,
+ maps_service_search_place_cb callback,
+ void *user_data, int *request_id);
+
+/**
+ * @brief Queries a Place information by a free-formed address string.
+ * @details This function obtains the Place information for a specified free-
+ * formed address string.
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/mapservice
+ * @remarks This function requires network access.
+ * \n @a boundary is supporting only circle type bounds for search.
+ * \n To cancel the search request use maps_plugin_cancel_request().
+ * \n To check if Maps Provider is capable of Place Search and which Place
+ * preferences are supported see the lists of capacities and preferences above.
+ *
+ * @param[in] address The interested address
+ * @param[in] boundary The interested area
+ * @param[in] filter The filter handle
+ * @param[in] preference The place preference handle
+ * @param[in] callback The result callback
+ * @param[in] user_data The user data to be passed to the callback
+ * function
+ * @param[out] request_id A Request id, can be set to NULL if does not
+ * required operation cancel
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ * @retval #MAPS_ERROR_PERMISSION_DENIED Permission Denied
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ * @retval #MAPS_ERROR_CONNECTION_TIME_OUT Timeout error, no answer
+ * @retval #MAPS_ERROR_INVALID_OPERATION Operation is not valid
+ * @retval #MAPS_ERROR_NOT_FOUND Result not found
+ * @retval #MAPS_ERROR_KEY_NOT_AVAILABLE Invalid key
+ * @retval #MAPS_ERROR_RESOURCE_BUSY Places service busy
+ * @retval #MAPS_ERROR_CANCELED Places service aborted
+ * @retval #MAPS_ERROR_UNKNOWN Unknown error
+ *
+ * @post It invokes maps_service_search_place_cb() to deliver obtained Place
+ * information.
+ *
+ * @see maps_plugin_search_place()
+ * @see maps_plugin_search_place_by_area()
+ * @see maps_plugin_cancel_request()
+ * @see maps_service_search_place_cb()
+ */
+int maps_plugin_search_place_by_address(const char *address,
+ const maps_area_h boundary,
+ const maps_place_filter_h filter,
+ maps_preference_h preference,
+ maps_service_search_place_cb callback,
+ void *user_data, int *request_id);
+
+/*----------------------------------------------------------------------------*/
+/*
+ * Route
+ */
+
+/**
+ * @brief Queries the Route from origin coordinate to a destination.
+ * @details This function obtains the Route information for a specified origin
+ * and destination coordinates.
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/mapservice
+ * @remarks This function requires network access.
+ * \n To cancel the search request use maps_plugin_cancel_request().
+ * \n To check if Maps Provider is capable of Route Search and which Route
+ * preferences are supported see the lists of capacities and preferences above.
+ *
+ * @param[in] origin The starting point
+ * @param[in] destination The destination
+ * @param[in] preference The Route preference handle
+ * @param[in] callback The result callback
+ * @param[in] user_data The user data to be passed to the callback
+ * function
+ * @param[out] request_id The request ID
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Service unavailable
+ * @retval #MAPS_ERROR_PERMISSION_DENIED Permission Denied
+ * @retval #MAPS_ERROR_CONNECTION_TIME_OUT Timeout error, no answer
+ * @retval #MAPS_ERROR_INVALID_OPERATION Operation is not valid
+ * @retval #MAPS_ERROR_NOT_FOUND Result not found
+ * @retval #MAPS_ERROR_KEY_NOT_AVAILABLE Invalid key
+ * @retval #MAPS_ERROR_UNKNOWN Unknown error
+ *
+ * @post It invokes maps_service_search_route_cb() to deliver obtained Route
+ * information.
+ *
+ * @see maps_plugin_search_route_waypoints()
+ * @see maps_plugin_cancel_request()
+ * @see maps_service_search_route_cb()
+ */
+int maps_plugin_search_route(const maps_coordinates_h origin,
+ const maps_coordinates_h destination,
+ maps_preference_h preference,
+ maps_service_search_route_cb callback,
+ void *user_data, int *request_id);
+
+/**
+ * @brief Queries the Route, passing through a specified way points.
+ * @details This function obtains the Route information for the Route, passing
+ * through a specified set of way points.
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/mapservice
+ * @remarks This function requires network access.
+ * \n To cancel the search request use maps_plugin_cancel_request().
+ * \n To check if Maps Provider is capable of Route Search and which Route
+ * preferences are supported see the lists of capacities and preferences above.
+ *
+ * @param[in] waypoint_list The list of way points to go through
+ * @param[in] waypoint_num The number of way points to go through
+ * @param[in] preference The Route preference handle
+ * @param[in] callback The result callback
+ * @param[in] user_data The user data to be passed to the callback
+ * function
+ * @param[out] request_id The request ID
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Service unavailable
+ * @retval #MAPS_ERROR_PERMISSION_DENIED Permission Denied
+ * @retval #MAPS_ERROR_CONNECTION_TIME_OUT Timeout error, no answer
+ * @retval #MAPS_ERROR_INVALID_OPERATION Operation is not valid
+ * @retval #MAPS_ERROR_NOT_FOUND Result not found
+ * @retval #MAPS_ERROR_KEY_NOT_AVAILABLE Invalid key
+ * @retval #MAPS_ERROR_UNKNOWN Unknown error
+ *
+ * @post It invokes maps_service_search_route_cb() to deliver obtained Route
+ * information.
+ *
+ * @see maps_plugin_search_route()
+ * @see maps_plugin_cancel_request()
+ * @see maps_service_search_route_cb()
+ */
+int maps_plugin_search_route_waypoints(const maps_coordinates_h *waypoint_list,
+ int waypoint_num,
+ maps_preference_h preference,
+ maps_service_search_route_cb callback,
+ void *user_data, int *request_id);
+
+/*----------------------------------------------------------------------------*/
+/*
+ * Cancel Request
+ */
+
+/**
+ * @brief Cancels the service request.
+ * @details This function cancels the service request initiated by geocode,
+ * route or place search.
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/mapservice
+ * @remarks This function requires network access.
+ *
+ * @param[in] request_id The id of request
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NETWORK_UNREACHABLE Network connection failed
+ * @retval #MAPS_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ * @retval #MAPS_ERROR_PERMISSION_DENIED Permission Denied
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ * @retval #MAPS_ERROR_CONNECTION_TIME_OUT Timeout error, no answer
+ * @retval #MAPS_ERROR_INVALID_OPERATION Operation is not valid
+ * @retval #MAPS_ERROR_NOT_FOUND Result not found
+ * @retval #MAPS_ERROR_KEY_NOT_AVAILABLE Invalid key
+ * @retval #MAPS_ERROR_UNKNOWN Unknown error
+ *
+ * @pre @a request_id is obtained from one of following:
+ * - maps_plugin_geocode()
+ * - maps_plugin_geocode_inside_area()
+ * - maps_plugin_geocode_by_structured_address()
+ * - maps_plugin_reverse_geocode()
+ * - maps_plugin_search_place()
+ * - maps_plugin_search_place_by_area()
+ * - maps_plugin_search_place_by_address()
+ * - maps_plugin_search_route()
+ * - maps_plugin_search_route_waypoints()
+ * .
+ *
+ * @see maps_plugin_geocode()
+ * @see maps_plugin_geocode_inside_area()
+ * @see maps_plugin_geocode_by_structured_address()
+ * @see maps_plugin_reverse_geocode()
+ * @see maps_plugin_search_place()
+ * @see maps_plugin_search_place_by_area()
+ * @see maps_plugin_search_place_by_address()
+ * @see maps_plugin_search_route()
+ * @see maps_plugin_search_route_waypoints()
+ */
+int maps_plugin_cancel_request(int request_id);
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+#endif /* __MAPS_PLUGIN_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_SERVICE_PLUGIN_INFO_H__
+#define __MAPS_SERVICE_PLUGIN_INFO_H__
+
+/**
+ *
+ * @ingroup CAPI_MAPS_PLUGIN_AND_PROVIDERS_MODULE
+ * @defgroup CAPI_MAPS_PLUGIN_INFO_MODULE Plugin info
+ *
+ * @file maps_plugin_info.h
+ * @brief This file contains the Maps Plugin Info interface
+ *
+ * @addtogroup CAPI_MAPS_PLUGIN_INFO_MODULE
+ * @{
+ * @brief This provides APIs related to Maps Plugins Info data structure
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief The Maps Plugin Info handle
+ * @details The handle of Maps Plugin Info instance.
+ * @remarks To create the handle use maps_plugin_info_create().
+ * \n To release the handle use maps_plugin_info_destroy().
+ * \n To clone the handle use maps_plugin_info_clone().
+ * @since_tizen 2.4
+ *
+ * @see maps_plugin_info_create()
+ * @see maps_plugin_info_destroy()
+ * @see maps_plugin_info_clone()
+ */
+typedef void *maps_plugin_info_h;
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Creates a new plugin info handle.
+ * @details This function creates a new plugin info handle and allocates all
+ * needed resources.
+ * @since_tizen 2.4
+ * @remarks @a info must be released using maps_plugin_info_destroy().
+ * \n @a info may be cloned using maps_plugin_info_clone().
+ *
+ * @param[out] info A handle of a new plugin info on success
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_plugin_info_destroy()
+ * @see maps_plugin_info_clone()
+ */
+int maps_plugin_info_create(maps_plugin_info_h *info);
+
+/**
+ * @brief Destroys the plugin info handle and releases all its resources.
+ * @details This function destroys the plugin info handle and releases all its
+ * resources.
+ * @since_tizen 2.4
+ *
+ * @param[in] info The plugin info handle to destroy
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a info is created using maps_plugin_info_create().
+ *
+ * @see maps_plugin_info_create()
+ * @see maps_plugin_info_clone()
+ */
+int maps_plugin_info_destroy(maps_plugin_info_h info);
+
+/**
+ * @brief Clones the plugin info handle.
+ * @details This function clones the plugin info handle @a origin and all its
+ * resources.
+ * @since_tizen 2.4
+ * @remarks @a cloned must be released using maps_plugin_info_destroy().
+ *
+ * @param[in] origin The original plugin info handle
+ * @param[out] cloned A cloned plugin info handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a info is created using maps_plugin_info_create().
+ *
+ * @see maps_plugin_info_create()
+ * @see maps_plugin_info_destroy()
+ */
+int maps_plugin_info_clone(const maps_plugin_info_h origin,
+ maps_plugin_info_h *cloned);
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Gets the plugin provider name.
+ * @details This function gets the plugin provider name.
+ * @since_tizen 2.4
+ * @remarks @a provider_name must be released using free().
+ *
+ * @param[in] info The handle of plugin info
+ * @param[out] provider_name The plugin info name
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a info is created using maps_plugin_info_create().
+ *
+ * @see maps_plugin_info_create()
+ */
+int maps_plugin_info_get_provider_name(const maps_plugin_info_h info,
+ char **provider_name);
+
+/**
+ * @brief Sets the plugin provider name.
+ * @details This function sets the plugin provider name.
+ * @since_tizen 2.4
+ *
+ * @param[in] info The handle of plugin info
+ * @param[in] provider_name The plugin info name
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a info is created using maps_plugin_info_create().
+ *
+ * @see maps_plugin_info_create()
+ */
+int maps_plugin_info_set_provider_name(maps_plugin_info_h info,
+ const char *provider_name);
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+#endif /*__MAPS_SERVICE_PLUGIN_INFO_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_PREFERENCE_H__
+#define __MAPS_PREFERENCE_H__
+
+#include <tizen_type.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @ingroup CAPI_MAPS_SERVICE_MODULE
+ * @defgroup CAPI_MAPS_PREFERENCE_MODULE Preference
+ *
+ * @file maps_preference.h
+ * @brief This file contains the enumerations of Maps API preferences
+ *
+ * @addtogroup CAPI_MAPS_PREFERENCE_MODULE
+ * @{
+ * @brief This provides enumerations of Maps API preferences
+
+* - - - - - - - - - - - - -
+*
+* Preference key names
+* --------------------
+*
+* The Preferences are organized as a key-value table where available Preference
+* keys are following strings:
+*
+* * Place search preferences
+* - MAPS_PLACE_FILTER_TYPE
+* - MAPS_PLACE_FILTER_SORT_BY
+*
+* * Route search preferences
+* - MAPS_ROUTE_FREEFORM_ADDR_TO_AVOID
+* - MAPS_ROUTE_STRUCTED_ADDR_TO_AVOID
+* - MAPS_ROUTE_CIRCLE_AREA_TO_AVOID
+* - MAPS_ROUTE_RECT_AREA_TO_AVOID
+*
+* - MAPS_ROUTE_GEOMETRY_BOUNDING_BOX
+* - MAPS_ROUTE_GEOMETRY_RETRIEVAL
+* - MAPS_ROUTE_INSTRUCTION_GEOMETRY
+* - MAPS_ROUTE_INSTRUCTION_BOUNDING_BOX
+* - MAPS_ROUTE_INSTRUCTION_RETRIEVAL
+* - MAPS_ROUTE_REALTIME_TRAFFIC
+* .
+* .
+*/
+
+/**
+ * @brief The name of the preference indicating place type while searching
+ * the place
+ * @since_tizen 2.4
+ */
+#define MAPS_PLACE_FILTER_TYPE "MAPS_PLACE_FILTER_TYPE"
+
+/**
+ * @brief The name of the preference indicating sorting key while
+ * searching the place
+ * @since_tizen 2.4
+ */
+#define MAPS_PLACE_FILTER_SORT_BY "MAPS_PLACE_FILTER_SORT_BY"
+
+/**
+ * @brief The name of the preference indicating free-form address to avoid
+ * while computing the route
+ * @since_tizen 2.4
+ */
+#define MAPS_ROUTE_FREEFORM_ADDR_TO_AVOID "MAPS_ROUTE_FREEFORM_ADDR_TO_AVOID"
+
+/**
+ * @brief The name of the preference indicating structured address to
+ * avoid while computing the route
+ * @since_tizen 2.4
+ */
+#define MAPS_ROUTE_STRUCTED_ADDR_TO_AVOID "MAPS_ROUTE_STRUCTED_ADDR_TO_AVOID"
+
+/**
+ * @brief The name of the preference indicating circular geographical area
+ * to avoid while computing the route
+ * @since_tizen 2.4
+ */
+#define MAPS_ROUTE_CIRCLE_AREA_TO_AVOID "MAPS_ROUTE_CIRCLE_AREA_TO_AVOID"
+
+/**
+ * @brief The name of the preference indicating rectangular geographical
+ * area to avoid while computing the route
+ * @since_tizen 2.4
+ */
+#define MAPS_ROUTE_RECT_AREA_TO_AVOID "MAPS_ROUTE_RECT_AREA_TO_AVOID"
+
+/**
+ * @brief The name of the preference indicating that route should be
+ * computed within a specified bounding box
+ * @since_tizen 2.4
+ */
+#define MAPS_ROUTE_GEOMETRY_BOUNDING_BOX "MAPS_ROUTE_GEOMETRY_BOUNDING_BOX"
+
+/**
+ * @brief The name of the preference indicating that geometry parameters
+ * should be retrieved while route processing
+ * @since_tizen 2.4
+ */
+#define MAPS_ROUTE_GEOMETRY_RETRIEVAL "MAPS_ROUTE_GEOMETRY_RETRIEVAL"
+
+/**
+ * @brief The name of the preference indicating that route should be
+ * computed with geometry instructions
+ * @since_tizen 2.4
+ */
+#define MAPS_ROUTE_INSTRUCTION_GEOMETRY "MAPS_ROUTE_INSTRUCTION_GEOMETRY"
+
+/**
+ * @brief The name of the preference indicating that route should be
+ * computed with bounding box instructions
+ * @since_tizen 2.4
+ */
+#define MAPS_ROUTE_INSTRUCTION_BOUNDING_BOX "MAPS_ROUTE_INSTRUCTION_BOUNDING_BOX"
+
+/**
+ * @brief The name of the preference indicating that route should be
+ * computed correspondingly to retrieval instructions
+ * @since_tizen 2.4
+ */
+#define MAPS_ROUTE_INSTRUCTION_RETRIEVAL "MAPS_ROUTE_INSTRUCTION_RETRIEVAL"
+
+/**
+ * @brief The name of the preference indicating that route should be
+ * computed in accordance to real time traffic
+ * @since_tizen 2.4
+ */
+#define MAPS_ROUTE_REALTIME_TRAFFIC "MAPS_ROUTE_REALTIME_TRAFFIC"
+
+/**
+ * @brief The Maps Preference handle.
+ * @details The Maps Preference handle can be obtained via call of
+ * maps_preference_create().
+ * @since_tizen 2.4
+ * \n To release the handle use maps_preference_destroy().
+ * \n To clone the handle use maps_preference_clone().
+ * @since_tizen 2.4
+ *
+ * @see maps_preference_create()
+ * @see maps_preference_destroy()
+ * @see maps_preference_clone()
+ */
+typedef void *maps_preference_h;
+
+/**
+ * @brief Enumeration of allowed distance units.
+ * @details This enumeration represents allowed distance units used in Maps
+ * Services.
+ * \n This enumeration is used in #maps_area_s.
+ * @since_tizen 2.4
+ *
+ * @see #maps_preference_h
+ */
+typedef enum _maps_distance_unit_e {
+ MAPS_DISTANCE_UNIT_M, /**< for Meter */
+ MAPS_DISTANCE_UNIT_KM, /**< for Kilometer */
+ MAPS_DISTANCE_UNIT_FT, /**< for Foot */
+ MAPS_DISTANCE_UNIT_YD /**< for Yard */
+} maps_distance_unit_e;
+
+/**
+ * @brief Enumeration of allowed route optimization option.
+ * @details This enumeration represents allowed route optimization option used
+ * in Route Service.
+ * \n This enumeration is used in #maps_area_s.
+ * @since_tizen 2.4
+ *
+ * @see #_maps_route_transport_mode_e
+ * @see #_maps_route_feature_weight_e
+ * @see #_maps_route_request_feature_e
+ */
+typedef enum _maps_route_optimization_e {
+
+ MAPS_ROUTE_TYPE_FASTEST, /**< Indicates the fastest route */
+
+ MAPS_ROUTE_TYPE_SHORTEST, /**< Indicates the shortest route
+ (car mode only) */
+
+ MAPS_ROUTE_TYPE_ECONOMIC, /**< Indicates the most economic route
+ (car mode only) */
+
+ MAPS_ROUTE_TYPE_SCENIC, /**< Indicates the most scenic route */
+
+ MAPS_ROUTE_TYPE_FASTESTNOW, /**< Indicates the most fastest route now */
+
+ MAPS_ROUTE_TYPE_DIRECTDRIVE /**< Indicates direct drive */
+
+} maps_route_optimization_e;
+
+/**
+ * @brief Enumeration of preferable route types.
+ * @details This enumeration represents allowed route types used in Route
+ * Service.
+ * \n This enumeration is used in #maps_area_s.
+ * @since_tizen 2.4
+ *
+ * @see #_maps_distance_unit_e
+ * @see #_maps_route_feature_weight_e
+ * @see #_maps_route_request_feature_e
+ */
+typedef enum _maps_route_transport_mode_e {
+
+ MAPS_ROUTE_TRANSPORT_MODE_CAR, /**< Indicates that the route is to be
+ traveled by car. */
+
+ MAPS_ROUTE_TRANSPORT_MODE_PEDESTRIAN, /**< Indicates that the route is
+ for a pedestrian. */
+
+ MAPS_ROUTE_TRANSPORT_MODE_BICYCLE, /**< Indicates that the route is for
+ a cyclist. */
+
+ MAPS_ROUTE_TRANSPORT_MODE_PUBLICTRANSIT, /**< Indicates that the route
+ is to be traveled using
+ public transport. */
+
+ MAPS_ROUTE_TRANSPORT_MODE_TRUCK /**< Indicates that the route is for a
+ truck. */
+} maps_route_transport_mode_e;
+
+/**
+ * @brief Enumeration of route feature weights.
+ * @details This enumeration represents allowed route feature weights used in
+ * Route Service.
+ * \n This enumeration is used in #maps_area_s.
+ * @since_tizen 2.4
+ *
+ * @see #_maps_distance_unit_e
+ * @see #_maps_route_transport_mode_e
+ * @see #_maps_route_request_feature_e
+ */
+typedef enum _maps_route_feature_weight_e {
+
+ MAPS_ROUTE_FEATURE_WEIGHT_NORMAL, /**< Indicates normal weighting. */
+
+ MAPS_ROUTE_FEATURE_WEIGHT_PREFER, /**< Indicates that a feature is
+ preferred. */
+
+ MAPS_ROUTE_FEATURE_WEIGHT_AVOID, /**< Indicates that a feature is to be
+ avoided. */
+
+ MAPS_ROUTE_FEATURE_WEIGHT_SOFTEXCLUDE, /**< Indicates that soft-exclude
+ applies to the feature. */
+
+ MAPS_ROUTE_FEATURE_WEIGHT_STRICTEXCLUDE /**< Indicates that the feature
+ is to be strictly excluded. */
+} maps_route_feature_weight_e;
+
+/**
+ * @brief Enumeration of route features.
+ * @details This enumeration represents allowed route features used in Route
+ * Service.
+ * \n This enumeration is used in #maps_area_s.
+ * @since_tizen 2.4
+ *
+ * @see #_maps_distance_unit_e
+ * @see #_maps_route_transport_mode_e
+ * @see #_maps_route_feature_weight_e
+ */
+typedef enum _maps_route_request_feature_e {
+
+ MAPS_ROUTE_FEATURE_NO, /**< Indicates no route features
+ (are selected). */
+
+ MAPS_ROUTE_FEATURE_TOLL, /**< Indicates toll roads
+ (toll gates/booths). */
+
+ MAPS_ROUTE_FEATURE_MOTORWAY, /**< Indicates motorway. */
+
+ MAPS_ROUTE_FEATURE_BOATFERRY, /**< Indicates a boat ferry. */
+
+ MAPS_ROUTE_FEATURE_RAILFERRY, /**< Indicates rail (train) ferry. */
+
+ MAPS_ROUTE_FEATURE_PUBLICTTRANSIT, /**< Indicates public transport. */
+
+ MAPS_ROUTE_FEATURE_TUNNEL, /**< Indicates tunnel. */
+
+ MAPS_ROUTE_FEATURE_DIRTROAD, /**< Indicates dirt road. */
+
+ MAPS_ROUTE_FEATURE_PARKS, /**< Indicates park. */
+
+ MAPS_ROUTE_FEATURE_HOVLANE, /**< Indicates a high-occupancy vehicle
+ lane. */
+
+ MAPS_ROUTE_FEATURE_STAIRS /**< Indicates stairs. */
+} maps_route_feature_e;
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Called when requesting the list of Maps Properties.
+ * @details This callback is invoked while iterating through the list of Maps
+ * Properties.
+ * @since_tizen 2.4
+ * @remarks @a key and @a value must be released using free() and corresponding
+ * release method for property value correspondingly.
+ *
+ * @param[in] index The current index of property
+ * @param[in] total The total amount of properties
+ * @param[in] key The key of property
+ * @param[in] value The value of property
+ * @param[in] user_data The user data passed from
+ * maps_preference_foreach_property()
+ * @return @c true to continue with the next iteration of the loop, \n @c
+ * false to break out of the loop
+ *
+ * @pre maps_preference_foreach_property() will invoke this callback.
+ *
+ * @see maps_preference_foreach_property()
+ */
+typedef bool(*maps_preference_properties_cb) (int index, int total, char *key,
+ char *value, void *user_data);
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Creates a new maps preference handle.
+ * @details This function creates a new maps preference handle and allocates all
+ * needed resources.
+ * @since_tizen 2.4
+ * @remarks @a preference must be released using maps_preference_destroy().
+ * \n @a preference may be cloned using maps_preference_clone().
+ *
+ * @param[out] preference A newly created preference handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see maps_preference_destroy()
+ * @see maps_preference_clone()
+ */
+int maps_preference_create(maps_preference_h *preference);
+
+/**
+ * @brief Destroys the maps preference handle and releases all its
+ * resources.
+ * @details This function destroys the maps preference handle and releases all
+ * its resources.
+ * @since_tizen 2.4
+ *
+ * @param[in] preference The preference handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_preference_clone()
+ */
+int maps_preference_destroy(maps_preference_h preference);
+
+/**
+ * @brief Clones the maps preference handle.
+ * @details This function clones the maps preference handle @a origin and all
+ * its resources.
+ * @since_tizen 2.4
+ * @remarks @a cloned must be released using maps_preference_destroy().
+ *
+ * @param[in] origin The original preference handle
+ * @param[out] cloned A cloned preference handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see maps_preference_destroy()
+ */
+int maps_preference_clone(const maps_preference_h origin,
+ maps_preference_h *cloned);
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Gets the distance unit.
+ * @details This function gets the maps distance unit.
+ * @since_tizen 2.4
+ *
+ * @param[in] preference The preference handle
+ * @param[out] unit The distance unit
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_preference_get_distance_unit(const maps_preference_h preference,
+ maps_distance_unit_e *unit);
+
+/**
+ * @brief Gets the language.
+ * @details This function gets the maps language.
+ * @since_tizen 2.4
+ * @remarks @a language must be released using free().
+ *
+ * @param[in] preference The preference handle
+ * @param[out] language The language
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_preference_get_language(const maps_preference_h preference,
+ char **language);
+
+/**
+ * @brief Gets the max amount of results.
+ * @details This function gets the max amount of results.
+ * @since_tizen 2.4
+ *
+ * @param[in] preference The preference handle
+ * @param[out] max_results The max amount of results
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_preference_get_max_results(const maps_preference_h preference,
+ int *max_results);
+
+/**
+ * @brief Gets the country code.
+ * @details This function gets the country code.
+ * @since_tizen 2.4
+ * @remarks @a country_code must be released using free().
+ *
+ * @param[in] preference The preference handle
+ * @param[out] country_code The country code
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_preference_get_country_code(const maps_preference_h preference,
+ char **country_code);
+
+/**
+ * @brief Gets the route optimization.
+ * @details This function gets the route optimization.
+ * @since_tizen 2.4
+ *
+ * @param[in] preference The preference handle
+ * @param[out] optimization The route optimization
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_preference_get_route_optimization(const maps_preference_h preference,
+ maps_route_optimization_e *
+ optimization);
+
+/**
+ * @brief Gets the route transport mode.
+ * @details This function gets the route transport mode.
+ * @since_tizen 2.4
+ *
+ * @param[in] preference The preference handle
+ * @param[out] transport_mode The transport mode
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_preference_get_route_transport_mode(const maps_preference_h
+ preference,
+ maps_route_transport_mode_e *
+ transport_mode);
+
+/**
+ * @brief Gets the route feature weight.
+ * @details This function gets the route feature weight.
+ * @since_tizen 2.4
+ *
+ * @param[in] preference The preference handle
+ * @param[out] feature_weight The feature weight
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_preference_get_route_feature_weight(const maps_preference_h
+ preference,
+ maps_route_feature_weight_e *
+ feature_weight);
+
+/**
+ * @brief Gets the route feature.
+ * @details This function gets the route feature.
+ * @since_tizen 2.4
+ *
+ * @param[in] preference The preference handle
+ * @param[out] feature The feature
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_preference_get_route_feature(const maps_preference_h preference,
+ maps_route_feature_e *feature);
+
+/**
+ * @brief Gets the maps preference value by key.
+ * @details This function gets the maps preference value by key.
+ * @since_tizen 2.4
+ * @remarks @a value must be released using free().
+ *
+ * @param[in] preference The preference handle
+ * @param[in] key The preference key
+ * @param[out] value The preference value
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_preference_get(const maps_preference_h preference, const char *key,
+ char **value);
+
+/**
+ * @brief Retrieves all maps properties.
+ * @details This function retrieves all maps properties.
+ * @since_tizen 2.4
+ * @remarks The properties will be delivered via
+ * maps_preference_properties_cb().
+ *
+ * @param[in] preference The preference handle
+ * @param[in] callback The callback function to invoke
+ * @param[in] user_data The user data to be passed to the callback
+ * function
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NOT_FOUND Result not found
+ *
+ * @post This function invokes maps_preference_properties_cb() repeatedly to
+ * retrieve each property.
+ *
+ * @see maps_preference_properties_cb()
+ */
+int maps_preference_foreach_property(const maps_preference_h preference,
+ maps_preference_properties_cb callback,
+ void *user_data);
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Sets the maps distance unit.
+ * @details This function sets the maps distance unit.
+ * @since_tizen 2.4
+ *
+ * @param[in] preference The preference handle
+ * @param[in] unit The distance unit
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a preference is created using maps_preference_create().
+ *
+ * @see maps_preference_create()
+ * @see maps_preference_get_distance_unit()
+ */
+int maps_preference_set_distance_unit(maps_preference_h preference,
+ const maps_distance_unit_e unit);
+
+/**
+ * @brief Sets the maps language.
+ * @details This function sets the maps language.
+ * @since_tizen 2.4
+ *
+ * @param[in] preference The preference handle
+ * @param[in] language The maps language
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a preference is created using maps_preference_create().
+ *
+ * @see maps_preference_create()
+ * @see maps_preference_get_language()
+ */
+int maps_preference_set_language(maps_preference_h preference,
+ const char *language);
+
+/**
+ * @brief Sets the max amount of results.
+ * @details This function sets the max amount of results.
+ * @since_tizen 2.4
+ *
+ * @param[in] preference The preference handle
+ * @param[in] max_results The max amount of results
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a preference is created using maps_preference_create().
+ *
+ * @see maps_preference_create()
+ * @see maps_preference_get_max_results()
+ */
+int maps_preference_set_max_results(maps_preference_h preference,
+ const int max_results);
+
+/**
+ * @brief Sets the maps country code.
+ * @details This function sets the maps country code.
+ * @since_tizen 2.4
+ *
+ * @param[in] preference The preference handle
+ * @param[in] country_code The maps country code
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a preference is created using maps_preference_create().
+ *
+ * @see maps_preference_create()
+ * @see maps_preference_get_country_code()
+ */
+int maps_preference_set_country_code(maps_preference_h preference,
+ const char *country_code);
+
+/**
+ * @brief Sets the route optimization.
+ * @details This function sets the route optimization.
+ * @since_tizen 2.4
+ *
+ * @param[in] preference The preference handle
+ * @param[in] optimization The route optimization
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a preference is created using maps_preference_create().
+ *
+ * @see maps_preference_create()
+ * @see maps_preference_get_route_optimization()
+ */
+int maps_preference_set_route_optimization(maps_preference_h preference,
+ const maps_route_optimization_e
+ optimization);
+
+/**
+ * @brief Sets the route transport mode.
+ * @details This function sets the route transport mode.
+ * @since_tizen 2.4
+ *
+ * @param[in] preference The preference handle
+ * @param[in] transport_mode The route transport mode
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a preference is created using maps_preference_create().
+ *
+ * @see maps_preference_create()
+ * @see maps_preference_get_route_optimization()
+ */
+int maps_preference_set_route_transport_mode(maps_preference_h preference,
+ const maps_route_transport_mode_e
+ transport_mode);
+
+/**
+ * @brief Sets the route feature weight.
+ * @details This function sets the route feature weight.
+ * @since_tizen 2.4
+ *
+ * @param[in] preference The preference handle
+ * @param[in] feature_weight The route feature weight
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a preference is created using maps_preference_create().
+ *
+ * @see maps_preference_create()
+ * @see maps_preference_get_route_feature_weight()
+ */
+int maps_preference_set_route_feature_weight(maps_preference_h preference,
+ const maps_route_feature_weight_e
+ feature_weight);
+
+/**
+ * @brief Sets the route feature.
+ * @details This function sets the route feature.
+ * @since_tizen 2.4
+ *
+ * @param[in] preference The preference handle
+ * @param[in] feature The route feature
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a preference is created using maps_preference_create().
+ *
+ * @see maps_preference_create()
+ * @see maps_preference_get_route_feature()
+ */
+int maps_preference_set_route_feature(maps_preference_h preference,
+ const maps_route_feature_e feature);
+
+/**
+ * @brief Sets the preference value by key.
+ * @details This function sets the preference value assigned with a specified
+ * key.
+ * @since_tizen 2.4
+ *
+ * @param[in] preference The preference handle
+ * @param[in] key The key
+ * @param[in] value The value
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a preference is created using maps_preference_create().
+ *
+ * @see maps_preference_create()
+ * @see maps_preference_get_property()
+ * @see maps_preference_foreach_property()
+ */
+int maps_preference_set_property(maps_preference_h preference,
+ const char *key, const char *value);
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+#endif /* __MAPS_PREFERENCE_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_ROUTE_H__
+#define __MAPS_ROUTE_H__
+
+#include <tizen_type.h>
+#include <maps_area.h>
+#include <maps_route_segment.h>
+#include <maps_route_maneuver.h>
+#include <maps_preference.h>
+
+/**
+ * @ingroup CAPI_MAPS_ROUTE_MODULE
+ * @defgroup CAPI_MAPS_ROUTE_DATA_MODULE Route
+ *
+ * @file maps_route.h
+ * @brief This file contains the functions related to Route information.
+ *
+ * @addtogroup CAPI_MAPS_ROUTE_DATA_MODULE
+ * @{
+ * @brief This provides APIs related to Route information, used in Route Search.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief The Route handle
+ * @details The handle of Route instance.
+ * @remarks To release the handle use maps_route_destroy().
+ * \n To clone the handle use maps_route_clone().
+ * @since_tizen 2.4
+ *
+ * @see maps_route_destroy()
+ * @see maps_route_clone()
+ */
+typedef void *maps_route_h;
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Called when requesting the path of the Route.
+ * @details This callback is invoked while iterating through the list of
+ * coordinates, composing the Route.
+ * @since_tizen 2.4
+ * @remarks @a coordinates must be released using maps_coordinates_destroy().
+ * \n To use @a coordinates outside this function, clone it with
+ * maps_coordinates_clone().
+ *
+ * @param[in] index The current index of path point
+ * @param[in] total The total amount of path points
+ * @param[in] coordinates The coordinates
+ * @param[in] user_data The user data passed from
+ * maps_route_foreach_path()
+ * @return @c true to continue with the next iteration of the loop, \n @c
+ * false to break out of the loop
+ *
+ * @pre maps_route_foreach_path() will invoke this callback.
+ *
+ * @see maps_route_foreach_path()
+ * @see #maps_coordinates_h
+ */
+typedef bool(*maps_route_path_cb) (int index, int total,
+ maps_coordinates_h coordinates,
+ void *user_data);
+
+/**
+ * @brief Called when requesting the segments of the Route.
+ * @details This callback is invoked while iterating through the list of
+ * segments, composing the Route.
+ * @since_tizen 2.4
+ * @remarks @a segment is valid only in this function and must be released using
+ * maps_route_segment_destroy().
+ * \n To use @a segment outside this function, clone it with
+ * maps_route_segment_clone().
+ *
+ * @param[in] index The current index of segment
+ * @param[in] total The total amount of segments
+ * @param[in] segment The segment or leg of route
+ * @param[in] user_data The user data passed from
+ * maps_route_foreach_segment()
+ * @return @c true to continue with the next iteration of the loop, \n @c
+ * false to break out of the loop
+ *
+ * @pre maps_route_foreach_segment() will invoke this callback.
+ *
+ * @see maps_route_foreach_segment()
+ * @see #maps_route_segment_h
+ */
+typedef bool(*maps_route_segment_cb) (int index, int total,
+ maps_route_segment_h segment,
+ void *user_data);
+
+/**
+ * @brief Called when requesting the list of Route Properties.
+ * @details This callback is invoked while iterating through the list of Route
+ * Properties.
+ * @since_tizen 2.4
+ * @remarks @a key and @a value must be released using free() and corresponding
+ * release method for property value correspondingly.
+ * \n To use @a key and @a value outside this function, you should clone it.
+ *
+ * @param[in] index The current index of property
+ * @param[in] total The total amount of properties
+ * @param[in] key The key of property
+ * @param[in] value The value of property
+ * @param[in] user_data The user data passed from
+ * maps_route_foreach_property()
+ * @return @c true to continue with the next iteration of the loop, \n @c
+ * false to break out of the loop
+ *
+ * @pre maps_route_foreach_property() will invoke this callback.
+ *
+ * @see maps_route_foreach_property()
+ */
+typedef bool(*maps_route_properties_cb) (int index, int total, char *key,
+ void *value, void *user_data);
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Destroys the route handle and releases all its resources.
+ * @details This function destroys the route handle and releases all its
+ * resources.
+ * @since_tizen 2.4
+ *
+ * @param[in] route The route handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_route_clone()
+ */
+int maps_route_destroy(maps_route_h route);
+
+/**
+ * @brief Clones the route handle.
+ * @details This function clones the route handle @a origin and all its
+ * resources.
+ * @since_tizen 2.4
+ * @remarks @a cloned must be released using maps_route_destroy().
+ *
+ * @param[in] origin The original route handle
+ * @param[out] cloned A cloned route handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see maps_route_destroy()
+ */
+int maps_route_clone(const maps_route_h origin, maps_route_h *cloned);
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Gets the route id.
+ * @details This function gets the route id.
+ * @since_tizen 2.4
+ * @remarks @a id must be released using free().
+ *
+ * @param[in] route The route handle
+ * @param[out] route_id The id of route
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_route_get_route_id(const maps_route_h route, char **route_id);
+
+/**
+ * @brief Gets the route origin.
+ * @details This function gets the route origin.
+ * @since_tizen 2.4
+ * @remarks @a origin must be released using maps_coordinates_destroy().
+ *
+ * @param[in] route The route handle
+ * @param[out] origin The origin of route
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_route_get_destination()
+ * @see #maps_coordinates_h
+ */
+int maps_route_get_origin(const maps_route_h route,
+ maps_coordinates_h *origin);
+
+/**
+ * @brief Gets the route destination.
+ * @details This function gets the route destination.
+ * @since_tizen 2.4
+ * @remarks @a destination must be released using maps_coordinates_destroy().
+ *
+ * @param[in] route The route handle
+ * @param[out] destination The destination of route
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_route_get_origin()
+ * @see #maps_coordinates_h
+ */
+int maps_route_get_destination(const maps_route_h route,
+ maps_coordinates_h *destination);
+
+/**
+ * @brief Gets the route bounding box.
+ * @details This function gets the route bounding box.
+ * @since_tizen 2.4
+ * @remarks @a bounding_box must be released using maps_area_destroy().
+ *
+ * @param[in] route The route handle
+ * @param[out] bounding_box The bounding box of route
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see #maps_area_h
+ */
+int maps_route_get_bounding_box(const maps_route_h route,
+ maps_area_h *bounding_box);
+
+/**
+ * @brief Gets the route transport mode.
+ * @details This function gets the route transport mode.
+ * @since_tizen 2.4
+ *
+ * @param[in] route The route handle
+ * @param[out] transport_mode The transport mode
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see #maps_route_transport_mode_e
+ */
+int maps_route_get_transport_mode(const maps_route_h route,
+ maps_route_transport_mode_e *transport_mode);
+
+/**
+ * @brief Gets the route total distance.
+ * @details This function gets the route total distance.
+ * @since_tizen 2.4
+ *
+ * @param[in] route The route handle
+ * @param[out] total_distance The distance of route. You can get the distance
+ * unit by route_get_distance_unit()
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_route_get_total_duration()
+ */
+int maps_route_get_total_distance(const maps_route_h route,
+ double *total_distance);
+
+/**
+ * @brief Gets the route total duration.
+ * @details This function gets the route total duration.
+ * @since_tizen 2.4
+ *
+ * @param[in] route The route handle
+ * @param[out] total_duration The duration
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_route_get_total_distance()
+ */
+int maps_route_get_total_duration(const maps_route_h route,
+ long *total_duration);
+
+/**
+ * @brief Gets the route distance units.
+ * @details This function gets the route distance units.
+ * @since_tizen 2.4
+ *
+ * @param[in] route The route handle
+ * @param[out] distance_unit The distance units
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see #maps_distance_unit_e
+ */
+int maps_route_get_distance_unit(const maps_route_h route,
+ maps_distance_unit_e *distance_unit);
+
+/**
+ * @brief Retrieves all properties.
+ * @details This function retrieves all route properties.
+ * @since_tizen 2.4
+ * @remarks The properties will be delivered via maps_route_properties_cb().
+ *
+ * @param[in] route The route handle
+ * @param[in] callback The callback function to invoke
+ * @param[in] user_data The user data to be passed to the callback
+ * function
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NOT_FOUND Result not found
+ *
+ * @post This function invokes maps_route_properties_cb() repeatedly to retrieve
+ * each property.
+ *
+ * @see maps_route_properties_cb()
+ */
+int maps_route_foreach_property(const maps_route_h route,
+ maps_route_properties_cb callback,
+ void *user_data);
+
+/**
+ * @brief Retrieves all coordinates of the path.
+ * @details This function retrieves all coordinates of the route path.
+ * @since_tizen 2.4
+ * @remarks The coordinates will be delivered via maps_route_path_cb().
+ *
+ * @param[in] route The route handle
+ * @param[in] callback The callback function to invoke
+ * @param[in] user_data The user data to be passed to the
+ * callback function
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NOT_FOUND Result not found
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @post This function invokes maps_route_path_cb() repeatedly to retrieve each
+ * coordinate point.
+ *
+ * @see maps_route_path_cb()
+ */
+int maps_route_foreach_path(const maps_route_h route,
+ maps_route_path_cb callback, void *user_data);
+
+/**
+ * @brief Retrieves all segments of the route.
+ * @details This function retrieves all segments of the route.
+ * @since_tizen 2.4
+ * @remarks The segments will be delivered via maps_route_path_cb().
+ *
+ * @param[in] route The route handle
+ * @param[in] callback The callback function to invoke
+ * @param[in] user_data The user data to be passed to the callback
+ * function
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NOT_FOUND Result not found
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @post This function invokes maps_route_segment_cb() repeatedly to retrieve
+ * each segment.
+ *
+ * @see maps_route_segment_cb()
+ */
+int maps_route_foreach_segment(const maps_route_h route,
+ maps_route_segment_cb callback,
+ void *user_data);
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+#endif /* __MAPS_ROUTE_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_MANEUVER_H__
+#define __MAPS_MANEUVER_H__
+
+#include <maps_coordinates.h>
+
+/**
+ * @ingroup CAPI_MAPS_ROUTE_MODULE
+ * @defgroup CAPI_MAPS_ROUTE_MANEUVER_MODULE Maneuver
+ *
+ * @file maps_route_maneuver.h
+ * @brief This file contains the functions related to Route Maneuver
+ * information.
+ * @addtogroup CAPI_MAPS_ROUTE_MANEUVER_MODULE
+ * @{
+ * @brief This provides APIs related to Place Maneuver information, used in
+ * Route Search.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief The Route Maneuver handle
+ * @details The handle of Route Maneuver instance.
+ * @remarks To release the handle use maps_route_maneuver_destroy().
+ * \n To clone the handle use maps_route_maneuver_clone().
+ * @since_tizen 2.4
+ *
+ * @see maps_route_maneuver_destroy()
+ * @see maps_route_maneuver_clone()
+ */
+typedef void *maps_route_maneuver_h;
+
+/**
+ * @brief The enumeration of direction type.
+ * @since_tizen 2.4
+ */
+typedef enum {
+
+ MAPS_ROUTE_DIRECTION_NONE, /**< Indicates unknown direction */
+
+ MAPS_ROUTE_DIRECTION_NORTH, /**< Indicates north direction */
+
+ MAPS_ROUTE_DIRECTION_NORTHWEST, /**< Indicates north-west direction */
+
+ MAPS_ROUTE_DIRECTION_NORTHEAST, /**< Indicates north-east direction */
+
+ MAPS_ROUTE_DIRECTION_SOUTH, /**< Indicates south direction */
+
+ MAPS_ROUTE_DIRECTION_SOUTHEAST, /**< Indicates south-east direction */
+
+ MAPS_ROUTE_DIRECTION_SOUTHWEST, /**< Indicates south-west direction */
+
+ MAPS_ROUTE_DIRECTION_WEST, /**< Indicates west direction */
+
+ MAPS_ROUTE_DIRECTION_EAST /**< Indicates east direction */
+
+} maps_route_direction_e;
+
+/**
+ * @brief The enumeration of turn type.
+ * @since_tizen 2.4
+ */
+typedef enum {
+
+ MAPS_ROUTE_TURN_TYPE_NONE, /**< Indicates unknown instruction. */
+
+ MAPS_ROUTE_TURN_TYPE_STRAIGHT, /**< Indicates instruction to move
+ straight */
+
+ MAPS_ROUTE_TURN_TYPE_BEAR_RIGHT, /**< Indicates instruction to bear
+ right. */
+
+ MAPS_ROUTE_TURN_TYPE_LIGHT_RIGHT, /**< Indicates instruction slightly to
+ the right. */
+
+ MAPS_ROUTE_TURN_TYPE_RIGHT, /**< Indicates instruction to turn right. */
+
+ MAPS_ROUTE_TURN_TYPE_HARD_RIGHT, /**< Indicates instruction to turn hard
+ to the right. */
+
+ MAPS_ROUTE_TURN_TYPE_UTURN_RIGHT, /**< Indicates instruction to u-turn
+ to the right. */
+
+ MAPS_ROUTE_TURN_TYPE_UTURN_LEFT, /**< Indicates instruction to u-turn
+ to the left. */
+
+ MAPS_ROUTE_TURN_TYPE_HARD_LEFT, /**< Indicates instruction to turn hard
+ to the left. */
+
+ MAPS_ROUTE_TURN_TYPE_LEFT, /**< Indicates instruction to turn left. */
+
+ MAPS_ROUTE_TURN_TYPE_LIGHT_LEFT, /**< Indicates instruction to turn
+ lightly to the left. */
+
+ MAPS_ROUTE_TURN_TYPE_BEAR_LEFT, /**< Indicates instruction to bear
+ left. */
+
+ MAPS_ROUTE_TURN_TYPE_RIGHT_FORK, /**< Indicates right fork
+ instruction. */
+
+ MAPS_ROUTE_TURN_TYPE_LEFT_FORK, /**< Indicates left fork instruction. */
+
+ MAPS_ROUTE_TURN_TYPE_STRAIGHT_FORK /**< Indicates straight fork
+ instruction. */
+} maps_route_turn_type_e;
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Destroys the route maneuver handle and releases all its
+ * resources.
+ * @details This function destroys the route maneuver handle and releases all
+ * its resources.
+ * @since_tizen 2.4
+ *
+ * @param[in] maneuver The maneuver handle to destroy
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_route_maneuver_clone()
+ */
+int maps_route_maneuver_destroy(maps_route_maneuver_h maneuver);
+
+/**
+ * @brief Clones the route maneuver handle.
+ * @details This function clones the route maneuver handle @a origin and all its
+ * resources.
+ * @since_tizen 2.4
+ * @remarks @a cloned must be released using maps_route_maneuver_destroy().
+ *
+ * @param[in] origin The original maneuver handle
+ * @param[out] cloned A cloned maneuver handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_route_maneuver_destroy()
+ */
+int maps_route_maneuver_clone(const maps_route_maneuver_h origin,
+ maps_route_maneuver_h *cloned);
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Gets the route maneuver direction id.
+ * @details This function gets the route maneuver direction id.
+ * @since_tizen 2.4
+ *
+ * @param[in] maneuver The maneuver handle
+ * @param[out] direction_id The direction ID
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see #maps_route_direction_e
+ */
+int maps_route_maneuver_get_direction_id(const maps_route_maneuver_h maneuver,
+ maps_route_direction_e *direction_id);
+
+/**
+ * @brief Gets the route maneuver turn type.
+ * @details This function gets the route maneuver turn type.
+ * @since_tizen 2.4
+ *
+ * @param[in] maneuver The maneuver handle
+ * @param[out] turn_type The turn type
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see #maps_route_turn_type_e
+ */
+int maps_route_maneuver_get_turn_type(const maps_route_maneuver_h maneuver,
+ maps_route_turn_type_e *turn_type);
+
+/**
+ * @brief Gets the route maneuver position.
+ * @details This function gets the route maneuver position.
+ * @since_tizen 2.4
+ * @remarks @a position must be released using maps_coordinates_destroy().
+ *
+ * @param[in] maneuver The maneuver handle
+ * @param[out] position The start position of the maneuver
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see #maps_coordinates_h
+ */
+int maps_route_maneuver_get_position(const maps_route_maneuver_h maneuver,
+ maps_coordinates_h *position);
+
+/**
+ * @brief Gets the road name of the route maneuver.
+ * @details This function gets the road name of the route maneuver.
+ * @since_tizen 2.4
+ * @remarks @a road_name must be released using free().
+ *
+ * @param[in] maneuver The maneuver handle
+ * @param[out] road_name The current road name of the maneuver handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_route_maneuver_get_road_name(const maps_route_maneuver_h maneuver,
+ char **road_name);
+
+/**
+ *
+ * @brief Gets the instruction text (narrative) of the route maneuver.
+ * @details This function gets the instruction text (narrative) of the route
+ * maneuver.
+ * @since_tizen 2.4
+ * @remarks @a instruction_text must be released using free().
+ *
+ * @param[in] maneuver The maneuver handle
+ * @param[in] instruction_text The instruction text
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_route_maneuver_get_instruction_text(const maps_route_maneuver_h
+ maneuver,
+ char **instruction_text);
+
+/**
+ * @brief Gets the route maneuver locale.
+ * @details This function gets the route maneuver locale.
+ * @since_tizen 2.4
+ * @remarks @a locale must be released using free().
+ *
+ * @param[in] maneuver The maneuver handle
+ * @param[out] locale The languages of instruction text and street
+ * name
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_route_maneuver_get_locale(const maps_route_maneuver_h maneuver,
+ char **locale);
+
+/**
+ * @brief Gets the time to next instruction of the route maneuver.
+ * @details This function gets the time to next instruction of the route
+ * maneuver.
+ * @since_tizen 2.4
+ *
+ * @param[in] maneuver The maneuver handle
+ * @param[out] time_to_next_instruction The time to next instruction on the
+ * given maneuver
+ * handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_route_maneuver_get_time_to_next_instruction(const maps_route_maneuver_h
+ maneuver,
+ int *time_to_next_instruction);
+
+/**
+ * @brief Gets the distance to next instruction of the route maneuver.
+ * @details This function gets the distance to next instruction of the route
+ * maneuver.
+ * @since_tizen 2.4
+ *
+ * @param[in] maneuver The maneuver handle
+ * @param[out] distance_to_next_instruction The distance from the current
+ * maneuver to the next maneuver
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_route_maneuver_get_distance_to_next_instruction(const
+ maps_route_maneuver_h
+ maneuver,
+ double *distance_to_next_instruction);
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+#endif /* __MAPS_MANEUVER_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_MANEUVER_PLUGIN_H__
+#define __MAPS_MANEUVER_PLUGIN_H__
+
+#include <maps_route_maneuver.h>
+
+/**
+ * @ingroup CAPI_MAPS_PLUGIN_ROUTE_MODULE
+ * @defgroup CAPI_MAPS_PLUGIN_ROUTE_MANEUVER_MODULE Maneuver
+ *
+ * @file maps_route_maneuver_plugin.h
+ * @brief This file contains the functions related to Route Maneuver
+ * information, needed in plug-in development.
+ * @addtogroup CAPI_MAPS_PLUGIN_ROUTE_MANEUVER_MODULE
+ * @{
+ * @brief This provides APIs related to Route Maneuver information,
+ * used in Route Search, needed in plug-in development.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Creates a new route maneuver handle.
+ * @details This function creates a new route maneuver handle and allocates all
+ * needed resources.
+ * @since_tizen 2.4
+ * @remarks @a maneuver must be released using maps_route_maneuver_destroy().
+ * \n @a maneuver may be cloned using maps_route_maneuver_clone().
+ *
+ * @param[out] maneuver The maneuver handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_route_maneuver_destroy()
+ * @see maps_route_maneuver_clone()
+ */
+int maps_route_maneuver_create(maps_route_maneuver_h *maneuver);
+
+/**
+ * @brief Sets the route maneuver direction id.
+ * @details This function sets the route maneuver direction id.
+ * @since_tizen 2.4
+ *
+ * @param[in] maneuver The maneuver handle
+ * @param[in] direction_id The direction ID
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a maneuver is created using maps_route_maneuver_create().
+ *
+ * @see maps_route_maneuver_create()
+ * @see maps_route_maneuver_get_direction_id()
+ * @see #maps_route_direction_e
+ */
+int maps_route_maneuver_set_direction_id(maps_route_maneuver_h maneuver,
+ const maps_route_direction_e
+ direction_id);
+
+/**
+ * @brief Sets the route maneuver turn type.
+ * @details This function sets the route maneuver turn type.
+ * @since_tizen 2.4
+ *
+ * @param[in] maneuver The maneuver handle
+ * @param[in] turn_type The turn type
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a maneuver is created using maps_route_maneuver_create().
+ *
+ * @see maps_route_maneuver_create()
+ * @see maps_route_maneuver_get_turn_type()
+ * @see #maps_route_turn_type_e
+ */
+int maps_route_maneuver_set_turn_type(maps_route_maneuver_h maneuver,
+ const maps_route_turn_type_e turn_type);
+
+/**
+ * @brief Sets the route maneuver road name.
+ * @details This function sets the route maneuver road name.
+ * @since_tizen 2.4
+ *
+ * @param[in] maneuver The maneuver handle
+ * @param[in] road_name The current road name
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a maneuver is created using maps_route_maneuver_create().
+ *
+ * @see maps_route_maneuver_create()
+ * @see maps_route_maneuver_get_road_name()
+ */
+int maps_route_maneuver_set_road_name(maps_route_maneuver_h maneuver,
+ const char *road_name);
+
+/**
+ * @brief Sets the route maneuver instruction text.
+ * @details This function sets the route maneuver instruction text.
+ * @since_tizen 2.4
+ *
+ * @param[in] maneuver The maneuver handle
+ * @param[in] instruction_text The current road name
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a maneuver is created using maps_route_maneuver_create().
+ *
+ * @see maps_route_maneuver_create()
+ * @see maps_route_maneuver_get_instruction_text()
+ */
+int maps_route_maneuver_set_instruction_text(maps_route_maneuver_h maneuver,
+ const char *instruction_text);
+
+/**
+ * @brief Sets the route maneuver locale.
+ * @details This function sets the route maneuver locale.
+ * @since_tizen 2.4
+ *
+ * @param[in] maneuver The maneuver handle
+ * @param[in] locale The languages of instruction text and street
+ * name
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a maneuver is created using maps_route_maneuver_create().
+ *
+ * @see maps_route_maneuver_create()
+ * @see maps_route_maneuver_get_locale()
+ */
+int maps_route_maneuver_set_locale(maps_route_maneuver_h maneuver,
+ const char *locale);
+
+/**
+ * @brief Sets the route maneuver position.
+ * @details This function sets the route maneuver position.
+ * @since_tizen 2.4
+ *
+ * @param[in] maneuver The maneuver handle
+ * @param[in] position The geographical position of maneuver
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a maneuver is created using maps_route_maneuver_create().
+ *
+ * @see maps_route_maneuver_create()
+ * @see maps_route_maneuver_get_position()
+ */
+int maps_route_maneuver_set_position(maps_route_maneuver_h maneuver,
+ const maps_coordinates_h position);
+
+/**
+ * @brief Sets the time to next instruction in route maneuver.
+ * @details This function sets the time to next instruction in route maneuver.
+ * @since_tizen 2.4
+ *
+ * @param[in] maneuver The maneuver handle
+ * @param[in] time_to_next_instruction The time to next instruction
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a maneuver is created using maps_route_maneuver_create().
+ *
+ * @see maps_route_maneuver_create()
+ * @see maps_route_maneuver_get_time_to_next_instruction()
+ */
+int maps_route_maneuver_set_time_to_next_instruction(maps_route_maneuver_h
+ maneuver,
+ const int time_to_next_instruction);
+
+/**
+ * @brief Sets the distance to next instruction in route maneuver.
+ * @details This function sets the distance to next instruction in route
+ * maneuver.
+ * @since_tizen 2.4
+ *
+ * @param[in] maneuver The maneuver handle
+ * @param[in] distance_to_next_instruction The distance from the current
+ * maneuver to the next maneuver
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a maneuver is created using maps_route_maneuver_create().
+ *
+ * @see maps_route_maneuver_create()
+ * @see maps_route_maneuver_get_distance_to_next_instruction()
+ */
+int maps_route_maneuver_set_distance_to_next_instruction(maps_route_maneuver_h
+ maneuver,
+ const double distance_to_next_instruction);
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+#endif /* __MAPS_MANEUVER_PLUGIN_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_ROUTE_PLUGIN_H__
+#define __MAPS_ROUTE_PLUGIN_H__
+
+#include <maps_route.h>
+#include <maps_extra_types.h>
+
+/**
+ * @ingroup CAPI_MAPS_PLUGIN_MODULE
+ * @defgroup CAPI_MAPS_PLUGIN_ROUTE_MODULE Routes
+ */
+
+/**
+ *
+ * @ingroup CAPI_MAPS_PLUGIN_ROUTE_MODULE
+ * @defgroup CAPI_MAPS_PLUGIN_ROUTE_DATA_MODULE Route
+ *
+ * @file maps_route_plugin.h
+ * @brief This file contains the functions related to Route
+ * information, needed in plug-in development.
+ *
+ * @addtogroup CAPI_MAPS_PLUGIN_ROUTE_DATA_MODULE
+ * @{
+ * @brief This provides APIs related to Route information, used in
+ * Route Search, needed in plug-in development.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Creates a new route handle.
+ * @details This function creates a new route handle and allocates all needed
+ * resources.
+ * @since_tizen 2.4
+ * @remarks @a route must be released using maps_route_destroy().
+ * \n @a route may be cloned using maps_route_clone().
+ *
+ * @param[out] route A newly created route handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see maps_route_destroy()
+ * @see maps_route_clone()
+ */
+int maps_route_create(maps_route_h *route);
+
+/**
+ * @brief Sets the route id.
+ * @details This function sets the route id.
+ * @since_tizen 2.4
+ *
+ * @param[in] route The route handle
+ * @param[in] id The route ID
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a route is created using maps_route_create().
+ *
+ * @see maps_route_create()
+ * @see maps_route_get_route_id()
+ */
+int maps_route_set_route_id(maps_route_h route, const char *id);
+
+/**
+ * @brief Sets the route origin.
+ * @details This function sets the route origin.
+ * @since_tizen 2.4
+ *
+ * @param[in] route The route handle
+ * @param[in] origin The origin of route
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a route is created using maps_route_create().
+ *
+ * @see maps_route_create()
+ * @see maps_route_get_origin()
+ * @see maps_route_set_destination()
+ */
+int maps_route_set_origin(maps_route_h route,
+ const maps_coordinates_h origin);
+
+/**
+ * @brief Sets the route destination.
+ * @details This function sets the route destination.
+ * @since_tizen 2.4
+ *
+ * @param[in] route The route handle
+ * @param[in] destination The destination of route
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a route is created using maps_route_create().
+ *
+ * @see maps_route_create()
+ * @see maps_route_get_destination()
+ * @see maps_route_set_origin()
+ */
+int maps_route_set_destination(maps_route_h route,
+ const maps_coordinates_h destination);
+
+/**
+ * @brief Sets the route bounding box.
+ * @details This function sets the route bounding box.
+ * @since_tizen 2.4
+ *
+ * @param[in] route The route handle
+ * @param[in] bounding_box The top bounding box
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a route is created using maps_route_create().
+ *
+ * @see maps_route_create()
+ * @see maps_route_get_bounding_box()
+ */
+int maps_route_set_bounding_box(maps_route_h route,
+ const maps_area_h bounding_box);
+
+/**
+ * @brief Sets the route total distance.
+ * @details This function sets the route total distance.
+ * @since_tizen 2.4
+ *
+ * @param[in] route The route handle
+ * @param[in] total_distance The distance of route in meters
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a route is created using maps_route_create().
+ *
+ * @see maps_route_create()
+ * @see maps_route_get_total_distance()
+ */
+int maps_route_set_total_distance(maps_route_h route,
+ const double total_distance);
+
+/**
+ * @brief Sets the route total duration.
+ * @details This function sets the route total duration.
+ * @since_tizen 2.4
+ *
+ * @param[in] route The route handle
+ * @param[in] total_duration The duration
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a route is created using maps_route_create().
+ *
+ * @see maps_route_create()
+ * @see maps_route_get_total_duration()
+ */
+int maps_route_set_total_duration(maps_route_h route,
+ const long total_duration);
+
+/**
+ * @brief Sets the route transport mode.
+ * @details This function sets the route transport mode.
+ * @since_tizen 2.4
+ *
+ * @param[in] route The route handle
+ * @param[in] transport_mode The transportation mode
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a route is created using maps_route_create().
+ *
+ * @see maps_route_create()
+ * @see maps_route_get_transport_mode()
+ * @see #maps_route_transport_mode_e
+ */
+int maps_route_set_transport_mode(maps_route_h route,
+ const maps_route_transport_mode_e
+ transport_mode);
+
+/**
+ * @brief Sets the route distance units.
+ * @details This function sets the route distance units.
+ * @since_tizen 2.4
+ *
+ * @param[in] maneuver The maneuver handle
+ * @param[in] distance_unit The distance units
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a route is created using maps_route_create().
+ *
+ * @see maps_route_create()
+ * @see maps_route_get_distance_unit()
+ * @see #maps_distance_unit_e
+ */
+int maps_route_set_distance_unit(maps_route_maneuver_h maneuver,
+ const maps_distance_unit_e distance_unit);
+
+/**
+ * @brief Sets the route path.
+ * @details This function sets the route path.
+ * @since_tizen 2.4
+ *
+ * @param[in] route The route handle
+ * @param[in] path The coordinates list
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a route is created using maps_route_create().
+ *
+ * @see maps_route_create()
+ * @see maps_route_foreach_path()
+ */
+int maps_route_set_path(maps_route_h route, const maps_item_list_h path);
+
+/**
+ * @brief Sets the route segment list.
+ * @details This function sets the route segment list.
+ * @since_tizen 2.4
+ *
+ * @param[in] route The route handle
+ * @param[in] segments The maneuvers list
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a route is created using maps_route_create().
+ *
+ * @see maps_route_create()
+ * @see maps_route_foreach_segment()
+ */
+
+int maps_route_set_segments(maps_route_h route,
+ const maps_item_list_h segments);
+
+/**
+ * @brief Sets the route properties.
+ * @details This function sets the route properties.
+ * @since_tizen 2.4
+ *
+ * @param[in] route The route handle
+ * @param[in] properties The table of properties
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see maps_route_set_total_distance()
+ *
+ * @pre @a route is created using maps_route_create().
+ *
+ * @see maps_route_create()
+ * @see maps_route_foreach_property()
+ */
+int maps_route_set_properties(maps_route_h route,
+ const maps_item_hashtable_h properties);
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+#endif /* __MAPS_ROUTE_PLUGIN_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_SEGMENT_H__
+#define __MAPS_SEGMENT_H__
+
+#include <tizen_type.h>
+#include <maps_coordinates.h>
+#include <maps_route_maneuver.h>
+#include <maps_area.h>
+
+/**
+ * @ingroup CAPI_MAPS_ROUTE_MODULE
+ * @defgroup CAPI_MAPS_ROUTE_SEGMENT_MODULE Segment
+ *
+ * @file maps_route_segment.h
+ * @brief This file contains the functions related to Route Segment information.
+ * @addtogroup CAPI_MAPS_ROUTE_SEGMENT_MODULE
+ * @{
+ * @brief This provides APIs related to Place Segment information, used in Route
+ * Search.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief The Route Segment handle
+ * @details The handle of Route Segment instance.
+ * @remarks To release the handle use maps_route_segment_destroy().
+ * \n To clone the handle use maps_route_segment_clone().
+ * @since_tizen 2.4
+ *
+ * @see maps_route_segment_destroy()
+ * @see maps_route_segment_clone()
+ */
+typedef void *maps_route_segment_h;
+
+/**
+ * @brief Called when requesting the path of the Route Segment.
+ * @details This callback is invoked while iterating through the list of
+ * coordinates, composing the Route Segment.
+ * @since_tizen 2.4
+ * @remarks @a coordinates must be released using maps_coordinates_destroy().
+ * \n To use @a coordinates outside this function, clone it with
+ * maps_coordinates_clone().
+ *
+ * @param[in] segment The segment of route
+ * @param[in] user_data The user data passed from
+ * maps_route_segment_foreach_path()
+ * @return @c true to continue with the next iteration of the loop, \n @c
+ * false to break out of the loop
+ *
+ * @pre maps_route_segment_foreach_path() will invoke this callback.
+ *
+ * @see maps_route_segment_foreach_path()
+ * @see #maps_coordinates_h
+ */
+typedef bool(*maps_route_segment_path_cb) (int index, int total,
+ maps_coordinates_h coordinates,
+ void *user_data);
+
+/**
+ * @brief Called when requesting the maneuvers of the Route Segment.
+ * @details This callback is invoked while iterating through the list of
+ * maneuvers, composing the Route Segment.
+ * @since_tizen 2.4
+ * @remarks @a maneuver is valid only in this function and must be released
+ * using maps_route_maneuver_destroy().
+ * \n To use @a maneuver outside this function, clone it with
+ * maps_route_maneuver_clone().
+ *
+ * @param[in] maneuver The maneuver of route
+ * @param[in] user_data The user data passed from
+ * maps_route_segment_foreach_maneuver()
+ * @return @c true to continue with the next iteration of the loop, \n @c
+ * false to break out of the loop
+ *
+ * @pre maps_route_segment_foreach_maneuver() will invoke this callback.
+ *
+ * @see maps_route_segment_foreach_maneuver()
+ * @see #maps_route_maneuver_h
+ */
+typedef bool(*maps_route_segment_maneuver_cb) (int index, int total,
+ maps_route_maneuver_h maneuver,
+ void *user_data);
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Destroys the route segment handle and releases all its resources.
+ * @details This function destroys the route segment handle and releases all its
+ * resources.
+ * @since_tizen 2.4
+ *
+ * @param[in] segment The segment handle to destroy
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_route_segment_clone()
+ */
+int maps_route_segment_destroy(maps_route_segment_h segment);
+
+/**
+ * @brief Clones the route segment handle.
+ * @details This function clones the route handle @a origin and all its
+ * resources.
+ * @since_tizen 2.4
+ * @remarks @a cloned must be released using maps_route_segment_destroy().
+ *
+ * @param[in] origin The original segment handle
+ * @param[out] cloned A cloned segment handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_route_segment_destroy()
+ */
+int maps_route_segment_clone(const maps_route_segment_h origin,
+ maps_route_segment_h *cloned);
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * @brief Gets the route segment origin.
+ * @details This function gets the route segment origin.
+ * @since_tizen 2.4
+ * @remarks @a origin must be released using maps_coordinates_destroy().
+ *
+ * @param[in] segment The segment handle
+ * @param[out] origin The origin of segment
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see #maps_coordinates_h
+ */
+int maps_route_segment_get_origin(const maps_route_segment_h segment,
+ maps_coordinates_h *origin);
+
+/**
+ * @brief Gets the route segment destination.
+ * @details This function gets the route segment destination.
+ * @since_tizen 2.4
+ * @remarks @a destination must be released using maps_coordinates_destroy().
+ *
+ * @param[in] segment The segment handle
+ * @param[out] destination The destination of segment
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see #maps_coordinates_h
+ */
+int maps_route_segment_get_destination(const maps_route_segment_h segment,
+ maps_coordinates_h *destination);
+
+/**
+ * @brief Gets the route segment bounding box.
+ * @details This function gets the route segment bounding box.
+ * @since_tizen 2.4
+ * @remarks @a bounding_box must be released using maps_area_destroy().
+ *
+ * @param[in] segment The segment handle
+ * @param[out] bounding_box The bounding box of segment
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see #maps_area_h
+ */
+int maps_route_segment_get_bounding_box(const maps_route_segment_h segment,
+ maps_area_h *bounding_box);
+
+/**
+ * @brief Gets the route segment distance.
+ * @details This function gets the route segment distance.
+ * @since_tizen 2.4
+ *
+ * @param[in] segment The segment handle
+ * @param[out] distance The distance of segment
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_route_segment_get_distance(const maps_route_segment_h segment,
+ double *distance);
+
+/**
+ * @brief Gets the route segment duration.
+ * @details This function gets the route segment duration.
+ * @since_tizen 2.4
+ *
+ * @param[in] segment The segment handle
+ * @param[out] duration The distance of segment
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_route_segment_get_duration(const maps_route_segment_h segment,
+ long *duration);
+
+/**
+ * @brief Retrieves all coordinates of the path.
+ * @details This function retrieves all coordinates of the route segment path.
+ * @since_tizen 2.4
+ * @remarks The coordinates will be delivered via maps_route_segment_path_cb().
+ *
+ * @param[in] segment The segment handle
+ * @param[in] callback The callback function to invoke
+ * @param[in] user_data The user data to be passed to the callback
+ * function
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NOT_FOUND Result not found
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @post This function invokes maps_route_segment_path_cb() repeatedly to
+ * retrieve each coordinate point.
+ *
+ * @see maps_route_segment_path_cb()
+ */
+int maps_route_segment_foreach_path(const maps_route_segment_h segment,
+ maps_route_segment_path_cb callback,
+ void *user_data);
+
+/**
+ * @brief Retrieves all maneuvers of the path.
+ * @details This function retrieves all maneuvers of the route segment path.
+ * @since_tizen 2.4
+ * @remarks The coordinates will be delivered via
+ * maps_route_segment_maneuver_cb().
+ *
+ * @param[in] segment The segment handle
+ * @param[in] callback The callback function to invoke
+ * @param[in] user_data The user data to be passed to the callback
+ * function
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NOT_FOUND Result not found
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @post This function invokes maps_route_segment_maneuver_cb() repeatedly to
+ * retrieve each coordinate point.
+ *
+ * @see maps_route_segment_maneuver_cb()
+ */
+int maps_route_segment_foreach_maneuver(const maps_route_segment_h segment,
+ maps_route_segment_maneuver_cb
+ callback, void *user_data);
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+#endif /* __MAPS_SEGMENT_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_SEGMENT_PLUGIN_H__
+#define __MAPS_SEGMENT_PLUGIN_H__
+
+#include <maps_route_segment.h>
+#include <maps_extra_types.h>
+/**
+ * @ingroup CAPI_MAPS_PLUGIN_ROUTE_MODULE
+ * @defgroup CAPI_MAPS_PLUGIN_ROUTE_SEGMENT_MODULE Segment
+ *
+ * @file maps_route_segment_plugin.h
+ * @brief This file contains the functions related to Route Segment
+ * information, needed in plug-in development.
+ * @addtogroup CAPI_MAPS_ROUTE_SEGMENT_MODULE
+ * @{
+ * @brief This provides APIs related to Route Segment information, used
+ * in Route Search, needed in plug-in development.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Creates a new route segment handle.
+ * @details This function creates a new route segment handle and allocates all
+ * needed resources.
+ * @since_tizen 2.4
+ * @remarks @a segment must be released using maps_route_segment_destroy().
+ * \n @a segment may be cloned using maps_route_segment_clone().
+ *
+ * @param[out] segment The segment handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_route_segment_destroy()
+ * @see maps_route_segment_clone()
+ */
+int maps_route_segment_create(maps_route_segment_h *segment);
+
+/**
+ * @brief Sets the route segment origin.
+ * @details This function sets the route segment origin.
+ * @since_tizen 2.4
+ *
+ * @param[in] segment The segment handle
+ * @param[in] origin The origin of segment
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a segment is created using maps_route_segment_create().
+ *
+ * @see maps_route_segment_create()
+ * @see maps_route_segment_get_origin()
+ */
+int maps_route_segment_set_origin(maps_route_segment_h segment,
+ const maps_coordinates_h origin);
+
+/**
+ * @brief Sets the route segment destination.
+ * @details This function sets the route segment destination.
+ * @since_tizen 2.4
+ *
+ * @param[in] segment The segment handle
+ * @param[in] destination The destination of segment
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a segment is created using maps_route_segment_create().
+ *
+ * @see maps_route_segment_create()
+ * @see maps_route_segment_get_destination()
+ */
+int maps_route_segment_set_destination(maps_route_segment_h segment,
+ const maps_coordinates_h destination);
+
+/**
+ * @brief Sets the route segment bounding box.
+ * @details This function sets the route segment bounding box.
+ * @since_tizen 2.4
+ *
+ * @param[in] segment The segment handle
+ * @param[in] bounding_box The start angle of the segment
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a segment is created using maps_route_segment_create().
+ *
+ * @see maps_route_segment_create()
+ * @see maps_route_segment_get_bounding_box()
+ */
+int maps_route_segment_set_bounding_box(maps_route_segment_h segment,
+ const maps_area_h bounding_box);
+
+/**
+ * @brief Sets the route segment distance.
+ * @details This function sets the route segment distance.
+ * @since_tizen 2.4
+ *
+ * @param[in] segment The segment handle
+ * @param[in] distance The distance of the segment
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a segment is created using maps_route_segment_create().
+ *
+ * @see maps_route_segment_create()
+ * @see maps_route_segment_get_distance()
+ */
+int maps_route_segment_set_distance(maps_route_segment_h segment,
+ const double distance);
+
+/**
+ * @brief Sets the route segment duration.
+ * @details This function sets the route segment duration.
+ * @since_tizen 2.4
+ *
+ * @param[in] segment The segment handle
+ * @param[in] duration The duration of the segment
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a segment is created using maps_route_segment_create().
+ *
+ * @see maps_route_segment_create()
+ * @see maps_route_segment_get_duration()
+ */
+int maps_route_segment_set_duration(maps_route_segment_h segment,
+ const long duration);
+
+/**
+ * @brief Sets the route segment path.
+ * @details This function sets the route segment path.
+ * @since_tizen 2.4
+ *
+ * @param[in] segment The segment handle
+ * @param[in] path The maneuver list
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a segment is created using maps_route_segment_create().
+ *
+ * @see maps_route_segment_create()
+ * @see maps_route_segment_foreach_path()
+ */
+int maps_route_segment_set_path(maps_route_segment_h segment,
+ const maps_item_list_h path);
+
+/**
+ * @brief Sets the route segment maneuver list.
+ * @details This function sets the route segment maneuver list.
+ * @since_tizen 2.4
+ *
+ * @param[in] segment The segment handle
+ * @param[in] maneuvers The maneuver list
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a segment is created using maps_route_segment_create().
+ *
+ * @see maps_route_segment_create()
+ * @see maps_route_segment_foreach_maneuver()
+ */
+int maps_route_segment_set_maneuvers(maps_route_segment_h segment,
+ const maps_item_list_h maneuvers);
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+#endif /* __MAPS_SEGMENT_PLUGIN_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_SERVICE_H__
+#define __MAPS_SERVICE_H__
+
+#include <tizen_type.h>
+#include <maps_error.h>
+#include <maps_address.h>
+#include <maps_area.h>
+#include <maps_coordinates.h>
+#include <maps_place.h>
+#include <maps_place_filter.h>
+#include <maps_route.h>
+
+/**
+ *
+ * @file maps_service.h
+ * @brief This file contains the top level functions of Maps API
+ *
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*----------------------------------------------------------------------------*/
+/*
+ * Maps Service and Preference
+ */
+
+/**
+ * @ingroup CAPI_MAPS_SERVICE_MODULE
+ * @defgroup CAPI_MAPS_SERVICE_AND_PREFERENCE_MODULE Service and Providers
+ *
+ * @addtogroup CAPI_MAPS_SERVICE_AND_PREFERENCE_MODULE
+ * @{
+ * @brief This provides APIs related Search and Preference.
+ *
+ */
+
+/**
+ * @brief Enumerations of maps requests available in the Maps Service
+ * @since_tizen 2.4
+ */
+typedef enum _maps_service_e {
+ MAPS_SERVICE_GEOCODE, /** Indicates that
+ maps_service_geocode() service is allowed */
+ MAPS_SERVICE_GEOCODE_INSIDE_AREA, /** Indicates that
+ maps_service_geocode_iside_area() service is allowed */
+ MAPS_SERVICE_GEOCODE_BY_STRUCTURED_ADDRESS, /** Indicates that
+ maps_service_geocode_by_structured_address() service is allowed */
+ MAPS_SERVICE_REVERSE_GEOCODE, /** Indicates that
+ maps_service_reverse_geocode() service is allowed */
+ MAPS_SERVICE_SEARCH_PLACE, /** Indicates that
+ maps_service_place() service is allowed */
+ MAPS_SERVICE_SEARCH_PLACE_BY_AREA, /** Indicates that
+ maps_service_search_place_by_area() service is allowed */
+ MAPS_SERVICE_SEARCH_PLACE_BY_ADDRESS, /** Indicates that
+ maps_service_search_place_by_address() service is allowed */
+ MAPS_SERVICE_SEARCH_ROUTE, /** Indicates that
+ maps_service_search_route() service is allowed */
+ MAPS_SERVICE_SEARCH_ROUTE_WAYPOINTS, /** Indicates that
+ maps_service_search_route_waypoints() service is allowed */
+ MAPS_SERVICE_CANCEL_REQUEST /** Indicates that
+ maps_service_cancel_request() service is allowed */
+} maps_service_e;
+
+/**
+ * @brief Enumerations of maps features available in the Maps Service
+ * @since_tizen 2.4
+ */
+typedef enum _maps_service_data_e {
+ MAPS_PLACE_ADDRESS, /**< Indicates the address value in the
+ Place data*/
+ MAPS_PLACE_RATING, /**< Indicates the rating value in the
+ Place data*/
+ MAPS_PLACE_CATEGORIES, /**< Indicates the place category list
+ in the Place data*/
+ MAPS_PLACE_ATTRIBUTES, /**< Indicates the place attribute
+ list in the Place data*/
+ MAPS_PLACE_CONTACTS, /**< Indicates the place contact list in
+ the Place data*/
+ MAPS_PLACE_EDITORIALS, /**< Indicates the place editorial list
+ in the Place data*/
+ MAPS_PLACE_REVIEWS, /**< Indicates the place review list in
+ the Place data*/
+ MAPS_PLACE_IMAGE, /**< Indicates the place image in Place
+ the data*/
+ MAPS_PLACE_SUPPLIER, /**< Indicates the place supplier link
+ value in the Place data*/
+ MAPS_PLACE_RELATED, /**< Indicates the related place link in
+ the Place data*/
+ MAPS_ROUTE_PATH, /**< Indicates that the Route Data
+ Structure is defined as a Path (a list of geographical coordinates) */
+ MAPS_ROUTE_SEGMENTS_PATH, /**< Indicates that the Route Data
+ Structure is defined as a list of Segments while each segment is defined
+ as a Path*/
+ MAPS_ROUTE_SEGMENTS_MANEUVERS /**< Indicates that the Route Data
+ Structure is defined as a list of Segments while each segment is defined
+ as a list of Maneuvers*/
+} maps_service_data_e;
+
+/**
+ * @brief The Maps Service handle
+ * @details The Maps Service handle can be created by calling of maps_service_create().
+ * \n To release the handle use maps_service_destroy().
+ * @since_tizen 2.4
+ *
+ * @see maps_service_create()
+ * @see maps_service_destroy()
+ */
+typedef void *maps_service_h;
+
+
+/**
+ * @brief Called when requesting available Maps Providers.
+ * @details A Maps Service invokes this callback iteratively as long as available Maps Providers exist.
+ * @since_tizen 2.4
+ * @remarks The string @a maps_provider must be released using free().
+ *
+ * @param[in] maps_provider The info of Maps Provider
+ * @param[in] user_data The user data passed from
+ * maps_service_foreach_provider()
+ * @return @c true to continue with the next iteration of the loop, \n @c
+ * false to break out of the loop
+ *
+ * @pre maps_service_foreach_provider() will invoke this callback.
+ *
+ * @see maps_service_foreach_provider()
+ * @see maps_service_create()
+ */
+typedef bool(*maps_service_provider_info_cb) (char *maps_provider,
+ void *user_data);
+
+/**
+ * @brief Gets available Maps Providers.
+ * @details This function delivers available Maps Providers via
+ * maps_service_provider_info_cb() callback.
+ * @since_tizen 2.4
+ *
+ * @param[in] callback The callback function to receive available Maps Providers
+ * information
+ * @param[out] user_data The user data to be passed to the callback
+ * function
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NOT_FOUND Result not found
+ *
+ * @post This function invokes maps_service_provider_info_cb() to deliver Maps
+ * Provider information.
+ *
+ * @see maps_service_provider_info_cb()
+ * @see maps_service_create()
+ */
+int maps_service_foreach_provider(maps_service_provider_info_cb callback,
+ void *user_data);
+
+/**
+ * @brief Creates a new Maps Service and assigns it with a handle.
+ * @details While Maps Service is being created, a Maps Provider is initialized
+ * and linked with Maps Service handle.
+ * \n A Maps Service handle is used to query Maps Provider performing services,
+ * such as Geocoding, Searching Places and Routing.
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/mapservice \n
+ * %http://tizen.org/privilege/network.get
+ *
+ * @remarks @a maps service handle must be released using maps_service_destroy().
+ * \n use maps_service_foreach_provider() to choose one of available Providers.
+ * \n use maps_service_set_provider_key() to set provider's key.
+ * \n use use maps_service_set_preference() to set various options of Maps Provider.
+ * \n use maps_service_provider_is_service_supported() and maps_service_provider_is_data_supported()
+ * to check the Maps Provider's capabilities
+ *
+ * @param[in] maps_provider The name of Maps Provider
+ * @param[out] maps A handle of the new Maps Service on success
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ * @retval #MAPS_ERROR_PERMISSION_DENIED Permission Denied
+*
+ * @pre Call maps_service_foreach_provider() to get a available Maps Providers.
+ *
+ * @see maps_service_foreach_provider()
+ * @see maps_service_destroy()
+ * @see maps_service_geocode()
+ * @see maps_service_geocode_inside_area()
+ * @see maps_service_reverse_geocode()
+ * @see maps_service_search_place()
+ * @see maps_service_search_place_by_area()
+ * @see maps_service_search_place_by_address()
+ * @see maps_service_search_route()
+ * @see maps_service_search_route_waypoints()
+ * @see maps_service_set_provider_key()
+ * @see maps_service_set_preference()
+ * @see maps_service_provider_is_service_supported()
+ * @see maps_service_provider_is_data_supported()
+ */
+int maps_service_create(const char *maps_provider, maps_service_h *maps);
+
+/**
+ * @brief Destroys the Maps Service handle and releases all its resources.
+ * @details This function releases all used resources of the Maps Service and Maps Provider.
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/mapservice
+ *
+ * @param[in] maps The Maps Service handle to destroy
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @pre Call maps_service_create() to create Maps Service and get its handle.
+ *
+ * @see maps_service_create()
+ */
+int maps_service_destroy(maps_service_h maps);
+
+/**
+ * @brief Sets the Maps Key to be used in the requests of Maps Service.
+ * @details This function sets the Maps Provider's Key which will be used in each Maps
+ * Service request to Maps Provider.
+ * \n Maps key can be obtained with maps_service_get_provider_key().
+ * @since_tizen 2.4
+ * @remarks To get the @a provider_key, refer to corresponding Maps Provider
+ * documentation.
+ * \n To get app_id and app_code of HERE, visit https://developer.here.com/, https://developer.here.com/rest-apis.
+ *
+ * @param[in] maps The Maps Service handle
+ * @param[in] provider_key The Maps Key to be used
+ * \n In case of combining two more strings, use slash("/") as a delimiter.
+ * \n e.g. For HERE "app_id/app_code"
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @pre Call maps_service_create() to create Maps Service and get its handle.
+ *
+ * @see maps_service_create()
+ * @see maps_service_get_provider_key()
+ */
+int maps_service_set_provider_key(maps_service_h maps,
+ const char *provider_key);
+
+/**
+ * @brief Gets the Maps Key which is to be used in the Maps Service
+ * requests
+ * @details This function gets the Maps Key which is to be used in each Maps
+ * Service request to Maps Provider.
+ * \n Maps key can be set with maps_service_set_provider_key().
+ * @since_tizen 2.4
+ * @remarks The string @a provider_key must be released using free().
+ * \n @a maps_service_get_provider_key is always synchronous function.
+ *
+ * @param[in] maps The Maps Service handle
+ * @param[out] provider_key The Maps Key
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @pre Call maps_service_create() to create Maps Service and get its handle.
+ *
+ * @see maps_service_set_provider_key()
+ * @see maps_service_create()
+ */
+int maps_service_get_provider_key(const maps_service_h maps,
+ char **provider_key);
+
+/**
+ * @brief Sets the Maps Preference.
+ * @details This function sets the Maps Preferences which are used in each Maps
+ * Service request to Maps Provider.
+ * @since_tizen 2.4
+ *
+ * @param[in] maps The handle of Maps Service
+ * @param[in] preference The handle of Maps Preference
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ * @retval #MAPS_ERROR_PERMISSION_DENIED Permission Denied
+ *
+ * @pre Call maps_service_create() to create Maps Service and get its handle.
+ *
+ * @see maps_service_get_preference()
+ * @see maps_service_create()
+ */
+int maps_service_set_preference(maps_service_h maps,
+ maps_preference_h preference);
+
+/**
+ * @brief Gets the Maps Preference.
+ * @details This function gets the Maps Preferences which are used in each Maps
+ * Service request to Maps Provider.
+ * \n Preferences can be set with maps_service_set_preference().
+ * @since_tizen 2.4
+ * @remarks @a preference must be released using maps_preference_destroy().
+ * \n @a maps_service_get_preference is always synchronous function.
+ *
+ * @param[in] maps The handle of Maps Service
+ * @param[out] preference The handle of Maps Preference
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @pre Call maps_service_create() to create Maps Service and get its handle.
+ *
+ * @see maps_service_set_preference()
+ * @see maps_service_create()
+ */
+int maps_service_get_preference(maps_service_h maps,
+ maps_preference_h *preference);
+
+/**
+ * @brief Checks if the Maps Service supports a request.
+ * @details This function checks if the Maps Service supports a specified request.
+ * @since_tizen 2.4
+ * @remarks @a maps_service_provider_is_service_supported is always synchronous
+ * function.
+ *
+ * @param[in] maps The handle of Maps Service
+ * @param[in] service The service to be checked
+ * @param[out] supported Is the service supported
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful, the service is supported
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @pre Call maps_service_create() to create Maps Service and get its handle.
+ *
+ * @see maps_service_create()
+ */
+int maps_service_provider_is_service_supported(const maps_service_h maps,
+ maps_service_e service,
+ bool *supported);
+
+/**
+ * @brief Checks if the Maps Service supports a data feature.
+ * @details This function checks if the Maps Service supports a specified data
+ * feature.
+ * @since_tizen 2.4
+ * @remarks @a maps_service_provider_is_data_supported is always synchronous
+ * function.
+ *
+ * @param[in] maps The handle of Maps Service
+ * @param[in] data The data feature to be checked
+ * @param[out] supported Is the data feature supported
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful, the data feature is supported
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @pre Call maps_service_create() to create Maps Service and get its handle.
+ *
+ * @see maps_service_create()
+ */
+int maps_service_provider_is_data_supported(const maps_service_h maps,
+ maps_service_data_e data,
+ bool *supported);
+
+/*----------------------------------------------------------------------------*/
+/*
+ * Cancel Service Request
+ */
+
+/**
+ * @brief Cancels the service request.
+ * @details This function cancels the service request initiated by geocode,
+ * route or place search.
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/mapservice
+ *
+ * @param[in] maps The Maps Service handle
+ * @param[in] request_id The id of request
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NETWORK_UNREACHABLE Network connection failed
+ * @retval #MAPS_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ * @retval #MAPS_ERROR_PERMISSION_DENIED Permission Denied
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ * @retval #MAPS_ERROR_CONNECTION_TIME_OUT Timeout error, no answer
+ * @retval #MAPS_ERROR_INVALID_OPERATION Operation is not valid
+ * @retval #MAPS_ERROR_NOT_FOUND Result not found
+ * @retval #MAPS_ERROR_KEY_NOT_AVAILABLE Invalid key
+ * @retval #MAPS_ERROR_UNKNOWN Unknown error
+ *
+ * @pre @a request_id is obtained from one of followings:
+ * * maps_service_geocode()
+ * * maps_service_geocode_inside_area()
+ * * maps_service_geocode_by_structured_address()
+ * * maps_service_reverse_geocode()
+ * * maps_service_search_place()
+ * * maps_service_search_place_by_area()
+ * * maps_service_search_place_by_address()
+ * * maps_service_search_route()
+ * * maps_service_search_route_waypoints()
+ * .
+ * @pre Call maps_service_create() to create Maps Service and get its handle.
+ *
+ * @see maps_service_geocode()
+ * @see maps_service_geocode_inside_area()
+ * @see maps_service_geocode_by_structured_address()
+ * @see maps_service_reverse_geocode()
+ * @see maps_service_search_place()
+ * @see maps_service_search_place_by_area()
+ * @see maps_service_search_place_by_address()
+ * @see maps_service_search_route()
+ * @see maps_service_search_route_waypoints()
+ */
+int maps_service_cancel_request(const maps_service_h maps, int request_id);
+
+/**
+ * @}
+ */
+
+/*----------------------------------------------------------------------------*/
+/*
+ * Geocoder Service
+ */
+
+/**
+ *
+ * @ingroup CAPI_MAPS_SERVICE_MODULE
+ * @defgroup CAPI_MAPS_GEOCODER_MODULE Geocoder
+ *
+ * @addtogroup CAPI_MAPS_GEOCODER_MODULE
+ * @{
+ * @brief This provides APIs for Geocoder Service
+ * @details The Maps Geocoding API allows mapping an address to its geographical
+ * location defined in terms of latitude and longitude; the input can be a
+ * qualified, structured address or a free form single search text with full
+ * or partial address information.
+ * \n The Maps Reverse Geocoding API allows to inverse mapping a geographical
+ * location (longitude, latitude) to an address;
+ * it can be used to answer the question "Where am I?".
+ *
+ */
+
+/**
+ * @brief Called once for each position coordinates converted from the
+ * given address information.
+ * @details The Maps Service invokes this callback while iterating through the
+ * list of obtained coordinates of the specified place.
+ * \n If search is failed, the value of @a total is 0 and @a coordinates is NULL
+ * @since_tizen 2.4
+ * @remarks The parameter @a coordinates must be released using
+ * maps_coordinates_destroy().
+ *
+ * @param[in] result The result of request
+ * @param[in] request_id The id of request
+ * @param[in] index The current index of coordinates in result set,
+ * start from 0
+ * @param[in] total The total number of results
+ * @param[in] coordinates The coordinates of the place
+ * @param[in] user_data The user data passed from maps_service_geocode()
+ * or maps_service_geocode_inside_area()
+ * @return @c true to continue with the next iteration of the loop, \n @c
+ * false to break out of the loop
+ *
+ * @pre maps_service_geocode() or maps_service_geocode_inside_area() will invoke
+ * this callback.
+ *
+ * @see maps_service_geocode()
+ * @see maps_service_geocode_inside_area()
+ * @see maps_service_cancel_request()
+ */
+typedef bool(*maps_service_geocode_cb) (maps_error_e result, int request_id,
+ int index, int total,
+ maps_coordinates_h coordinates,
+ void *user_data);
+
+/**
+ * @brief Called when the address information is converted from position
+ * information.
+ * @details The Maps Service invokes this callback when the address is obtained
+ * from the specified coordinates.
+ * \n If search is failed, the value of @a total is 0 and @a address is NULL
+ * @remarks The parameter @a address must be released using
+ * maps_address_destroy().
+ * @since_tizen 2.4
+ *
+ * @param[in] result The result of request
+ * @param[in] request_id The id of request
+ * @param[in] index The current index of address data in result set,
+ * start from 0
+ * @param[in] total The total number of results
+ * @param[in] address The requested address information
+ * @param[in] user_data The user data passed from
+ * maps_service_reverse_geocode()
+ *
+ * @pre maps_service_reverse_geocode() will invoke this callback.
+ *
+ * @see maps_service_reverse_geocode()
+ * @see maps_service_cancel_request()
+ */
+typedef void (*maps_service_reverse_geocode_cb) (maps_error_e result,
+ int request_id, int index,
+ int total,
+ maps_address_h address,
+ void *user_data);
+
+/**
+ * @brief Gets the position coordinates for a given address. The request
+ * is asynchronous.
+ * @details This function obtains position coordinates for a given free-formed
+ * address string.
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/mapservice \n
+ * %http://tizen.org/privilege/internet \n
+ * %http://tizen.org/privilege/network.get
+ * @remarks %http://tizen.org/privilege/internet is needed to access internet.
+ * \n To cancel the request use maps_service_cancel_request().
+ * \n To check if Maps Provider is capable of Geocoding and which Geocode
+ * preferences are supported, see the lists of capacities and preferences above.
+ *
+ * @param[in] maps The Maps Service handle
+ * @param[in] address The free-formed address
+ * @param[in] preference The set of preferences for processing Geocode
+ * @param[in] callback The callback which will receive position
+ * coordinates
+ * @param[in] user_data The user data to be passed to the callback
+ * function
+ * @param[out] request_id The id of request
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NETWORK_UNREACHABLE Network connection failed
+ * @retval #MAPS_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ * @retval #MAPS_ERROR_PERMISSION_DENIED Permission Denied
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ * @retval #MAPS_ERROR_CONNECTION_TIME_OUT Timeout error, no answer
+ * @retval #MAPS_ERROR_INVALID_OPERATION Operation is not valid
+ * @retval #MAPS_ERROR_NOT_FOUND Result not found
+ * @retval #MAPS_ERROR_KEY_NOT_AVAILABLE Invalid key
+ * @retval #MAPS_ERROR_UNKNOWN Unknown error
+ *
+ * @pre Call maps_service_create() to create Maps Service and obtain its handle.
+ * @post It invokes maps_service_geocode_cb() to deliver obtained position
+ * coordinates.
+ *
+ * @see maps_service_geocode_inside_area()
+ * @see maps_service_geocode_cb()
+ * @see maps_service_cancel_request()
+ * @see maps_service_reverse_geocode()
+ */
+int maps_service_geocode(const maps_service_h maps, const char *address,
+ const maps_preference_h preference,
+ maps_service_geocode_cb callback, void *user_data,
+ int *request_id);
+
+/**
+ * @brief Gets the position for a given address, within the specified
+ * bounding box. The request is asynchronous.
+ * @details This function obtains position coordinates for a given free-formed
+ * address string within the specified bounding box.
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/mapservice \n
+ * %http://tizen.org/privilege/internet \n
+ * %http://tizen.org/privilege/network.get
+ * @remarks %http://tizen.org/privilege/internet is needed to access internet.
+ * \n Polygonal bounding box is not supported.
+ * \n To cancel the request use maps_service_cancel_request().
+ * \n To check if Maps Provider is capable of Geocoding and which Geocode
+ * preferences are supported, see the lists of capacities and preferences above.
+ *
+ * @param[in] maps The Maps Service handle
+ * @param[in] address The free-formed address
+ * @param[in] bounds The bounding box
+ * @param[in] preference The set of preferences for processing Geocode
+ * @param[in] callback The callback which will receive position
+ * coordinates
+ * @param[in] user_data The user data to be passed to the callback
+ * function
+ * @param[out] request_id The id of request
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NETWORK_UNREACHABLE Network connection failed
+ * @retval #MAPS_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ * @retval #MAPS_ERROR_PERMISSION_DENIED Permission Denied
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ * @retval #MAPS_ERROR_KEY_NOT_AVAILABLE Invalid key
+ * @retval #MAPS_ERROR_CONNECTION_TIME_OUT Timeout error, no answer
+ * @retval #MAPS_ERROR_INVALID_OPERATION Operation is not valid
+ * @retval #MAPS_ERROR_NOT_FOUND Result not found
+ * @retval #MAPS_ERROR_KEY_NOT_AVAILABLE Invalid key
+ * @retval #MAPS_ERROR_UNKNOWN Unknown error
+ *
+ * @pre Call maps_service_create() to create Maps Service and obtain its
+ * handle.
+ * @post It invokes maps_service_geocode_cb() to deliver obtained position
+ * coordinates.
+ *
+ * @see maps_service_geocode_by_structured_address()
+ * @see maps_service_geocode_inside_area()
+ * @see maps_service_geocode_cb()
+ * @see maps_service_geocode()
+ * @see maps_service_cancel_request()
+ * @see maps_service_reverse_geocode()
+ */
+int maps_service_geocode_inside_area(const maps_service_h maps,
+ const char *address,
+ const maps_area_h bounds,
+ const maps_preference_h preference,
+ maps_service_geocode_cb callback,
+ void *user_data, int *request_id);
+
+/**
+ * @brief Gets the position coordinates for a given address. The request
+ * is asynchronous.
+ * @details This function obtains position coordinates for a given structured
+ * address.
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/mapservice \n
+ * %http://tizen.org/privilege/internet \n
+ * %http://tizen.org/privilege/network.get
+ * @remarks %http://tizen.org/privilege/internet is needed to access internet.
+ * \n To cancel the request use maps_service_cancel_request().
+ * \n To check if Maps Provider is capable of Geocoding and which Geocode
+ * preferences are supported see the lists of capacities and preferences above.
+ *
+ * @param[in] maps The Maps Service handle
+ * @param[in] address The structured address
+ * @param[in] preference The set of preferences for processing Geocode
+ * @param[in] callback The callback which will receive position
+ * coordinates
+ * @param[in] user_data The user data to be passed to the callback
+ * function
+ * @param[out] request_id The id of request
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NETWORK_UNREACHABLE Network connection failed
+ * @retval #MAPS_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ * @retval #MAPS_ERROR_PERMISSION_DENIED Permission Denied
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ * @retval #MAPS_ERROR_CONNECTION_TIME_OUT Timeout error, no answer
+ * @retval #MAPS_ERROR_INVALID_OPERATION Operation is not valid
+ * @retval #MAPS_ERROR_NOT_FOUND Result not found
+ * @retval #MAPS_ERROR_KEY_NOT_AVAILABLE Invalid key
+ * @retval #MAPS_ERROR_UNKNOWN Unknown error
+ *
+ * @pre Call maps_service_create() to create Maps Service and obtain its handle.
+ * @post It invokes maps_service_geocode_cb() to deliver obtained position
+ * coordinates.
+
+ * @see maps_service_geocode()
+ * @see maps_service_geocode_inside_area()
+ * @see maps_service_geocode_cb()
+ * @see maps_service_cancel_request()
+ * @see maps_service_reverse_geocode()
+ */
+int maps_service_geocode_by_structured_address(const maps_service_h maps,
+ const maps_address_h address,
+ const maps_preference_h
+ preference,
+ maps_service_geocode_cb
+ callback, void *user_data,
+ int *request_id);
+
+/**
+ * @brief Gets the address for a given position coordinates. The request
+ * is asynchronous.
+ * @details This function obtains structured address information for a given
+ * position coordinates.
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/mapservice \n
+ * %http://tizen.org/privilege/internet \n
+ * %http://tizen.org/privilege/network.get
+ * @remarks %http://tizen.org/privilege/internet is needed to access internet.
+ * \n To cancel the request use maps_service_cancel_request().
+ * \n To check if Maps Provider is capable of Reverse Geocoding and which
+ * Reverse Geocode preferences are supported, see the lists of capacities and
+ * preferences above.
+ *
+ * @param[in] maps The Maps Service handle
+ * @param[in] latitude The latitude [-90.0 ~ 90.0] (degrees)
+ * @param[in] longitude The longitude [-180.0 ~ 180.0] (degrees)
+ * @param[in] preference The set of preferences for processing Reverse
+ * Geocode
+ * @param[in] callback The callback which will receive address
+ * information
+ * @param[in] user_data The user data to be passed to the callback
+ * function
+ * @param[out] request_id The id of request
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NETWORK_UNREACHABLE Network connection failed
+ * @retval #MAPS_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ * @retval #MAPS_ERROR_PERMISSION_DENIED Permission Denied
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ * @retval #MAPS_ERROR_CONNECTION_TIME_OUT Timeout error, no answer
+ * @retval #MAPS_ERROR_INVALID_OPERATION Operation is not valid
+ * @retval #MAPS_ERROR_NOT_FOUND Result not found
+ * @retval #MAPS_ERROR_KEY_NOT_AVAILABLE Invalid key
+ * @retval #MAPS_ERROR_UNKNOWN Unknown error
+ *
+ * @pre Call maps_service_create() to create Maps Service and obtain its handle.
+ * @post This function invokes maps_service_reverse_geocode_cb().
+ *
+ * @see maps_service_reverse_geocode_cb()
+ * @see maps_service_cancel_request()
+ * @see maps_service_geocode()
+ */
+int maps_service_reverse_geocode(const maps_service_h maps, double latitude,
+ double longitude,
+ const maps_preference_h preference,
+ maps_service_reverse_geocode_cb callback,
+ void *user_data, int *request_id);
+
+/**
+ * @}
+ */
+
+/*----------------------------------------------------------------------------*/
+/*
+ * Place Service
+ */
+
+/**
+ * @ingroup CAPI_MAPS_SERVICE_MODULE
+ * @defgroup CAPI_MAPS_PLACE_MODULE Places
+ *
+ * @addtogroup CAPI_MAPS_PLACE_MODULE
+ * @{
+ * @brief This provides APIs for Place Service
+ * @details The Maps Place API allows to find places that are relevant to user
+ * discovery context.
+ *
+ */
+
+/**
+ * @brief Called for each result of Place Search request
+ * @details The Maps Service invokes this callback while iterating through the
+ * set of obtained Place data.
+ * \n If search is failed, the value of @a total is 0 and @a place is NULL
+ * @since_tizen 2.4
+ * @remarks The parameter @a place must be released using maps_place_destroy().
+ *
+ * @param[in] error The result of request
+ * @param[in] request_id The request id
+ * @param[in] index The current index of place data in result set,
+ * start from 0
+ * @param[in] total The total number of results
+ * @param[in] place The resulting Place data
+ * @param[in] uesr_data The user data passed from
+ * maps_service_search_place(), maps_service_search_place_by_area() or
+ * maps_service_search_place_by_address()
+ * @return @c true to continue with the next iteration of the loop, \n @c
+ * false to break out of the loop
+ *
+ * @pre maps_service_search_place(), maps_service_search_place_by_area() or
+ * maps_service_search_place_by_address() will invoke this callback.
+ *
+ * @see maps_service_search_place()
+ * @see maps_service_search_place_by_area()
+ * @see maps_service_search_place_by_address()
+ */
+typedef bool(*maps_service_search_place_cb) (maps_error_e error,
+ int request_id, int index,
+ int total, maps_place_h place,
+ void *user_data);
+
+/**
+ * @brief Queries a Place information by a coordinates position and a
+ * distance. The request is asynchronous.
+ * @details This function obtains the Place information for a specified distance
+ * around a given coordinates position.
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/mapservice \n
+ * %http://tizen.org/privilege/internet \n
+ * %http://tizen.org/privilege/network.get
+ * @remarks %http://tizen.org/privilege/internet is needed to access internet.
+ * \n To cancel the search request use maps_service_cancel_request().
+ * \n To check if Maps Provider is capable of Place Search and which Place
+ * preferences are supported, see the lists of capacities and preferences above.
+ *
+ * @param[in] maps The Maps Service handle
+ * @param[in] position The interested position
+ * @param[in] distance The search area distance
+ * @param[in] filter The filter handle
+ * @param[in] preference The place preference handle
+ * @param[in] callback The result callback
+ * @param[in] user_data The user data to be passed to the callback
+ * function
+ * @param[out] request_id A Request id, can be set to NULL if does not
+ * require operation cancel
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ * @retval #MAPS_ERROR_PERMISSION_DENIED Permission Denied
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ * @retval #MAPS_ERROR_CONNECTION_TIME_OUT Timeout error, no answer
+ * @retval #MAPS_ERROR_INVALID_OPERATION Operation is not valid
+ * @retval #MAPS_ERROR_NOT_FOUND Result not found
+ * @retval #MAPS_ERROR_KEY_NOT_AVAILABLE Invalid key
+ * @retval #MAPS_ERROR_RESOURCE_BUSY Places service busy
+ * @retval #MAPS_ERROR_CANCELED Places service aborted
+ * @retval #MAPS_ERROR_UNKNOWN Unknown error
+ *
+ * @pre Call maps_service_create() to create Maps Service and obtain its handle.
+ * @post It invokes maps_service_search_place_cb() to deliver obtained Place
+ * information.
+ *
+ * @see maps_service_search_place_by_area()
+ * @see maps_service_search_place_by_address()
+ * @see maps_service_cancel_request()
+ * @see maps_service_search_place_cb()
+ */
+int maps_service_search_place(const maps_service_h maps,
+ const maps_coordinates_h position, int distance,
+ const maps_place_filter_h filter,
+ maps_preference_h preference,
+ maps_service_search_place_cb callback,
+ void *user_data, int *request_id);
+
+/**
+ * @brief Queries a Place information by a coordinates boundary. The
+ * request is asynchronous.
+ * @details This function obtains the Place information for a specified
+ * coordinates boundary.
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/mapservice \n
+ * %http://tizen.org/privilege/internet \n
+ * %http://tizen.org/privilege/network.get
+ * @remarks %http://tizen.org/privilege/internet is needed to access internet.
+ * \n @a boundary is supporting only circle type bounds for search.
+ * \n To cancel the search request use maps_service_cancel_request().
+ * \n To check if Maps Provider is capable of Place Search and which Place
+ * preferences are supported, see the lists of capacities and preferences above.
+ *
+ * @param[in] maps The Maps Service handle
+ * @param[in] boundary The interested area
+ * @param[in] filter The filter handle
+ * @param[in] preference The place preference handle
+ * @param[in] callback The result callback
+ * @param[in] user_data The user data to be passed to the callback
+ * function
+ * @param[out] request_id A Request id, can be set to NULL if does not
+ * required operation cancel
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ * @retval #MAPS_ERROR_PERMISSION_DENIED Permission Denied
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ * @retval #MAPS_ERROR_CONNECTION_TIME_OUT Timeout error, no answer
+ * @retval #MAPS_ERROR_INVALID_OPERATION Operation is not valid
+ * @retval #MAPS_ERROR_NOT_FOUND Result not found
+ * @retval #MAPS_ERROR_KEY_NOT_AVAILABLE Invalid key
+ * @retval #MAPS_ERROR_RESOURCE_BUSY Places service busy
+ * @retval #MAPS_ERROR_CANCELED Places service aborted
+ * @retval #MAPS_ERROR_UNKNOWN Unknown error
+ *
+ * @pre Call maps_service_create() to create Maps Service and obtain its
+ * handle.
+ * @post It invokes maps_service_search_place_cb() to deliver obtained Place
+ * information.
+ *
+ * @see maps_service_search_place()
+ * @see maps_service_search_place_by_address()
+ * @see maps_service_cancel_request()
+ * @see maps_service_search_place_cb()
+ */
+int maps_service_search_place_by_area(const maps_service_h maps,
+ const maps_area_h boundary,
+ const maps_place_filter_h filter,
+ maps_preference_h preference,
+ maps_service_search_place_cb callback,
+ void *user_data, int *request_id);
+
+/**
+ * @brief Queries a Place information by a free-formed address string.
+ * The request is asynchronous.
+ * @details This function obtains the Place information for a specified free-
+ * formed address string.
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/mapservice \n
+ * %http://tizen.org/privilege/internet \n
+ * %http://tizen.org/privilege/network.get
+ * @remarks %http://tizen.org/privilege/internet is needed to access internet.
+ * \n @a boundary is supporting only circle type bounds for search.
+ * \n To cancel the search request use maps_service_cancel_request().
+ * \n To check if Maps Provider is capable of Place Search and which Place
+ * preferences are supported, see the lists of capacities and preferences above.
+ *
+ * @param[in] maps The Maps Service handle
+ * @param[in] address The interested address
+ * @param[in] boundary The interested area
+ * @param[in] filter The filter handle
+ * @param[in] preference The place preference handle
+ * @param[in] callback The result callback
+ * @param[in] user_data The user data to be passed to the callback
+ * function
+ * @param[out] request_id A Request id, can be set to NULL if does not
+ * required operation cancel
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ * @retval #MAPS_ERROR_PERMISSION_DENIED Permission Denied
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ * @retval #MAPS_ERROR_CONNECTION_TIME_OUT Timeout error, no answer
+ * @retval #MAPS_ERROR_INVALID_OPERATION Operation is not valid
+ * @retval #MAPS_ERROR_NOT_FOUND Result not found
+ * @retval #MAPS_ERROR_KEY_NOT_AVAILABLE Invalid key
+ * @retval #MAPS_ERROR_RESOURCE_BUSY Places service busy
+ * @retval #MAPS_ERROR_CANCELED Places service aborted
+ * @retval #MAPS_ERROR_UNKNOWN Unknown error
+ *
+ * @pre Call maps_service_create() to create Maps Service and obtain its handle.
+ * @post It invokes maps_service_search_place_cb() to deliver obtained Place
+ * information.
+ *
+ * @see maps_service_search_place()
+ * @see maps_service_search_place_by_area()
+ * @see maps_service_cancel_request()
+ * @see maps_service_search_place_cb()
+ */
+int maps_service_search_place_by_address(const maps_service_h maps,
+ const char *address,
+ const maps_area_h boundary,
+ const maps_place_filter_h filter,
+ maps_preference_h preference,
+ maps_service_search_place_cb
+ callback, void *user_data,
+ int *request_id);
+
+/**
+ * @}
+ */
+
+/*----------------------------------------------------------------------------*/
+/*
+ * Route Service
+ */
+
+/**
+ * @ingroup CAPI_MAPS_SERVICE_MODULE
+ * @defgroup CAPI_MAPS_ROUTE_MODULE Routes
+ *
+ * @addtogroup CAPI_MAPS_ROUTE_MODULE
+ * @{
+ * @brief This provides APIs for Rote Service
+ * @details The Maps Route API provides ways to calculate a route that defines a
+ * path between a start and a destination and may,
+ * optionally, pass through specific intermediate locations.
+ *
+ */
+
+/**
+ * @brief Called when the requested Routes are found.
+ * @details The Maps Service invokes this callback while iterating through the
+ * set of obtained Routes.
+ * \n If search is failed, the value of @a total is 0 and @a route is NULL.
+ * @since_tizen 2.4
+ * @remarks The parameter @a route must be released using maps_route_destroy().
+ *
+ * @param[in] error The result of request
+ * @param[in] request_id The id of request
+ * @param[in] index The current index of Route in result set, start
+ * from 0
+ * @param[in] total The total number of result
+ * @param[in] route The Route data
+ * @param[in] user_data The user data passed from
+ * maps_service_search_route() or maps_service_search_route_waypoints()
+ * @return @c true to continue with the next iteration of the loop, \n @c
+ * false to break out of the loop
+ *
+ * @pre maps_service_search_route() or maps_service_search_route_waypoints()
+ * will invoke this callback.
+ *
+ * @see maps_service_search_route()
+ * @see maps_service_search_route_waypoints()
+ * @see maps_service_cancel_request()
+ */
+typedef bool(*maps_service_search_route_cb) (maps_error_e error,
+ int request_id, int index,
+ int total, maps_route_h route,
+ void *user_data);
+
+/**
+ * @brief Queries the Route from origin coordinate to a destination.
+ * The request is asynchronous.
+ * @details This function gets the Route information for a specified origin and
+ * destination coordinates.
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/mapservice \n
+ * %http://tizen.org/privilege/internet \n
+ * %http://tizen.org/privilege/network.get
+ * @remarks %http://tizen.org/privilege/internet is needed to access internet.
+ * \n To cancel the search request use maps_service_cancel_request().
+ * \n To check if Maps Provider is capable of Route Search and which Route
+ * preferences are supported, see the lists of capacities and preferences above.
+ *
+ * @param[in] maps The Maps Service handle
+ * @param[in] origin The starting point
+ * @param[in] destination The destination
+ * @param[in] preference The Route preference handle
+ * @param[in] callback The result callback
+ * @param[in] user_data The user data to be passed to the callback
+ * function
+ * @param[out] request_id The request ID
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_PERMISSION_DENIED Permission Denied
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ * @retval #MAPS_ERROR_CONNECTION_TIME_OUT Timeout error, no answer
+ * @retval #MAPS_ERROR_INVALID_OPERATION Operation is not valid
+ * @retval #MAPS_ERROR_NOT_FOUND Result not found
+ * @retval #MAPS_ERROR_KEY_NOT_AVAILABLE Invalid key
+ * @retval #MAPS_ERROR_UNKNOWN Unknown error
+ *
+ * @pre Call maps_service_create() to create Maps Service and get its handle.
+ * @post It invokes maps_service_search_route_cb() to deliver obtained Route
+ * information.
+ *
+ * @see maps_service_search_route_waypoints()
+ * @see maps_service_cancel_request()
+ * @see maps_service_search_route_cb()
+ */
+int maps_service_search_route(const maps_service_h maps,
+ const maps_coordinates_h origin,
+ const maps_coordinates_h destination,
+ maps_preference_h preference,
+ maps_service_search_route_cb callback,
+ void *user_data, int *request_id);
+
+/**
+ * @brief Queries the Route, passing through a specified way points. The
+ * request is asynchronous.
+ * @details This function gets the Route information for the Route, passing
+ * through a specified set of way points.
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/mapservice \n
+ * %http://tizen.org/privilege/internet \n
+ * %http://tizen.org/privilege/network.get
+ * @remarks %http://tizen.org/privilege/internet is needed to access internet.
+ * \n To cancel the search request use maps_service_cancel_request().
+ * \n To check if Maps Provider is capable of Route Search and which Route
+ * preferences are supported, see the lists of capacities and preferences above.
+ *
+ * @param[in] maps The Maps Service handle
+ * @param[in] waypoint_list The list of way points to go through
+ * @param[in] waypoint_num The number of way points to go through
+ * @param[in] preference The Route preference handle
+ * @param[in] callback The result callback
+ * @param[in] user_data The user data to be passed to the callback
+ * function
+ * @param[out] request_id The request ID
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Service unavailable
+ * @retval #MAPS_ERROR_PERMISSION_DENIED Permission Denied
+ * @retval #MAPS_ERROR_CONNECTION_TIME_OUT Timeout error, no answer
+ * @retval #MAPS_ERROR_INVALID_OPERATION Operation is not valid
+ * @retval #MAPS_ERROR_NOT_FOUND Result not found
+ * @retval #MAPS_ERROR_KEY_NOT_AVAILABLE Invalid key
+ * @retval #MAPS_ERROR_UNKNOWN Unknown error
+ *
+ * @pre Call maps_service_create() to create Maps Service and get its handle.
+ * @post It invokes maps_service_search_route_cb() to deliver obtained Route
+ * information.
+ *
+ * @see maps_service_search_route()
+ * @see maps_service_cancel_request()
+ * @see maps_service_search_route_cb()
+ */
+int maps_service_search_route_waypoints(const maps_service_h maps,
+ const maps_coordinates_h *
+ waypoint_list, int waypoint_num,
+ maps_preference_h preference,
+ maps_service_search_route_cb callback,
+ void *user_data, int *request_id);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __MAPS_SERVICE_H__ */
--- /dev/null
+Name: capi-maps-service
+Summary: Tizen Maps Service API
+Version: 0.4.6
+Release: 1
+Group: Location/API
+License: Apache-2.0
+Source0: %{name}-%{version}.tar.gz
+
+BuildRequires: cmake
+BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(gmodule-2.0)
+BuildRequires: pkgconfig(capi-base-common)
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(security-privilege-checker)
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
+Provides: capi-maps-service-plugin-devel
+
+%ifarch %{arm}
+%define ARCH arm
+%else
+%define ARCH i586
+%endif
+
+%description
+This provides the Tizen Map Service API to access and handle the map data.
+
+%prep
+%setup -q
+
+%build
+export CFLAGS="$CFLAGS -DTIZEN_ENGINEER_MODE"
+export CXXFLAGS="$CXXFLAGS -DTIZEN_ENGINEER_MODE"
+export FFLAGS="$FFLAGS -DTIZEN_ENGINEER_MODE"
+
+MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
+cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DMAJORVER=${MAJORVER} -DFULLVER=%{version} -DLIBDIR=%{_libdir}
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+
+mkdir -p %{buildroot}/usr/share/license
+cp LICENSE %{buildroot}/usr/share/license/%{name}
+
+%post
+/sbin/ldconfig
+
+%postun
+/sbin/ldconfig
+
+%files
+%manifest capi-maps-service.manifest
+%defattr(-,root,root,-)
+/usr/share/license/capi-maps-service
+%{_libdir}/libcapi-maps-service.so.*
+
+
+%package devel
+Summary: Tizen Maps Service Library (Development)
+Group: Location/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description devel
+This provides the Tizen Maps Service Library to access and handle the map data. (Development)
+
+%post devel
+/sbin/ldconfig
+
+%postun devel
+/sbin/ldconfig
+
+%files devel
+%defattr(-,root,root,-)
+%{_includedir}/maps/maps_*.h
+%{_libdir}/pkgconfig/capi-maps-service.pc
+%{_libdir}/libcapi-maps-service.so
+%exclude %{_includedir}/maps/maps_plugin*.h
+%exclude %{_includedir}/maps/maps_*_plugin.h
+%exclude %{_includedir}/maps/maps_extra_types.h
+
+
+%package plugin-devel
+Summary: Tizen Maps Library for the Maps Service Plug-in (Development)
+Group: Location/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description plugin-devel
+This provides the Tizen Map Service APIs to access and handle map data for the Maps Service Plug-in. (Development)
+
+%post plugin-devel
+/sbin/ldconfig
+
+%postun plugin-devel
+/sbin/ldconfig
+
+%files plugin-devel
+%defattr(-,root,root,-)
+%{_includedir}/maps/maps_plugin*.h
+%{_includedir}/maps/maps_*plugin.h
+%{_includedir}/maps/maps_extra_types.h
+
+
+#if you want to tesst code, please remove %if statement
+%if 0
+%package test
+Summary: Tizen Maps Service Library Test (Internal Dev)
+Group: Location/Testing
+Requires: capi-maps-service = %{version}-%{release}
+
+%description test
+This is a program to test the Tizen Maps Service Library internally.
+
+
+%files test
+%defattr(-,root,root,-)
+%manifest test/capi-maps-service-test.manifest
+/etc/smack/accesses.d/capi-maps-service-test.efl
+#/usr/share/packages/capi-maps-service-test.xml
+/opt/usr/devel/capi-maps-service-test
+
+#################################################################################
+# Test plugin library
+
+%package -n maps-plugin-test
+Summary: Tizen Maps Service Plug-in Test (Internal Dev)
+Group: Location/Testing
+Requires: %{name} = %{version}-%{release}
+
+%description -n maps-plugin-test
+This is a program to test the Tizen Maps Service for Plug-in internally.
+
+%files -n maps-plugin-test
+%manifest test/dummy_plugin/maps-plugin-test.manifest
+%defattr(-,root,root,-)
+%{_libdir}/maps/plugins/libmaps-plugin-test.so*
+%endif
--- /dev/null
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * 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 "maps_error.h"
+#include "maps_address.h"
+#include "maps_util.h"
+
+/*
+ * This represents address information such as building number,
+ * street name, etc.
+ */
+typedef struct _maps_address_s
+{
+ char *building_number; /**< Building number. */
+ char *street; /**< Full street name. */
+ char *district; /**< Municipal district name. */
+ char *city; /**< City name. */
+ char *state; /**< State or province region
+ of a nation. */
+ char *country_code; /**< Country name. */
+ char *postal_code; /**< Postal delivery code. */
+ char *freetext; /**<freeform address input */
+ char *country; /**<country name */
+ char *county; /**<county name */
+} maps_address_s;
+
+const gsize _MAPS_ADDRESS_BUILDING_NUMBER_MAX_LENGTH = 32;
+const gsize _MAPS_ADDRESS_STREET_MAX_LENGTH = 256;
+const gsize _MAPS_ADDRESS_MAX_LENGTH = 128;
+const gsize _MAPS_ADDRESS_DISTRICT_MAX_LENGTH = 128;
+const gsize _MAPS_ADDRESS_CITY_MAX_LENGTH = 256;
+const gsize _MAPS_ADDRESS_STATE_MAX_LENGTH = 256;
+const gsize _MAPS_ADDRESS_COUNTRY_CODE_MAX_LENGTH = 32;
+const gsize _MAPS_ADDRESS_POSTAL_CODE_MAX_LENGTH = 32;
+const gsize _MAPS_ADDRESS_FREE_TEXT_MAX_LENGTH = 1024;
+const gsize _MAPS_ADDRESS_COUNTRY_MAX_LENGTH = 128;
+const gsize _MAPS_ADDRESS_COUNTY_MAX_LENGTH = 128;
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_address_create(maps_address_h *address)
+{
+ if (!address)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ maps_address_s *a = g_slice_new0(maps_address_s);
+ if (!a) {
+ MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
+ return MAPS_ERROR_OUT_OF_MEMORY;
+ }
+
+ *address = (maps_address_h) a;
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_address_destroy(maps_address_h address)
+{
+ if (!address)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ maps_address_s *a = (maps_address_s *) address;
+
+ if (a->building_number)
+ g_free(a->building_number);
+ if (a->street)
+ g_free(a->street);
+ if (a->district)
+ g_free(a->district);
+ if (a->city)
+ g_free(a->city);
+ if (a->state)
+ g_free(a->state);
+ if (a->country_code)
+ g_free(a->country_code);
+ if (a->postal_code)
+ g_free(a->postal_code);
+ if (a->freetext)
+ g_free(a->freetext);
+ if (a->country)
+ g_free(a->country);
+ if (a->county)
+ g_free(a->county);
+
+ g_slice_free(maps_address_s, a);
+ address = NULL;
+
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_address_clone(const maps_address_h origin,
+ maps_address_h *cloned)
+{
+ if (!cloned || !origin)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ int error = MAPS_ERROR_NONE;
+ do {
+ error = maps_address_create(cloned);
+ if (!(*cloned) || (error != MAPS_ERROR_NONE))
+ break;
+
+ maps_address_s *a = (maps_address_s *) origin;
+
+ if (a->building_number) {
+ error = maps_address_set_building_number(*cloned,
+ a->building_number);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (a->street) {
+ error = maps_address_set_street(*cloned, a->street);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (a->district) {
+ error = maps_address_set_district(*cloned, a->district);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (a->city) {
+ error = maps_address_set_city(*cloned, a->city);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (a->state) {
+ error = maps_address_set_state(*cloned, a->state);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (a->country_code) {
+ error = maps_address_set_country_code(*cloned,
+ a->country_code);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (a->postal_code) {
+ error = maps_address_set_postal_code(*cloned,
+ a->postal_code);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (a->freetext) {
+ error = maps_address_set_freetext(*cloned, a->freetext);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (a->country) {
+ error = maps_address_set_country(*cloned, a->country);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (a->county) {
+ error = maps_address_set_county(*cloned, a->county);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ return MAPS_ERROR_NONE;
+ } while (false);
+
+ maps_address_destroy(*cloned);
+ *cloned = NULL;
+ return error;
+}
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_address_get_building_number(const maps_address_h address,
+ char **building_number)
+{
+ if (!address || !building_number)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_get_string(((maps_address_s *) address)->building_number,
+ _MAPS_ADDRESS_BUILDING_NUMBER_MAX_LENGTH, building_number);
+}
+
+EXPORT_API int maps_address_get_street(const maps_address_h address,
+ char **street)
+{
+ if (!address || !street)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_get_string(((maps_address_s *) address)->street,
+ _MAPS_ADDRESS_STREET_MAX_LENGTH, street);
+}
+
+EXPORT_API int maps_address_get_district(const maps_address_h address,
+ char **district)
+{
+ if (!address || !district)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_get_string(((maps_address_s *) address)->district,
+ _MAPS_ADDRESS_DISTRICT_MAX_LENGTH, district);
+}
+
+EXPORT_API int maps_address_get_city(const maps_address_h address, char **city)
+{
+ if (!address || !city)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_get_string(((maps_address_s *) address)->city,
+ _MAPS_ADDRESS_CITY_MAX_LENGTH, city);
+}
+
+EXPORT_API int maps_address_get_state(const maps_address_h address,
+ char **state)
+{
+ if (!address || !state)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_get_string(((maps_address_s *) address)->state,
+ _MAPS_ADDRESS_STATE_MAX_LENGTH, state);
+}
+
+EXPORT_API int maps_address_get_country(const maps_address_h address,
+ char **country)
+{
+ if (!address || !country)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_get_string(((maps_address_s *) address)->country,
+ _MAPS_ADDRESS_COUNTRY_MAX_LENGTH, country);
+}
+
+EXPORT_API int maps_address_get_country_code(const maps_address_h address,
+ char **country_code)
+{
+ if (!address || !country_code)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_get_string(((maps_address_s *) address)->country_code,
+ _MAPS_ADDRESS_COUNTRY_CODE_MAX_LENGTH, country_code);
+}
+
+EXPORT_API int maps_address_get_county(const maps_address_h address,
+ char **county)
+{
+ if (!address || !county)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_get_string(((maps_address_s *) address)->county,
+ _MAPS_ADDRESS_COUNTY_MAX_LENGTH, county);
+}
+
+EXPORT_API int maps_address_get_postal_code(const maps_address_h address,
+ char **postal_code)
+{
+ if (!address || !postal_code)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_get_string(((maps_address_s *) address)->postal_code,
+ _MAPS_ADDRESS_POSTAL_CODE_MAX_LENGTH, postal_code);
+}
+
+EXPORT_API int maps_address_get_freetext(const maps_address_h address,
+ char **freetext)
+{
+ if (!address || !freetext)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_get_string(((maps_address_s *) address)->freetext,
+ _MAPS_ADDRESS_FREE_TEXT_MAX_LENGTH, freetext);
+}
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_address_set_building_number(maps_address_h address,
+ const char *building_number)
+{
+ if (!address || !building_number)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_set_string(building_number,
+ _MAPS_ADDRESS_BUILDING_NUMBER_MAX_LENGTH,
+ &((maps_address_s *) address)->building_number);
+}
+
+EXPORT_API int maps_address_set_street(maps_address_h address,
+ const char *street)
+{
+ if (!address || !street)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_set_string(street, _MAPS_ADDRESS_STREET_MAX_LENGTH,
+ &((maps_address_s *) address)->street);
+}
+
+EXPORT_API int maps_address_set_district(maps_address_h address,
+ const char *district)
+{
+ if (!address || !district)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_set_string(district, _MAPS_ADDRESS_DISTRICT_MAX_LENGTH,
+ &((maps_address_s *) address)->district);
+}
+
+EXPORT_API int maps_address_set_city(maps_address_h address, const char *city)
+{
+ if (!address || !city)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_set_string(city, _MAPS_ADDRESS_CITY_MAX_LENGTH,
+ &((maps_address_s *) address)->city);
+}
+
+EXPORT_API int maps_address_set_state(maps_address_h address, const char *state)
+{
+ if (!address || !state)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_set_string(state, _MAPS_ADDRESS_STATE_MAX_LENGTH,
+ &((maps_address_s *) address)->state);
+}
+
+EXPORT_API int maps_address_set_country(maps_address_h address,
+ const char *country)
+{
+ if (!address || !country)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_set_string(country, _MAPS_ADDRESS_COUNTRY_MAX_LENGTH,
+ &((maps_address_s *) address)->country);
+}
+
+EXPORT_API int maps_address_set_country_code(maps_address_h address,
+ const char *country_code)
+{
+ if (!address || !country_code)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_set_string(country_code,
+ _MAPS_ADDRESS_COUNTRY_CODE_MAX_LENGTH,
+ &((maps_address_s *) address)->country_code);
+}
+
+EXPORT_API int maps_address_set_county(maps_address_h address,
+ const char *county)
+{
+ if (!address || !county)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_set_string(county, _MAPS_ADDRESS_COUNTY_MAX_LENGTH,
+ &((maps_address_s *) address)->county);
+}
+
+EXPORT_API int maps_address_set_postal_code(maps_address_h address,
+ const char *postal_code)
+{
+ if (!address || !postal_code)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_set_string(postal_code,
+ _MAPS_ADDRESS_POSTAL_CODE_MAX_LENGTH,
+ &((maps_address_s *) address)->postal_code);
+}
+
+EXPORT_API int maps_address_set_freetext(maps_address_h address,
+ const char *freetext)
+{
+ if (!address || !freetext)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_set_string(freetext, _MAPS_ADDRESS_FREE_TEXT_MAX_LENGTH,
+ &((maps_address_s *) address)->freetext);
+}
--- /dev/null
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * 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 "maps_error.h"
+#include "maps_area.h"
+#include "maps_util.h"
+
+EXPORT_API int maps_area_create_rectangle(const maps_coordinates_h top_left,
+ const maps_coordinates_h bottom_right,
+ maps_area_h *area)
+{
+ if (!top_left || !bottom_right || !area)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ double tf_lat = .0;
+ double tf_lon = .0;
+ double rb_lat = .0;
+ double rb_lon = .0;
+
+ maps_coordinates_get_latitude(top_left, &tf_lat);
+ maps_coordinates_get_latitude(bottom_right, &rb_lat);
+ maps_coordinates_get_longitude(top_left, &tf_lon);
+ maps_coordinates_get_longitude(bottom_right, &rb_lon);
+
+ double lon_interval = rb_lon - tf_lat;
+
+ if (lon_interval < 180 && lon_interval > -180) {
+ if (rb_lon <= tf_lon || rb_lat >= tf_lat)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ }
+ else {
+ if (rb_lon >= tf_lon || rb_lat >= tf_lat)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ }
+
+ maps_area_s *bound = g_slice_new0(maps_area_s);
+
+ if (bound == NULL) {
+ MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
+ return MAPS_ERROR_OUT_OF_MEMORY;
+ }
+
+ bound->type = MAPS_AREA_RECTANGLE;
+
+ bound->rect.top_left = *((maps_coordinates_s *) top_left);
+ bound->rect.bottom_right = *((maps_coordinates_s *) bottom_right);
+
+ *area = (maps_area_h) bound;
+
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_area_create_circle(const maps_coordinates_h center,
+ const double radius, maps_area_h *area)
+{
+ if (!center || !area)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ if (radius < 0)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ /* MAPS_CHECK_CONDITION(radius > 0, MAPS_ERROR_INVALID_PARAMETER,
+ * "MAPS_ERROR_INVALID_PARAMETER"); */
+ maps_area_s *bound = g_slice_new0(maps_area_s);
+
+ if (bound == NULL) {
+ MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
+ return MAPS_ERROR_OUT_OF_MEMORY;
+ }
+
+ bound->type = MAPS_AREA_CIRCLE;
+ bound->circle.center = *((maps_coordinates_s *) center);
+ bound->circle.radius = radius;
+ *area = (maps_area_h) bound;
+
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_area_destroy(maps_area_h area)
+{
+ if (!area)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ maps_area_s *handle = (maps_area_s *) area;
+
+ g_slice_free(maps_area_s, handle);
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_area_clone(const maps_area_h origin, maps_area_h *cloned)
+{
+ if (!cloned || !origin)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ maps_area_s * origin_handle = (maps_area_s *) origin;
+ if (origin_handle->type == MAPS_AREA_RECTANGLE) {
+ maps_area_h new_rect = NULL;
+ maps_area_rectangle_s rect = origin_handle->rect;
+ maps_coordinates_s rec_tl = rect.top_left;
+ maps_coordinates_s rec_br = rect.bottom_right;
+ maps_area_create_rectangle((maps_coordinates_h) & rec_tl,
+ (maps_coordinates_h) & rec_br, &new_rect);
+ if (new_rect) {
+ *cloned = new_rect;
+ }
+ else
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ }
+ else if (origin_handle->type == MAPS_AREA_CIRCLE) {
+ maps_area_h new_circle = NULL;
+ maps_area_circle_s cir = origin_handle->circle;
+ maps_coordinates_s center = cir.center;
+ double radius = cir.radius;
+ maps_area_create_circle((maps_coordinates_h) & center, radius,
+ &new_circle);
+ if (new_circle) {
+ *cloned = new_circle;
+ }
+ else
+ return MAPS_ERROR_INVALID_PARAMETER;
+ }
+
+ return MAPS_ERROR_NONE;
+}
--- /dev/null
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * 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 "maps_error.h"
+#include "maps_coordinates.h"
+#include "maps_util.h"
+
+EXPORT_API int maps_coordinates_create(const double latitude,
+ const double longitude,
+ maps_coordinates_h *coords)
+{
+ if (!coords)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ MAPS_CHECK_CONDITION(latitude >= -90
+ && latitude <= 90, MAPS_ERROR_INVALID_PARAMETER,
+ "MAPS_ERROR_INVALID_PARAMETER");
+ MAPS_CHECK_CONDITION(longitude >= -180
+ && longitude <= 180, MAPS_ERROR_INVALID_PARAMETER,
+ "MAPS_ERROR_INVALID_PARAMETER");
+
+ maps_coordinates_s *coord = g_slice_new0(maps_coordinates_s);
+
+ if (coord == NULL) {
+ MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
+ return MAPS_ERROR_OUT_OF_MEMORY;
+ }
+ coord->latitude = latitude;
+ coord->longitude = longitude;
+
+ *coords = (maps_coordinates_h) coord;
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_coordinates_destroy(maps_coordinates_h coords)
+{
+ if (!coords)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ maps_coordinates_s *handle = (maps_coordinates_s *) coords;
+ g_slice_free(maps_coordinates_s, handle);
+
+ coords = NULL;
+
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_coordinates_clone(const maps_coordinates_h origin,
+ maps_coordinates_h *cloned)
+{
+ if (!cloned || !origin)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ int error = MAPS_ERROR_NONE;
+ do {
+ maps_coordinates_s *c = (maps_coordinates_s *) origin;
+
+ error = maps_coordinates_create(c->latitude, c->longitude,
+ cloned);
+
+ if (!(*cloned) or(error != MAPS_ERROR_NONE))
+ break;
+
+ return MAPS_ERROR_NONE;
+ } while (false);
+
+ maps_coordinates_destroy(*cloned);
+ *cloned = NULL;
+ return error;
+}
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_coordinates_get_latitude(const maps_coordinates_h coords,
+ double *latitude)
+{
+ if (!coords || !latitude)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ *latitude = ((maps_coordinates_s *) coords)->latitude;
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_coordinates_get_longitude(const maps_coordinates_h coords,
+ double *longitude)
+{
+ if (!coords || !longitude)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ *longitude = ((maps_coordinates_s *) coords)->longitude;
+ return MAPS_ERROR_NONE;
+}
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_coordinates_set_latitude(maps_coordinates_h coords,
+ const double latitude)
+{
+ if (!coords)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ MAPS_CHECK_CONDITION(latitude >= -90
+ && latitude <= 90, MAPS_ERROR_INVALID_PARAMETER,
+ "MAPS_ERROR_INVALID_PARAMETER");
+ ((maps_coordinates_s *) coords)->latitude = latitude;
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_coordinates_set_longitude(maps_coordinates_h coords,
+ const double longitude)
+{
+ if (!coords)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ MAPS_CHECK_CONDITION(longitude >= -180
+ && longitude <= 180, MAPS_ERROR_INVALID_PARAMETER,
+ "MAPS_ERROR_INVALID_PARAMETER");
+ ((maps_coordinates_s *) coords)->longitude = longitude;
+ return MAPS_ERROR_NONE;
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 "maps_error.h"
+#include "maps_extra_types.h"
+#include "maps_util.h"
+
+typedef struct _maps_item_list_s
+{
+ GList *l;
+} maps_item_list_s;
+
+EXPORT_API int maps_item_list_create(maps_item_list_h *list)
+{
+ if (!list)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_item_list_s *l = g_slice_new0(maps_item_list_s);
+
+ if (!l) {
+ MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
+ return MAPS_ERROR_OUT_OF_MEMORY;
+ }
+
+ l->l = NULL;
+
+ *list = (maps_item_list_h *) l;
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_item_list_destroy(maps_item_list_h list)
+{
+ if (!list)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_item_list_s *l = (maps_item_list_s *) list;
+ if (l->l)
+ g_list_free(l->l);
+ g_slice_free(maps_item_list_s, l);
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_item_list_append(maps_item_list_h list, const void *data,
+ maps_item_list_clone_cb clone_func)
+{
+ if (!list || !data || !clone_func)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ void *p = NULL;
+ const int error = clone_func((void *) data, &p);
+ if (error != MAPS_ERROR_NONE)
+ return error;
+ maps_item_list_s *l = (maps_item_list_s *) list;
+ l->l = g_list_append(l->l, (gpointer) p);
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_item_list_foreach(maps_item_list_h list,
+ maps_item_list_clone_cb clone_func,
+ maps_item_list_foreach_cb callback,
+ void *user_data)
+{
+ if (!list || !clone_func || !callback)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_item_list_s *l = (maps_item_list_s *) list;
+
+ if (!l->l)
+ return MAPS_ERROR_NOT_FOUND;
+
+ const int total = g_list_length(l->l);
+ GList *head = g_list_first(l->l);
+ int index = 0;
+ while (head) {
+ void *data = head->data;
+ head = head->next;
+ void *clone = NULL;
+ if (clone_func(data, &clone) != MAPS_ERROR_NONE)
+ continue;
+ if (!callback(index++, total, clone, user_data))
+ break;
+ }
+
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_item_list_remove_all(maps_item_list_h list,
+ maps_item_list_free_cb free_func)
+{
+ if (!list)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_item_list_s *l = (maps_item_list_s *) list;
+ if (l->l) {
+ GList *head = g_list_first(l->l);
+ while (head) {
+ if (free_func)
+ free_func(head->data);
+ head = head->next;
+ }
+
+ g_list_free(l->l);
+ l->l = NULL;
+ }
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_item_list_clone(const maps_item_list_h origin,
+ maps_item_list_clone_cb clone_func,
+ maps_item_list_h *cloned)
+{
+ if (!cloned || !origin || !clone_func)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ int error = MAPS_ERROR_NONE;
+ do {
+
+ error = maps_item_list_create(cloned);
+ if (!(*cloned) || (error != MAPS_ERROR_NONE))
+ break;
+
+ maps_item_list_s *l = (maps_item_list_s *) origin;
+ if (!l->l)
+ return MAPS_ERROR_NONE;
+
+ maps_item_list_s *l_cloned = (maps_item_list_s *) (*cloned);
+
+ /* It would be cool when we will have glib v 2.34 */
+ /*l_cloned->l = g_list_copy_deep(l->l, clone_func, NULL); */
+ /* Now we iterate */
+ GList *head = g_list_first(l->l);
+ while (head) {
+ void *cloned_item = NULL;
+ const int error = clone_func(head->data, &cloned_item);
+ if (error == MAPS_ERROR_NONE)
+ l_cloned->l =
+ g_list_append(l_cloned->l,
+ (gpointer) cloned_item);
+ head = head->next;
+ }
+ return MAPS_ERROR_NONE;
+
+ } while (false);
+
+ maps_item_list_destroy(*cloned);
+ *cloned = NULL;
+ return error;
+}
+
+/*----------------------------------------------------------------------------*/
+
+typedef struct _maps_string_hashtable_s
+{
+ GHashTable *t;
+} maps_string_hashtable_s;
+
+EXPORT_API int maps_string_hashtable_create(maps_string_hashtable_h *table)
+{
+ if (!table)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_string_hashtable_s *t = g_slice_new0(maps_string_hashtable_s);
+
+ if (!t) {
+ MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
+ return MAPS_ERROR_OUT_OF_MEMORY;
+ }
+
+ t->t = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
+ *table = t;
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_string_hashtable_destroy(maps_string_hashtable_h table)
+{
+ if (!table)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_string_hashtable_s *t = (maps_string_hashtable_s *) table;
+ if (t->t)
+ g_hash_table_unref(t->t);
+ g_slice_free(maps_string_hashtable_s, t);
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_string_hashtable_set(maps_string_hashtable_h table,
+ const char *key, const char *value)
+{
+ if (!table || !key || !value)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_string_hashtable_s *t = (maps_string_hashtable_s *) table;
+ if (t->t)
+ g_hash_table_insert(t->t, (gpointer) g_strdup(key),
+ (gpointer) g_strdup(value));
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_string_hashtable_get(maps_string_hashtable_h table,
+ const char *key, char **value)
+{
+ if (!table || !key || !value)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_string_hashtable_s *t = (maps_string_hashtable_s *) table;
+ if (!t->t)
+ return MAPS_ERROR_NOT_FOUND;
+ char *table_value = (char *) g_hash_table_lookup(t->t, key);
+ if (!table_value)
+ return MAPS_ERROR_NONE;
+ return maps_get_string(table_value, strlen(table_value), value);
+}
+
+EXPORT_API int maps_string_hashtable_remove(maps_string_hashtable_h table,
+ const char *key)
+{
+ if (!table || !key)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_string_hashtable_s *t = (maps_string_hashtable_s *) table;
+ if (t->t)
+ g_hash_table_remove(t->t, (gpointer) key);
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_string_hashtable_foreach(maps_string_hashtable_h table,
+ maps_string_hashtable_foreach_cb
+ callback,
+ void *user_data)
+{
+ if (!table || !callback)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_string_hashtable_s *t = (maps_string_hashtable_s *) table;
+
+ if (!t->t)
+ return MAPS_ERROR_NOT_FOUND;
+
+ GHashTableIter iter;
+ gpointer key, value;
+ const int total = g_hash_table_size(t->t);
+ int index = 0;
+ g_hash_table_iter_init(&iter, t->t);
+ while (g_hash_table_iter_next(&iter, &key, &value)) {
+
+ char *key_clone = NULL;
+ if (maps_item_hashtable_clone_string(key,
+ (void **) &key_clone) != MAPS_ERROR_NONE)
+ continue;
+ char *value_clone = NULL;
+ if (maps_item_hashtable_clone_string(value,
+ (void **) &value_clone) != MAPS_ERROR_NONE)
+ continue;
+
+ if (!callback(index++, total, key_clone, value_clone,
+ user_data))
+ break;
+
+ }
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_string_hashtable_clone(const maps_string_hashtable_h origin,
+ maps_string_hashtable_h *cloned)
+{
+ if (!cloned || !origin)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ int error = MAPS_ERROR_NONE;
+ do {
+
+ error = maps_string_hashtable_create(cloned);
+ if (!(*cloned) || (error != MAPS_ERROR_NONE))
+ break;
+
+ maps_string_hashtable_s *t = (maps_string_hashtable_s *) origin;
+
+ if (!t->t)
+ return MAPS_ERROR_NONE;
+
+ maps_string_hashtable_s *t_cloned =
+ (maps_string_hashtable_s *) (*cloned);
+
+ GHashTableIter iter;
+ gpointer key, value;
+ g_hash_table_iter_init(&iter, t->t);
+ while (g_hash_table_iter_next(&iter, &key, &value)) {
+ g_hash_table_insert(t_cloned->t,
+ (gpointer) g_strdup((const gchar *) key),
+ (gpointer) g_strdup((const gchar *) value));
+ }
+
+ return MAPS_ERROR_NONE;
+
+ } while (false);
+
+ maps_string_hashtable_destroy(*cloned);
+ *cloned = NULL;
+ return error;
+}
+
+EXPORT_API int maps_string_hashtable_contains(maps_string_hashtable_h table,
+ const char * key, bool * contains)
+{
+ if (!table || !key || !contains)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_string_hashtable_s *t = (maps_string_hashtable_s *) table;
+ if (t->t)
+ *contains = g_hash_table_contains(t->t, (gpointer) key);
+ return MAPS_ERROR_NONE;
+}
+
+/*----------------------------------------------------------------------------*/
+
+typedef struct _maps_hashtable_item_s
+{
+ void *value;
+ maps_item_hashtable_clone_cb clone_func;
+ maps_item_hashtable_free_cb free_func;
+} maps_hashtable_item_s;
+
+void _maps_hashtable_item_create(maps_hashtable_item_s **item)
+{
+ *item = g_slice_new0(maps_hashtable_item_s);
+
+ if (*item == NULL) {
+ MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
+ }
+}
+
+void _maps_hashtable_item_destroy(gpointer data)
+{
+ if (!data)
+ return;
+
+ maps_hashtable_item_s *item = (maps_hashtable_item_s *) data;
+ if (item && item->value && item->free_func)
+ item->free_func(item->value);
+
+ g_slice_free(maps_hashtable_item_s, item);
+}
+
+/*----------------------------------------------------------------------------*/
+
+typedef struct _maps_item_hashtable_s
+{
+ GHashTable *t;
+} maps_item_hashtable_s;
+
+EXPORT_API int maps_item_hashtable_create(maps_item_hashtable_h *table)
+{
+ if (!table)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_item_hashtable_s *t = g_slice_new0(maps_item_hashtable_s);
+
+ if (!t) {
+ MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
+ return MAPS_ERROR_OUT_OF_MEMORY;
+ }
+
+ t->t = g_hash_table_new_full(g_str_hash, g_str_equal, g_free,
+ _maps_hashtable_item_destroy);
+ *table = t;
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_item_hashtable_destroy(maps_item_hashtable_h table)
+{
+ if (!table)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_item_hashtable_s *t = (maps_item_hashtable_s *) table;
+ if (t->t)
+ g_hash_table_unref(t->t);
+ g_slice_free(maps_item_hashtable_s, t);
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_item_hashtable_clone_string(void *origin, void **cloned)
+{
+ if (!origin || !cloned)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_get_string((char *) origin, strlen((char *) origin),
+ (char **) cloned);
+}
+
+EXPORT_API int maps_item_hashtable_free_string(void *data)
+{
+ g_free(data);
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_item_hashtable_clone_int(void *origin, void **cloned)
+{
+ if (!origin || !cloned)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ int *n_cloned = g_new0(int, 1);
+
+ if (n_cloned == NULL) {
+ MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
+ return MAPS_ERROR_OUT_OF_MEMORY;
+ }
+
+ int *n_origin = (int *) origin;
+ *n_cloned = *n_origin;
+ *cloned = n_cloned;
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_item_hashtable_free_int(void *data)
+{
+ g_free(data);
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_item_hashtable_clone_float(void *origin, void **cloned)
+{
+ if (!origin || !cloned)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ double *n_cloned = g_new0(double, 1);
+
+ if (n_cloned == NULL) {
+ MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
+ return MAPS_ERROR_OUT_OF_MEMORY;
+ }
+
+ double *n_origin = (double *) origin;
+ *n_cloned = *n_origin;
+ *cloned = n_cloned;
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_item_hashtable_free_float(void *data)
+{
+ g_free(data);
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_item_hashtable_set_string(maps_item_hashtable_h table,
+ const char *key,
+ const char *value)
+{
+ return maps_item_hashtable_set(table, key, value,
+ maps_item_hashtable_clone_string,
+ maps_item_hashtable_free_string);
+}
+
+EXPORT_API int maps_item_hashtable_set_int(maps_item_hashtable_h table,
+ const char *key, const int value)
+{
+ return maps_item_hashtable_set(table, key, &value,
+ maps_item_hashtable_clone_int, maps_item_hashtable_free_int);
+}
+
+EXPORT_API int maps_item_hashtable_set_float(maps_item_hashtable_h table,
+ const char *key,
+ const double value)
+{
+ return maps_item_hashtable_set(table, key, &value,
+ maps_item_hashtable_clone_float,
+ maps_item_hashtable_free_float);
+}
+
+EXPORT_API int maps_item_hashtable_set(maps_item_hashtable_h table,
+ const char *key, const void *value,
+ maps_item_hashtable_clone_cb clone_func,
+ maps_item_hashtable_free_cb free_func)
+{
+ if (!table || !key || !value || !clone_func || !free_func)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_item_hashtable_s *t = (maps_item_hashtable_s *) table;
+
+ if (t->t) {
+ maps_hashtable_item_s *item = NULL;
+ _maps_hashtable_item_create(&item);
+
+ const int error = clone_func((void *) value, &item->value);
+ if (error != MAPS_ERROR_NONE) {
+ _maps_hashtable_item_destroy(item);
+ return error;
+ }
+ item->clone_func = clone_func;
+ item->free_func = free_func;
+ if (t->t)
+ g_hash_table_insert(t->t, (gpointer) g_strdup(key),
+ (gpointer) item);
+ }
+
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_item_hashtable_get_string(maps_item_hashtable_h table,
+ const char *key, char **value)
+{
+ return maps_item_hashtable_get(table, key, (void **) value);
+}
+
+EXPORT_API int maps_item_hashtable_get_int(maps_item_hashtable_h table,
+ const char *key, int *value)
+{
+ if (!table || !key || !value)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ int *data = NULL;
+ const int error = maps_item_hashtable_get(table, key, (void **) &data);
+ if (error == MAPS_ERROR_NONE) {
+ *value = *data;
+ maps_item_hashtable_free_int(data);
+ }
+ return error;
+}
+
+EXPORT_API int maps_item_hashtable_get_float(maps_item_hashtable_h table,
+ const char *key, double *value)
+{
+ if (!table || !key || !value)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ double *data = NULL;
+ const int error = maps_item_hashtable_get(table, key, (void **) &data);
+ if (error == MAPS_ERROR_NONE) {
+ *value = *data;
+ maps_item_hashtable_free_float(data);
+ }
+ return error;
+}
+
+EXPORT_API int maps_item_hashtable_get(maps_item_hashtable_h table,
+ const char *key, void **value)
+{
+ if (!table || !key || !value)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_item_hashtable_s *t = (maps_item_hashtable_s *) table;
+ if (!t->t)
+ return MAPS_ERROR_NOT_FOUND;
+ maps_hashtable_item_s *item =
+ (maps_hashtable_item_s *) g_hash_table_lookup(t->t, key);
+ if (!item || !item->clone_func)
+ return MAPS_ERROR_NOT_FOUND;
+ return item->clone_func(item->value, value);
+}
+
+EXPORT_API int maps_item_hashtable_remove(maps_item_hashtable_h table,
+ const char *key)
+{
+ if (!table || !key)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_item_hashtable_s *t = (maps_item_hashtable_s *) table;
+ if (t->t)
+ g_hash_table_remove(t->t, (gpointer) key);
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_item_hashtable_foreach(maps_item_hashtable_h table,
+ maps_item_hashtable_foreach_cb
+ callback,
+ void *user_data)
+{
+ if (!table || !callback)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_item_hashtable_s *t = (maps_item_hashtable_s *) table;
+
+ if (!t->t)
+ return MAPS_ERROR_NOT_FOUND;
+
+ GHashTableIter iter;
+ gpointer key, value;
+ const int total = g_hash_table_size(t->t);
+ int index = 0;
+ g_hash_table_iter_init(&iter, t->t);
+ while (g_hash_table_iter_next(&iter, &key, &value)) {
+ maps_hashtable_item_s *item = (maps_hashtable_item_s *) value;
+ if (!item || !item->clone_func)
+ continue;
+
+ char *key_clone = NULL;
+ if (maps_item_hashtable_clone_string(key,
+ (void **) &key_clone) != MAPS_ERROR_NONE)
+ continue;
+ void *value_clone = NULL;
+ if (item->clone_func(item->value,
+ &value_clone) != MAPS_ERROR_NONE)
+ continue;
+
+ if (!callback(index++, total, key_clone, value_clone,
+ user_data))
+ break;
+ }
+
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_item_hashtable_clone(const maps_item_hashtable_h origin,
+ maps_item_hashtable_h* cloned)
+{
+ if (!cloned || !origin)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ int error = MAPS_ERROR_NONE;
+ do {
+
+ error = maps_item_hashtable_create(cloned);
+ if (!(*cloned) || (error != MAPS_ERROR_NONE))
+ break;
+
+ maps_item_hashtable_s *t = (maps_item_hashtable_s *) origin;
+
+ if (!t->t)
+ return MAPS_ERROR_NONE;
+
+ GHashTableIter iter;
+ gpointer key, value;
+ g_hash_table_iter_init(&iter, t->t);
+ while (g_hash_table_iter_next(&iter, &key, &value)) {
+ maps_hashtable_item_s *item =
+ (maps_hashtable_item_s *) value;
+ if (!item)
+ continue;
+ maps_item_hashtable_set(*cloned, (const char *) key,
+ (const void *) item->value, item->clone_func,
+ item->free_func);
+ }
+
+ return MAPS_ERROR_NONE;
+
+ } while (false);
+
+ maps_item_hashtable_destroy(*cloned);
+ *cloned = NULL;
+ return error;
+}
+
+EXPORT_API int maps_item_hashtable_contains(maps_item_hashtable_h table,
+ const char *key, bool *contains)
+{
+ if (!table || !key || !contains)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_item_hashtable_s *t = (maps_item_hashtable_s *) table;
+ if (t->t)
+ *contains = g_hash_table_contains(t->t, (gpointer) key);
+ return MAPS_ERROR_NONE;
+}
--- /dev/null
+/* Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 "maps_error.h"
+#include "maps_place_plugin.h"
+#include "maps_extra_types.h"
+#include "maps_util.h"
+#include "maps_address.h"
+#include "maps_place_private.h"
+#include <glib.h>
+
+static bool __is_supported(const maps_place_h place, maps_service_data_e data)
+{
+ bool supported = false;
+ _maps_place_is_data_supported(place, data, &supported);
+ return supported;
+}
+
+/*----------------------------------------------------------------------------*/
+
+typedef struct _maps_place_s
+{
+
+ char *id;
+ char *name;
+ char *uri;
+
+ maps_coordinates_h location;
+
+ int distance;
+
+ maps_address_h address;
+
+ maps_place_rating_h rating;
+
+ /* List of properties:
+ * Obtained with: maps_place_properties_cb callback
+ * Items are pairs: const char* key, const char* value */
+ maps_item_hashtable_h properties;
+
+ /* List of categories
+ * Obtained with: maps_place_categories_cb
+ * Each of type: maps_place_category_h */
+ maps_item_list_h categories;
+
+ /* List of attributes
+ * Obtained with maps_place_attributes_cb
+ * Each of type: maps_place_attribute_h */
+ maps_item_list_h attribute;
+
+ /* List of contacts
+ * Obtained with: maps_place_contacts_cb
+ * Each of type: maps_place_contact_h */
+ maps_item_list_h contacts;
+
+ /* List of editorials
+ * Obtained with: maps_place_editorials_cb
+ * Each of type: maps_place_editorial_h */
+ maps_item_list_h editorials;
+
+ /* List of images
+ * Obtained with: maps_place_images_cb callback
+ * Each of type: maps_place_image_h */
+ maps_item_list_h images;
+
+ /* List of reviews
+ * Obtained with: maps_place_reviews_cb callback
+ * Each of type: maps_place_review_h */
+ maps_item_list_h reviews;
+
+ maps_place_link_object_h supplier;
+ maps_place_link_object_h related;
+
+ /* The table of available data features */
+ maps_string_hashtable_h supported_data;
+ /* TODO: implement hashtable<int, int> */
+
+} maps_place_s;
+
+/* TODO: extract all such constants to the dedcated header file */
+const gsize _MAPS_PLACE_ID_MAX_LENGTH = 32;
+const gsize _MAPS_PLACE_NAME_MAX_LENGTH = 64;
+const gsize _MAPS_PLACE_URI_MAX_LENGTH = 128;
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_place_create(maps_place_h *place)
+{
+ if (!place)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ *place = (maps_place_h) g_slice_new0(maps_place_s);
+
+ if (*place == NULL) {
+ MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
+ return MAPS_ERROR_OUT_OF_MEMORY;
+ }
+
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_place_destroy(maps_place_h place)
+{
+ if (!place)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ maps_place_s *p = (maps_place_s *) place;
+
+ if (p->id)
+ g_free(p->id);
+ if (p->name)
+ g_free(p->name);
+ if (p->uri)
+ g_free(p->uri);
+
+ if (p->location)
+ maps_coordinates_destroy(p->location);
+
+ if (p->address)
+ maps_address_destroy(p->address);
+
+ if (p->rating)
+ maps_place_rating_destroy(p->rating);
+
+ if (p->properties)
+ maps_item_hashtable_destroy(p->properties);
+
+ if (p->categories) {
+ maps_item_list_remove_all(p->categories,
+ maps_place_category_destroy);
+ maps_item_list_destroy(p->categories);
+ }
+
+ if (p->attribute) {
+ maps_item_list_remove_all(p->attribute,
+ maps_place_attribute_destroy);
+ maps_item_list_destroy(p->attribute);
+ }
+
+ if (p->contacts) {
+ maps_item_list_remove_all(p->contacts,
+ maps_place_contact_destroy);
+ maps_item_list_destroy(p->contacts);
+ }
+
+ if (p->editorials) {
+ maps_item_list_remove_all(p->editorials,
+ maps_place_editorial_destroy);
+ maps_item_list_destroy(p->editorials);
+ }
+
+ if (p->images) {
+ maps_item_list_remove_all(p->images, maps_place_image_destroy);
+ maps_item_list_destroy(p->images);
+ }
+
+ if (p->reviews) {
+ maps_item_list_remove_all(p->reviews,
+ maps_place_review_destroy);
+ maps_item_list_destroy(p->reviews);
+ }
+
+ if (p->supplier)
+ maps_place_link_object_destroy(p->supplier);
+ if (p->related)
+ maps_place_link_object_destroy(p->related);
+
+ if (p->supported_data)
+ maps_item_hashtable_destroy(p->supported_data);
+
+ g_slice_free(maps_place_s, place);
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_place_clone(const maps_place_h origin,
+ maps_place_h *cloned)
+{
+ if (!cloned || !origin)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ int error = MAPS_ERROR_NONE;
+ do {
+ error = maps_place_create(cloned);
+ if (!(*cloned) || (error != MAPS_ERROR_NONE))
+ break;
+
+ maps_place_s *p = (maps_place_s *) origin;
+
+ if (p->id) {
+ error = maps_place_set_id(*cloned, p->id);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (p->name) {
+ error = maps_place_set_name(*cloned, p->name);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (p->uri) {
+ error = maps_place_set_uri(*cloned, p->uri);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (p->location) {
+ error = maps_place_set_location(*cloned, p->location);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ error = maps_place_set_distance(*cloned, p->distance);
+ if (error != MAPS_ERROR_NONE)
+ break;
+
+ if (p->address) {
+ error = maps_place_set_address(*cloned, p->address);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (p->rating) {
+ error = maps_place_set_rating(*cloned, p->rating);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (p->properties) {
+ error = maps_place_set_properties(*cloned,
+ p->properties);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (p->categories) {
+ error = maps_place_set_categories(*cloned,
+ p->categories);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (p->attribute) {
+ error = maps_place_set_attributes(*cloned,
+ p->attribute);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (p->contacts) {
+ error = maps_place_set_contacts(*cloned, p->contacts);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (p->editorials) {
+ error = maps_place_set_editorials(*cloned,
+ p->editorials);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (p->images) {
+ error = maps_place_set_images(*cloned, p->images);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (p->reviews) {
+ error = maps_place_set_reviews(*cloned, p->reviews);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (p->supplier) {
+ error = maps_place_set_supplier_link(*cloned,
+ p->supplier);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (p->related) {
+ error = maps_place_set_related_link(*cloned,
+ p->related);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (p->supported_data) {
+ error = _maps_place_set_supported_data(*cloned,
+ p->supported_data);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ return MAPS_ERROR_NONE;
+ } while (false);
+
+ maps_place_destroy(*cloned);
+ *cloned = NULL;
+ return error;
+}
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_place_get_id(const maps_place_h place, char **id)
+{
+ if (!place || !id)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_get_string(((maps_place_s *) place)->id,
+ _MAPS_PLACE_ID_MAX_LENGTH, id);
+}
+
+EXPORT_API int maps_place_get_name(const maps_place_h place, char **name)
+{
+ if (!place || !name)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_get_string(((maps_place_s *) place)->name,
+ _MAPS_PLACE_NAME_MAX_LENGTH, name);
+}
+
+EXPORT_API int maps_place_get_uri(const maps_place_h place, char **uri)
+{
+ if (!place || !uri)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_get_string(((maps_place_s *) place)->uri,
+ _MAPS_PLACE_URI_MAX_LENGTH, uri);
+}
+
+EXPORT_API int maps_place_get_location(const maps_place_h place,
+ maps_coordinates_h *location)
+{
+ if (!place || !location)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_coordinates_clone(((maps_place_s *) place)->location,
+ location);
+}
+
+EXPORT_API int maps_place_get_distance(const maps_place_h place, int *distance)
+{
+ if (!place || !distance)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ *distance = ((maps_place_s *) place)->distance;
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_place_get_address(const maps_place_h place,
+ maps_address_h *address)
+{
+ /* Check if the handle of the Place is valid */
+ if (!place)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ /* Check if this API feature available */
+ if (!__is_supported(place, MAPS_PLACE_ADDRESS))
+ return MAPS_ERROR_NOT_SUPPORTED;
+
+ /* Check if parameters are valid */
+ if (!address)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ return maps_address_clone(((maps_place_s *) place)->address, address);
+}
+
+EXPORT_API int maps_place_get_rating(const maps_place_h place,
+ maps_place_rating_h *rating)
+{
+ /* Check if the handle of the Place is valid */
+ if (!place)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ /* Check if this API feature available */
+ if (!__is_supported(place, MAPS_PLACE_RATING))
+ return MAPS_ERROR_NOT_SUPPORTED;
+
+ /* Check if parameters are valid */
+ if (!rating)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ return maps_place_rating_clone(((maps_place_s *) place)->rating,
+ rating);
+}
+
+EXPORT_API int maps_place_foreach_property(const maps_place_h place,
+ maps_place_properties_cb callback,
+ void *user_data)
+{
+ if (!place || !callback)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_item_hashtable_foreach(((maps_place_s *) place)->properties,
+ callback, user_data);
+}
+
+EXPORT_API int maps_place_foreach_category(const maps_place_h place,
+ maps_place_categories_cb callback,
+ void *user_data)
+{
+ /* Check if the handle of the Place is valid */
+ if (!place)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ /* Check if this API feature available */
+ if (!__is_supported(place, MAPS_PLACE_CATEGORIES))
+ return MAPS_ERROR_NOT_SUPPORTED;
+
+ /* Check if parameters are valid */
+ if (!callback)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ return maps_item_list_foreach(((maps_place_s *) place)->categories,
+ maps_place_category_clone, callback, user_data);
+}
+
+EXPORT_API int maps_place_foreach_attribute(const maps_place_h place,
+ maps_place_attributes_cb callback,
+ void * user_data)
+{
+ /* Check if the handle of the Place is valid */
+ if (!place)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ /* Check if this API feature available */
+ if (!__is_supported(place, MAPS_PLACE_ATTRIBUTES))
+ return MAPS_ERROR_NOT_SUPPORTED;
+
+ /* Check if parameters are valid */
+ if (!callback)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ return maps_item_list_foreach(((maps_place_s *) place)->attribute,
+ maps_place_attribute_clone, callback, user_data);
+}
+
+EXPORT_API int maps_place_foreach_contact(const maps_place_h place,
+ maps_place_contacts_cb callback,
+ void *user_data)
+{
+ /* Check if the handle of the Place is valid */
+ if (!place)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ /* Check if this API feature available */
+ if (!__is_supported(place, MAPS_PLACE_CONTACTS))
+ return MAPS_ERROR_NOT_SUPPORTED;
+
+ /* Check if parameters are valid */
+ if (!callback)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ return maps_item_list_foreach(((maps_place_s *) place)->contacts,
+ maps_place_contact_clone, callback, user_data);
+}
+
+EXPORT_API int maps_place_foreach_editorial(const maps_place_h place,
+ maps_place_editorials_cb callback,
+ void *user_data)
+{
+ /* Check if the handle of the Place is valid */
+ if (!place)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ /* Check if this API feature available */
+ if (!__is_supported(place, MAPS_PLACE_EDITORIALS))
+ return MAPS_ERROR_NOT_SUPPORTED;
+
+ /* Check if parameters are valid */
+ if (!callback)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ return maps_item_list_foreach(((maps_place_s *) place)->editorials,
+ maps_place_editorial_clone, callback, user_data);
+}
+
+EXPORT_API int maps_place_foreach_image(const maps_place_h place,
+ maps_place_images_cb callback,
+ void *user_data)
+{
+ /* Check if the handle of the Place is valid */
+ if (!place)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ /* Check if this API feature available */
+ if (!__is_supported(place, MAPS_PLACE_IMAGE))
+ return MAPS_ERROR_NOT_SUPPORTED;
+
+ /* Check if parameters are valid */
+ if (!callback)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ return maps_item_list_foreach(((maps_place_s *) place)->images,
+ maps_place_image_clone, callback, user_data);
+}
+
+EXPORT_API int maps_place_foreach_review(const maps_place_h place,
+ maps_place_reviews_cb callback,
+ void *user_data)
+{
+ /* Check if the handle of the Place is valid */
+ if (!place)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ /* Check if this API feature available */
+ if (!__is_supported(place, MAPS_PLACE_REVIEWS))
+ return MAPS_ERROR_NOT_SUPPORTED;
+
+ /* Check if parameters are valid */
+ if (!callback)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ return maps_item_list_foreach(((maps_place_s *) place)->reviews,
+ maps_place_review_clone, callback, user_data);
+}
+
+EXPORT_API int maps_place_get_supplier_link(const maps_place_image_h place,
+ maps_place_link_object_h *supplier)
+{
+ /* Check if the handle of the Place is valid */
+ if (!place)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ /* Check if this API feature available */
+ if (!__is_supported(place, MAPS_PLACE_SUPPLIER))
+ return MAPS_ERROR_NOT_SUPPORTED;
+
+ /* Check if parameters are valid */
+ if (!supplier)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ return maps_place_link_object_clone(((maps_place_s *) place)->supplier,
+ supplier);
+}
+
+EXPORT_API int maps_place_get_related_link(const maps_place_image_h place,
+ maps_place_link_object_h *related)
+{
+ /* Check if the handle of the Place is valid */
+ if (!place)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ /* Check if this API feature available */
+ if (!__is_supported(place, MAPS_PLACE_RELATED))
+ return MAPS_ERROR_NOT_SUPPORTED;
+
+ /* Check if parameters are valid */
+ if (!related)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ return maps_place_link_object_clone(((maps_place_s *) place)->related,
+ related);
+}
+
+int _maps_place_is_data_supported(const maps_place_h place,
+ maps_service_data_e data, bool *supported)
+{
+ if (!place || !supported)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ if (!((maps_place_s*) place)->supported_data) {
+ /* This is a case when the "supported" flags are not set yet */
+ /* No need to limit access to fields */
+ *supported = true;
+ return MAPS_ERROR_NONE;
+ }
+
+ *supported = false;
+ string data_feature;
+ switch (data) {
+ case MAPS_PLACE_ADDRESS:
+ data_feature = _S(MAPS_PLACE_ADDRESS);
+ break;
+ case MAPS_PLACE_RATING:
+ data_feature = _S(MAPS_PLACE_RATING);
+ break;
+ case MAPS_PLACE_CATEGORIES:
+ data_feature = _S(MAPS_PLACE_CATEGORIES);
+ break;
+ case MAPS_PLACE_ATTRIBUTES:
+ data_feature = _S(MAPS_PLACE_ATTRIBUTES);
+ break;
+ case MAPS_PLACE_CONTACTS:
+ data_feature = _S(MAPS_PLACE_CONTACTS);
+ break;
+ case MAPS_PLACE_EDITORIALS:
+ data_feature = _S(MAPS_PLACE_EDITORIALS);
+ break;
+ case MAPS_PLACE_REVIEWS:
+ data_feature = _S(MAPS_PLACE_REVIEWS);
+ break;
+ case MAPS_PLACE_IMAGE:
+ data_feature = _S(MAPS_PLACE_IMAGE);
+ break;
+ case MAPS_PLACE_SUPPLIER:
+ data_feature = _S(MAPS_PLACE_SUPPLIER);
+ break;
+ case MAPS_PLACE_RELATED:
+ data_feature = _S(MAPS_PLACE_RELATED);
+ break;
+ default:
+ return MAPS_ERROR_NOT_SUPPORTED;
+ }
+ return maps_string_hashtable_contains(((maps_place_s *) place)->
+ supported_data, data_feature.c_str(), supported);
+}
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_place_set_id(maps_place_h place, const char *id)
+{
+ if (!place || !id)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_set_string(id, _MAPS_PLACE_ID_MAX_LENGTH,
+ &((maps_place_s *) place)->id);
+}
+
+EXPORT_API int maps_place_set_name(maps_place_h place, const char *name)
+{
+ if (!place || !name)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_set_string(name, _MAPS_PLACE_NAME_MAX_LENGTH,
+ &((maps_place_s *) place)->name);
+}
+
+EXPORT_API int maps_place_set_uri(maps_place_h place, const char *uri)
+{
+ if (!place || !uri)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_set_string(uri, _MAPS_PLACE_URI_MAX_LENGTH,
+ &((maps_place_s *) place)->uri);
+}
+
+EXPORT_API int maps_place_set_location(maps_place_h place,
+ const maps_coordinates_h location)
+{
+ if (!place || !location)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_place_s *p = (maps_place_s *) place;
+ if (p->location)
+ maps_coordinates_destroy(p->location);
+ return maps_coordinates_clone(location, &p->location);
+}
+
+EXPORT_API int maps_place_set_distance(maps_place_h place, const int distance)
+{
+ if (!place)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_place_s *p = (maps_place_s *) place;
+ p->distance = distance;
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_place_set_address(maps_place_h place,
+ const maps_address_h address)
+{
+ if (!place || !address)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_place_s *p = (maps_place_s *) place;
+ if (p->address)
+ maps_address_destroy(p->address);
+ return maps_address_clone(address, &p->address);
+}
+
+EXPORT_API int maps_place_set_categories(maps_place_h place,
+ const maps_item_list_h categories)
+{
+ if (!place || !categories)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_place_s *p = (maps_place_s *) place;
+ if (p->categories) {
+ maps_item_list_remove_all(p->categories,
+ maps_place_category_destroy);
+ maps_item_list_destroy(p->categories);
+ }
+ return maps_item_list_clone(categories, maps_place_category_clone,
+ &p->categories);
+}
+
+EXPORT_API int maps_place_set_attributes(maps_place_h place,
+ const maps_item_list_h attributes)
+{
+ if (!place || !attributes)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_place_s *p = (maps_place_s *) place;
+ if (p->attribute) {
+ maps_item_list_remove_all(p->attribute,
+ maps_place_attribute_destroy);
+ maps_item_list_destroy(p->attribute);
+ }
+ return maps_item_list_clone(attributes, maps_place_attribute_clone,
+ &p->attribute);
+}
+
+EXPORT_API int maps_place_set_contacts(maps_place_h place,
+ const maps_item_list_h contacts)
+{
+ if (!place || !contacts)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_place_s *p = (maps_place_s *) place;
+ if (p->contacts) {
+ maps_item_list_remove_all(p->contacts,
+ maps_place_contact_destroy);
+ maps_item_list_destroy(p->contacts);
+ }
+ return maps_item_list_clone(contacts, maps_place_contact_clone,
+ &p->contacts);
+}
+
+EXPORT_API int maps_place_set_editorials(maps_place_h place,
+ const maps_item_list_h editorials)
+{
+ if (!place || !editorials)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_place_s *p = (maps_place_s *) place;
+ if (p->editorials) {
+ maps_item_list_remove_all(p->editorials,
+ maps_place_editorial_destroy);
+ maps_item_list_destroy(p->editorials);
+ }
+ return maps_item_list_clone(editorials, maps_place_editorial_clone,
+ &p->editorials);
+}
+
+EXPORT_API int maps_place_set_images(maps_place_h place,
+ const maps_item_list_h images)
+{
+ if (!place || !images)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_place_s *p = (maps_place_s *) place;
+ if (p->images) {
+ maps_item_list_remove_all(p->images, maps_place_image_destroy);
+ maps_item_list_destroy(p->images);
+ }
+ return maps_item_list_clone(images, maps_place_image_clone, &p->images);
+}
+
+EXPORT_API int maps_place_set_reviews(maps_place_h place,
+ const maps_item_list_h reviews)
+{
+ if (!place || !reviews)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_place_s *p = (maps_place_s *) place;
+ if (p->reviews) {
+ maps_item_list_remove_all(p->reviews,
+ maps_place_review_destroy);
+ maps_item_list_destroy(p->reviews);
+ }
+ return maps_item_list_clone(reviews, maps_place_review_clone,
+ &p->reviews);
+}
+
+EXPORT_API int maps_place_set_properties(maps_place_h place,
+ const maps_item_hashtable_h properties)
+{
+ if (!place || !properties)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_place_s *p = (maps_place_s *) place;
+ if (p->properties)
+ maps_item_hashtable_destroy(p->properties);
+ return maps_item_hashtable_clone(properties, &p->properties);
+}
+
+EXPORT_API int maps_place_set_rating(maps_place_h place,
+ const maps_place_rating_h rating)
+{
+ if (!place || !rating)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_place_s *p = (maps_place_s *) place;
+ if (p->rating)
+ maps_place_rating_destroy(p->rating);
+ return maps_place_rating_clone(rating, &p->rating);
+}
+
+EXPORT_API int maps_place_set_supplier_link(maps_place_h place,
+ const maps_place_link_object_h
+ supplier)
+{
+ if (!place || !supplier)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_place_s *p = (maps_place_s *) place;
+ if (p->supplier)
+ maps_place_link_object_destroy(p->supplier);
+ return maps_place_link_object_clone(supplier, &p->supplier);
+}
+
+EXPORT_API int maps_place_set_related_link(maps_place_h place,
+ const maps_place_link_object_h
+ related)
+{
+ if (!place || !related)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_place_s *p = (maps_place_s *) place;
+ if (p->related)
+ maps_place_link_object_destroy(p->related);
+ return maps_place_link_object_clone(related, &p->related);
+}
+
+int _maps_place_set_supported_data(maps_place_h place,
+ const maps_string_hashtable_h supported_data)
+{
+ if (!place || !supported_data)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_place_s *p = (maps_place_s *) place;
+ if (p->supported_data)
+ maps_string_hashtable_destroy(p->supported_data);
+ return maps_string_hashtable_clone(supported_data, &p->supported_data);
+}
--- /dev/null
+/* Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 "maps_error.h"
+#include "maps_place_attribute_plugin.h"
+#include <glib.h>
+#include "maps_util.h"
+
+typedef struct _maps_place_attribute_s
+{
+ char *id;
+ char *label;
+ char *text;
+} maps_place_attribute_s;
+
+const gsize _MAPS_PLACE_ATTRIBUTE_ID_MAX_LENGTH = 32;
+const gsize _MAPS_PLACE_ATTRIBUTE_LABEL_MAX_LENGTH = 64;
+const gsize _MAPS_PLACE_ATTRIBUTE_TEXT_MAX_LENGTH = 512;
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_place_attribute_create(maps_place_attribute_h *place)
+{
+ if (!place)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ *place = (maps_place_attribute_h) g_slice_new0(maps_place_attribute_s);
+
+ if (*place == NULL) {
+ MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
+ return MAPS_ERROR_OUT_OF_MEMORY;
+ }
+
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_place_attribute_destroy(maps_place_attribute_h place)
+{
+ if (!place)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ maps_place_attribute_s *a = (maps_place_attribute_s *) place;
+
+ if (a->id)
+ g_free(a->id);
+ if (a->label)
+ g_free(a->label);
+ if (a->text)
+ g_free(a->text);
+
+ g_slice_free(maps_place_attribute_s, place);
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_place_attribute_clone(const maps_place_attribute_h origin,
+ maps_place_attribute_h *cloned)
+{
+ if (!cloned || !origin)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ int error = MAPS_ERROR_NONE;
+ do {
+ error = maps_place_attribute_create(cloned);
+ if (!(*cloned) || (error != MAPS_ERROR_NONE))
+ break;
+
+ maps_place_attribute_s *a = (maps_place_attribute_s *) origin;
+
+ if (a->id) {
+ error = maps_place_attribute_set_id(*cloned, a->id);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (a->label) {
+ error = maps_place_attribute_set_label(*cloned,
+ a->label);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (a->text) {
+ error = maps_place_attribute_set_text(*cloned, a->text);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ return MAPS_ERROR_NONE;
+ } while (false);
+
+ maps_place_attribute_destroy(*cloned);
+ *cloned = NULL;
+ return error;
+}
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_place_attribute_get_id(const maps_place_attribute_h place,
+ char **id)
+{
+ if (!place || !id)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_get_string(((maps_place_attribute_s *) place)->id,
+ _MAPS_PLACE_ATTRIBUTE_ID_MAX_LENGTH, id);
+}
+
+EXPORT_API int maps_place_attribute_get_text(const maps_place_attribute_h place,
+ char **text)
+{
+ if (!place || !text)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_get_string(((maps_place_attribute_s *) place)->text,
+ _MAPS_PLACE_ATTRIBUTE_TEXT_MAX_LENGTH, text);
+}
+
+EXPORT_API int maps_place_attribute_get_label(const maps_place_attribute_h
+ place, char **label)
+{
+ if (!place || !label)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_get_string(((maps_place_attribute_s *) place)->label,
+ _MAPS_PLACE_ATTRIBUTE_LABEL_MAX_LENGTH, label);
+}
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_place_attribute_set_id(maps_place_attribute_h place,
+ const char * id)
+{
+ if (!place || !id)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_set_string(id, _MAPS_PLACE_ATTRIBUTE_ID_MAX_LENGTH,
+ &((maps_place_attribute_s *) place)->id);
+}
+
+EXPORT_API int maps_place_attribute_set_label(maps_place_attribute_h place,
+ const char *label)
+{
+ if (!place || !label)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_set_string(label, _MAPS_PLACE_ATTRIBUTE_LABEL_MAX_LENGTH,
+ &((maps_place_attribute_s *) place)->label);
+}
+
+EXPORT_API int maps_place_attribute_set_text(maps_place_attribute_h place,
+ const char *text)
+{
+ if (!place || !text)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_set_string(text, _MAPS_PLACE_ATTRIBUTE_TEXT_MAX_LENGTH,
+ &((maps_place_attribute_s *) place)->text);
+}
--- /dev/null
+/* Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 "maps_error.h"
+#include "maps_extra_types.h"
+#include <glib.h>
+#include "maps_util.h"
+#include "maps_place_category.h"
+
+typedef struct _maps_place_category_s
+{
+ char *name;
+ char *id;
+ char *url;
+} maps_place_category_s;
+
+const gsize _MAPS_PLACE_CATEGORY_ID_MAX_LENGTH = 32;
+const gsize _MAPS_PLACE_CATEGORY_NAME_MAX_LENGTH = 64;
+const gsize _MAPS_PLACE_CATEGORY_URL_MAX_LENGTH = 128;
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_place_category_create(maps_place_category_h *place)
+{
+ if (!place)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ *place = g_slice_new0(maps_place_category_s);
+
+ if (*place == NULL) {
+ MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
+ return MAPS_ERROR_OUT_OF_MEMORY;
+ }
+
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_place_category_destroy(maps_place_category_h place)
+{
+ if (!place)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ int error = MAPS_ERROR_NONE;
+
+ maps_place_category_s *c = (maps_place_category_s *) place;
+
+ if (c->id)
+ g_free(c->id);
+ if (c->name)
+ g_free(c->name);
+ if (c->url)
+ g_free(c->url);
+
+ g_slice_free(maps_place_category_s, place);
+ return error;
+}
+
+EXPORT_API int maps_place_category_clone(const maps_place_category_h origin,
+ maps_place_category_h *cloned)
+{
+ if (!cloned || !origin)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ int error = MAPS_ERROR_NONE;
+
+ do {
+ error = maps_place_category_create(cloned);
+ if (error != MAPS_ERROR_NONE)
+ return error;
+
+ maps_place_category_s *c = (maps_place_category_s *) origin;
+
+ if (c->id) {
+ error = maps_place_category_set_id(*cloned, c->id);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (c->name) {
+ error = maps_place_category_set_name(*cloned, c->name);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (c->url) {
+ error = maps_place_category_set_url(*cloned, c->url);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ return MAPS_ERROR_NONE;
+
+ } while (false);
+
+ maps_place_category_destroy(*cloned);
+ *cloned = NULL;
+ return error;
+}
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_place_category_get_name(const maps_place_category_h place,
+ char **name)
+{
+ if (!place || !name)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_get_string(((maps_place_category_s *) place)->name,
+ _MAPS_PLACE_CATEGORY_NAME_MAX_LENGTH, name);
+}
+
+EXPORT_API int maps_place_category_get_id(const maps_place_category_h place,
+ char **id)
+{
+ if (!place || !id)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_get_string(((maps_place_category_s *) place)->id,
+ _MAPS_PLACE_CATEGORY_ID_MAX_LENGTH, id);
+}
+
+EXPORT_API int maps_place_category_get_url(const maps_place_category_h place,
+ char **url)
+{
+ if (!place || !url)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_get_string(((maps_place_category_s *) place)->url,
+ _MAPS_PLACE_CATEGORY_URL_MAX_LENGTH, url);
+}
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_place_category_set_id(maps_place_category_h place,
+ const char *id)
+{
+ if (!place || !id)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_set_string(id, _MAPS_PLACE_CATEGORY_ID_MAX_LENGTH,
+ &((maps_place_category_s *) place)->id);
+}
+
+EXPORT_API int maps_place_category_set_name(maps_place_category_h place,
+ const char *name)
+{
+ if (!place || !name)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_set_string(name, _MAPS_PLACE_CATEGORY_NAME_MAX_LENGTH,
+ &((maps_place_category_s *) place)->name);
+}
+
+EXPORT_API int maps_place_category_set_url(maps_place_category_h place,
+ const char *url)
+{
+ if (!place || !url)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_set_string(url, _MAPS_PLACE_CATEGORY_URL_MAX_LENGTH,
+ &((maps_place_category_s *) place)->url);
+}
--- /dev/null
+/* Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 "maps_error.h"
+#include "maps_place_contact_plugin.h"
+#include <glib.h>
+#include "maps_util.h"
+
+typedef struct _maps_place_contact_s
+{
+ char *label;
+ char *type;
+ char * value;
+} maps_place_contact_s;
+
+const gsize _MAPS_PLACE_CONTACT_LABEL_MAX_LENGTH = 64;
+const gsize _MAPS_PLACE_CONTACT_TYPE_MAX_LENGTH = 32;
+const gsize _MAPS_PLACE_CONTACT_VALUE_MAX_LENGTH = 512;
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_place_contact_create(maps_place_contact_h *place)
+{
+ if (!place)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ *place = (maps_place_contact_h) g_slice_new0(maps_place_contact_s);
+
+ if (*place == NULL) {
+ MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
+ return MAPS_ERROR_OUT_OF_MEMORY;
+ }
+
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_place_contact_destroy(maps_place_contact_h place)
+{
+ if (!place)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ maps_place_contact_s *c = (maps_place_contact_s *) place;
+
+ if (c->label)
+ g_free(c->label);
+ if (c->type)
+ g_free(c->type);
+ if (c->value)
+ g_free(c->value);
+
+ g_slice_free(maps_place_contact_s, place);
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_place_contact_clone(const maps_place_contact_h origin,
+ maps_place_contact_h *cloned)
+{
+ if (!cloned || !origin)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ int error = MAPS_ERROR_NONE;
+ do {
+ error = maps_place_contact_create(cloned);
+ if (!(*cloned) || (error != MAPS_ERROR_NONE))
+ break;
+
+ maps_place_contact_s *c = (maps_place_contact_s *) origin;
+
+ if (c->label) {
+ error = maps_place_contact_set_label(*cloned, c->label);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (c->type) {
+ error = maps_place_contact_set_type(*cloned, c->type);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (c->value) {
+ error = maps_place_contact_set_value(*cloned, c->value);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ return MAPS_ERROR_NONE;
+ } while (false);
+
+ maps_place_contact_destroy(*cloned);
+ *cloned = NULL;
+ return error;
+}
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_place_contact_get_label(const maps_place_contact_h place,
+ char **label)
+{
+ if (!place || !label)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_get_string(((maps_place_contact_s *) place)->label,
+ _MAPS_PLACE_CONTACT_LABEL_MAX_LENGTH, label);
+}
+
+EXPORT_API int maps_place_contact_get_type(const maps_place_contact_h place,
+ char **type)
+{
+ if (!place || !type)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_get_string(((maps_place_contact_s *) place)->type,
+ _MAPS_PLACE_CONTACT_TYPE_MAX_LENGTH, type);
+}
+
+EXPORT_API int maps_place_contact_get_value(const maps_place_contact_h place,
+ char **value)
+{
+ if (!place || !value)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_get_string(((maps_place_contact_s *) place)->value,
+ _MAPS_PLACE_CONTACT_VALUE_MAX_LENGTH, value);
+}
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_place_contact_set_label(maps_place_contact_h place,
+ const char *label)
+{
+ if (!place || !label)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_set_string(label, _MAPS_PLACE_CONTACT_LABEL_MAX_LENGTH,
+ &((maps_place_contact_s *) place)->label);
+}
+
+EXPORT_API int maps_place_contact_set_type(maps_place_contact_h place,
+ const char *type)
+{
+ if (!place || !type)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_set_string(type, _MAPS_PLACE_CONTACT_TYPE_MAX_LENGTH,
+ &((maps_place_contact_s *) place)->type);
+}
+
+EXPORT_API int maps_place_contact_set_value(maps_place_contact_h place,
+ const char *value)
+{
+ if (!place || !value)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_set_string(value, _MAPS_PLACE_CONTACT_VALUE_MAX_LENGTH,
+ &((maps_place_contact_s *) place)->value);
+}
--- /dev/null
+/* Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 "maps_error.h"
+#include "maps_place_editorial_plugin.h"
+#include "maps_place_media_plugin.h"
+#include <glib.h>
+#include "maps_util.h"
+
+typedef struct _maps_place_editorial_s
+{
+ char *description;
+ char *language;
+ maps_place_media_h media;
+} maps_place_editorial_s;
+
+const gsize _MAPS_PLACE_EDITORIAL_DESCRIPTION_MAX_LENGTH = 64;
+const gsize _MAPS_PLACE_EDITORIAL_LANGUAGE_MAX_LENGTH = 32;
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_place_editorial_create(maps_place_editorial_h *place)
+{
+ if (!place)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ *place = (maps_place_editorial_h) g_slice_new0(maps_place_editorial_s);
+
+ if (*place == NULL) {
+ MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
+ return MAPS_ERROR_OUT_OF_MEMORY;
+ }
+
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_place_editorial_destroy(maps_place_editorial_h place)
+{
+ if (!place)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ maps_place_editorial_s *e = (maps_place_editorial_s *) place;
+
+ if (e->description)
+ g_free(e->description);
+ if (e->language)
+ g_free(e->language);
+
+ if (e->media)
+ maps_place_media_destroy(e->media);
+
+ g_slice_free(maps_place_editorial_s, place);
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_place_editorial_clone(const maps_place_editorial_h origin,
+ maps_place_editorial_h *cloned)
+{
+ if (!cloned || !origin)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ int error = MAPS_ERROR_NONE;
+ do {
+ error = maps_place_editorial_create(cloned);
+ if (!(*cloned) || (error != MAPS_ERROR_NONE))
+ break;
+
+ maps_place_editorial_s *e = (maps_place_editorial_s *) origin;
+
+ if (e->description) {
+ error = maps_place_editorial_set_description(*cloned,
+ e->description);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (e->language) {
+ error = maps_place_editorial_set_language(*cloned,
+ e->language);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (e->media) {
+ maps_place_editorial_s *e_cloned =
+ (maps_place_editorial_s *) (*cloned);
+ error = maps_place_media_clone(e->media,
+ &e_cloned->media);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ return MAPS_ERROR_NONE;
+ } while (false);
+
+ maps_place_editorial_destroy(*cloned);
+ *cloned = NULL;
+ return error;
+}
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_place_editorial_get_description(const maps_place_editorial_h
+ place,
+ char **description)
+{
+ if (!place || !description)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_get_string(((maps_place_editorial_s *) place)->description,
+ _MAPS_PLACE_EDITORIAL_DESCRIPTION_MAX_LENGTH, description);
+}
+
+EXPORT_API int maps_place_editorial_get_language(const maps_place_editorial_h
+ place,
+ char **language)
+{
+ if (!place || !language)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_get_string(((maps_place_editorial_s *) place)->language,
+ _MAPS_PLACE_EDITORIAL_LANGUAGE_MAX_LENGTH, language);
+}
+
+EXPORT_API int maps_place_editorial_get_media(const maps_place_editorial_h
+ place,
+ maps_place_media_h *media)
+{
+ if (!place || !media)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_place_media_clone(((maps_place_editorial_s *) place)->media,
+ media);
+}
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_place_editorial_set_description(maps_place_editorial_h
+ place,
+ const char *description)
+{
+ if (!place || !description)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_set_string(description,
+ _MAPS_PLACE_EDITORIAL_DESCRIPTION_MAX_LENGTH,
+ &((maps_place_editorial_s *) place)->description);
+}
+
+EXPORT_API int maps_place_editorial_set_language(maps_place_editorial_h place,
+ const char *language)
+{
+ if (!place || !language)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_set_string(language,
+ _MAPS_PLACE_EDITORIAL_LANGUAGE_MAX_LENGTH,
+ &((maps_place_editorial_s *) place)->language);
+}
+
+EXPORT_API int maps_place_editorial_set_media(maps_place_editorial_h place,
+ const maps_place_media_h media)
+{
+ if (!place || !media)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_place_editorial_s *e = (maps_place_editorial_s *) place;
+ if (e->media)
+ maps_place_media_destroy(e->media);
+ return maps_place_media_clone(media, &e->media);
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 "maps_error.h"
+#include "maps_place_filter.h"
+#include "maps_extra_types.h"
+#include <glib.h>
+#include "maps_util.h"
+
+typedef struct _maps_place_filter_s
+{
+ maps_item_hashtable_h table;
+} maps_place_filter_s;
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_place_filter_create(maps_place_filter_h *filter)
+{
+ if (!filter)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ *filter = (maps_place_filter_h) g_slice_new0(maps_place_filter_s);
+
+ if (*filter == NULL) {
+ MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
+ return MAPS_ERROR_OUT_OF_MEMORY;
+ }
+
+ maps_place_filter_s *f = (maps_place_filter_s *) (*filter);
+ maps_item_hashtable_create(&f->table);
+
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_place_filter_destroy(maps_place_filter_h filter)
+{
+ if (!filter)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ maps_place_filter_s *f = (maps_place_filter_s *) filter;
+
+ if (f->table)
+ maps_item_hashtable_destroy(f->table);
+
+ g_slice_free(maps_place_filter_s, filter);
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_place_filter_clone(const maps_place_filter_h origin,
+ maps_place_filter_h *cloned)
+{
+ if (!cloned || !origin)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ int error = MAPS_ERROR_NONE;
+ do {
+ error = maps_place_filter_create(cloned);
+ if (!(*cloned) || (error != MAPS_ERROR_NONE))
+ break;
+
+ maps_place_filter_s *f = (maps_place_filter_s *) origin;
+
+ if (f->table) {
+
+ maps_place_filter_s *f_cloned =
+ (maps_place_filter_s *) (*cloned);
+ if (f_cloned->table)
+ maps_item_hashtable_destroy(f_cloned->table);
+
+ error = maps_item_hashtable_clone(f->table,
+ &f_cloned->table);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ return MAPS_ERROR_NONE;
+ } while (false);
+
+ maps_place_filter_destroy(*cloned);
+ *cloned = NULL;
+ return error;
+}
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_place_filter_get(const maps_place_filter_h filter,
+ const char *key, char **value)
+{
+ if (!filter)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_item_hashtable_get_string(((maps_place_filter_s *) filter)->
+ table, key, value);
+}
+
+EXPORT_API int maps_place_filter_foreach_property(const maps_place_filter_h
+ filter,
+ maps_place_filter_properties_cb
+ callback,
+ void *user_data)
+{
+ if (!filter || !callback)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_item_hashtable_foreach(((maps_place_filter_s *) filter)->
+ table, callback, user_data);
+}
+
+EXPORT_API int maps_place_filter_get_keyword(const maps_place_filter_h filter,
+ char **keyword)
+{
+ if (!filter || !keyword)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_item_hashtable_get_string(((maps_place_filter_s *) filter)->
+ table, "MAPS_PLACE_FILTER_KEYWORD", keyword);
+}
+
+EXPORT_API int maps_place_filter_get_place_name(const maps_place_filter_h
+ filter,
+ char **place_name)
+{
+ if (!filter || !place_name)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_item_hashtable_get_string(((maps_place_filter_s *) filter)->
+ table, "MAPS_PLACE_FILTER_PLACE_NAME", place_name);
+}
+
+EXPORT_API int maps_place_filter_get_category(const maps_place_filter_h filter,
+ maps_place_category_h *category)
+{
+ if (!filter || !category)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_item_hashtable_get(((maps_place_filter_s *) filter)->table,
+ "MAPS_PLACE_FILTER_CATEGORY", (void **) category);
+}
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_place_filter_set(maps_place_filter_h filter,
+ const char *key, const char *value)
+{
+ if (!filter)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_item_hashtable_set_string(((maps_place_filter_s *) filter)->
+ table, key, value);
+}
+
+EXPORT_API int maps_place_filter_set_keyword(maps_place_filter_h filter,
+ const char *keyword)
+{
+ if (!filter || !keyword)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_item_hashtable_set_string(((maps_place_filter_s *) filter)->
+ table, "MAPS_PLACE_FILTER_KEYWORD", keyword);
+}
+
+EXPORT_API int maps_place_filter_set_place_name(maps_place_filter_h filter,
+ const char *place_name)
+{
+ if (!filter || !place_name)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_item_hashtable_set_string(((maps_place_filter_s *) filter)->
+ table, "MAPS_PLACE_FILTER_PLACE_NAME", place_name);
+}
+
+EXPORT_API int maps_place_filter_set_category(maps_place_filter_h filter,
+ const maps_place_category_h category)
+{
+ if (!filter || !category)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_item_hashtable_set(((maps_place_filter_s *) filter)->table,
+ "MAPS_PLACE_FILTER_CATEGORY", (void **) category,
+ maps_place_category_clone, maps_place_category_destroy);
+}
--- /dev/null
+/* Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 "maps_error.h"
+#include "maps_place_image_plugin.h"
+#include <glib.h>
+#include "maps_place_media_plugin.h"
+#include "maps_place_link_object_plugin.h"
+#include <glib.h>
+#include "maps_util.h"
+
+typedef struct _maps_place_image_s
+{
+ char *id;
+ char *url;
+ int width;
+ int height;
+ maps_place_media_h media;
+ maps_place_link_object_h user;
+} maps_place_image_s;
+
+const gsize _MAPS_PLACE_IMAGE_ID_MAX_LENGTH = 32;
+const gsize _MAPS_PLACE_IMAGE_URL_MAX_LENGTH = 128;
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_place_image_create(maps_place_image_h *place)
+{
+ if (!place)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ *place = (maps_place_image_h) g_slice_new0(maps_place_image_s);
+
+ if (*place == NULL) {
+ MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
+ return MAPS_ERROR_OUT_OF_MEMORY;
+ }
+
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_place_image_destroy(maps_place_image_h place)
+{
+ if (!place)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ maps_place_image_s *i = (maps_place_image_s *) place;
+
+ if (i->id)
+ g_free(i->id);
+ if (i->url)
+ g_free(i->url);
+
+ if (i->media)
+ maps_place_media_destroy(i->media);
+ if (i->user)
+ maps_place_link_object_destroy(i->user);
+
+ g_slice_free(maps_place_image_s, place);
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_place_image_clone(const maps_place_image_h origin,
+ maps_place_image_h *cloned)
+{
+ if (!cloned || !origin)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ int error = MAPS_ERROR_NONE;
+ do {
+ error = maps_place_image_create(cloned);
+ if (!(*cloned) || (error != MAPS_ERROR_NONE))
+ break;
+
+ maps_place_image_s *i = (maps_place_image_s *) origin;
+
+ if (i->id) {
+ error = maps_place_image_set_id(*cloned, i->id);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (i->url) {
+ error = maps_place_image_set_url(*cloned, i->url);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ error = maps_place_image_set_width(*cloned, i->width);
+ if (error != MAPS_ERROR_NONE)
+ break;
+
+ error = maps_place_image_set_height(*cloned, i->height);
+ if (error != MAPS_ERROR_NONE)
+ break;
+
+ if (i->media) {
+ error = maps_place_image_set_media(*cloned, i->media);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (i->user) {
+ error = maps_place_image_set_user_link(*cloned,
+ i->user);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ return MAPS_ERROR_NONE;
+ } while (false);
+
+ maps_place_image_destroy(*cloned);
+ *cloned = NULL;
+ return error;
+}
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_place_image_get_url(const maps_place_image_h place,
+ char **url)
+{
+ if (!place || !url)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_get_string(((maps_place_image_s *) place)->url,
+ _MAPS_PLACE_IMAGE_URL_MAX_LENGTH, url);
+}
+
+EXPORT_API int maps_place_image_get_id(const maps_place_image_h place,
+ char **id)
+{
+ if (!place || !id)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_get_string(((maps_place_image_s *) place)->id,
+ _MAPS_PLACE_IMAGE_ID_MAX_LENGTH, id);
+}
+
+EXPORT_API int maps_place_image_get_width(const maps_place_image_h place,
+ int *width)
+{
+ if (!place || !width)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ *width = ((maps_place_image_s *) place)->width;
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_place_image_get_height(const maps_place_image_h place,
+ int *height)
+{
+ if (!place || !height)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ *height = ((maps_place_image_s *) place)->height;
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_place_image_get_user_link(const maps_place_image_h place,
+ maps_place_link_object_h *user)
+{
+ if (!place || !user)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_place_link_object_clone(((maps_place_image_s *) place)->
+ user, user);
+}
+
+EXPORT_API int maps_place_image_get_media(const maps_place_image_h place,
+ maps_place_media_h *media)
+{
+ if (!place || !media)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_place_media_clone(((maps_place_image_s *) place)->media,
+ media);
+}
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_place_image_set_id(maps_place_image_h place, const char *id)
+{
+ if (!place || !id)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_set_string(id, _MAPS_PLACE_IMAGE_ID_MAX_LENGTH,
+ &((maps_place_image_s *) place)->id);
+}
+
+EXPORT_API int maps_place_image_set_url(maps_place_image_h place,
+ const char *url)
+{
+ if (!place || !url)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_set_string(url, _MAPS_PLACE_IMAGE_URL_MAX_LENGTH,
+ &((maps_place_image_s *) place)->url);
+}
+
+EXPORT_API int maps_place_image_set_width(maps_place_image_h place,
+ const int width)
+{
+ if (!place || width < 0)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ ((maps_place_image_s *) place)->width = width;
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_place_image_set_height(maps_place_image_h place,
+ const int height)
+{
+ if (!place || height < 0)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ ((maps_place_image_s *) place)->height = height;
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_place_image_set_user_link(maps_place_image_h place,
+ const maps_place_link_object_h
+ user)
+{
+ if (!place || !user)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_place_image_s *i = (maps_place_image_s *) place;
+ if (i->user)
+ maps_place_link_object_destroy(i->user);
+ return maps_place_link_object_clone(user, &i->user);
+}
+
+EXPORT_API int maps_place_image_set_media(maps_place_image_h place,
+ const maps_place_media_h media)
+{
+ if (!place || !media)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_place_image_s *i = (maps_place_image_s *) place;
+ if (i->media)
+ maps_place_media_destroy(i->media);
+ return maps_place_media_clone(media, &i->media);
+}
--- /dev/null
+/* Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 "maps_error.h"
+#include "maps_place_link_object_plugin.h"
+#include <glib.h>
+#include "maps_util.h"
+
+typedef struct _maps_place_link_object_s
+{
+ char *id;
+ char *name;
+ char *type;
+ char *string;
+} maps_place_link_object_s;
+
+const gsize _MAPS_PLACE_LINK_OBJECT_ID_MAX_LENGTH = 32;
+const gsize _MAPS_PLACE_LINK_OBJECT_NAME_MAX_LENGTH = 64;
+const gsize _MAPS_PLACE_LINK_OBJECT_TYPE_MAX_LENGTH = 32;
+const gsize _MAPS_PLACE_LINK_OBJECT_STRING_MAX_LENGTH = 256;
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_place_link_object_create(maps_place_link_object_h *place)
+{
+ if (!place)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ *place = (maps_place_link_object_h)
+ g_slice_new0(maps_place_link_object_s);
+
+ if (*place == NULL) {
+ MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
+ return MAPS_ERROR_OUT_OF_MEMORY;
+ }
+
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_place_link_object_destroy(maps_place_link_object_h place)
+{
+ if (!place)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ maps_place_link_object_s *lo = (maps_place_link_object_s *) place;
+
+ if (lo->id)
+ g_free(lo->id);
+ if (lo->name)
+ g_free(lo->name);
+ if (lo->type)
+ g_free(lo->type);
+ if (lo->string)
+ g_free(lo->string);
+
+ g_slice_free(maps_place_link_object_s, place);
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_place_link_object_clone(const maps_place_link_object_h
+ origin, maps_place_link_object_h *
+ cloned)
+{
+ if (!cloned || !origin)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ int error = MAPS_ERROR_NONE;
+ do {
+ error = maps_place_link_object_create(cloned);
+ if (!(*cloned) || (error != MAPS_ERROR_NONE))
+ break;
+
+ maps_place_link_object_s *lo =
+ (maps_place_link_object_s *) origin;
+
+ if (lo->id) {
+ error = maps_place_link_object_set_id(*cloned, lo->id);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (lo->name) {
+ error = maps_place_link_object_set_name(*cloned,
+ lo->name);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (lo->type) {
+ error = maps_place_link_object_set_type(*cloned,
+ lo->type);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (lo->string) {
+ error = maps_place_link_object_set_string(*cloned,
+ lo->string);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ return MAPS_ERROR_NONE;
+ } while (false);
+
+ maps_place_link_object_destroy(*cloned);
+ *cloned = NULL;
+ return error;
+}
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_place_link_object_get_string(const maps_place_link_object_h
+ place,
+ char **string)
+{
+ if (!place || !string)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_get_string(((maps_place_link_object_s *) place)->string,
+ _MAPS_PLACE_LINK_OBJECT_STRING_MAX_LENGTH, string);
+}
+
+EXPORT_API int maps_place_link_object_get_type(const maps_place_link_object_h
+ place,
+ char **type)
+{
+ if (!place || !type)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_get_string(((maps_place_link_object_s *) place)->type,
+ _MAPS_PLACE_LINK_OBJECT_TYPE_MAX_LENGTH, type);
+}
+
+EXPORT_API int maps_place_link_object_get_id(const maps_place_link_object_h
+ place,
+ char **id)
+{
+ if (!place || !id)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_get_string(((maps_place_link_object_s *) place)->id,
+ _MAPS_PLACE_LINK_OBJECT_ID_MAX_LENGTH, id);
+}
+
+EXPORT_API int maps_place_link_object_get_name(const maps_place_link_object_h
+ place, char **name)
+{
+ if (!place || !name)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_get_string(((maps_place_link_object_s *) place)->name,
+ _MAPS_PLACE_LINK_OBJECT_NAME_MAX_LENGTH, name);
+}
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_place_link_object_set_id(maps_place_link_object_h place,
+ const char *id)
+{
+ if (!place || !id)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_set_string(id, _MAPS_PLACE_LINK_OBJECT_ID_MAX_LENGTH,
+ &((maps_place_link_object_s *) place)->id);
+}
+
+EXPORT_API int maps_place_link_object_set_string(maps_place_link_object_h place,
+ const char *string)
+{
+ if (!place || !string)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_set_string(string,
+ _MAPS_PLACE_LINK_OBJECT_STRING_MAX_LENGTH,
+ &((maps_place_link_object_s *) place)->string);
+}
+
+EXPORT_API int maps_place_link_object_set_type(maps_place_link_object_h place,
+ const char *type)
+{
+ if (!place || !type)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_set_string(type, _MAPS_PLACE_LINK_OBJECT_TYPE_MAX_LENGTH,
+ &((maps_place_link_object_s *) place)->type);
+}
+
+EXPORT_API int maps_place_link_object_set_name(maps_place_link_object_h place,
+ const char *name)
+{
+ if (!place || !name)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_set_string(name, _MAPS_PLACE_LINK_OBJECT_NAME_MAX_LENGTH,
+ &((maps_place_link_object_s *) place)->name);
+}
--- /dev/null
+/* Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 "maps_error.h"
+#include "maps_place_media_plugin.h"
+#include "maps_place_link_object_plugin.h"
+#include <glib.h>
+#include "maps_util.h"
+
+typedef struct _maps_place_media_s
+{
+ char *attribution;
+ maps_place_link_object_h supplier;
+ maps_place_link_object_h via;
+} maps_place_media_s;
+
+const gsize _MAPS_PLACE_MEDIA_ATTRIBUTION_MAX_LENGTH = 64;
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_place_media_create(maps_place_media_h *place)
+{
+ if (!place)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ *place = (maps_place_media_h) g_slice_new0(maps_place_media_s);
+
+ if (*place == NULL) {
+ MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
+ return MAPS_ERROR_OUT_OF_MEMORY;
+ }
+
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_place_media_destroy(maps_place_media_h place)
+{
+ if (!place)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ maps_place_media_s *m = (maps_place_media_s *) place;
+
+ if (m->attribution)
+ g_free(m->attribution);
+ if (m->supplier)
+ maps_place_link_object_destroy(m->supplier);
+ if (m->via)
+ maps_place_link_object_destroy(m->via);
+
+ g_slice_free(maps_place_media_s, place);
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_place_media_clone(const maps_place_media_h origin,
+ maps_place_media_h *cloned)
+{
+ if (!cloned || !origin)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ int error = MAPS_ERROR_NONE;
+ do {
+ error = maps_place_media_create(cloned);
+ if (!(*cloned) || (error != MAPS_ERROR_NONE))
+ break;
+
+ maps_place_media_s *m = (maps_place_media_s *) origin;
+
+ if (m->attribution) {
+ error = maps_place_media_set_attribution(*cloned,
+ m->attribution);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (m->supplier) {
+ error = maps_place_media_set_supplier(*cloned,
+ m->supplier);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (m->via) {
+ error = maps_place_media_set_via(*cloned, m->via);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ return MAPS_ERROR_NONE;
+ } while (false);
+
+ maps_place_media_destroy(*cloned);
+ *cloned = NULL;
+ return error;
+}
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_place_media_get_attribution(const maps_place_media_h place,
+ char **attribution)
+{
+ if (!place || !attribution)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_get_string(((maps_place_media_s *) place)->attribution,
+ _MAPS_PLACE_MEDIA_ATTRIBUTION_MAX_LENGTH, attribution);
+}
+
+EXPORT_API int maps_place_media_get_supplier(const maps_place_media_h place,
+ maps_place_link_object_h *supplier)
+{
+ if (!place || !supplier)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_place_link_object_clone(((maps_place_media_s *) place)->
+ supplier, supplier);
+}
+
+EXPORT_API int maps_place_media_get_via(const maps_place_media_h place,
+ maps_place_link_object_h * via)
+{
+ if (!place || !via)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_place_link_object_clone(((maps_place_media_s *) place)->via,
+ via);
+}
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_place_media_set_attribution(maps_place_media_h place,
+ const char *attribution)
+{
+ if (!place || !attribution)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_set_string(attribution,
+ _MAPS_PLACE_MEDIA_ATTRIBUTION_MAX_LENGTH,
+ &((maps_place_media_s *) place)->attribution);
+}
+
+EXPORT_API int maps_place_media_set_supplier(maps_place_media_h place,
+ const maps_place_link_object_h
+ supplier)
+{
+ if (!place || !supplier)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_place_media_s *m = (maps_place_media_s *) place;
+ if (m->supplier)
+ maps_place_link_object_destroy(m->supplier);
+ return maps_place_link_object_clone(supplier, &m->supplier);
+}
+
+EXPORT_API int maps_place_media_set_via(maps_place_media_h place,
+ const maps_place_link_object_h via)
+{
+ if (!place || !via)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_place_media_s *m = (maps_place_media_s *) place;
+ if (m->via)
+ maps_place_link_object_destroy(m->via);
+ return maps_place_link_object_clone(via, &m->via);
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_PLACE_PRIVATE_H__
+#define __MAPS_PLACE_PRIVATE_H__
+
+#include <maps_service.h>
+#include <maps_extra_types.h>
+
+/**
+ * @ingroup CAPI_MAPS_PLACE_MODULE
+ * @defgroup CAPI_MAPS_PLACE_DATA_MODULE Place
+ *
+ * @file maps_place_private.h
+ * @brief This file contains the functions related to Place information.
+ *
+ * @addtogroup CAPI_MAPS_PLACE_DATA_MODULE
+ * @{
+ * @brief This provides APIs related to Place information, used in Place
+ * Discovery and Search.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @internal
+ * @brief Checks if a place data feature is supported.
+ * @details This function checks if a place data feature is supported.
+ * @since_tizen 2.4
+ *
+ * @param[in] place The handle to place
+ * @param[in] data The feature to be checked
+ * @param[out] supported Is the feature supported
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a place is created using maps_place_create().
+ *
+ * @see maps_place_create()
+ */
+int _maps_place_is_data_supported(const maps_place_h place,
+ maps_service_data_e data, bool *supported);
+
+/**
+ * @internal
+ * @brief Sets the supported place data features.
+ * @details This function sets the supported place data features.
+ * @since_tizen 2.4
+ *
+ * @param[in] place The handle to place
+ * @param[in] supported_data The supported place data features
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a place is created using maps_place_create().
+ *
+ * @see maps_place_create()
+ */
+int _maps_place_set_supported_data(maps_place_h place,
+ const maps_string_hashtable_h
+ supported_data);
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+#endif /* __MAPS_PLACE_PRIVATE_H__ */
--- /dev/null
+/* Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 "maps_error.h"
+#include "maps_place_rating_plugin.h"
+#include <glib.h>
+#include "maps_util.h"
+
+typedef struct _maps_place_rating_s
+{
+ int count;
+ double average;
+} maps_place_rating_s;
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_place_rating_create(maps_place_rating_h *place)
+{
+ if (!place)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ *place = (maps_place_rating_h) g_slice_new0(maps_place_rating_s);
+
+ if (*place == NULL) {
+ MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
+ return MAPS_ERROR_OUT_OF_MEMORY;
+ }
+
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_place_rating_destroy(maps_place_rating_h place)
+{
+ if (!place)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ g_slice_free(maps_place_rating_s, place);
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_place_rating_clone(const maps_place_rating_h origin,
+ maps_place_rating_h *cloned)
+{
+ if (!cloned || !origin)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ int error = MAPS_ERROR_NONE;
+ do {
+ error = maps_place_rating_create(cloned);
+ if (!(*cloned) || (error != MAPS_ERROR_NONE))
+ break;
+
+ maps_place_rating_s *r = (maps_place_rating_s *) origin;
+
+ error = maps_place_rating_set_count(*cloned, r->count);
+ if (error != MAPS_ERROR_NONE)
+ break;
+
+ error = maps_place_rating_set_average(*cloned, r->average);
+ if (error != MAPS_ERROR_NONE)
+ break;
+
+ return MAPS_ERROR_NONE;
+ } while (false);
+
+ maps_place_rating_destroy(*cloned);
+ *cloned = NULL;
+ return error;
+}
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_place_rating_get_count(const maps_place_rating_h place,
+ int *count)
+{
+ if (!place || !count)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ *count = ((maps_place_rating_s *) place)->count;
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_place_rating_get_average(const maps_place_rating_h place,
+ double *average)
+{
+ if (!place || !average)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ *average = ((maps_place_rating_s *) place)->average;
+ return MAPS_ERROR_NONE;
+}
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_place_rating_set_count(maps_place_rating_h place,
+ const int count)
+{
+ if (!place || (count < 0))
+ return MAPS_ERROR_INVALID_PARAMETER;
+ ((maps_place_rating_s *) place)->count = count;
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_place_rating_set_average(maps_place_rating_h place,
+ const double average)
+{
+ if (!place || (average < 0))
+ return MAPS_ERROR_INVALID_PARAMETER;
+ ((maps_place_rating_s *) place)->average = average;
+ return MAPS_ERROR_NONE;
+}
--- /dev/null
+/* Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 "maps_error.h"
+#include "maps_place_review_plugin.h"
+#include "maps_place_media_plugin.h"
+#include "maps_place_link_object_plugin.h"
+#include <glib.h>
+#include "maps_util.h"
+
+typedef struct _maps_place_review_s
+{
+ char *date;
+ char *title;
+ double rating;
+ char *description;
+ char *language;
+ maps_place_media_h media;
+ maps_place_link_object_h user;
+} maps_place_review_s;
+
+const gsize _MAPS_PLACE_REVIEW_DATE_MAX_LENGTH = 64;
+const gsize _MAPS_PLACE_REVIEW_TITLE_MAX_LENGTH = 264;
+const gsize _MAPS_PLACE_REVIEW_DESCRIPTION_MAX_LENGTH = 512;
+const gsize _MAPS_PLACE_REVIEW_LANGUAGE_MAX_LENGTH = 32;
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_place_review_create(maps_place_review_h *place)
+{
+ if (!place)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ *place = (maps_place_review_h) g_slice_new0(maps_place_review_s);
+
+ if (*place == NULL) {
+ MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
+ return MAPS_ERROR_OUT_OF_MEMORY;
+ }
+
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_place_review_destroy(maps_place_review_h place)
+{
+ if (!place)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ maps_place_review_s *r = (maps_place_review_s *) place;
+
+ if (r->date)
+ g_free(r->date);
+ if (r->title)
+ g_free(r->title);
+ if (r->description)
+ g_free(r->description);
+ if (r->language)
+ g_free(r->language);
+
+ if (r->media)
+ maps_place_media_destroy(r->media);
+ if (r->user)
+ maps_place_link_object_destroy(r->user);
+
+ g_slice_free(maps_place_review_s, place);
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_place_review_clone(const maps_place_review_h origin,
+ maps_place_review_h *cloned)
+{
+ if (!cloned || !origin)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ int error = MAPS_ERROR_NONE;
+ do {
+ error = maps_place_review_create(cloned);
+ if (!(*cloned) || (error != MAPS_ERROR_NONE))
+ break;
+
+ maps_place_review_s *r = (maps_place_review_s *) origin;
+
+ if (r->date) {
+ error = maps_place_review_set_date(*cloned, r->date);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (r->title) {
+ error = maps_place_review_set_title(*cloned, r->title);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ ((maps_place_review_s *) (*cloned))->rating = r->rating;
+
+ if (r->description) {
+ error = maps_place_review_set_description(*cloned,
+ r->description);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+ if (r->language) {
+ error = maps_place_review_set_language(*cloned,
+ r->language);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+ if (r->media) {
+ error = maps_place_review_set_media(*cloned, r->media);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+ if (r->user) {
+ error = maps_place_review_set_user_link(*cloned,
+ r->user);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ return MAPS_ERROR_NONE;
+ } while (false);
+
+ maps_place_review_destroy(*cloned);
+ *cloned = NULL;
+ return error;
+}
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_place_review_get_date(const maps_place_review_h place,
+ char **date)
+{
+ if (!place || !date)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_get_string(((maps_place_review_s *) place)->date,
+ _MAPS_PLACE_REVIEW_DATE_MAX_LENGTH, date);
+}
+
+EXPORT_API int maps_place_review_get_title(const maps_place_review_h place,
+ char **title)
+{
+ if (!place || !title)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_get_string(((maps_place_review_s *) place)->title,
+ _MAPS_PLACE_REVIEW_TITLE_MAX_LENGTH, title);
+}
+
+EXPORT_API int maps_place_review_get_rating(const maps_place_review_h place,
+ double *rating)
+{
+ if (!place || !rating)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ *rating = ((maps_place_review_s *) place)->rating;
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_place_review_get_description(const maps_place_review_h
+ place,
+ char **description)
+{
+ if (!place || !description)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_get_string(((maps_place_review_s *) place)->description,
+ _MAPS_PLACE_REVIEW_DESCRIPTION_MAX_LENGTH, description);
+}
+
+EXPORT_API int maps_place_review_get_language(const maps_place_review_h place,
+ char ** language)
+{
+ if (!place || !language)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_get_string(((maps_place_review_s *) place)->language,
+ _MAPS_PLACE_REVIEW_LANGUAGE_MAX_LENGTH, language);
+}
+
+EXPORT_API int maps_place_review_get_media(const maps_place_review_h place,
+ maps_place_media_h *media)
+{
+ if (!place || !media)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_place_media_clone(((maps_place_review_s *) place)->media,
+ media);
+}
+
+EXPORT_API int maps_place_review_get_user_link(const maps_place_review_h place,
+ maps_place_link_object_h *user)
+{
+ if (!place || !user)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_place_link_object_clone(((maps_place_review_s *) place)->
+ user, user);
+}
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_place_review_set_date(maps_place_review_h place,
+ const char *date)
+{
+ if (!place || !date)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_set_string(date, _MAPS_PLACE_REVIEW_DATE_MAX_LENGTH,
+ &((maps_place_review_s *) place)->date);
+}
+
+EXPORT_API int maps_place_review_set_title(maps_place_review_h place,
+ const char *title)
+{
+ if (!place || !title)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_set_string(title, _MAPS_PLACE_REVIEW_TITLE_MAX_LENGTH,
+ &((maps_place_review_s *) place)->title);
+}
+
+EXPORT_API int maps_place_review_set_rating(maps_place_review_h place,
+ const double rating)
+{
+ if (!place)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ ((maps_place_review_s *) place)->rating = rating;
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_place_review_set_description(maps_place_review_h place,
+ const char *description)
+{
+ if (!place || !description)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_set_string(description,
+ _MAPS_PLACE_REVIEW_DESCRIPTION_MAX_LENGTH,
+ &((maps_place_review_s *) place)->description);
+}
+
+EXPORT_API int maps_place_review_set_language(maps_place_review_h place,
+ const char *language)
+{
+ if (!place || !language)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_set_string(language, _MAPS_PLACE_REVIEW_LANGUAGE_MAX_LENGTH,
+ &((maps_place_review_s *) place)->language);
+}
+
+EXPORT_API int maps_place_review_set_media(maps_place_review_h place,
+ const maps_place_media_h media)
+{
+ if (!place || !media)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_place_review_s *r = (maps_place_review_s *) place;
+ if (r->media)
+ maps_place_media_destroy(r->media);
+ return maps_place_media_clone(media, &r->media);
+}
+
+EXPORT_API int maps_place_review_set_user_link(maps_place_review_h place,
+ const maps_place_link_object_h
+ user)
+{
+ if (!place || !user)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_place_review_s *r = (maps_place_review_s *) place;
+ if (r->user)
+ maps_place_link_object_destroy(r->user);
+ return maps_place_link_object_clone(user, &r->user);
+}
--- /dev/null
+/* Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 "maps_error.h"
+#include "maps_place_url_plugin.h"
+#include <glib.h>
+#include "maps_util.h"
+
+typedef struct _maps_place_url_s
+{
+ char *path;
+ char *desc;
+} maps_place_url_s;
+
+const gsize _MAPS_PLACE_URL_PATH_MAX_LENGTH = 264;
+const gsize _MAPS_PLACE_URL_DESC_MAX_LENGTH = 512;
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_place_url_create(maps_place_url_h *place)
+{
+ if (!place)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ *place = (maps_place_url_h) g_slice_new0(maps_place_url_s);
+
+ if (*place == NULL) {
+ MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
+ return MAPS_ERROR_OUT_OF_MEMORY;
+ }
+
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_place_url_destroy(maps_place_url_h place)
+{
+ if (!place)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ maps_place_url_s *u = (maps_place_url_s *) place;
+
+ if (u->path)
+ g_free(u->path);
+ if (u->desc)
+ g_free(u->desc);
+
+ g_slice_free(maps_place_url_s, place);
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_place_url_clone(const maps_place_url_h origin,
+ maps_place_url_h *cloned)
+{
+ if (!cloned || !origin)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ int error = MAPS_ERROR_NONE;
+ do {
+ error = maps_place_url_create(cloned);
+ if (!(*cloned) || (error != MAPS_ERROR_NONE))
+ break;
+
+ maps_place_url_s* u = (maps_place_url_s*) origin;
+
+ if (u->path) {
+ error = maps_place_url_set_path(*cloned, u->path);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (u->desc) {
+ error = maps_place_url_set_description(*cloned,
+ u->desc);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ return MAPS_ERROR_NONE;
+ } while (false);
+
+ maps_place_url_destroy(*cloned);
+ *cloned = NULL;
+ return error;
+}
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_place_url_get_path(const maps_place_url_h place,
+ char **path)
+{
+ if (!place || !path)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_get_string(((maps_place_url_s *) place)->path,
+ _MAPS_PLACE_URL_PATH_MAX_LENGTH, path);
+}
+
+EXPORT_API int maps_place_url_get_description(const maps_place_url_h place,
+ char **desc)
+{
+ if (!place || !desc)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_get_string(((maps_place_url_s *) place)->desc,
+ _MAPS_PLACE_URL_DESC_MAX_LENGTH, desc);
+}
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_place_url_set_path(maps_place_url_h place, const char *path)
+{
+ if (!place || !path)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_set_string(path, _MAPS_PLACE_URL_PATH_MAX_LENGTH,
+ &((maps_place_url_s *) place)->path);
+}
+
+EXPORT_API int maps_place_url_set_description(maps_place_url_h place,
+ const char *desc)
+{
+ if (!place || !desc)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_set_string(desc, _MAPS_PLACE_URL_DESC_MAX_LENGTH,
+ &((maps_place_url_s *) place)->desc);
+}
--- /dev/null
+/* Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 "maps_error.h"
+#include "maps_plugin_info.h"
+#include <glib.h>
+#include "maps_util.h"
+
+typedef struct _maps_plugin_info_s
+{
+ char *provider_name;
+} maps_plugin_info_s;
+
+const gsize _MAPS_PLUGIN_INFO_NAME_MAX_LENGTH = 64;
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_plugin_info_create(maps_plugin_info_h *info)
+{
+ if (!info)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ *info = g_slice_new0(maps_plugin_info_s);
+
+ if (*info == NULL) {
+ MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
+ return MAPS_ERROR_OUT_OF_MEMORY;
+ }
+
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_plugin_info_destroy(maps_plugin_info_h info)
+{
+ if (!info)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ int error = MAPS_ERROR_NONE;
+
+ maps_plugin_info_s *c = (maps_plugin_info_s *) info;
+
+ if (c->provider_name)
+ g_free(c->provider_name);
+
+ g_slice_free(maps_plugin_info_s, info);
+ return error;
+}
+
+EXPORT_API int maps_plugin_info_clone(const maps_plugin_info_h origin,
+ maps_plugin_info_h *cloned)
+{
+ if (!cloned || !origin)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ int error = MAPS_ERROR_NONE;
+
+ do {
+ error = maps_plugin_info_create(cloned);
+ if (error != MAPS_ERROR_NONE)
+ break;
+
+ maps_plugin_info_s *c = (maps_plugin_info_s *) origin;
+
+ if (c->provider_name) {
+ error = maps_plugin_info_set_provider_name(*cloned,
+ c->provider_name);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ return MAPS_ERROR_NONE;
+
+ } while (false);
+
+ maps_plugin_info_destroy(*cloned);
+ *cloned = NULL;
+ return error;
+}
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_plugin_info_get_provider_name(const maps_plugin_info_h info,
+ char **provider_name)
+{
+ if (!info || !provider_name)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_get_string(((maps_plugin_info_s *) info)->provider_name,
+ _MAPS_PLUGIN_INFO_NAME_MAX_LENGTH, provider_name);
+}
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_plugin_info_set_provider_name(maps_plugin_info_h info,
+ const char *provider_name)
+{
+ if (!info || !provider_name)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_set_string(provider_name, _MAPS_PLUGIN_INFO_NAME_MAX_LENGTH,
+ &((maps_plugin_info_s *) info)->provider_name);
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 "maps_error.h"
+#include "maps_extra_types.h"
+#include "maps_util.h"
+#include "maps_preference.h"
+#include <glib.h>
+
+typedef struct _callback_data
+{
+ maps_preference_properties_cb callback;
+ void *user_data;
+} callback_data;
+
+static bool __isnamed_preference(const char *key)
+{
+ if (!key)
+ return false;
+
+ static guint names[] = {
+ g_str_hash(MAPS_PLACE_FILTER_TYPE),
+ g_str_hash(MAPS_PLACE_FILTER_SORT_BY),
+ g_str_hash(MAPS_PLACE_FILTER_TYPE),
+ g_str_hash(MAPS_PLACE_FILTER_SORT_BY),
+ g_str_hash(MAPS_ROUTE_FREEFORM_ADDR_TO_AVOID),
+ g_str_hash(MAPS_ROUTE_STRUCTED_ADDR_TO_AVOID),
+ g_str_hash(MAPS_ROUTE_CIRCLE_AREA_TO_AVOID),
+ g_str_hash(MAPS_ROUTE_RECT_AREA_TO_AVOID),
+ g_str_hash(MAPS_ROUTE_GEOMETRY_BOUNDING_BOX),
+ g_str_hash(MAPS_ROUTE_GEOMETRY_RETRIEVAL),
+ g_str_hash(MAPS_ROUTE_INSTRUCTION_GEOMETRY),
+ g_str_hash(MAPS_ROUTE_INSTRUCTION_BOUNDING_BOX),
+ g_str_hash(MAPS_ROUTE_INSTRUCTION_RETRIEVAL),
+ g_str_hash(MAPS_ROUTE_REALTIME_TRAFFIC),
+ g_str_hash("MAPS_PREFERENCE_DISTANCE_UNIT"),
+ g_str_hash("MAPS_PREFERENCE_LANGUAGE"),
+ g_str_hash("MAPS_PREFERENCE_MAX_RESULTS"),
+ g_str_hash("MAPS_PREFERENCE_COUNTRY_CODE"),
+ g_str_hash("MAPS_PREFERENCE_ROUTE_OPTIMIZATION"),
+ g_str_hash("MAPS_PREFERENCE_ROUTE_TRANSPORT_MODE"),
+ g_str_hash("MAPS_PREFERENCE_ROUTE_FEATURE_WEIGHT"),
+ g_str_hash("MAPS_PREFERENCE_ROUTE_FEATURE")
+ };
+ const int size = sizeof(names) / sizeof(names[0]);
+
+ guint key_hash = g_str_hash(key);
+ for (int i = 0; i < size; i++)
+ if (key_hash == names[i])
+ return true;
+
+ return false;
+}
+
+static bool __maps_preference_properties_helper_cb(int index, int total,
+ char *key, void *value,
+ void *user_data)
+{
+ /* Do not return the "named" preference, which can be obtained, */
+ /* with other functions from this module. */
+ /* The reason is that "named" preferences may be not only string type */
+ if (__isnamed_preference(key)) {
+ g_free(key);
+ g_free(value);
+ return true;
+ }
+ if (!user_data)
+ return false;
+ callback_data *cbd = (callback_data *) user_data;
+ if (!cbd->callback)
+ return false;
+ return cbd->callback(index, total, key, (char *) value, cbd->user_data);
+}
+
+EXPORT_API int maps_preference_create(maps_preference_h *preference)
+{
+ if (!preference)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ int error = maps_item_hashtable_create(preference);
+ if (error != MAPS_ERROR_NONE)
+ return error;
+
+ do {
+ error = maps_item_hashtable_set_int(*preference,
+ "MAPS_PREFERENCE_DISTANCE_UNIT", MAPS_DISTANCE_UNIT_M);
+ if (error != MAPS_ERROR_NONE)
+ break;
+
+ error = maps_item_hashtable_set_string(*preference,
+ "MAPS_PREFERENCE_LANGUAGE", "en-US");
+ if (error != MAPS_ERROR_NONE)
+ break;
+
+ error = maps_item_hashtable_set_int(*preference,
+ "MAPS_PREFERENCE_MAX_RESULTS", 25);
+ if (error != MAPS_ERROR_NONE)
+ break;
+
+ return MAPS_ERROR_NONE;
+ } while (0);
+
+ maps_item_hashtable_destroy(preference);
+ return error;
+}
+
+EXPORT_API int maps_preference_destroy(maps_preference_h preference)
+{
+ if (!preference)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_item_hashtable_destroy(preference);
+}
+
+EXPORT_API int maps_preference_clone(const maps_preference_h origin,
+ maps_preference_h *cloned)
+{
+ if (!cloned || !origin)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_item_hashtable_clone(origin, cloned);
+}
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_preference_get_distance_unit(const maps_preference_h
+ preference,
+ maps_distance_unit_e *unit)
+{
+ if (!preference || !unit)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_item_hashtable_get_int(preference,
+ "MAPS_PREFERENCE_DISTANCE_UNIT", (int *) unit);
+}
+
+EXPORT_API int maps_preference_get_language(const maps_preference_h preference,
+ char **language)
+{
+ if (!preference || !language)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_item_hashtable_get_string(preference,
+ "MAPS_PREFERENCE_LANGUAGE", language);
+}
+
+EXPORT_API int maps_preference_get_max_results(const maps_preference_h
+ preference,
+ int *max_results)
+{
+ if (!preference || !max_results)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_item_hashtable_get_int(preference,
+ "MAPS_PREFERENCE_MAX_RESULTS", max_results);
+}
+
+EXPORT_API int maps_preference_get_country_code(const maps_preference_h
+ preference,
+ char **country_code)
+{
+ if (!preference || !country_code)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_item_hashtable_get_string(preference,
+ "MAPS_PREFERENCE_COUNTRY_CODE", country_code);
+}
+
+EXPORT_API int maps_preference_get_route_optimization(const maps_preference_h
+ preference,
+ maps_route_optimization_e*
+ optimization)
+{
+ if (!preference || !optimization)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_item_hashtable_get_int(preference,
+ "MAPS_PREFERENCE_ROUTE_OPTIMIZATION", (int *) optimization);
+}
+
+EXPORT_API int maps_preference_get_route_transport_mode(const maps_preference_h
+ preference,
+ maps_route_transport_mode_e *
+ transport_mode)
+{
+ if (!preference || !transport_mode)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_item_hashtable_get_int(preference,
+ "MAPS_PREFERENCE_ROUTE_TRANSPORT_MODE", (int *) transport_mode);
+}
+
+EXPORT_API int maps_preference_get_route_feature_weight(const maps_preference_h
+ preference,
+ maps_route_feature_weight_e *
+ feature_weight)
+{
+ if (!preference || !feature_weight)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_item_hashtable_get_int(preference,
+ "MAPS_PREFERENCE_ROUTE_FEATURE_WEIGHT", (int *) feature_weight);
+}
+
+EXPORT_API int maps_preference_get_route_feature(const maps_preference_h
+ preference,
+ maps_route_feature_e * feature)
+{
+ if (!preference || !feature)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_item_hashtable_get_int(preference,
+ "MAPS_PREFERENCE_ROUTE_FEATURE", (int *) feature);
+}
+
+EXPORT_API int maps_preference_get(const maps_preference_h preference,
+ const char *key, char **value)
+{
+ if (!preference || !key || !value)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_item_hashtable_get_string(preference, key, value);
+}
+
+
+EXPORT_API int maps_preference_foreach_property(const maps_preference_h
+ preference,
+ maps_preference_properties_cb
+ callback, void *user_data)
+{
+ if (!preference || !callback)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ callback_data cd = { callback, user_data };
+ return maps_item_hashtable_foreach(preference,
+ __maps_preference_properties_helper_cb, &cd);
+}
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_preference_set_distance_unit(maps_preference_h preference,
+ const maps_distance_unit_e
+ unit)
+{
+ if (!preference)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ if ((unit < MAPS_DISTANCE_UNIT_M) || (unit > MAPS_DISTANCE_UNIT_YD))
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_item_hashtable_set_int(preference,
+ "MAPS_PREFERENCE_DISTANCE_UNIT", unit);
+}
+
+EXPORT_API int maps_preference_set_language(maps_preference_h preference,
+ const char *language)
+{
+ if (!preference || !language)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_item_hashtable_set_string(preference,
+ "MAPS_PREFERENCE_LANGUAGE", language);
+}
+
+EXPORT_API int maps_preference_set_max_results(maps_preference_h preference,
+ const int max_results)
+{
+ if (!preference || max_results <= 0)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_item_hashtable_set_int(preference,
+ "MAPS_PREFERENCE_MAX_RESULTS", max_results);
+}
+
+EXPORT_API int maps_preference_set_country_code(maps_preference_h preference,
+ const char *country_code)
+{
+ if (!preference || !country_code)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_item_hashtable_set_string(preference,
+ "MAPS_PREFERENCE_COUNTRY_CODE", country_code);
+}
+
+EXPORT_API int maps_preference_set_route_optimization(maps_preference_h
+ preference,
+ const maps_route_optimization_e
+ optimization)
+{
+ if (!preference)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ if ((optimization < MAPS_ROUTE_TYPE_FASTEST)
+ || (optimization > MAPS_ROUTE_TYPE_DIRECTDRIVE))
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_item_hashtable_set_int(preference,
+ "MAPS_PREFERENCE_ROUTE_OPTIMIZATION", optimization);
+}
+
+EXPORT_API int maps_preference_set_route_transport_mode(maps_preference_h
+ preference,
+ const maps_route_transport_mode_e
+ transport_mode)
+{
+ if (!preference)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ if ((transport_mode < MAPS_ROUTE_TRANSPORT_MODE_CAR)
+ || (transport_mode > MAPS_ROUTE_TRANSPORT_MODE_TRUCK))
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_item_hashtable_set_int(preference,
+ "MAPS_PREFERENCE_ROUTE_TRANSPORT_MODE", transport_mode);
+}
+
+EXPORT_API int maps_preference_set_route_feature_weight(maps_preference_h
+ preference,
+ const maps_route_feature_weight_e
+ feature_weight)
+{
+ if (!preference)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ if ((feature_weight < MAPS_ROUTE_FEATURE_WEIGHT_NORMAL)
+ || (feature_weight > MAPS_ROUTE_FEATURE_WEIGHT_STRICTEXCLUDE))
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_item_hashtable_set_int(preference,
+ "MAPS_PREFERENCE_ROUTE_FEATURE_WEIGHT", feature_weight);
+}
+
+EXPORT_API int maps_preference_set_route_feature(maps_preference_h preference,
+ const maps_route_feature_e
+ feature)
+{
+ if (!preference)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ if ((feature < MAPS_ROUTE_FEATURE_NO)
+ || (feature > MAPS_ROUTE_FEATURE_STAIRS))
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_item_hashtable_set_int(preference,
+ "MAPS_PREFERENCE_ROUTE_FEATURE", feature);
+}
+
+EXPORT_API int maps_preference_set_property(maps_preference_h preference,
+ const char *key, const char *value)
+{
+ if (!preference || !key || !value)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_item_hashtable_set_string(preference, key, value);
+}
+
+/*----------------------------------------------------------------------------*/
+
+#if 0
+EXPORT_API int maps_preference_append_route_feature(maps_preference_h
+ preference, maps_item_list_h feature_list,
+ maps_route_feature_weight_e feature)
+{
+
+ if (!preference || max_result_count <= 0)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ maps_item_list_s* list = (maps_item_list_s*) feature_list;
+
+ if (!feature) {
+ maps_item_list_create(list);
+ }
+
+ maps_item_list_append(list, feature);
+ maps_item_hashtable_s* p = (maps_item_hashtable_s*) preference;
+
+ int ret;
+ ret = maps_item_hashtable_set(p, "MAPS_PREFERENCE_ROUTE_FEATURE", list);
+
+ feature = list;
+
+ return ret;
+}
+
+EXPORT_API int maps_preference_remove_route_feature(maps_preference_h
+ preference, maps_item_list_h feature_list,
+ maps_route_feature_weight_e feature)
+{
+
+ if (!preference || !feature_list)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ maps_item_list_s* list = (maps_item_list_s*) feature_list;
+
+ if (!feature) {
+ maps_item_list_create(list);
+ }
+
+ maps_item_list_remove(list, feature);
+ maps_item_hashtable_s* p = (maps_item_hashtable_s*) preference;
+
+ int ret;
+ ret = maps_item_hashtable_set(p, "MAPS_PREFERENCE_ROUTE_FEATURE", list);
+
+ feature = list;
+
+ return ret;
+}
+#endif
--- /dev/null
+/*
+ * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 "maps_util.h"
+#include "maps_route_plugin.h"
+#include "maps_error.h"
+#include "maps_preference.h"
+#include "maps_route_segment_plugin.h"
+#include "maps_route_private.h"
+#include "maps_route_segment_private.h"
+
+static bool __is_supported(const maps_route_h route, maps_service_data_e data)
+{
+ bool supported = false;
+ _maps_route_is_data_supported(route, data, &supported);
+ return supported;
+}
+
+static bool __maps_route_set_supported_data_foreach_cb(int index, int total,
+ void *data,
+ void *user_data)
+{
+ _maps_route_segment_set_supported_data(data, user_data);
+ return true;
+}
+
+static int __maps_route_set_supported_data_clone_cb(void *origin, void **cloned)
+{
+ *cloned = origin; /* No clonning, please */
+ return MAPS_ERROR_NONE;
+}
+
+/*----------------------------------------------------------------------------*/
+
+/*
+ * maps_route_s module
+ */
+typedef struct _maps_route_s
+{
+ char *route_id; /*< route_id */
+ maps_coordinates_h origin; /*< Coordinate StartCoord */
+ maps_coordinates_h destination; /*< Coordinates destCoord */
+ maps_area_h bounding_box; /*< A rectangular geographical area */
+ maps_route_transport_mode_e transport_mode; /*< The transport mode
+ for the route */
+ double total_distance; /*< Total distance */
+ long total_duration; /*< Total duration */
+ maps_distance_unit_e distance_unit; /*< Distance units */
+ maps_item_list_h segments; /*< List of segments,
+ maps_route_segment_h */
+ maps_item_list_h path; /*< Path, list of maps_coordinates_h */
+ maps_item_hashtable_h properties; /*< Key/Value> */
+
+ /* The table of available data features */
+ maps_string_hashtable_h supported_data;
+ /* TODO: implement hashtable<int, int> */
+} maps_route_s;
+
+const gsize _MAPS_ROUTE_ID_MAX_LENGTH = 32;
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_route_create(maps_route_h *route)
+{
+ if (!route)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ *route = (maps_route_h) g_slice_new0(maps_route_s);
+
+ if (*route == NULL) {
+ MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
+ return MAPS_ERROR_OUT_OF_MEMORY;
+ }
+
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_route_destroy(maps_route_h route)
+{
+ if (!route)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ maps_route_s *p = (maps_route_s *) route;
+
+ if (p->route_id)
+ g_free(p->route_id);
+ if (p->origin)
+ maps_coordinates_destroy(p->origin);
+ if (p->destination)
+ maps_coordinates_destroy(p->destination);
+ if (p->bounding_box)
+ maps_area_destroy(p->bounding_box);
+ if (p->properties)
+ maps_item_hashtable_destroy(p->properties);
+
+ if (p->segments) {
+ maps_item_list_remove_all(p->segments,
+ maps_route_segment_destroy);
+ maps_item_list_destroy(p->segments);
+ }
+
+ if (p->path) {
+ maps_item_list_remove_all(p->path, maps_coordinates_destroy);
+ maps_item_list_destroy(p->path);
+ }
+
+ if (p->supported_data)
+ maps_item_hashtable_destroy(p->supported_data);
+
+ g_slice_free(maps_route_s, route);
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_route_clone(const maps_route_h origin,
+ maps_route_h *cloned)
+{
+ if (!cloned || !origin)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ int error = MAPS_ERROR_NONE;
+ do {
+ error = maps_route_create(cloned);
+ if (!(*cloned) || (error != MAPS_ERROR_NONE))
+ break;
+
+ maps_route_s *r = (maps_route_s *) origin;
+
+ if (r->route_id) {
+ error = maps_route_set_route_id(*cloned, r->route_id);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (r->origin) {
+ error = maps_route_set_origin(*cloned, r->origin);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (r->destination) {
+ error = maps_route_set_destination(*cloned,
+ r->destination);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (r->bounding_box) {
+ error = maps_route_set_bounding_box(*cloned,
+ r->bounding_box);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ error = maps_route_set_transport_mode(*cloned,
+ r->transport_mode);
+ if (error != MAPS_ERROR_NONE)
+ break;
+
+ error = maps_route_set_total_distance(*cloned,
+ r->total_distance);
+ if (error != MAPS_ERROR_NONE)
+ break;
+
+ error = maps_route_set_total_duration(*cloned,
+ r->total_duration);
+ if (error != MAPS_ERROR_NONE)
+ break;
+
+ error = maps_route_set_distance_unit(*cloned, r->distance_unit);
+ if (error != MAPS_ERROR_NONE)
+ break;
+
+ if (r->segments) {
+ error = maps_route_set_segments(*cloned, r->segments);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (r->path) {
+ error = maps_route_set_path(*cloned, r->path);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (r->properties) {
+ error = maps_route_set_properties(*cloned,
+ r->properties);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (r->supported_data) {
+ error = _maps_route_set_supported_data(*cloned,
+ r->supported_data);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ return MAPS_ERROR_NONE;
+ } while (false);
+
+ maps_route_destroy(*cloned);
+ *cloned = NULL;
+ return error;
+}
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_route_get_route_id(const maps_route_h route,
+ char **route_id)
+{
+ if (!route || !route_id)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_get_string(((maps_route_s *) route)->route_id,
+ _MAPS_ROUTE_ID_MAX_LENGTH, route_id);
+}
+
+EXPORT_API int maps_route_get_origin(const maps_route_h route,
+ maps_coordinates_h *origin)
+{
+ if (!route || !origin)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_coordinates_clone(((maps_route_s *) route)->origin, origin);
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_route_get_destination(const maps_route_h route,
+ maps_coordinates_h *destination)
+{
+ if (!route || !destination)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_coordinates_clone(((maps_route_s *) route)->destination,
+ destination);
+}
+
+EXPORT_API int maps_route_get_bounding_box(const maps_route_h route,
+ maps_area_h *bounding_box)
+{
+ if (!route || !bounding_box)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_area_clone(((maps_route_s *) route)->bounding_box,
+ bounding_box);
+}
+
+EXPORT_API int maps_route_get_transport_mode(const maps_route_h route,
+ maps_route_transport_mode_e *
+ transport_mode)
+{
+ if (!route || !transport_mode)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ *transport_mode = ((maps_route_s *) route)->transport_mode;
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_route_get_total_distance(const maps_route_h route,
+ double *total_distance)
+{
+ if (!route || !total_distance)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ *total_distance = ((maps_route_s *) route)->total_distance;
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_route_get_total_duration(const maps_route_h route,
+ long *total_duration)
+{
+ if (!route || !total_duration)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ *total_duration = ((maps_route_s *) route)->total_duration;
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_route_foreach_path(const maps_route_h route,
+ maps_route_path_cb callback,
+ void *user_data)
+{
+ /* Check if the handle of the Route is valid */
+ if (!route)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ /* Check if this API feature available */
+ if (!__is_supported(route, MAPS_ROUTE_PATH))
+ return MAPS_ERROR_NOT_SUPPORTED;
+
+ /* Check if parameters are valid */
+ if (!callback)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ return maps_item_list_foreach(((maps_route_s *) route)->path,
+ maps_coordinates_clone, callback, user_data);
+}
+
+EXPORT_API int maps_route_foreach_segment(const maps_route_h route,
+ maps_route_segment_cb callback,
+ void *user_data)
+{
+ /* Check if the handle of the Route is valid */
+ if (!route)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ /* Check if this API feature available */
+ if (!__is_supported(route, MAPS_ROUTE_SEGMENTS_PATH)
+ && !__is_supported(route, MAPS_ROUTE_SEGMENTS_MANEUVERS))
+ return MAPS_ERROR_NOT_SUPPORTED;
+
+ /* Check if parameters are valid */
+ if (!callback)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ return maps_item_list_foreach(((maps_route_s *) route)->segments,
+ maps_route_segment_clone, callback, user_data);
+}
+
+EXPORT_API int maps_route_foreach_property(const maps_route_h route,
+ maps_route_properties_cb callback,
+ void *user_data)
+{
+ if (!route || !callback)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_item_hashtable_foreach(((maps_route_s *) route)->properties,
+ callback, user_data);
+}
+
+EXPORT_API int maps_route_get_distance_unit(const maps_route_h route,
+ maps_distance_unit_e *distance_unit)
+{
+ if (!route || !distance_unit)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ *distance_unit = ((maps_route_s *) route)->distance_unit;
+ return MAPS_ERROR_NONE;
+}
+
+int _maps_route_is_data_supported(const maps_route_h route,
+ maps_service_data_e data, bool *supported)
+{
+ if (!route || !supported)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ if (!((maps_route_s *) route)->supported_data) {
+ /* This is a case when the "supported" flags are not set yet */
+ /* No need to limit access to fields */
+ *supported = true;
+ return MAPS_ERROR_NONE;
+ }
+
+ *supported = false;
+ string data_feature;
+ switch (data) {
+ case MAPS_ROUTE_PATH:
+ data_feature = _S(MAPS_ROUTE_PATH);
+ break;
+ case MAPS_ROUTE_SEGMENTS_PATH:
+ data_feature = _S(MAPS_ROUTE_SEGMENTS_PATH);
+ break;
+ case MAPS_ROUTE_SEGMENTS_MANEUVERS:
+ data_feature = _S(MAPS_ROUTE_SEGMENTS_MANEUVERS);
+ break;
+ default:
+ return MAPS_ERROR_NOT_SUPPORTED;
+ }
+ return maps_string_hashtable_contains(((maps_route_s *) route)->
+ supported_data, data_feature.c_str(), supported);
+}
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_route_set_route_id(const maps_route_h route,
+ const char *route_id)
+{
+ if (!route || !route_id)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_set_string(route_id, _MAPS_ROUTE_ID_MAX_LENGTH,
+ &((maps_route_s *) route)->route_id);
+}
+
+EXPORT_API int maps_route_set_origin(maps_route_h route,
+ const maps_coordinates_h origin)
+{
+ if (!route || !origin)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_route_s *p = (maps_route_s *) route;
+ if (p->origin)
+ maps_coordinates_destroy(p->origin);
+ return maps_coordinates_clone(origin, &p->origin);
+}
+
+EXPORT_API int maps_route_set_destination(maps_route_h route,
+ const maps_coordinates_h destination)
+{
+ if (!route || !destination)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_route_s *p = (maps_route_s *) route;
+ if (p->destination)
+ maps_coordinates_destroy(p->destination);
+ return maps_coordinates_clone(destination, &p->destination);
+}
+
+EXPORT_API int maps_route_set_bounding_box(maps_route_h route,
+ const maps_area_h bounding_box)
+{
+ if (!route || !bounding_box)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_route_s *p = (maps_route_s *) route;
+ if (p->bounding_box)
+ maps_area_destroy(p->bounding_box);
+ return maps_area_clone(bounding_box, &p->bounding_box);
+}
+
+EXPORT_API int maps_route_set_total_distance(maps_route_h route,
+ const double total_distance)
+{
+ if (!route || total_distance < 0)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ ((maps_route_s *) route)->total_distance = total_distance;
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_route_set_total_duration(maps_route_h route,
+ const long total_duration)
+{
+ if (!route || total_duration < 0)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ ((maps_route_s *) route)->total_duration = total_duration;
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_route_set_transport_mode(maps_route_h route,
+ const maps_route_transport_mode_e
+ transport_mode)
+{
+ if (!route)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ if ((transport_mode < MAPS_ROUTE_TRANSPORT_MODE_CAR) ||
+ (transport_mode > MAPS_ROUTE_TRANSPORT_MODE_TRUCK))
+ return MAPS_ERROR_INVALID_PARAMETER;
+ ((maps_route_s *) route)->transport_mode = transport_mode;
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_route_set_path(maps_route_h route,
+ const maps_item_list_h path)
+{
+ if (!route || !path)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_route_s *p = (maps_route_s *) route;
+ if (p->path) {
+ maps_item_list_remove_all(p->path, maps_coordinates_destroy);
+ maps_item_list_destroy(p->path);
+ }
+ maps_item_list_clone(path, maps_coordinates_clone, &p->path);
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_route_set_segments(maps_route_h route,
+ const maps_item_list_h segments)
+{
+ if (!route || !segments)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_route_s *p = (maps_route_s *) route;
+ if (p->segments) {
+ maps_item_list_remove_all(p->segments,
+ maps_route_segment_destroy);
+ maps_item_list_destroy(p->segments);
+ }
+ maps_item_list_clone(segments, maps_route_segment_clone, &p->segments);
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_route_set_properties(maps_route_h route,
+ const maps_item_hashtable_h properties)
+{
+ if (!route || !properties)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_route_s *p = (maps_route_s *) route;
+ if (p->properties)
+ maps_item_hashtable_destroy(p->properties);
+ return maps_item_hashtable_clone(properties, &p->properties);
+}
+
+EXPORT_API int maps_route_set_distance_unit(maps_route_h route,
+ const maps_distance_unit_e
+ distance_unit)
+{
+ if (!route)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ if ((distance_unit < MAPS_DISTANCE_UNIT_M) ||
+ (distance_unit > MAPS_DISTANCE_UNIT_YD))
+ return MAPS_ERROR_INVALID_PARAMETER;
+ ((maps_route_s *) route)->distance_unit = distance_unit;
+ return MAPS_ERROR_NONE;
+}
+
+int _maps_route_set_supported_data(maps_route_h route,
+ const maps_string_hashtable_h supported_data)
+{
+ if (!route || !supported_data)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_route_s *p = (maps_route_s *) route;
+ if (p->supported_data)
+ maps_string_hashtable_destroy(p->supported_data);
+ int error =
+ maps_string_hashtable_clone(supported_data, &p->supported_data);
+ if (error != MAPS_ERROR_NONE)
+ return error;
+
+ if (!p->segments)
+ return error;
+
+ return maps_item_list_foreach(p->segments,
+ __maps_route_set_supported_data_clone_cb,
+ __maps_route_set_supported_data_foreach_cb, supported_data);
+
+}
--- /dev/null
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * 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 "maps_error.h"
+#include "maps_route_maneuver_plugin.h"
+#include "maps_extra_types.h"
+#include <glib.h>
+#include "maps_util.h"
+
+typedef struct _maps_route_maneuver_s
+{
+ maps_route_direction_e direction_id;
+ maps_route_turn_type_e turn_type;
+ maps_coordinates_h position;
+ char *instruction_text;
+ char *road_name;
+ char *locale; /* locale of instruction_text; */
+ int time_to_next_instruction; /* duration */
+ double distance_to_next_instruction; /* distance */
+} maps_route_maneuver_s;
+
+const gsize _MAPS_ROUTE_MANEUVER_ROAD_NAME_MAX_LENGTH = 128;
+const gsize _MAPS_ROUTE_MANEUVER_INSTRUCTION_TEXT_MAX_LENGTH = 256;
+const gsize _MAPS_ROUTE_MANEUVER_LOCALE_MAX_LENGTH = 32;
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_route_maneuver_create(maps_route_maneuver_h *maneuver)
+{
+ if (!maneuver)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ *maneuver = (maps_route_maneuver_h) g_slice_new0(maps_route_maneuver_s);
+
+ if (*maneuver == NULL) {
+ MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
+ return MAPS_ERROR_OUT_OF_MEMORY;
+ }
+
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_route_maneuver_destroy(maps_route_maneuver_h maneuver)
+{
+ if (!maneuver)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ maps_route_maneuver_s *p = (maps_route_maneuver_s *) maneuver;
+
+ if (p->position)
+ maps_coordinates_destroy(p->position);
+ if (p->instruction_text)
+ g_free(p->instruction_text);
+ if (p->road_name)
+ g_free(p->road_name);
+ if (p->locale)
+ g_free(p->locale);
+
+ g_slice_free(maps_route_maneuver_s, maneuver);
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_route_maneuver_clone(const maps_route_maneuver_h origin,
+ maps_route_maneuver_h *cloned)
+{
+ if (!cloned || !origin)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ int error = MAPS_ERROR_NONE;
+ do {
+ error = maps_route_maneuver_create(cloned);
+ if (!(*cloned) || (error != MAPS_ERROR_NONE))
+ break;
+
+ maps_route_maneuver_s *p = (maps_route_maneuver_s *) origin;
+
+ error = maps_route_maneuver_set_direction_id(*cloned,
+ p->direction_id);
+ if (error != MAPS_ERROR_NONE)
+ break;
+
+ error = maps_route_maneuver_set_turn_type(*cloned,
+ p->turn_type);
+ if (error != MAPS_ERROR_NONE)
+ break;
+
+ if (p->position) {
+ error = maps_route_maneuver_set_position(*cloned,
+ p->position);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (p->instruction_text) {
+ error = maps_route_maneuver_set_instruction_text
+ (*cloned, p->instruction_text);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (p->road_name) {
+ error = maps_route_maneuver_set_road_name(*cloned,
+ p->road_name);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (p->locale) {
+ error = maps_route_maneuver_set_locale(*cloned,
+ p->locale);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ error = maps_route_maneuver_set_time_to_next_instruction
+ (*cloned, p->time_to_next_instruction);
+ if (error != MAPS_ERROR_NONE)
+ break;
+
+ error = maps_route_maneuver_set_distance_to_next_instruction
+ (*cloned, p->distance_to_next_instruction);
+ if (error != MAPS_ERROR_NONE)
+ break;
+
+ return MAPS_ERROR_NONE;
+ } while (false);
+
+ maps_route_maneuver_destroy(*cloned);
+ *cloned = NULL;
+ return error;
+}
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_route_maneuver_get_direction_id(const maps_route_maneuver_h
+ maneuver,
+ maps_route_direction_e *
+ direction_id)
+{
+ if (!maneuver || !direction_id)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ *direction_id = ((maps_route_maneuver_s *) maneuver)->direction_id;
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_route_maneuver_get_turn_type(const maps_route_maneuver_h
+ maneuver,
+ maps_route_turn_type_e *
+ turn_type)
+{
+ if (!maneuver || !turn_type)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ *turn_type = ((maps_route_maneuver_s *) maneuver)->turn_type;
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_route_maneuver_get_position(const maps_route_maneuver_h
+ maneuver,
+ maps_coordinates_h * position)
+{
+ if (!maneuver || !position)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_coordinates_clone(((maps_route_maneuver_s *) maneuver)->
+ position, position);
+}
+
+EXPORT_API int maps_route_maneuver_get_road_name(const maps_route_maneuver_h
+ maneuver,
+ char ** road_name)
+{
+ if (!maneuver || !road_name)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_get_string(((maps_route_maneuver_s *) maneuver)->road_name,
+ _MAPS_ROUTE_MANEUVER_ROAD_NAME_MAX_LENGTH, road_name);
+}
+
+EXPORT_API int maps_route_maneuver_get_instruction_text(const
+ maps_route_maneuver_h
+ maneuver,
+ char **
+ instruction_text)
+{
+ if (!maneuver || !instruction_text)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_get_string(((maps_route_maneuver_s *) maneuver)->
+ instruction_text,
+ _MAPS_ROUTE_MANEUVER_INSTRUCTION_TEXT_MAX_LENGTH,
+ instruction_text);
+}
+
+EXPORT_API int maps_route_maneuver_get_locale(const maps_route_maneuver_h
+ maneuver,
+ char **locale)
+{
+ if (!maneuver || !locale)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_get_string(((maps_route_maneuver_s *) maneuver)->locale,
+ _MAPS_ROUTE_MANEUVER_LOCALE_MAX_LENGTH, locale);
+}
+
+EXPORT_API int maps_route_maneuver_get_time_to_next_instruction(const
+ maps_route_maneuver_h
+ maneuver,
+ int *time_to_next_instruction)
+{
+ if (!maneuver || !time_to_next_instruction)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ *time_to_next_instruction =
+ ((maps_route_maneuver_s *) maneuver)->time_to_next_instruction;
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_route_maneuver_get_distance_to_next_instruction(const
+ maps_route_maneuver_h maneuver,
+ double *distance_to_next_instruction)
+{
+ if (!maneuver || !distance_to_next_instruction)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ *distance_to_next_instruction =
+ ((maps_route_maneuver_s *) maneuver)->
+ distance_to_next_instruction;
+ return MAPS_ERROR_NONE;
+}
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_route_maneuver_set_direction_id(maps_route_maneuver_h
+ maneuver,
+ const
+ maps_route_direction_e
+ direction_id)
+{
+ if (!maneuver)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ if ((direction_id < MAPS_ROUTE_DIRECTION_NONE)
+ || (direction_id > MAPS_ROUTE_DIRECTION_EAST))
+ return MAPS_ERROR_INVALID_PARAMETER;
+ ((maps_route_maneuver_s *) maneuver)->direction_id = direction_id;
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_route_maneuver_set_turn_type(maps_route_maneuver_h maneuver,
+ const maps_route_turn_type_e
+ turn_type)
+{
+ if (!maneuver)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ if ((turn_type < MAPS_ROUTE_TURN_TYPE_NONE)
+ || (turn_type > MAPS_ROUTE_TURN_TYPE_STRAIGHT_FORK))
+ return MAPS_ERROR_INVALID_PARAMETER;
+ ((maps_route_maneuver_s *) maneuver)->turn_type = turn_type;
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_route_maneuver_set_position(maps_route_maneuver_h maneuver,
+ const maps_coordinates_h
+ position)
+{
+ if (!maneuver || !position)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_route_maneuver_s *p = (maps_route_maneuver_s *) maneuver;
+ if (p->position)
+ maps_coordinates_destroy(p->position);
+ return maps_coordinates_clone(position, &p->position);
+}
+
+EXPORT_API int maps_route_maneuver_set_road_name(maps_route_maneuver_h maneuver,
+ const char *road_name)
+{
+ if (!maneuver || !road_name)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_set_string(road_name,
+ _MAPS_ROUTE_MANEUVER_ROAD_NAME_MAX_LENGTH,
+ &((maps_route_maneuver_s *) maneuver)->road_name);
+}
+
+EXPORT_API int maps_route_maneuver_set_instruction_text(maps_route_maneuver_h
+ maneuver,
+ const char *
+ instruction_text)
+{
+ if (!maneuver || !instruction_text)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_set_string(instruction_text,
+ _MAPS_ROUTE_MANEUVER_INSTRUCTION_TEXT_MAX_LENGTH,
+ &((maps_route_maneuver_s *) maneuver)->instruction_text);
+}
+
+EXPORT_API int maps_route_maneuver_set_locale(maps_route_maneuver_h maneuver,
+ const char *locale)
+{
+ if (!maneuver || !locale)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_route_maneuver_s *p = (maps_route_maneuver_s *) maneuver;
+ return maps_set_string(locale, _MAPS_ROUTE_MANEUVER_LOCALE_MAX_LENGTH,
+ &p->locale);
+}
+
+EXPORT_API int maps_route_maneuver_set_time_to_next_instruction(
+ maps_route_maneuver_h maneuver,
+ const int time_to_next_instruction)
+{
+ if (!maneuver || time_to_next_instruction < 0)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ ((maps_route_maneuver_s *) maneuver)->time_to_next_instruction =
+ time_to_next_instruction;
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_route_maneuver_set_distance_to_next_instruction(
+ maps_route_maneuver_h maneuver,
+ const double distance_to_next_instruction)
+{
+ if (!maneuver || distance_to_next_instruction < 0)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ ((maps_route_maneuver_s *) maneuver)->distance_to_next_instruction =
+ distance_to_next_instruction;
+ return MAPS_ERROR_NONE;
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_ROUTE_PRIVATE_H__
+#define __MAPS_ROUTE_PRIVATE_H__
+
+#include <maps_service.h>
+#include <maps_extra_types.h>
+
+/**
+ * @ingroup CAPI_MAPS_PLACE_MODULE
+ * @defgroup CAPI_MAPS_PLACE_DATA_MODULE Place
+ *
+ * @file maps_route_private.h
+ * @brief This file contains the functions related to Place information.
+ *
+ * @addtogroup CAPI_MAPS_PLACE_DATA_MODULE
+ * @{
+ * @brief This provides APIs related to Place information, used in Place
+ * Discovery and Search.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @internal
+ * @brief Checks if a route data feature is supported.
+ * @details This function checks if a route data feature is supported.
+ * @since_tizen 2.4
+ *
+ * @param[in] route The handle to route
+ * @param[in] data The feature to be checked
+ * @param[out] supported Is the feature supported
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a route is created using maps_route_create().
+ *
+ * @see maps_route_create()
+ */
+int _maps_route_is_data_supported(const maps_route_h route,
+ maps_service_data_e data, bool *supported);
+
+/**
+ * @internal
+ * @brief Sets the supported route data features.
+ * @details This function sets the supported route data features.
+ * @since_tizen 2.4
+ *
+ * @param[in] route The handle to route
+ * @param[in] supported_data The supported route data features
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a route is created using maps_route_create().
+ *
+ * @see maps_route_create()
+ */
+int _maps_route_set_supported_data(maps_route_h route,
+ const maps_string_hashtable_h
+ supported_data);
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+#endif /* __MAPS_ROUTE_PRIVATE_H__ */
--- /dev/null
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * 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 "maps_error.h"
+#include "maps_route_segment_plugin.h"
+#include "maps_route_maneuver_plugin.h"
+#include "maps_extra_types.h"
+#include <glib.h>
+#include "maps_util.h"
+#include "maps_route_segment_private.h"
+
+static bool __is_supported(const maps_route_segment_h route_segment,
+ maps_service_data_e data)
+{
+ bool supported = false;
+ _maps_route_segment_is_data_supported(route_segment, data, &supported);
+ return supported;
+}
+
+/*----------------------------------------------------------------------------*/
+
+typedef struct _maps_route_segment_s
+{
+ maps_coordinates_h origin;
+ maps_coordinates_h destination;
+ maps_area_h bounding_box;
+ double distance;
+ long duration;
+ maps_item_list_h path; /*< path, list of maps_coordinates_h */
+ maps_item_list_h maneuvers; /*< list of maneuvers,
+ maps_route_maneuver_h */
+
+ /* The table of available data features */
+ maps_string_hashtable_h supported_data;
+ /* TODO: implement hashtable<int, int> */
+} maps_route_segment_s;
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_route_segment_create(maps_route_segment_h *segment)
+{
+ if (!segment)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ *segment = (maps_route_segment_h) g_slice_new0(maps_route_segment_s);
+
+ if (*segment == NULL) {
+ MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
+ return MAPS_ERROR_OUT_OF_MEMORY;
+ }
+
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_route_segment_destroy(maps_route_segment_h segment)
+{
+ if (!segment)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ maps_route_segment_s *p = (maps_route_segment_s *) segment;
+
+ if (p->origin)
+ maps_coordinates_destroy(p->origin);
+ if (p->destination)
+ maps_coordinates_destroy(p->destination);
+ if (p->bounding_box)
+ maps_area_destroy(p->bounding_box);
+ if (p->path) {
+ maps_item_list_remove_all(p->path, maps_coordinates_destroy);
+ maps_item_list_destroy(p->path);
+ }
+ if (p->maneuvers) {
+ maps_item_list_remove_all(p->maneuvers,
+ maps_route_maneuver_destroy);
+ maps_item_list_destroy(p->maneuvers);
+ }
+
+ if (p->supported_data)
+ maps_item_hashtable_destroy(p->supported_data);
+
+ g_slice_free(maps_route_segment_s, segment);
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_route_segment_clone(const maps_route_segment_h segment,
+ maps_route_segment_h *cloned)
+{
+ if (!cloned || !segment)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ int error = MAPS_ERROR_NONE;
+ do {
+ error = maps_route_segment_create(cloned);
+ if (!(*cloned) || (error != MAPS_ERROR_NONE))
+ break;
+
+ maps_route_segment_s *p = (maps_route_segment_s *) segment;
+
+ if (p->origin) {
+ error = maps_route_segment_set_origin(*cloned,
+ p->origin);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (p->destination) {
+ error = maps_route_segment_set_destination(*cloned,
+ p->destination);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (p->bounding_box) {
+ error = maps_route_segment_set_bounding_box(*cloned,
+ p->bounding_box);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ error = maps_route_segment_set_distance(*cloned, p->distance);
+ if (error != MAPS_ERROR_NONE)
+ break;
+
+ error = maps_route_segment_set_duration(*cloned, p->duration);
+ if (error != MAPS_ERROR_NONE)
+ break;
+
+ if (p->path) {
+ error = maps_route_segment_set_path(*cloned, p->path);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (p->maneuvers) {
+ error = maps_route_segment_set_maneuvers(*cloned,
+ p->maneuvers);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ if (p->supported_data) {
+ error = _maps_route_segment_set_supported_data(*cloned,
+ p->supported_data);
+ if (error != MAPS_ERROR_NONE)
+ break;
+ }
+
+ return MAPS_ERROR_NONE;
+ } while (false);
+
+ maps_route_segment_destroy(*cloned);
+ *cloned = NULL;
+ return error;
+}
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_route_segment_get_origin(const maps_route_segment_h segment,
+ maps_coordinates_h *origin)
+{
+ if (!segment || !origin)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_coordinates_clone(((maps_route_segment_s *) segment)->
+ origin, origin);
+}
+
+EXPORT_API int maps_route_segment_get_destination(const maps_route_segment_h
+ segment,
+ maps_coordinates_h *destination)
+{
+ if (!segment || !destination)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_coordinates_clone(((maps_route_segment_s *) segment)->
+ destination, destination);
+}
+
+EXPORT_API int maps_route_segment_get_bounding_box(const maps_route_segment_h
+ segment, maps_area_h *
+ bounding_box)
+{
+ if (!segment || !bounding_box)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_area_clone(((maps_route_segment_s *) segment)->bounding_box,
+ bounding_box);
+}
+
+EXPORT_API int maps_route_segment_get_distance(const maps_route_segment_h
+ segment,
+ double *distance)
+{
+ if (!segment || !distance)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ *distance = ((maps_route_segment_s *) segment)->distance;
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_route_segment_get_duration(const maps_route_segment_h
+ segment,
+ long *duration)
+{
+ if (!segment || !duration)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ *duration = ((maps_route_segment_s *) segment)->duration;
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_route_segment_foreach_path(const maps_route_segment_h
+ segment,
+ maps_route_segment_path_cb callback,
+ void *user_data)
+{
+ /* Check if the handle of the Segment is valid */
+ if (!segment)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ /* Check if this API feature available */
+ if (!__is_supported(segment, MAPS_ROUTE_SEGMENTS_PATH))
+ return MAPS_ERROR_NOT_SUPPORTED;
+
+ /* Check if parameters are valid */
+ if (!callback)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ return maps_item_list_foreach(((maps_route_segment_s *) segment)->path,
+ maps_coordinates_clone, callback, user_data);
+}
+
+EXPORT_API int maps_route_segment_foreach_maneuver(const maps_route_segment_h
+ segment,
+ maps_route_segment_maneuver_cb
+ callback,
+ void *user_data)
+{
+ /* Check if the handle of the Segment is valid */
+ if (!segment)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ /* Check if this API feature available */
+ if (!__is_supported(segment, MAPS_ROUTE_SEGMENTS_MANEUVERS))
+ return MAPS_ERROR_NOT_SUPPORTED;
+
+ /* Check if parameters are valid */
+ if (!callback)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ return maps_item_list_foreach(((maps_route_segment_s *) segment)->
+ maneuvers, maps_route_maneuver_clone, callback, user_data);
+}
+
+int _maps_route_segment_is_data_supported(const maps_route_segment_h segment,
+ maps_service_data_e data,
+ bool *supported)
+{
+ if (!segment || !supported)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ if (!((maps_route_segment_s *) segment)->supported_data) {
+ /* This is a case when the "supported" flags are not set yet */
+ /* No need to limit access to fields */
+ *supported = true;
+ return MAPS_ERROR_NONE;
+ }
+
+ *supported = false;
+ string data_feature;
+ switch (data) {
+ case MAPS_ROUTE_SEGMENTS_PATH:
+ data_feature = _S(MAPS_ROUTE_SEGMENTS_PATH);
+ break;
+ case MAPS_ROUTE_SEGMENTS_MANEUVERS:
+ data_feature = _S(MAPS_ROUTE_SEGMENTS_MANEUVERS);
+ break;
+ default:
+ return MAPS_ERROR_NOT_SUPPORTED;
+ }
+ return maps_string_hashtable_contains(((maps_route_segment_s *)
+ segment)->supported_data, data_feature.c_str(),
+ supported);
+}
+
+/*----------------------------------------------------------------------------*/
+
+EXPORT_API int maps_route_segment_set_origin(maps_route_segment_h segment,
+ const maps_coordinates_h origin)
+{
+ if (!segment || !origin)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_route_segment_s *p = (maps_route_segment_s *) segment;
+ if (p->origin)
+ maps_coordinates_destroy(p->origin);
+ return maps_coordinates_clone(origin, &p->origin);
+}
+
+EXPORT_API int maps_route_segment_set_destination(maps_route_segment_h segment,
+ const maps_coordinates_h
+ destination)
+{
+ if (!segment || !destination)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_route_segment_s *p = (maps_route_segment_s *) segment;
+ if (p->destination)
+ maps_coordinates_destroy(p->destination);
+ return maps_coordinates_clone(destination, &p->destination);
+
+}
+
+EXPORT_API int maps_route_segment_set_bounding_box(maps_route_segment_h segment,
+ const maps_area_h
+ bounding_box)
+{
+ if (!segment || !bounding_box)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_route_segment_s *p = (maps_route_segment_s *) segment;
+ if (p->bounding_box)
+ maps_area_destroy(p->bounding_box);
+ return maps_area_clone(bounding_box, &p->bounding_box);
+}
+
+EXPORT_API int maps_route_segment_set_distance(maps_route_segment_h segment,
+ const double distance)
+{
+ if (!segment || distance < 0)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ ((maps_route_segment_s *) segment)->distance = distance;
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_route_segment_set_duration(maps_route_segment_h segment,
+ const long duration)
+{
+ if (!segment || duration < 0)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ ((maps_route_segment_s *) segment)->duration = duration;
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_route_segment_set_path(maps_route_segment_h segment,
+ const maps_item_list_h path)
+{
+ if (!segment || !path)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_route_segment_s *s = (maps_route_segment_s *) segment;
+ if (s->path) {
+ maps_item_list_remove_all(s->path, maps_coordinates_destroy);
+ maps_item_list_destroy(s->path);
+ }
+ maps_item_list_clone(path, maps_coordinates_clone, &s->path);
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_route_segment_set_maneuvers(maps_route_segment_h segment,
+ const maps_item_list_h
+ maneuvers)
+{
+ if (!segment || !maneuvers)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_route_segment_s *s = (maps_route_segment_s *) segment;
+ if (s->maneuvers) {
+ maps_item_list_remove_all(s->maneuvers,
+ maps_route_maneuver_destroy);
+ maps_item_list_destroy(s->maneuvers);
+ }
+ maps_item_list_clone(maneuvers, maps_route_maneuver_clone,
+ &s->maneuvers);
+ return MAPS_ERROR_NONE;
+}
+
+int _maps_route_segment_set_supported_data(maps_route_segment_h segment,
+ const maps_string_hashtable_h
+ supported_data)
+{
+
+ if (!segment || !supported_data)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ maps_route_segment_s *p = (maps_route_segment_s *) segment;
+ if (p->supported_data)
+ maps_string_hashtable_destroy(p->supported_data);
+ return maps_string_hashtable_clone(supported_data, &p->supported_data);
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_ROUTE_SEGMENT_PRIVATE_H__
+#define __MAPS_ROUTE_SEGMENT_PRIVATE_H__
+
+#include <maps_service.h>
+#include <maps_extra_types.h>
+
+/**
+ * @ingroup CAPI_MAPS_PLACE_MODULE
+ * @defgroup CAPI_MAPS_PLACE_DATA_MODULE Place
+ *
+ * @file maps_route_segment_private.h
+ * @brief This file contains the functions related to Place information.
+ *
+ * @addtogroup CAPI_MAPS_PLACE_DATA_MODULE
+ * @{
+ * @brief This provides APIs related to Place information, used in Place
+ * Discovery and Search.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @internal
+ * @brief Checks if a segment data feature is supported.
+ * @details This function checks if a segment data feature is supported.
+ * @since_tizen 2.4
+ *
+ * @param[in] segment The handle to segment
+ * @param[in] data The feature to be checked
+ * @param[out] supported Is the feature supported
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a segment is created using maps_route_segment_create().
+ *
+ * @see maps_route_segment_create()
+ */
+int _maps_route_segment_is_data_supported(const maps_route_segment_h segment,
+ maps_service_data_e data,
+ bool *supported);
+
+/**
+ * @internal
+ * @brief Sets the supported segment data features.
+ * @details This function sets the supported segment data features.
+ * @since_tizen 2.4
+ *
+ * @param[in] segment The handle to segment
+ * @param[in] supported_data The supported segment data features
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a segment is created using maps_route_segment_create().
+ *
+ * @see maps_route_segment_create()
+ */
+int _maps_route_segment_set_supported_data(maps_route_segment_h segment,
+ const maps_string_hashtable_h
+ supported_data);
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+#endif /* __MAPS_ROUTE_SEGMENT_PRIVATE_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 "maps_service.h"
+#include "maps_error.h"
+#include "maps_service.h"
+#include "maps_util.h"
+
+#include "command_queue.h"
+#include "commands.h"
+#include "discovery.h"
+#include "module.h"
+
+#include <privilege_checker.h>
+
+/*----------------------------------------------------------------------------*/
+/* Structure of maps_service */
+/* maps_service_s* is used as maps_service_h */
+typedef struct _maps_service_s
+{
+ maps_plugin_h plugin;
+} maps_service_s;
+
+const gsize _MAPS_PROVIDER_KEY_MAX_LENGTH = 1024;
+
+static session::command_queue *q()
+{
+ return session::command_queue::interface();
+}
+
+/* This function is used in command class */
+plugin::plugin_s *__extract_plugin(maps_service_h maps)
+{
+ if (!maps)
+ return NULL;
+ maps_service_s *maps_service = (maps_service_s *) maps;
+ return (plugin::plugin_s *) maps_service->plugin;
+}
+
+static bool __maps_provider_supported(maps_service_h maps,
+ maps_service_e service)
+{
+ if (!maps)
+ return false;
+ bool supported = false;
+ if (maps_service_provider_is_service_supported(maps, service,
+ &supported) != MAPS_ERROR_NONE)
+ return false;
+ return supported;
+}
+
+static bool __has_maps_service_privilege()
+{
+ return (privilege_checker_check_privilege(
+ "http://tizen.org/privilege/mapservice")
+ == PRIVILEGE_CHECKER_ERR_NONE);
+}
+
+/*----------------------------------------------------------------------------*/
+/* */
+/* Maps Service & Preference */
+
+EXPORT_API int maps_service_foreach_provider(maps_service_provider_info_cb
+ callback,
+ void *user_data)
+{
+ if (!callback)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ /* The list of map provider info, obtained by enumerating available
+ * plugins */
+ plugin::discovery pd;
+ vector < plugin::provider_info > v = pd.get_available_list();
+
+ /* Send obtained provider info to the user */
+ const int total = int(v.size());
+ for (int i = 0; i < total; i++) {
+ /* Get a plugin info handle from the array */
+ /* and send a callback with provider info to the user */
+ char *provider = g_strdup(v[i].provider.c_str());
+ if (!callback(provider, user_data))
+ break;
+ }
+
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_service_create(const char *maps_provider,
+ maps_service_h *maps)
+{
+ /* Check if parameters are valid */
+ if (!maps || !maps_provider)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ /* Check if privileges enough */
+ if (!__has_maps_service_privilege())
+ return MAPS_ERROR_PERMISSION_DENIED;
+
+ maps_error_e error = MAPS_ERROR_NOT_SUPPORTED;
+
+ do {
+ /* 0. Find the plugin, requested by the user */
+ const plugin::provider_info info =
+ plugin::find_by_names(string(maps_provider));
+
+ /* 1. Check whether provider info is valid */
+ if (info.empty()) {
+ MAPS_LOGE("ERROR! Provider info not found for name: %s",
+ maps_provider);
+ error = MAPS_ERROR_NOT_SUPPORTED;
+ break;
+ }
+
+ /* 2. Setup maps service handling structure */
+ maps_service_s *maps_service = g_slice_new0(maps_service_s);
+
+ if (maps_service == NULL) {
+ MAPS_LOGE("OUT_OF_MEMORY(0x%08x)",
+ MAPS_ERROR_OUT_OF_MEMORY);
+ error = MAPS_ERROR_OUT_OF_MEMORY;
+ break;
+ }
+
+ /* 3. Initialize the requested plugin */
+ maps_plugin_h plugin_h = plugin::binary_extractor().init(info);
+ if (!plugin_h) {
+ error = MAPS_ERROR_NOT_SUPPORTED;
+ MAPS_LOGE("ERROR! Plugin init failed");
+ break;
+ }
+
+ maps_service->plugin = plugin_h;
+
+ /* 4. Initialize an output pointer to maps service */
+ *maps = maps_service;
+
+ /* 5. Set status of completely correct plugin initialization */
+ error = MAPS_ERROR_NONE;
+
+ } while(false);
+
+ if (error != MAPS_ERROR_NONE)
+ maps_service_destroy(*maps);
+
+ return error;
+}
+
+EXPORT_API int maps_service_destroy(maps_service_h maps)
+{
+ /* Check if parameters are valid */
+ if (!maps)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ /* Check if privileges enough */
+ if (!__has_maps_service_privilege())
+ return MAPS_ERROR_PERMISSION_DENIED;
+
+ maps_service_s *maps_service = (maps_service_s *) maps;
+
+ if (maps_service->plugin)
+ plugin::binary_extractor().shutdown(maps_service->plugin);
+
+ g_slice_free(maps_service_s, maps);
+
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_service_set_provider_key(maps_service_h maps,
+ const char *provider_key)
+{
+ if (!maps || !provider_key)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ const plugin::plugin_s *p = __extract_plugin(maps);
+ if (!p)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return p->interface.maps_plugin_set_provider_key(provider_key);
+}
+
+EXPORT_API int maps_service_get_provider_key(const maps_service_h maps,
+ char **provider_key)
+{
+ if (!maps || !provider_key)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ const plugin::plugin_s *p = __extract_plugin(maps);
+ if (!p)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return p->interface.maps_plugin_get_provider_key(provider_key);
+}
+
+EXPORT_API int maps_service_set_preference(maps_service_h maps,
+ maps_string_hashtable_h preference)
+{
+ if (!maps || !preference)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ const plugin::plugin_s *p = __extract_plugin(maps);
+ if (!p)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return p->interface.maps_plugin_set_preference(preference);
+}
+
+EXPORT_API int maps_service_get_preference(maps_service_h maps,
+ maps_string_hashtable_h *preference)
+{
+ if (!maps || !preference)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ const plugin::plugin_s *p = __extract_plugin(maps);
+ if (!p)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return p->interface.maps_plugin_get_preference(preference);
+}
+
+EXPORT_API int maps_service_provider_is_service_supported(const maps_service_h
+ maps,
+ maps_service_e service,
+ bool *supported)
+{
+ if (!maps || !supported)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ if ((service < MAPS_SERVICE_GEOCODE)
+ || (service > MAPS_SERVICE_CANCEL_REQUEST))
+ return MAPS_ERROR_INVALID_PARAMETER;
+ const plugin::plugin_s *p = __extract_plugin(maps);
+ if (!p)
+ return MAPS_ERROR_NOT_SUPPORTED;
+ return p->interface.maps_plugin_is_service_supported(service,
+ supported);
+}
+
+EXPORT_API int maps_service_provider_is_data_supported(const maps_service_h
+ maps,
+ maps_service_data_e data,
+ bool *supported)
+{
+ if (!maps || !supported)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ if ((data < MAPS_PLACE_ADDRESS)
+ || (data > MAPS_ROUTE_SEGMENTS_MANEUVERS))
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ const plugin::plugin_s *p = __extract_plugin(maps);
+ if (!p)
+ return MAPS_ERROR_NOT_SUPPORTED;
+ return p->interface.maps_plugin_is_data_supported(data, supported);
+}
+
+/*----------------------------------------------------------------------------*/
+/* */
+/* Geocoder Service */
+
+EXPORT_API int maps_service_geocode(const maps_service_h maps,
+ const char *address,
+ const maps_preference_h preference,
+ maps_service_geocode_cb callback,
+ void *user_data,
+ int *request_id)
+{
+ /* Check if the handle of the Maps Service is valid */
+ if (!maps)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ /* Check if this API feature available */
+ if (!__maps_provider_supported(maps, MAPS_SERVICE_GEOCODE))
+ return MAPS_ERROR_NOT_SUPPORTED;
+
+ /* Check if parameters are valid */
+ if (!address || !callback || !request_id)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ /* Check if privileges enough */
+ if (!__has_maps_service_privilege())
+ return MAPS_ERROR_PERMISSION_DENIED;
+
+ return q()->push(new session::command_geocode(maps, address, preference,
+ callback, user_data, request_id));
+}
+
+EXPORT_API int maps_service_geocode_inside_area(const maps_service_h maps,
+ const char *address,
+ const maps_area_h bounds,
+ const maps_preference_h preference,
+ maps_service_geocode_cb callback,
+ void *user_data, int *request_id)
+{
+ /* Check if the handle of the Maps Service is valid */
+ if (!maps)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ /* Check if this API feature available */
+ if (!__maps_provider_supported(maps,
+ MAPS_SERVICE_GEOCODE_INSIDE_AREA))
+ return MAPS_ERROR_NOT_SUPPORTED;
+
+ /* Check if parameters are valid */
+ if (!address || !bounds || !callback || !request_id)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ /* Check if privileges enough */
+ if (!__has_maps_service_privilege())
+ return MAPS_ERROR_PERMISSION_DENIED;
+
+ return q()->push(new session::command_geocode_inside_bounds(maps,
+ address, bounds, preference, callback, user_data,
+ request_id));
+}
+
+EXPORT_API int maps_service_geocode_by_structured_address(const maps_service_h
+ maps,
+ const maps_address_h address,
+ const maps_preference_h preference,
+ maps_service_geocode_cb callback,
+ void *user_data, int *request_id)
+{
+ /* Check if the handle of the Maps Service is valid */
+ if (!maps)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ /* Check if this API feature available */
+ if (!__maps_provider_supported(maps,
+ MAPS_SERVICE_GEOCODE_BY_STRUCTURED_ADDRESS))
+ return MAPS_ERROR_NOT_SUPPORTED;
+
+ /* Check if parameters are valid */
+ if (!address || !callback || !request_id)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ /* Check if privileges enough */
+ if (!__has_maps_service_privilege())
+ return MAPS_ERROR_PERMISSION_DENIED;
+
+ return q()->
+ push(new session::command_geocode_by_structured_address(maps,
+ address, preference, callback, user_data, request_id));
+}
+
+EXPORT_API int maps_service_reverse_geocode(const maps_service_h maps,
+ double latitude, double longitude,
+ const maps_preference_h preference,
+ maps_service_reverse_geocode_cb
+ callback, void * user_data,
+ int *request_id)
+{
+ /* Check if the handle of the Maps Service is valid */
+ if (!maps)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ /* Check if this API feature available */
+ if (!__maps_provider_supported(maps, MAPS_SERVICE_REVERSE_GEOCODE))
+ return MAPS_ERROR_NOT_SUPPORTED;
+
+ /* Check if parameters are valid */
+ if (!callback || !request_id)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ if (latitude <= -90 && latitude >= 90)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ if (longitude <= -180 && longitude >= 180)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ /* Check if privileges enough */
+ if (!__has_maps_service_privilege())
+ return MAPS_ERROR_PERMISSION_DENIED;
+
+ return q()->push(new session::command_reverse_geocode(maps, latitude,
+ longitude, preference, callback, user_data,
+ request_id));
+}
+
+/*----------------------------------------------------------------------------*/
+/* */
+/* Place Service */
+
+EXPORT_API int maps_service_search_place(const maps_service_h maps,
+ const maps_coordinates_h position,
+ int distance,
+ const maps_place_filter_h filter,
+ maps_preference_h preference,
+ maps_service_search_place_cb callback,
+ void *user_data, int *request_id)
+{
+ /* Check if the handle of the Maps Service is valid */
+ if (!maps)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ /* Check if this API feature available */
+ if (!__maps_provider_supported(maps, MAPS_SERVICE_SEARCH_PLACE))
+ return MAPS_ERROR_NOT_SUPPORTED;
+
+ /* Check if parameters are valid */
+ if (!position || !filter || !callback || !request_id)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ /* Check if privileges enough */
+ if (!__has_maps_service_privilege())
+ return MAPS_ERROR_PERMISSION_DENIED;
+
+ return q()->push(new session::command_search_place(maps, position,
+ distance, preference, filter, callback, user_data,
+ request_id));
+}
+
+EXPORT_API int maps_service_search_place_by_area(const maps_service_h maps,
+ const maps_area_h boundary,
+ const maps_place_filter_h
+ filter,
+ maps_preference_h preference,
+ maps_service_search_place_cb
+ callback,
+ void *user_data,
+ int *request_id)
+{
+ /* Check if the handle of the Maps Service is valid */
+ if (!maps)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ /* Check if this API feature available */
+ if (!__maps_provider_supported(maps,
+ MAPS_SERVICE_SEARCH_PLACE_BY_AREA))
+ return MAPS_ERROR_NOT_SUPPORTED;
+
+ /* Check if parameters are valid */
+ if (!boundary || !filter || !callback || !request_id)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ /* Check if privileges enough */
+ if (!__has_maps_service_privilege())
+ return MAPS_ERROR_PERMISSION_DENIED;
+
+ return q()->push(new session::command_search_by_area_place(maps,
+ boundary, preference, filter, callback, user_data,
+ request_id));
+}
+
+EXPORT_API int maps_service_search_place_by_address(const maps_service_h maps,
+ const char *address,
+ const maps_area_h boundary,
+ const maps_place_filter_h
+ filter,
+ maps_preference_h
+ preference,
+ maps_service_search_place_cb
+ callback,
+ void *user_data,
+ int *request_id)
+{
+ /* Check if the handle of the Maps Service is valid */
+ if (!maps)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ /* Check if this API feature available */
+ if (!__maps_provider_supported(maps,
+ MAPS_SERVICE_SEARCH_PLACE_BY_ADDRESS))
+ return MAPS_ERROR_NOT_SUPPORTED;
+
+ /* Check if parameters are valid */
+ if (!address || !boundary || !filter || !callback || !request_id)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ /* Check if privileges enough */
+ if (!__has_maps_service_privilege())
+ return MAPS_ERROR_PERMISSION_DENIED;
+
+ return q()->push(new session::command_search_by_address_place(maps,
+ address, boundary, preference, filter, callback,
+ user_data, request_id));
+}
+
+/*----------------------------------------------------------------------------*/
+/* */
+/* Route Service */
+
+EXPORT_API int maps_service_search_route(const maps_service_h maps,
+ const maps_coordinates_h origin,
+ const maps_coordinates_h destination,
+ maps_preference_h preference,
+ maps_service_search_route_cb callback,
+ void *user_data, int *request_id)
+{
+ /* Check if the handle of the Maps Service is valid */
+ if (!maps)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ /* Check if this API feature available */
+ if (!__maps_provider_supported(maps, MAPS_SERVICE_SEARCH_ROUTE))
+ return MAPS_ERROR_NOT_SUPPORTED;
+
+ /* Check if parameters are valid */
+ if (!origin || !destination || !callback || !request_id)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ /* Check if privileges enough */
+ if (!__has_maps_service_privilege())
+ return MAPS_ERROR_PERMISSION_DENIED;
+
+ return q()->push(new session::command_search_route(maps, preference,
+ origin, destination, callback, user_data, request_id));
+}
+
+EXPORT_API int maps_service_search_route_waypoints(const maps_service_h maps,
+ const maps_coordinates_h *
+ waypoint_list,
+ int waypoint_num,
+ maps_preference_h preference,
+ maps_service_search_route_cb
+ callback,
+ void *user_data,
+ int *request_id)
+{
+ /* Check if the handle of the Maps Service is valid */
+ if (!maps)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ /* Check if this API feature available */
+ if (!__maps_provider_supported(maps,
+ MAPS_SERVICE_SEARCH_ROUTE_WAYPOINTS))
+ return MAPS_ERROR_NOT_SUPPORTED;
+
+ /* Check if parameters are valid */
+ if (!waypoint_list || (waypoint_num < 2) || !callback || !request_id)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ /* Check if privileges enough */
+ if (!__has_maps_service_privilege())
+ return MAPS_ERROR_PERMISSION_DENIED;
+
+ return q()->push(new session::command_search_route_waypoints(maps,
+ preference, waypoint_list, waypoint_num, callback,
+ user_data, request_id));
+}
+
+/*----------------------------------------------------------------------------*/
+/* */
+/* Cancel Service Request */
+
+EXPORT_API int maps_service_cancel_request(const maps_service_h maps,
+ int request_id)
+{
+ /* Check if the handle of the Maps Service is valid */
+ if (!maps)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ /* Check if this API feature available */
+ if (!__maps_provider_supported(maps, MAPS_SERVICE_CANCEL_REQUEST))
+ return MAPS_ERROR_NOT_SUPPORTED;
+
+ /* Check if parameters are valid */
+ if (request_id < 0)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ /* Check if privileges enough */
+ if (!__has_maps_service_privilege())
+ return MAPS_ERROR_PERMISSION_DENIED;
+
+ return q()->push(new session::command_cancel_request(maps, request_id));
+}
--- /dev/null
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * 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 "maps_util.h"
+#include "maps_error.h"
+#include <glib.h>
+
+int maps_set_string(const char *src, const int max_length, char **dst)
+{
+ if (!dst || !src || (max_length <= 0))
+ return MAPS_ERROR_INVALID_PARAMETER;
+ if (*dst)
+ g_free(*dst);
+ *dst = g_strndup(src, max_length);
+ return MAPS_ERROR_NONE;
+}
+
+int maps_get_string(const char *src, const int max_length, char **dst)
+{
+ if (!dst || !src || (max_length <= 0))
+ return MAPS_ERROR_INVALID_PARAMETER;
+ *dst = g_strndup(src, max_length);
+ return MAPS_ERROR_NONE;
+}
\ No newline at end of file
--- /dev/null
+/* Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_UTIL_H__
+#define __MAPS_UTIL_H__
+
+#include <dlog.h>
+#include <glib.h>
+
+/*#include "stdio.h"
+
+#ifndef EXPORT_API
+#define EXPORT_API __attribute__((__visibility__("default")))
+#endif*/
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "CAPI_MAPS_SERVICE"
+
+/*
+* Internal Macros
+*/
+#define MAPS_LOGD(fmt,args...) LOGD(fmt, ##args)
+#define MAPS_LOGW(fmt,args...) LOGW(fmt, ##args)
+#define MAPS_LOGI(fmt,args...) LOGI(fmt, ##args)
+#define MAPS_LOGE(fmt,args...) LOGE(fmt, ##args)
+#define MAPS_SECLOG(fmt,args...) SECURE_LOGD(fmt, ##args)
+
+#define MAPS_CHECK_CONDITION(condition, error, msg) \
+ do { \
+ if (condition) { \
+ } else { \
+ MAPS_LOGE("%s(0x%08x)", msg, error); \
+ return error; \
+ } \
+ } while (0)
+
+#define MAPS_NULL_ARG_CHECK_RETURN_FALSE(arg)\
+ do { \
+ if(arg != NULL) { \
+ } else { \
+ MAPS_LOGE("MAPS_ERROR_INVALID_PARAMETER"); \
+ return false; }; \
+ } while (0)
+
+#define MAPS_NULL_ARG_CHECK(arg) \
+ MAPS_CHECK_CONDITION(arg != NULL,MAPS_ERROR_INVALID_PARAMETER,"MAPS_ERROR_INVALID_PARAMETER")
+
+#define MAPS_PRINT_ERROR_CODE_RETURN(code) \
+ do{ \
+ MAPS_LOGE("%s(0x%08x)", #code, code); \
+ return code; \
+ } while (0)
+
+/*----------------------------------------------------------------------------*/
+
+#define _S(s) #s
+
+/*
+ * @brief Copies one string to another and releases receiver if needed.
+ * @details This function copies one string to another and releases receiver if
+ * needed.
+ * @since_tizen 2.4
+ *
+ * @param[out] dst The destination string pointer.
+ * @param[in] src The original string pointer.
+ * @param[in] max_length The maximum size of bytes to be copied.
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_set_string(const char *src, const int max_length, char **dst);
+
+/*
+ * @brief Copies one string to another.
+ * @details This function copies one string to another.
+ * @since_tizen 2.4
+ *
+ * @param[out] dst The destination string pointer.
+ * @param[in] src The original string pointer.
+ * @param[in] max_length The maximum size of bytes to be copied.
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int maps_get_string(const char *src, const int max_length, char **dst);
+
+/* Prevent utility highlights defects in std::vector and std::string, so
+* simplified versions of that classes are implemented */
+template <class T> class vector {
+private:
+ GArray *parray;
+ unsigned int current_size;
+public:
+ vector() : parray(NULL), current_size(0)
+ {
+ parray = g_array_new(false, false, sizeof(T *));
+ }
+ ~vector()
+ {
+ /*if (!parray || (current_size == 0))*/
+ if (!parray)
+ return;
+ for (unsigned int i = 0; i < current_size; i++) {
+ T *item = g_array_index(parray, T *, i);
+ if (item)
+ delete item;
+ }
+ g_array_free(parray, TRUE);
+ parray = NULL;
+ current_size = 0;
+ }
+public:
+ void push_back(const T &value)
+ {
+ T *clone = new T(value);
+ g_array_append_val(parray, clone);
+ current_size++;
+ }
+ T &operator[](size_t idx) const
+ {
+ T *item = g_array_index(parray, T *, idx);
+ return *item;
+ }
+ unsigned int size() const
+ {
+ return current_size;
+ }
+};
+
+class string
+{
+private:
+ char *pstring;
+public:
+ string() : pstring(NULL)
+ {
+ }
+ string(const char *pstr) : pstring(NULL)
+ {
+ pstring = g_strdup(pstr);
+ }
+ string(const string &s) : pstring(NULL)
+ {
+ pstring = g_strdup(s.pstring);
+ }
+ ~string()
+ {
+ g_free(pstring);
+ pstring = NULL;
+ }
+public:
+ string &operator=(const string &s)
+ {
+ if (this != &s) {
+ g_free(pstring);
+ pstring = g_strdup(s.pstring);
+ }
+ return* this;
+ }
+ bool operator==(const string &s) const
+ {
+ return g_strcmp0(pstring, s.pstring) == 0;
+ }
+ bool operator!=(const string &s) const
+ {
+ return !(*this == s);
+ }
+public:
+ char *c_str() const
+ {
+ return pstring;
+ }
+ bool empty() const
+ {
+ return !pstring || (*this == string(""));
+ }
+};
+
+#endif /* __MAPS_UTIL_H__ */
--- /dev/null
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * 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 "discovery.h"
+#include "module.h"
+#include "maps_util.h"
+#include <algorithm>
+#include <glib.h>
+
+
+const char *MAPS_PLUGINS_PATH_PREFIX = "/usr/lib/maps/plugins";
+
+plugin::provider_info plugin::provider_info::empty_instance;
+
+plugin::provider_info::provider_info()
+{
+}
+
+plugin::provider_info::provider_info(const string &p, const string &f)
+: provider(p)
+, file(f)
+{
+}
+
+plugin::provider_info::provider_info(const provider_info &src)
+{
+ *this = src;
+}
+
+plugin::provider_info &plugin::provider_info::operator=(const
+ provider_info &src)
+{
+ if (this != &src) {
+ provider = src.provider;
+ file = src.file;
+ }
+ return* this;
+}
+
+void plugin::provider_info::construct(const string &p, const string &f)
+{
+ provider = p;
+ file = f;
+}
+
+bool plugin::provider_info::empty() const
+{
+ if (!provider.empty())
+ return false;
+ if (!file.empty())
+ return false;
+ return true;
+}
+
+plugin::discovery::discovery()
+{
+}
+
+plugin::discovery::~discovery()
+{
+}
+
+vector<plugin::provider_info> plugin::discovery::get_available_list() const
+{
+ vector <provider_info> v;
+ binary_extractor be;
+
+ /* Enumerate all available plugin binaries */
+ const vector <string> l = get_module_file_list();
+ for (int i = 0; i < int(l.size()); i++) {
+ /* Request the next plugin binary to get provider info */
+ const provider_info info = be.get_plugin_info(l[i]);
+ if (info.empty())
+ continue;
+
+ /* Add provider info to the resulting list */
+ v.push_back(info);
+ }
+
+ return v;
+}
+
+vector<string> plugin::discovery::get_module_file_list() const
+{
+ vector<string> l;
+
+ GDir *dir = NULL;
+ GError *error = NULL;
+ const gchar *filename = NULL;
+
+ MAPS_LOGD("START PLUGIN FILES DISCOVERY:");
+ dir = g_dir_open(MAPS_PLUGINS_PATH_PREFIX, 0, &error);
+ if (dir) {
+
+ GPatternSpec *plugin_name_pattern = g_pattern_spec_new("*?.so");
+
+ while ((filename = g_dir_read_name(dir))) {
+ MAPS_LOGD("found plugin binary: %s", filename);
+ if (g_pattern_match_string(plugin_name_pattern,
+ filename)) {
+ MAPS_LOGD("\tadded plugin binary: %s",
+ filename);
+ l.push_back(string(filename));
+ }
+ }
+
+ g_pattern_spec_free(plugin_name_pattern);
+
+ g_dir_close(dir);
+ }
+ else if (error) {
+ MAPS_LOGE("%d: Can not open directory: %s\n", error->code,
+ error->message); /* g_error */
+ }
+
+ return l;
+}
+
+plugin::provider_info plugin::find_by_names(const string &provider)
+{
+ const vector<provider_info> v = discovery().get_available_list();
+ for (int i = 0; i < int (v.size()); i++)
+ if (v[i].provider == provider)
+ return v[i];
+
+ return provider_info::empty_instance;
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_SERVICE_PLUGIN_DISCOVERY_H__
+#define __MAPS_SERVICE_PLUGIN_DISCOVERY_H__
+
+#include "maps_service.h"
+#include "maps_util.h"
+
+namespace plugin
+{
+
+ class provider_info
+ {
+ public:
+ string provider;
+ string file;
+ public:
+ static provider_info empty_instance;
+ public:
+ provider_info();
+ provider_info(const string &provider, const string &file);
+ provider_info(const provider_info &src);
+ virtual ~provider_info()
+ {
+ };
+ public:
+ provider_info & operator=(const provider_info &src);
+ /* operator maps_provider_info_h() const; */
+ public:
+ void construct(const string &provider, const string &file);
+ bool empty() const;
+ };
+
+ class discovery
+ {
+ public:
+ discovery();
+ virtual ~discovery();
+ public:
+ vector<provider_info> get_available_list() const;
+ private:
+ vector<string> get_module_file_list() const;
+ };
+
+ provider_info find_by_names(const string &provider);
+}
+
+#endif /* __MAPS_SERVICE_PLUGIN_DISCOVERY_H__ */
\ No newline at end of file
--- /dev/null
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * 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 "discovery.h"
+#include "empty_module.h"
+
+
+/* Set of empty functions */
+
+/* Plugin dedicated functions */
+int maps_plugin_init_empty(maps_plugin_h *plugin)
+{
+ return 0;
+}
+
+int maps_plugin_shutdown_empty(maps_plugin_h plugin)
+{
+ return 0;
+}
+
+int maps_plugin_get_info_empty(maps_plugin_info_h *info)
+{
+ return 0;
+}
+
+/* Maps Provider access key, preference and capabilities */
+int maps_plugin_set_provider_key_empty(const char *provider_key)
+{
+ return 0;
+}
+
+int maps_plugin_get_provider_key_empty(char **provider_key)
+{
+ return 0;
+}
+
+int maps_plugin_set_preference_empty(maps_preference_h preference)
+{
+ return 0;
+}
+
+int maps_plugin_get_preference_empty(maps_preference_h *preference)
+{
+ return 0;
+}
+
+int maps_plugin_is_service_supported_empty(maps_service_e service,
+ bool *supported)
+{
+ return 0;
+}
+
+int maps_plugin_is_data_supported_empty(maps_service_data_e data,
+ bool *supported)
+{
+ return 0;
+}
+
+/* Geocode */
+int maps_plugin_geocode_empty(const char *address,
+ const maps_preference_h preference,
+ const maps_service_geocode_cb callback,
+ void *user_data, int *request_id)
+{
+ return 0;
+}
+
+int maps_plugin_geocode_inside_area_empty(const char *address,
+ const maps_area_h bounds,
+ const maps_preference_h preference,
+ maps_service_geocode_cb callback,
+ void *user_data, int *request_id)
+{
+ return 0;
+}
+
+int maps_plugin_geocode_by_structured_address_empty(const maps_address_h
+ address,
+ const maps_preference_h
+ preference,
+ maps_service_geocode_cb
+ callback, void *user_data,
+ int *request_id)
+{
+ return 0;
+}
+
+int maps_plugin_reverse_geocode_empty(double latitude, double longitude,
+ const maps_preference_h preference,
+ maps_service_reverse_geocode_cb
+ callback, void *user_data,
+ int *request_id)
+{
+ return 0;
+}
+
+/* Place */
+int maps_plugin_search_place_empty(const maps_coordinates_h position,
+ int distance,
+ const maps_place_filter_h filter,
+ maps_preference_h preference,
+ maps_service_search_place_cb callback,
+ void *user_data, int *request_id)
+{
+ return 0;
+}
+
+int maps_plugin_search_place_by_area_empty(const maps_area_h boundary,
+ const maps_place_filter_h filter,
+ maps_preference_h preference,
+ maps_service_search_place_cb
+ callback, void *user_data,
+ int *request_id)
+{
+ return 0;
+}
+
+int maps_plugin_search_place_by_address_empty(const char *address,
+ const maps_area_h boundary,
+ const maps_place_filter_h filter,
+ maps_preference_h preference,
+ maps_service_search_place_cb
+ callback, void *user_data,
+ int *request_id)
+{
+ return 0;
+}
+
+/* Route */
+int maps_plugin_search_route_empty(const maps_coordinates_h origin,
+ const maps_coordinates_h destination,
+ maps_preference_h preference,
+ maps_service_search_route_cb callback,
+ void *user_data, int *request_id)
+{
+ return 0;
+}
+
+int maps_plugin_search_route_waypoints_empty(const maps_coordinates_h *
+ waypoint_list, int waypoint_num,
+ maps_preference_h preference,
+ maps_service_search_route_cb
+ callback, void *user_data,
+ int *request_id)
+{
+ return 0;
+}
+
+/* Cancel Request */
+int maps_plugin_cancel_request_empty(int request_id)
+{
+ return 0;
+}
+
+
+/* Interface of a plugin with all empty functions */
+plugin::interface_s empty_interface = {
+ /* Plugin dedicated functions */
+ maps_plugin_init_empty,
+ maps_plugin_shutdown_empty,
+ maps_plugin_get_info_empty,
+
+ maps_plugin_set_provider_key_empty,
+ maps_plugin_get_provider_key_empty,
+ maps_plugin_set_preference_empty,
+ maps_plugin_get_preference_empty,
+ maps_plugin_is_service_supported_empty,
+ maps_plugin_is_data_supported_empty,
+
+ /* Geocode */
+ maps_plugin_geocode_empty,
+ maps_plugin_geocode_inside_area_empty,
+ maps_plugin_geocode_by_structured_address_empty,
+ maps_plugin_reverse_geocode_empty,
+
+ /* Place */
+ maps_plugin_search_place_empty,
+ maps_plugin_search_place_by_area_empty,
+ maps_plugin_search_place_by_address_empty,
+
+ /* Route */
+ maps_plugin_search_route_empty,
+ maps_plugin_search_route_waypoints_empty,
+
+ /* Cancel Request */
+ maps_plugin_cancel_request_empty,
+};
+
+
+plugin::interface_s &plugin::get_empty_interface()
+{
+ return empty_interface;
+}
+
+plugin::interface_s *plugin::get_empty_interface_ptr()
+{
+ return &empty_interface;
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_SERVICE_PLUGIN_EMPTY_MODULE_H__
+#define __MAPS_SERVICE_PLUGIN_EMPTY_MODULE_H__
+
+#include "module.h"
+
+namespace plugin
+{
+ interface_s &get_empty_interface();
+ interface_s *get_empty_interface_ptr();
+};
+
+#endif /* __MAPS_SERVICE_PLUGIN_EMPTY_MODULE_H__ */
\ No newline at end of file
--- /dev/null
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * 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 "module.h"
+#include "maps_util.h"
+#include <glib/gstdio.h>
+#include "thread.h"
+#include "command.h"
+#include "command_queue.h"
+#include "empty_module.h"
+
+extern const char *MAPS_PLUGINS_PATH_PREFIX;
+
+ plugin::scope_mutex::scope_mutex(GMutex *m) : mutex(m)
+{
+ g_mutex_lock(mutex);
+}
+
+plugin::scope_mutex::~scope_mutex()
+{
+ g_mutex_unlock(mutex);
+}
+
+plugin::binary_extractor::binary_extractor()
+{
+}
+
+plugin::provider_info plugin::binary_extractor::get_plugin_info(const
+ string &file_name) const
+{
+
+ if (file_name.empty())
+ return provider_info::empty_instance;
+
+ /* 1.Init plugin */
+ GMod *plugin = gmod_new(file_name, FALSE);
+ if (!plugin)
+ return provider_info::empty_instance;
+
+ provider_info info;
+
+ /* 2. Get plugin info */
+ maps_plugin_get_info_f func =
+ (maps_plugin_get_info_f) gmod_find_sym(plugin,
+ "maps_plugin_get_info");
+ if (func) {
+ maps_plugin_info_h i;
+ if (func(&i) == MAPS_ERROR_NONE) {
+ char *provider_name = NULL;
+ maps_plugin_info_get_provider_name(i, &provider_name);
+
+ /* Convert plugin info to provider info */
+ info.construct(string(provider_name), file_name);
+
+ g_free(provider_name);
+ }
+ maps_plugin_info_destroy(i);
+ }
+
+ /* 3. shutdown plugin */
+ gmod_free(plugin);
+
+ return info;
+}
+
+maps_plugin_h plugin::binary_extractor::init(const provider_info &info)
+{
+ /* 1.Init plugin */
+ if (info.file.empty())
+ return NULL;
+
+ GMod *plugin = gmod_new(info.file, TRUE);
+ if (!plugin) {
+ MAPS_LOGE("Open Module Failed: %s", info.file.c_str());
+ gmod_free(plugin);
+ return NULL;
+ }
+
+ /* 2.1 Create new plugin interface */
+ plugin_s* new_plugin = g_slice_new0(plugin_s);
+
+ /* 2. Perform steps to completely initialize a plugin */
+ do {
+
+ if (!new_plugin) {
+ MAPS_LOGE("OUT_OF_MEMORY(0x%08x)",
+ MAPS_ERROR_OUT_OF_MEMORY);
+ break;
+ }
+
+ /* 2.1 Set plugin module handle */
+ new_plugin->module = plugin;
+
+ /* 2.2 Set plugin interface */
+ new_plugin->interface = get_empty_interface();
+
+ /* Plugin dedicated functions */
+ new_plugin->interface.maps_plugin_init =
+ (maps_plugin_init_f) gmod_find_sym(plugin,
+ "maps_plugin_init");
+ new_plugin->interface.maps_plugin_shutdown =
+ (maps_plugin_shutdown_f) gmod_find_sym(plugin,
+ "maps_plugin_shutdown");
+ new_plugin->interface.maps_plugin_get_info =
+ (maps_plugin_get_info_f) gmod_find_sym(plugin,
+ "maps_plugin_get_info");
+
+ /* Maps Provider access key, preference and capabilities */
+ new_plugin->interface.maps_plugin_set_provider_key =
+ (maps_plugin_set_provider_key_f) gmod_find_sym(plugin,
+ "maps_plugin_set_provider_key");
+ new_plugin->interface.maps_plugin_get_provider_key =
+ (maps_plugin_get_provider_key_f) gmod_find_sym(plugin,
+ "maps_plugin_get_provider_key");
+ new_plugin->interface.maps_plugin_set_preference =
+ (maps_plugin_set_preference_f) gmod_find_sym(plugin,
+ "maps_plugin_set_preference");
+ new_plugin->interface.maps_plugin_get_preference =
+ (maps_plugin_get_preference_f) gmod_find_sym(plugin,
+ "maps_plugin_get_preference");
+ new_plugin->interface.maps_plugin_is_service_supported =
+ (maps_plugin_is_service_supported_f)
+ gmod_find_sym(plugin,
+ "maps_plugin_is_service_supported");
+ new_plugin->interface.maps_plugin_is_data_supported =
+ (maps_plugin_is_data_supported_f) gmod_find_sym(plugin,
+ "maps_plugin_is_data_supported");
+
+ /* Geocode */
+ new_plugin->interface.maps_plugin_geocode =
+ (maps_plugin_geocode_f) gmod_find_sym(plugin,
+ "maps_plugin_geocode");
+ new_plugin->interface.maps_plugin_geocode_inside_area =
+ (maps_plugin_geocode_inside_area_f)
+ gmod_find_sym(plugin,
+ "maps_plugin_geocode_inside_area");
+ new_plugin->interface.
+ maps_plugin_geocode_by_structured_address =
+ (maps_plugin_geocode_by_structured_address_f)
+ gmod_find_sym(plugin,
+ "maps_plugin_geocode_by_structured_address");
+ new_plugin->interface.maps_plugin_reverse_geocode =
+ (maps_plugin_reverse_geocode_f) gmod_find_sym(plugin,
+ "maps_plugin_reverse_geocode");
+
+ /* Place */
+ new_plugin->interface.maps_plugin_search_place =
+ (maps_plugin_search_place_f) gmod_find_sym(plugin,
+ "maps_plugin_search_place");
+ new_plugin->interface.maps_plugin_search_place_by_area =
+ (maps_plugin_search_place_by_area_f)
+ gmod_find_sym(plugin,
+ "maps_plugin_search_place_by_area");
+ new_plugin->interface.maps_plugin_search_place_by_address =
+ (maps_plugin_search_place_by_address_f)
+ gmod_find_sym(plugin,
+ "maps_plugin_search_place_by_address");
+
+ /* Route */
+ new_plugin->interface.maps_plugin_search_route =
+ (maps_plugin_search_route_f) gmod_find_sym(plugin,
+ "maps_plugin_search_route");
+ new_plugin->interface.maps_plugin_search_route_waypoints =
+ (maps_plugin_search_route_waypoints_f)
+ gmod_find_sym(plugin,
+ "maps_plugin_search_route_waypoints");
+
+ /* Cancel Request */
+ new_plugin->interface.maps_plugin_cancel_request =
+ (maps_plugin_cancel_request_f) gmod_find_sym(plugin,
+ "maps_plugin_cancel_request");
+
+ /* 2.3 Check whether the plugin init function is valid */
+ if (!new_plugin->interface.maps_plugin_init) {
+ MAPS_LOGE(
+ "ERROR! Plugin initialization function is invalid");
+ break;
+ }
+
+ /* 2.4 Call a plugin to initialize itself, send to the plugin
+ * its pointer */
+ int ret =
+ new_plugin->interface.
+ maps_plugin_init((maps_plugin_h *) (&new_plugin));
+ if (ret != MAPS_ERROR_NONE) {
+ MAPS_LOGE(
+ "ERROR! Plugin initialization function ""failed: %d",
+ ret);
+ break;
+ }
+
+ if (!new_plugin->interface.maps_plugin_set_provider_key) {
+ MAPS_LOGE(
+ "ERROR! Plugin set_provider_key function is NULL: %d",
+ ret);
+ break;
+ }
+
+ if (!new_plugin->interface.maps_plugin_get_provider_key) {
+ MAPS_LOGE(
+ "ERROR! Plugin set_provider_key function is NULL: %d",
+ ret);
+ break;
+ }
+
+ if (!new_plugin->interface.maps_plugin_set_preference) {
+ MAPS_LOGE(
+ "ERROR! Plugin set_preference function is NULL: %d",
+ ret);
+ break;
+ }
+
+ if (!new_plugin->interface.maps_plugin_get_preference) {
+ MAPS_LOGE(
+ "ERROR! Plugin get_preference function is NULL: %d",
+ ret);
+ break;
+ }
+
+ if (!new_plugin->interface.maps_plugin_is_data_supported) {
+ MAPS_LOGE(
+ "ERROR! Plugin support_is_data_supported function is NULL: %d",
+ ret);
+ break;
+ }
+
+ if (!new_plugin->interface.maps_plugin_is_service_supported) {
+ MAPS_LOGE(
+ "ERROR! Plugin support_is_service_supported function is NULL: %d",
+ ret);
+ break;
+ }
+
+ /* 2.7 Create a queue with asynchronous requests to plugin */
+ if (session::command_queue::is_async())
+ new_plugin->request_queue = g_async_queue_new();
+
+ /* 2.8 Initialize the mutex for the map of pending requests */
+ new_plugin->pending_request_maps =
+ g_hash_table_new_full(g_int_hash, g_int_equal, g_free,
+ session::command_handler::destroy);
+ if (!new_plugin->pending_request_maps) {
+ MAPS_LOGE("OUT_OF_MEMORY(0x%08x)",
+ MAPS_ERROR_OUT_OF_MEMORY);
+ break;
+ }
+ g_mutex_init(&new_plugin->pending_request_mutex);
+
+ /* DEBUG TRACE */
+ trace_dbg(new_plugin);
+
+ /* 2.5 Return newly initialized plugin */
+ return new_plugin;
+
+ } while (FALSE);
+
+ MAPS_LOGE("Shut down the plugin becuause of error");
+
+ /* 3. shutdown plugin in case of problem */
+ shutdown(new_plugin);
+ return NULL;
+}
+
+void plugin::binary_extractor::shutdown(maps_plugin_h plugin_h)
+{
+ if (!plugin_h)
+ return;
+
+ plugin_s *plugin = (plugin_s *) plugin_h;
+ g_return_if_fail(plugin->module);
+
+ /* 0. shutdown plugin */
+ if (plugin->interface.maps_plugin_shutdown)
+ plugin->interface.maps_plugin_shutdown(plugin);
+
+ /* 1. Stop the thread, processing the request queue */
+ session::thread().stop(plugin);
+
+ /* 2. Destroy the request queue */
+ if (plugin->request_queue)
+ g_async_queue_unref(plugin->request_queue);
+
+ /* 3. Destroy the map of pending requests */
+ if (plugin->pending_request_maps) {
+ g_hash_table_unref(plugin->pending_request_maps);
+
+ /* Clear the mutex for the map of pending requests */
+ g_mutex_clear(&plugin->pending_request_mutex);
+ }
+
+ /* 4. Unload plugin from memory */
+ gmod_free((GMod *) plugin->module);
+
+ /* 5. Destroying the table with plugin capabilities */
+ /*maps_string_hashtable_destroy(plugin->capabilities); */
+
+ /* 6. Release memory used by plugin structure */
+ g_slice_free(plugin_s, plugin);
+}
+
+/* Open the binary (which contains a plugin) */
+plugin::GMod *plugin::binary_extractor::gmod_new(const string &module_file,
+ gboolean is_resident) const
+{
+
+ if (!g_module_supported()) {
+ MAPS_LOGE("ERROR! g_module_supported is false\n\n");
+ return NULL;
+ }
+
+ if (module_file.empty())
+ return NULL;
+
+ GMod *gmod = g_new0(GMod, 1);
+
+ gmod->name = g_strdup(module_file.c_str());
+ if (!gmod->name) {
+ g_free(gmod);
+ return NULL;
+ }
+
+ /*gmod->path = g_module_build_path(MAPS_PLUGINS_PATH_PREFIX,
+ * gmod->name); */
+ gmod->path = g_strnfill(100, 0);
+ g_sprintf(gmod->path, "%s/%s", MAPS_PLUGINS_PATH_PREFIX, gmod->name);
+ if (!gmod->path) {
+ g_free(gmod->name);
+ g_free(gmod);
+ return NULL;
+ }
+
+ gmod->module = g_module_open(gmod->path, G_MODULE_BIND_LAZY);
+ if (!gmod->module) {
+ MAPS_LOGE("module path not found: %s", gmod->path);
+
+ const gchar *last_error = g_module_error();
+ MAPS_LOGE("last module error: %s", last_error);
+
+ g_free(gmod->name);
+ g_free(gmod->path);
+ g_free(gmod);
+ return NULL;
+ }
+ MAPS_LOGD("open module");
+ /*if (is_resident)
+ g_module_make_resident(gmod->module);*/
+
+ return gmod;
+}
+
+/* Close the binary (which contains a plugin) */
+void plugin::binary_extractor::gmod_free(GMod *gmod) const
+{
+ /*g_return_if_fail(gmod); */
+ if (!gmod)
+ return;
+
+ if (gmod->name)
+ g_free(gmod->name);
+ if (gmod->path)
+ g_free(gmod->path);
+ if (gmod->module)
+ g_module_close(gmod->module);
+ g_free(gmod);
+
+ MAPS_LOGD("close module");
+ MAPS_LOGD("last module error: %s", g_module_error());
+}
+
+/* Find the address of a function in a binary (which contains a plugin) */
+gpointer plugin::binary_extractor::gmod_find_sym(GMod *gmod,
+ const gchar *func_name) const
+{
+ g_return_val_if_fail(gmod, NULL);
+ g_return_val_if_fail(func_name, NULL);
+
+ gpointer func_ptr = NULL;
+ if (!g_module_symbol(gmod->module, func_name, &func_ptr)) {
+ MAPS_LOGE("function symbol not found");
+ MAPS_LOGE("%s", g_module_error());
+ func_ptr = NULL;
+ }
+ return func_ptr;
+}
+
+void plugin::binary_extractor::trace_dbg(const plugin_s *plugin) const
+{
+
+ MAPS_LOGD("*********************************************");
+ MAPS_LOGD("PLUGIN INFO");
+ if (!plugin) {
+ MAPS_LOGD("PLUGIN is NULL");
+ MAPS_LOGD("*********************************************");
+ return;
+ }
+
+ const GMod *mod = (const GMod *) plugin->module;
+ if (!mod) {
+ MAPS_LOGD("PLUGIN module is NULL");
+ }
+ else {
+ MAPS_LOGD("module address:\t\t\t%p", mod->module);
+ MAPS_LOGD("module name:\t\t\t%s", mod->name);
+ MAPS_LOGD("module path:\t\t\t%s", mod->path);
+ }
+
+ if (!plugin->request_queue) {
+ MAPS_LOGD("PLUGIN request queue is NULL");
+ }
+ else {
+ MAPS_LOGD("plugin request queue:\t\t\t%p",
+ plugin->request_queue);
+ }
+
+ const interface_s *itf = &plugin->interface;
+ MAPS_LOGD("maps_plugin_init:\t\t\t%p", itf->maps_plugin_init);
+ MAPS_LOGD("maps_plugin_shutdown:\t\t\t%p", itf->maps_plugin_shutdown);
+ MAPS_LOGD("maps_plugin_get_info:\t\t\t%p", itf->maps_plugin_get_info);
+
+ /* Maps Provider access key */
+ MAPS_LOGD("maps_plugin_set_provider_key:\t\t%p",
+ itf->maps_plugin_set_provider_key);
+ MAPS_LOGD("maps_plugin_get_provider_key:\t\t%p",
+ itf->maps_plugin_get_provider_key);
+ MAPS_LOGD("maps_plugin_is_service_supported:\t%p",
+ itf->maps_plugin_is_service_supported);
+ MAPS_LOGD("maps_plugin_is_data_supported:\t\t%p",
+ itf->maps_plugin_is_data_supported);
+
+ MAPS_LOGD("maps_plugin_geocode:\t\t\t%p", itf->maps_plugin_geocode);
+ MAPS_LOGD("maps_plugin_geocode_inside_area:\t%p",
+ itf->maps_plugin_geocode_inside_area);
+ MAPS_LOGD("maps_plugin_geocode_by_structured_address: %p",
+ itf->maps_plugin_geocode_by_structured_address);
+ MAPS_LOGD("maps_plugin_reverse_geocode:\t\t%p",
+ itf->maps_plugin_reverse_geocode);
+
+ MAPS_LOGD("maps_plugin_search_place:\t\t%p",
+ itf->maps_plugin_search_place);
+ MAPS_LOGD("maps_plugin_search_place_by_area:\t%p",
+ itf->maps_plugin_search_place_by_area);
+ MAPS_LOGD("maps_plugin_search_place_by_address:\t%p",
+ itf->maps_plugin_search_place_by_address);
+
+ MAPS_LOGD("maps_plugin_search_route:\t\t%p",
+ itf->maps_plugin_search_route);
+ MAPS_LOGD("maps_plugin_search_route_waypoints:\t%p",
+ itf->maps_plugin_search_route_waypoints);
+
+ MAPS_LOGD("maps_plugin_cancel_request:\t\t%p",
+ itf->maps_plugin_cancel_request);
+ MAPS_LOGD("*********************************************");
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_SERVICE_PLUGIN_MODULE_H__
+#define __MAPS_SERVICE_PLUGIN_MODULE_H__
+
+#include "maps_plugin.h"
+#include "discovery.h"
+#include <glib.h>
+#include <gmodule.h>
+
+/* ------------------------------------------------------------------------- */
+/*
+* Plugin dedicated functions
+*/
+typedef int (*maps_plugin_init_f) (maps_plugin_h *plugin);
+typedef int (*maps_plugin_shutdown_f) (maps_plugin_h plugin);
+typedef int (*maps_plugin_get_info_f) (maps_plugin_info_h *info);
+
+/* Maps Provider access key, preference and capabilities */
+typedef int (*maps_plugin_set_provider_key_f) (const char *provider_key);
+typedef int (*maps_plugin_get_provider_key_f) (char **provider_key);
+typedef int (*maps_plugin_set_preference_f) (maps_preference_h preference);
+typedef int (*maps_plugin_get_preference_f) (maps_preference_h *preference);
+typedef int (*maps_plugin_is_service_supported_f) (maps_service_e service,
+ bool *supported);
+typedef int (*maps_plugin_is_data_supported_f) (maps_service_data_e data,
+ bool *supported);
+
+/* Geocode */
+typedef int (*maps_plugin_geocode_f) (const char *address,
+ const maps_preference_h preference,
+ maps_service_geocode_cb callback,
+ void *user_data, int *request_id);
+typedef int (*maps_plugin_geocode_inside_area_f) (const char *address,
+ const maps_area_h bounds,
+ const maps_preference_h
+ preference,
+ maps_service_geocode_cb
+ callback,
+ void *user_data,
+ int *request_id);
+typedef int (*maps_plugin_geocode_by_structured_address_f) (const maps_address_h
+ address,
+ const
+ maps_preference_h
+ preference,
+ maps_service_geocode_cb
+ callback,
+ void *user_data,
+ int *request_id);
+typedef int (*maps_plugin_reverse_geocode_f) (double latitude, double longitude,
+ const maps_preference_h
+ preference,
+ maps_service_reverse_geocode_cb
+ callback,
+ void *user_data, int *request_id);
+
+/* Place */
+typedef int (*maps_plugin_search_place_f) (const maps_coordinates_h position,
+ int distance,
+ const maps_place_filter_h filter,
+ maps_preference_h preference,
+ maps_service_search_place_cb
+ callback,
+ void *user_data, int *request_id);
+typedef int (*maps_plugin_search_place_by_area_f) (const maps_area_h boundary,
+ const maps_place_filter_h
+ filter,
+ maps_preference_h preference,
+ maps_service_search_place_cb
+ callback,
+ void *user_data,
+ int *request_id);
+typedef int (*maps_plugin_search_place_by_address_f) (const char *address,
+ const maps_area_h
+ boundary,
+ const maps_place_filter_h
+ filter,
+ maps_preference_h
+ preference,
+ maps_service_search_place_cb
+ callback,
+ void *user_data,
+ int *request_id);
+
+/* Route */
+typedef int (*maps_plugin_search_route_f) (const maps_coordinates_h origin,
+ const maps_coordinates_h destination,
+ maps_preference_h preference,
+ maps_service_search_route_cb
+ callback,
+ void *user_data, int *request_id);
+typedef int (*maps_plugin_search_route_waypoints_f) (const maps_coordinates_h *
+ waypoint_list,
+ int waypoint_num,
+ maps_preference_h
+ preference,
+ maps_service_search_route_cb
+ callback,
+ void *user_data,
+ int *request_id);
+
+/* Cancel Request */
+typedef int (*maps_plugin_cancel_request_f) (int request_id);
+
+
+namespace plugin {
+
+ /* Plugin interface */
+ typedef struct _interface_s {
+
+ /* Plugin dedicated functions */
+ maps_plugin_init_f maps_plugin_init;
+ maps_plugin_shutdown_f maps_plugin_shutdown;
+ maps_plugin_get_info_f maps_plugin_get_info;
+
+ /* Maps Provider access key, preference and capabilities */
+ maps_plugin_set_provider_key_f maps_plugin_set_provider_key;
+ maps_plugin_get_provider_key_f maps_plugin_get_provider_key;
+ maps_plugin_set_preference_f maps_plugin_set_preference;
+ maps_plugin_get_preference_f maps_plugin_get_preference;
+ maps_plugin_is_service_supported_f
+ maps_plugin_is_service_supported;
+ maps_plugin_is_data_supported_f maps_plugin_is_data_supported;
+
+ /* Geocode */
+ maps_plugin_geocode_f maps_plugin_geocode;
+ maps_plugin_geocode_inside_area_f
+ maps_plugin_geocode_inside_area;
+ maps_plugin_geocode_by_structured_address_f
+ maps_plugin_geocode_by_structured_address;
+ maps_plugin_reverse_geocode_f maps_plugin_reverse_geocode;
+
+ /* Place */
+ maps_plugin_search_place_f maps_plugin_search_place;
+ maps_plugin_search_place_by_area_f
+ maps_plugin_search_place_by_area;
+ maps_plugin_search_place_by_address_f
+ maps_plugin_search_place_by_address;
+
+ /* Route */
+ maps_plugin_search_route_f maps_plugin_search_route;
+ maps_plugin_search_route_waypoints_f
+ maps_plugin_search_route_waypoints;
+
+ /* Cancel Request */
+ maps_plugin_cancel_request_f maps_plugin_cancel_request;
+
+ } interface_s;
+
+ /* Plugin structure */
+ typedef struct _plugin_s {
+ interface_s interface; /* Plugin interface function pointers */
+ gpointer module; /* Plugin module pointer, GMod */
+ GAsyncQueue *request_queue; /* Queue of asynchronous requests */
+ GThread *thread; /* Request queue thread: there is
+ happening delivery of request from
+ app to plugin */
+
+ /* Flag: is the plugin in use */
+ volatile bool is_working; /* It is discouraged to use this
+ approach; */
+ /* probably, it must be exchanged with event dispite of
+ * performance trade-off */
+
+ /*maps_string_hashtable_h capabilities; // The table of plugin
+ * capabilities */
+
+ GMutex pending_request_mutex; /* Mutex for synchronizing the
+ map of pending requests */
+ GHashTable *pending_request_maps; /* Map of pending
+ requests */
+ } plugin_s;
+
+ /* TODO: Refactor to encapsulate everithing in a single calss
+ * plugin::module */
+ typedef struct _GMod {
+ gchar *name;
+ gchar *path;
+ GModule *module;
+ } GMod;
+
+ /* RAII Class implementing the mutex helper on the base of GLib mutex */
+ /* which automatically locks mutex during its creation and unlocks while
+ * exiting the scope */
+ class scope_mutex {
+ GMutex *mutex;
+ public:
+ scope_mutex(GMutex *m);
+ ~scope_mutex();
+ };
+
+ class binary_extractor {
+ public:
+ binary_extractor();
+ virtual ~binary_extractor()
+ {
+ }
+ public:
+ provider_info get_plugin_info(const string &file_name) const;
+ maps_plugin_h init(const provider_info &info);
+ void shutdown(maps_plugin_h plugin_h);
+ private:
+ GMod *gmod_new(const string &module_file,
+ gboolean is_resident) const;
+ void gmod_free(GMod *gmod) const;
+ gpointer gmod_find_sym(GMod *gmod,
+ const gchar *func_name) const;
+ void trace_dbg(const plugin_s *plugin) const;
+ };
+};
+
+#endif /* __MAPS_SERVICE_PLUGIN_MODULE_H__ */
\ No newline at end of file
--- /dev/null
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * 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 "command.h"
+#include "empty_module.h"
+#include "maps_util.h"
+
+extern plugin::plugin_s *__extract_plugin(maps_service_h maps);
+
+volatile int session::command::command_request_id = 1;
+session::command session::command::empty_instance;
+
+session::command::command(maps_service_h ms) : m(ms), my_req_id(0)
+{
+}
+
+session::command::command(const command &src)
+{
+ *this = src;
+}
+
+session::command::~command()
+{
+}
+
+session::command &session::command::operator =(const command &src)
+{
+ if (this != (&src)) {
+ m = src.m;
+ my_req_id = src.my_req_id;
+ }
+ return *this;
+}
+
+int session::command::run()
+{
+ return MAPS_ERROR_NONE;
+}
+
+void session::command::destroy()
+{
+ if (this != empty_ptr())
+ delete this;
+}
+
+plugin::interface_s *session::command::interface() const
+{
+ if (!m)
+ return plugin::get_empty_interface_ptr(); /* PROBLEM!!! Why have
+ no maps service!! Returning default empty interface */
+
+ plugin::plugin_s *p = __extract_plugin(m);
+ if (!p)
+ return plugin::get_empty_interface_ptr(); /* PROBLEM!!! Why have
+ no plugin!! Returning default empty interface */
+
+ return &p->interface;
+}
+
+maps_plugin_h session::command::handle() const
+{
+ return (maps_plugin_h) plugin();
+}
+
+plugin::plugin_s *session::command::plugin() const
+{
+ return __extract_plugin(m);
+}
+
+/*----------------------------------------------------------------------------*/
+
+session::command_handler::command_handler(plugin::plugin_s *p, void *ud,
+ int urid)
+ : plg(p), user_data(ud), user_req_id(urid), plg_req_id(-1)
+{
+}
+
+session::command_handler::~command_handler()
+{
+}
+
+void session::command_handler::destroy(void *p)
+{
+ if (!p)
+ return;
+ command_handler *c = (command_handler *) p;
+ delete c;
+}
+
+/*----------------------------------------------------------------------------*/
+
+session::pending_request::pending_request(plugin::plugin_s *p) : plg(p)
+{
+}
+
+bool session::pending_request::add(const int user_req_id)
+{
+ if (!plg || !plg->pending_request_maps || (user_req_id < 0))
+ return false;
+ plugin::scope_mutex(&plg->pending_request_mutex);
+
+ MAPS_LOGD("session::pending_request::add: %d", user_req_id);
+
+ if (contains(user_req_id))
+ return false; /* Attempt to add another instance of the id */
+ g_hash_table_insert(plg->pending_request_maps, int_dup(user_req_id),
+ NULL);
+ return true;
+}
+
+void session::pending_request::update(int user_req_id,
+ command_handler *handler)
+{
+ if (!plg || !plg->pending_request_maps || (user_req_id < 0) || !handler)
+ return;
+ plugin::scope_mutex(&plg->pending_request_mutex);
+
+ MAPS_LOGD("session::pending_request::update: %d, %d", user_req_id,
+ handler->plg_req_id);
+
+ if (!contains(user_req_id)) { /* Attempt to update not existing id */
+ MAPS_LOGD("\t not updated session::pending_request: %d, %d",
+ user_req_id, handler->plg_req_id);
+ delete handler; /* This handler must be deleted */
+ return;
+ }
+
+ g_hash_table_insert(plg->pending_request_maps, int_dup(user_req_id),
+ handler);
+}
+
+void session::pending_request::remove(int user_req_id)
+{
+ if (!plg || !plg->pending_request_maps || (user_req_id < 0))
+ return;
+ plugin::scope_mutex(&plg->pending_request_mutex);
+
+ MAPS_LOGD("session::pending_request::remove: %d", user_req_id);
+
+ if (!contains(user_req_id))
+ return; /* Attempt to remove not existing id */
+ g_hash_table_remove(plg->pending_request_maps, &user_req_id);
+}
+
+session::command_handler *session::pending_request::look_up(const int
+ user_req_id)
+{
+ if (!plg || !plg->pending_request_maps || (user_req_id < 0))
+ return NULL;
+ plugin::scope_mutex(&plg->pending_request_mutex);
+
+ MAPS_LOGD("session::pending_request::look_up: %d", user_req_id);
+
+ if (!contains(user_req_id))
+ return NULL; /* Attempt to query not existing id */
+ return (command_handler*) g_hash_table_lookup(plg->
+ pending_request_maps, &user_req_id);
+}
+
+int session::pending_request::extract_plg_id(const int user_req_id)
+{
+ if (!plg || !plg->pending_request_maps || (user_req_id < 0))
+ return -1;
+ plugin::scope_mutex(&plg->pending_request_mutex);
+
+ command_handler* ch = look_up(user_req_id);
+ if (!ch)
+ return -1;
+ const int plg_req_id = ch->plg_req_id;
+ remove(user_req_id);
+ return plg_req_id;
+}
+
+bool session::pending_request::contains(const int user_req_id)
+{
+ if (!plg || !plg->pending_request_maps || (user_req_id < 0))
+ return false;
+ plugin::scope_mutex(&plg->pending_request_mutex);
+
+ return g_hash_table_contains(plg->pending_request_maps, &user_req_id);
+}
+
+int *session::pending_request::int_dup(const int n)
+{
+ int *clone = g_new0(int, 1);
+ *clone = n;
+ return clone;
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_SERVICE_SESSION_COMMAND_H__
+#define __MAPS_SERVICE_SESSION_COMMAND_H__
+
+#include "maps_plugin.h"
+#include "module.h"
+
+namespace session
+{
+
+/*----------------------------------------------------------------------------*/
+
+ class command
+ {
+ private:
+ maps_service_h m;
+ protected:
+ int my_req_id;
+ public:
+ static volatile int command_request_id;
+ public:
+ static command empty_instance;
+ private:
+ command()
+ {
+ } /* Please, do not construct an empty object */
+ public:
+ command(maps_service_h ms);
+ command(const command &src);
+ virtual ~command();
+ command & operator=(const command &src);
+ public:
+ virtual int run();
+ void destroy();
+ public:
+ static command *empty_ptr()
+ {
+ return &empty_instance;
+ }
+ protected:
+ plugin::interface_s *interface() const;
+ maps_plugin_h handle() const;
+ public:
+ plugin::plugin_s *plugin()const;
+ };
+
+/*----------------------------------------------------------------------------*/
+
+ class command_handler
+ {
+ plugin::plugin_s *plg;
+ public:
+ void *user_data;
+ int user_req_id;
+ int plg_req_id;
+ public:
+ command_handler(plugin::plugin_s *plugin, void *user_data,
+ int user_req_id);
+ virtual ~command_handler();
+ private:
+ command_handler() : plg(NULL), user_data(NULL),
+ user_req_id(-1), plg_req_id(-1)
+ {
+ };
+ command_handler(const command_handler &src) : plg(NULL),
+ user_data(NULL), user_req_id(-1), plg_req_id(-1)
+ {
+ };
+ command_handler &operator=(const command_handler &src)
+ {
+ return *this;
+ }
+ public:
+ plugin::plugin_s *plugin()const
+ {
+ return plg;
+ }
+ public:
+ static void destroy(void *p);
+ };
+
+/*----------------------------------------------------------------------------*/
+
+ class pending_request
+ {
+ private:
+ plugin::plugin_s *plg;
+ public:
+ pending_request(plugin::plugin_s *plugin);
+ virtual ~pending_request()
+ {
+ };
+ private:
+ pending_request() : plg(NULL) {
+ }
+ pending_request(const pending_request &src)
+ {
+ }
+ pending_request &operator=(const pending_request &src)
+ {
+ return *this;
+ }
+ public:
+ bool add(const int user_req_id);
+ void update(int user_req_id, command_handler *handler);
+ void remove(int user_req_id);
+ command_handler *look_up(const int user_req_id);
+ int extract_plg_id(const int user_req_id);
+ bool contains(const int user_req_id);
+ private:
+ int *int_dup(const int n);
+ };
+}
+
+#endif /* __MAPS_SERVICE_SESSION_COMMAND_H__ */
\ No newline at end of file
--- /dev/null
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * 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 "command_queue.h"
+#include "command.h"
+#include "thread.h"
+
+session::command_queue *session::command_queue::interface()
+{
+ if (is_async()) {
+#ifdef _MAPS_SERVICE_SUPPORTS_ASYNC_QUEUE_
+ static command_queue_async async_queue;
+ return &async_queue;
+#else
+ static command_queue_sync sync_queue;
+ return &sync_queue;
+#endif /* _MAPS_SERVICE_SUPPORTS_ASYNC_QUEUE_ */
+ }
+ else {
+ static command_queue_sync sync_queue;
+ return &sync_queue;
+ }
+}
+
+/*----------------------------------------------------------------------------*/
+
+int session::command_queue_sync::push(command *c)
+{
+ return (c and c->plugin())? c->run() : MAPS_ERROR_INVALID_PARAMETER;
+}
+
+session::command* session::command_queue_sync::pop(plugin::plugin_s *p)
+{
+ return command::empty_ptr();
+}
+
+void session::command_queue_sync::process(plugin::plugin_s *p)
+{
+ /* empty */
+}
+
+void session::command_queue_sync::clear(plugin::plugin_s *p)
+{
+ /* empty */
+}
+
+/*----------------------------------------------------------------------------*/
+
+/*
+ * This is the implementation of asynchronous queue.
+ * In order to pass code coverage tests it is blocked.
+ */
+#ifdef _MAPS_SERVICE_SUPPORTS_ASYNC_QUEUE_
+int session::command_queue_async::push(command *c)
+{
+ if (!c || !c->plugin() || !c->plugin()->request_queue)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ queue_autoref(c->plugin()->request_queue);
+ g_async_queue_push(c->plugin()->request_queue, c);
+
+ /* Lazy initialization: run plugin thread if it is not started yet */
+ thread().run(c->plugin());
+
+ return MAPS_ERROR_NONE;
+}
+
+session::command *session::command_queue_async::pop(plugin::plugin_s *p)
+{
+ if (!p || !p->request_queue)
+ return command::empty_ptr();
+
+ queue_autoref(p->request_queue);
+
+ /* Pops data from the queue . */
+ /* If the queue is empty, blocks for timeout microseconds, or until data
+ * becomes available. */
+ /* If no data is received before the timeout, NULL is returned. */
+ /* https://developer.gnome.org/glib/stable/glib-Asynchronous-Queues.html#g-async-queue-timeout-pop */
+ command* c =
+ (command *) g_async_queue_timeout_pop(p->request_queue,
+ 300 * G_TIME_SPAN_MILLISECOND);
+ return (c) ? c : command::empty_ptr();
+}
+
+void session::command_queue_async::process(plugin::plugin_s *p)
+{
+ if (!p || !p->request_queue)
+ return;
+
+ queue_autoref(p->request_queue);
+ pop(p)->run();
+}
+
+void session::command_queue_async::clear(plugin::plugin_s *p)
+{
+ if (!p || !p->request_queue)
+ return;
+
+ queue_autoref(p->request_queue);
+ while (g_async_queue_length(p->request_queue))
+ pop(p)->destroy();
+}
+#endif /* _MAPS_SERVICE_SUPPORTS_ASYNC_QUEUE_ */
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_SERVICE_SESSION_COMMAND_QUEUE_H__
+#define __MAPS_SERVICE_SESSION_COMMAND_QUEUE_H__
+
+#include "module.h"
+
+namespace session
+{
+
+ class command;
+
+ class command_queue
+ {
+ public:
+ virtual int push(command *c) = 0;
+ virtual command *pop(plugin::plugin_s *p) = 0;
+ virtual void process(plugin::plugin_s *p) = 0;
+ virtual void clear(plugin::plugin_s *p) = 0;
+ public:
+ static command_queue *interface();
+ static bool is_async()
+ {
+ return false;
+ }
+ };
+
+ class command_queue_sync:public command_queue
+ {
+ private:
+ command_queue_sync()
+ {
+ }
+ virtual ~command_queue_sync()
+ {
+ }
+ private:
+ virtual int push(command *c);
+ virtual command *pop(plugin::plugin_s *p);
+ virtual void process(plugin::plugin_s *p);
+ virtual void clear(plugin::plugin_s *p);
+
+ friend class command_queue;
+ };
+
+/*
+ * This is the implementation of asynchronous queue.
+ * In order to pass code coverage tests it is blocked.
+ */
+/*#define _MAPS_SERVICE_SUPPORTS_ASYNC_QUEUE_*/
+#ifdef _MAPS_SERVICE_SUPPORTS_ASYNC_QUEUE_
+ class command_queue_async:public command_queue
+ {
+ private:
+ command_queue_async()
+ {
+ }
+ virtual ~command_queue_async()
+ {
+ }
+ private:
+ virtual int push(command *c);
+ virtual command *pop(plugin::plugin_s *p);
+ virtual void process(plugin::plugin_s *p);
+ virtual void clear(plugin::plugin_s *p);
+
+ friend class command_queue;
+ };
+#endif /* _MAPS_SERVICE_SUPPORTS_ASYNC_QUEUE_ */
+
+ class queue_autoref
+ {
+ public:
+ GAsyncQueue *q;
+ public:
+ queue_autoref(GAsyncQueue *async_queue) : q(async_queue)
+ {
+ g_async_queue_ref(q);
+ }
+ ~queue_autoref()
+ {
+ g_async_queue_unref(q);
+ }
+ };
+
+};
+
+#endif /* __MAPS_SERVICE_SESSION_COMMAND_QUEUE_H__ */
--- /dev/null
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * 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 "commands.h"
+#include "maps_util.h"
+#include "maps_place_private.h"
+#include "maps_route_private.h"
+#include "empty_module.h"
+
+static int __put_to_hashtable(session::command_handler *ch,
+ maps_service_data_e feature,
+ const char *feature_str,
+ maps_string_hashtable_h t)
+{
+ if (!ch || !feature_str || !t)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ bool supported = false;
+ ch->plugin()->interface.maps_plugin_is_data_supported(feature,
+ &supported);
+ return (supported) ? maps_string_hashtable_set(t, feature_str,
+ feature_str) : MAPS_ERROR_NONE;
+}
+
+/*----------------------------------------------------------------------------*/
+/*typedef int (*maps_plugin_geocode_f)(maps_service_h maps, const char *address,
+* maps_service_geocode_cb callback, void *user_data, int *request_id); */
+session::command_geocode::command_geocode(maps_service_h ms, const string a,
+ const maps_item_hashtable_h pref,
+ maps_service_geocode_cb cb,
+ void *ud, int *request_id)
+ : command(ms)
+ , address(a)
+ , preference(NULL)
+ , callback(cb)
+ , user_data(ud)
+ , error(0)
+{
+ *request_id = command::command_request_id++;
+ my_req_id = *request_id;
+
+ if (pref &&
+ (maps_item_hashtable_clone(pref, &preference) != MAPS_ERROR_NONE))
+ error = MAPS_ERROR_INVALID_PARAMETER;
+}
+
+session::command_geocode::~command_geocode()
+{
+ maps_item_hashtable_destroy(preference);
+}
+
+int session::command_geocode::run()
+{
+
+ if (error != MAPS_ERROR_NONE)
+ return error;
+
+ pending_request pr(plugin());
+
+ /* Get the plugin interface function */
+ maps_plugin_geocode_f func = interface()->maps_plugin_geocode;
+ command_geocode_handler *handler = NULL;
+ if (func) {
+ /* need to create the handler when the function is NULL */
+ pr.add(my_req_id);
+ handler = new command_geocode_handler(plugin(),
+ callback,
+ user_data,
+ my_req_id);
+
+ if (handler) {
+ /* Run the plugin interface function */
+ error = func(address.c_str(), preference,
+ command_geocode_handler::foreach_geocode_cb, handler,
+ &handler->plg_req_id);
+
+ pr.update(my_req_id, handler);
+
+ MAPS_LOGD("session::command_geocode::run: %d", my_req_id);
+ }
+ else {
+ error = MAPS_ERROR_OUT_OF_MEMORY;
+ }
+ }
+ else {
+ /* Plugin Function is NULL: use default empty function */
+ /*
+ func = plugin::get_empty_interface().maps_plugin_geocode;
+ */
+ MAPS_LOGE("MAPS_ERROR_NOT_SUPPORTED: Can't get any plugin");
+ error = MAPS_ERROR_NOT_SUPPORTED;
+ }
+
+ const int ret = error;
+ destroy();
+ return ret;
+}
+
+session::command_geocode_handler::command_geocode_handler(plugin::plugin_s *p,
+ maps_service_geocode_cb cb,
+ void *ud, int urid)
+ : command_handler(p, ud, urid)
+ , callback(cb)
+{
+}
+
+bool session::command_geocode_handler::foreach_geocode_cb(maps_error_e error,
+ int request_id,
+ int index,
+ int total_count,
+ maps_coordinates_h
+ coordinates,
+ void *user_data)
+{
+
+ command_geocode_handler *handler =
+ (command_geocode_handler *) user_data;
+
+ if (request_id != handler->plg_req_id) {
+ MAPS_LOGE(
+"\n\nERROR! Incorrect request id [%d] come from the plugin; expected [%d]\n\n",
+ request_id, handler->plg_req_id);
+ }
+
+ /* Make a user's copy of result data */
+ maps_coordinates_h cloned_result = NULL;
+ if (error == MAPS_ERROR_NONE)
+ error = (maps_error_e) maps_coordinates_clone(coordinates,
+ &cloned_result);
+ maps_coordinates_destroy(coordinates);
+
+ /* Send data to user */
+ const bool b =
+ handler->callback(error, handler->user_req_id, index,
+ total_count, cloned_result, handler->user_data);
+ if (!b || (index >= (total_count - 1))) {
+ pending_request pr(handler->plugin());
+ pr.remove(handler->user_req_id);
+ }
+
+ return b;
+}
+
+/*----------------------------------------------------------------------------*/
+/*typedef int (*maps_plugin_geocode_inside_area_f)(maps_service_h maps, const
+* char *address, maps_area_h bounds, maps_service_geocode_cb callback,
+* void *user_data, int *request_id); */
+session::command_geocode_inside_bounds::command_geocode_inside_bounds(
+ maps_service_h ms,
+ const char *a,
+ const maps_area_h b,
+ const maps_item_hashtable_h pref,
+ maps_service_geocode_cb cb,
+ void *ud, int *request_id)
+ : command(ms)
+ , address(a)
+ , bounds(NULL)
+ , preference(NULL)
+ , callback(cb)
+ , user_data(ud)
+ , error(0)
+{
+ *request_id = command::command_request_id++;
+ my_req_id = *request_id;
+
+ if (maps_area_clone(b, &bounds) != MAPS_ERROR_NONE)
+ error = MAPS_ERROR_INVALID_PARAMETER;
+
+ if (pref &&
+ (maps_item_hashtable_clone(pref, &preference) != MAPS_ERROR_NONE))
+ error = MAPS_ERROR_INVALID_PARAMETER;
+}
+
+session::command_geocode_inside_bounds::~command_geocode_inside_bounds()
+{
+ maps_area_destroy(bounds);
+ maps_item_hashtable_destroy(preference);
+}
+
+int session::command_geocode_inside_bounds::run()
+{
+ if (error != MAPS_ERROR_NONE)
+ return error;
+
+ pending_request pr(plugin());
+
+ /* Get the plugin interface function */
+ maps_plugin_geocode_inside_area_f func =
+ interface()->maps_plugin_geocode_inside_area;
+ command_geocode_handler *handler = NULL;
+ if (func) {
+ /* No need to create the handler when the function is NULL */
+ pr.add(my_req_id);
+ handler = new command_geocode_handler(plugin(),
+ callback,
+ user_data,
+ my_req_id);
+
+ if (handler) {
+ /* Run the plugin interface function */
+ error = func(address.c_str(), bounds, preference,
+ command_geocode_handler::foreach_geocode_cb,
+ handler, &handler->plg_req_id);
+
+ pr.update(my_req_id, handler);
+
+ MAPS_LOGD("session::command_geocode_inside_bounds::run: %d", my_req_id);
+ }
+ else {
+ error = MAPS_ERROR_OUT_OF_MEMORY;
+ }
+ }
+ else {
+ /* Plugin Function is NULL: use default empty function */
+ /*
+ func = plugin::get_empty_interface().
+ maps_plugin_geocode_inside_area;
+ */
+ MAPS_LOGE("MAPS_ERROR_NOT_SUPPORTED: Can't get any plugin");
+ error = MAPS_ERROR_NOT_SUPPORTED;
+ }
+
+ const int ret = error;
+ destroy();
+ return ret;
+}
+
+/*----------------------------------------------------------------------------*/
+/*typedef int (*maps_plugin_geocode_by_structured_address_f)(
+* maps_service_h maps, maps_address_h address, maps_preference_h preference,
+* maps_service_geocode_cb callback, void *user_data, int *request_id); */
+session::command_geocode_by_structured_address::
+ command_geocode_by_structured_address(maps_service_h ms,
+ const maps_address_h a,
+ const maps_item_hashtable_h pref,
+ maps_service_geocode_cb cb,
+ void *ud, int *request_id)
+ : command(ms)
+ , address(NULL)
+ , preference(NULL)
+ , callback(cb)
+ , user_data(ud)
+ , error(0)
+{
+ *request_id = command::command_request_id++;
+ my_req_id = *request_id;
+
+ if (maps_address_clone(a, &address) != MAPS_ERROR_NONE)
+ error = MAPS_ERROR_INVALID_PARAMETER;
+
+ if (pref &&
+ (maps_item_hashtable_clone(pref, &preference) != MAPS_ERROR_NONE))
+ error = MAPS_ERROR_INVALID_PARAMETER;
+}
+
+session::command_geocode_by_structured_address::
+ ~command_geocode_by_structured_address()
+{
+ maps_address_destroy(address);
+ maps_item_hashtable_destroy(preference);
+}
+
+int session::command_geocode_by_structured_address::run()
+{
+ if (error != MAPS_ERROR_NONE)
+ return error;
+
+ pending_request pr(plugin());
+
+ /* Get the plugin interface function */
+ maps_plugin_geocode_by_structured_address_f func =
+ interface()->maps_plugin_geocode_by_structured_address;
+ command_geocode_handler *handler = NULL;
+ if (func) {
+ /* No need to create the handler when the function is NULL */
+ pr.add(my_req_id);
+ handler = new command_geocode_handler(plugin(),
+ callback,
+ user_data,
+ my_req_id);
+
+ if (handler) {
+ /* Run the plugin interface function */
+ error = func(address,
+ preference, command_geocode_handler::foreach_geocode_cb,
+ handler, &handler->plg_req_id);
+
+ pr.update(my_req_id, handler);
+ }
+ else {
+ error = MAPS_ERROR_OUT_OF_MEMORY;
+ }
+ }
+ else {
+ /* Plugin Function is NULL: use default empty function */
+ /*
+ func = plugin::get_empty_interface().
+ maps_plugin_geocode_by_structured_address;
+ */
+ MAPS_LOGE("MAPS_ERROR_NOT_SUPPORTED: Can't get any plugin");
+ error = MAPS_ERROR_NOT_SUPPORTED;
+ }
+
+ const int ret = error;
+ destroy();
+ return ret;
+}
+
+/*----------------------------------------------------------------------------*/
+/*typedef int (*maps_plugin_reverse_geocode_f)(maps_service_h maps,
+* double latitude, double longitude, maps_service_reverse_geocode_cb callback,
+* void *user_data, int *request_id); */
+session::command_reverse_geocode::command_reverse_geocode(maps_service_h ms,
+ double lat, double lon,
+ const maps_item_hashtable_h pref,
+ maps_service_reverse_geocode_cb cb,
+ void *ud, int *request_id)
+ : command(ms)
+ , latitude(lat)
+ , longitude(lon)
+ , preference(NULL)
+ , callback(cb)
+ , user_data(ud)
+ , error(0)
+{
+ *request_id = command::command_request_id++;
+ my_req_id = *request_id;
+
+ if (pref &&
+ (maps_item_hashtable_clone(pref, &preference) != MAPS_ERROR_NONE))
+ error = MAPS_ERROR_INVALID_PARAMETER;
+}
+
+session::command_reverse_geocode::~command_reverse_geocode()
+{
+ maps_item_hashtable_destroy(preference);
+}
+
+int session::command_reverse_geocode::run()
+{
+
+ if (error != MAPS_ERROR_NONE)
+ return error;
+
+ pending_request pr(plugin());
+
+ /* Get the plugin interface function */
+ maps_plugin_reverse_geocode_f func =
+ interface()->maps_plugin_reverse_geocode;
+ command_reverse_geocode_handler *handler = NULL;
+ if (func) {
+ /* No need to create the handler when the function is NULL */
+ pr.add(my_req_id);
+ handler = new command_reverse_geocode_handler(plugin(),
+ callback,
+ user_data,
+ my_req_id);
+
+ if (handler) {
+ /* Run the plugin interface function */
+ error = func(latitude, longitude, preference,
+ command_reverse_geocode_handler::foreach_reverse_geocode_cb,
+ handler, &handler->plg_req_id);
+
+ pr.update(my_req_id, handler);
+
+ MAPS_LOGD("session::command_reverse_geocode::run: %d", my_req_id);
+ }
+ else {
+ error = MAPS_ERROR_OUT_OF_MEMORY;
+ }
+ }
+ else {
+ /* Plugin Function is NULL: use default empty function */
+ /*
+ func = plugin::get_empty_interface().
+ maps_plugin_reverse_geocode;
+ */
+ MAPS_LOGE("MAPS_ERROR_NOT_SUPPORTED: Can't get any plugin");
+ error = MAPS_ERROR_NOT_SUPPORTED;
+ }
+
+ const int ret = error;
+ destroy();
+ return ret;
+}
+
+session::command_reverse_geocode_handler::command_reverse_geocode_handler(
+ plugin::plugin_s *p,
+ maps_service_reverse_geocode_cb cb,
+ void *ud, int urid)
+ : command_handler(p, ud, urid)
+ , callback(cb)
+{
+}
+
+void session::command_reverse_geocode_handler::foreach_reverse_geocode_cb(
+ maps_error_e error,
+ int request_id, int index,
+ int total,
+ maps_address_h address,
+ void *user_data)
+{
+
+ command_reverse_geocode_handler *handler =
+ (command_reverse_geocode_handler *) user_data;
+
+ if (request_id != handler->plg_req_id) {
+ MAPS_LOGE(
+"\n\nERROR! Incorrect request id [%d] come from the plugin; expected [%d]\n\n",
+ request_id, handler->plg_req_id);
+ }
+
+ /* Make a user's copy of result data */
+ maps_address_h cloned_result = NULL;
+ if (error == MAPS_ERROR_NONE)
+ error = (maps_error_e) maps_address_clone(address,
+ &cloned_result);
+ maps_address_destroy(address);
+
+ /* Send data to user */
+ handler->callback(error, handler->user_req_id, index, total,
+ cloned_result, handler->user_data);
+ /*if(index>=(total-1)) */
+
+ pending_request pr(handler->plugin());
+ pr.remove(handler->user_req_id);
+}
+
+/*----------------------------------------------------------------------------*/
+/*typedef int (*maps_plugin_search_place_f)(maps_service_h maps,
+* maps_coordinates_h position, int distance, maps_item_hashtable_h preference,
+* maps_place_filter_h filter, maps_service_search_place_cb callback,
+* void* user_data, int* request_id); */
+session::command_search_place::command_search_place(maps_service_h ms,
+ const maps_coordinates_h pos,
+ int dst,
+ const maps_item_hashtable_h pref,
+ const maps_place_filter_h flt,
+ maps_service_search_place_cb cb,
+ void *ud, int *request_id)
+ : command(ms)
+ , position(NULL)
+ , distance(dst)
+ , preference(NULL)
+ , filter(NULL)
+ , callback(cb)
+ , user_data(ud)
+ , error(MAPS_ERROR_NONE)
+{
+ *request_id = command::command_request_id++;
+ my_req_id = *request_id;
+
+ if (maps_coordinates_clone(pos, &position) != MAPS_ERROR_NONE)
+ error = MAPS_ERROR_INVALID_PARAMETER;
+
+ if (pref &&
+ (maps_item_hashtable_clone(pref, &preference) != MAPS_ERROR_NONE))
+ error = MAPS_ERROR_INVALID_PARAMETER;
+
+ if (maps_place_filter_clone(flt, &filter) != MAPS_ERROR_NONE)
+ error = MAPS_ERROR_INVALID_PARAMETER;
+}
+
+session::command_search_place::~command_search_place()
+{
+ maps_coordinates_destroy(position);
+ maps_item_hashtable_destroy(preference);
+ maps_place_filter_destroy(filter);
+}
+
+int session::command_search_place::run()
+{
+
+ if (error != MAPS_ERROR_NONE)
+ return error;
+
+ pending_request pr(plugin());
+
+ /* Get the plugin interface function */
+ maps_plugin_search_place_f func = interface()->maps_plugin_search_place;
+ command_search_place_handler *handler = NULL;
+ if (func) {
+ /* No need to create the handler when the function is NULL */
+ pr.add(my_req_id);
+ handler = new command_search_place_handler(plugin(),
+ callback,
+ user_data,
+ my_req_id);
+ if (handler) {
+ /* Run the plugin interface function */
+ error = func(position, distance, filter, preference,
+ command_search_place_handler::foreach_place_cb, handler,
+ &handler->plg_req_id);
+
+ pr.update(my_req_id, handler);
+
+ MAPS_LOGD("session::command_search_place::run: %d", my_req_id);
+ }
+ else {
+ error = MAPS_ERROR_OUT_OF_MEMORY;
+ }
+ }
+ else {
+ /* Plugin Function is NULL: use default empty function */
+ /*
+ func = plugin::get_empty_interface().maps_plugin_search_place;
+ */
+ MAPS_LOGE("MAPS_ERROR_NOT_SUPPORTED: Can't get any plugin");
+ error = MAPS_ERROR_NOT_SUPPORTED;
+ }
+
+ const int ret = error;
+ destroy();
+ return ret;
+}
+
+session::command_search_place_handler::command_search_place_handler(
+ plugin::plugin_s* p,
+ maps_service_search_place_cb cb,
+ void *ud, int urid)
+ : command_handler(p, ud, urid)
+ , callback(cb)
+{
+}
+
+void session::command_search_place_handler::set_supported_data(maps_place_h
+ place)
+{
+ if (!place || !plugin())
+ return;
+
+ maps_string_hashtable_h data_supported = NULL;
+ if (maps_string_hashtable_create(&data_supported) != MAPS_ERROR_NONE)
+ return;
+
+ __put_to_hashtable(this, MAPS_PLACE_ADDRESS, _S(MAPS_PLACE_ADDRESS),
+ data_supported);
+ __put_to_hashtable(this, MAPS_PLACE_RATING, _S(MAPS_PLACE_RATING),
+ data_supported);
+ __put_to_hashtable(this, MAPS_PLACE_CATEGORIES,
+ _S(MAPS_PLACE_CATEGORIES), data_supported);
+ __put_to_hashtable(this, MAPS_PLACE_ATTRIBUTES,
+ _S(MAPS_PLACE_ATTRIBUTES), data_supported);
+ __put_to_hashtable(this, MAPS_PLACE_CONTACTS, _S(MAPS_PLACE_CONTACTS),
+ data_supported);
+ __put_to_hashtable(this, MAPS_PLACE_EDITORIALS,
+ _S(MAPS_PLACE_EDITORIALS), data_supported);
+ __put_to_hashtable(this, MAPS_PLACE_REVIEWS, _S(MAPS_PLACE_REVIEWS),
+ data_supported);
+ __put_to_hashtable(this, MAPS_PLACE_IMAGE, _S(MAPS_PLACE_IMAGE),
+ data_supported);
+ __put_to_hashtable(this, MAPS_PLACE_SUPPLIER, _S(MAPS_PLACE_SUPPLIER),
+ data_supported);
+ __put_to_hashtable(this, MAPS_PLACE_RELATED, _S(MAPS_PLACE_RELATED),
+ data_supported);
+
+ _maps_place_set_supported_data(place, data_supported);
+ maps_string_hashtable_destroy(data_supported);
+}
+
+bool session::command_search_place_handler::foreach_place_cb(maps_error_e error,
+ int request_id,
+ int index,
+ int length,
+ maps_place_h place,
+ void *user_data)
+{
+
+ command_search_place_handler *handler =
+ (command_search_place_handler *) user_data;
+
+ if (request_id != handler->plg_req_id) {
+ MAPS_LOGE(
+"\n\nERROR! Incorrect request id [%d] come from the plugin; expected [%d]\n\n",
+ request_id, handler->plg_req_id);
+ }
+
+ /* Make a user's copy of result data */
+ maps_place_h cloned_result = NULL;
+ if (error == MAPS_ERROR_NONE)
+ error = (maps_error_e) maps_place_clone(place, &cloned_result);
+ maps_place_destroy(place);
+
+ /* Check which data features are supported */
+ if (cloned_result)
+ handler->set_supported_data(cloned_result);
+
+ /* Send data to user */
+ const bool b =
+ handler->callback(error, handler->user_req_id, index, length,
+ cloned_result, handler->user_data);
+ if (!b || (index >= (length - 1))) {
+ pending_request pr(handler->plugin());
+ pr.remove(handler->user_req_id);
+ }
+
+ return b;
+}
+
+/*----------------------------------------------------------------------------*/
+/*typedef int (*maps_plugin_search_place_by_area_f)(maps_service_h maps,
+* maps_area_h boundary , maps_item_hashtable_h preference,
+* maps_place_filter_h filter, maps_service_search_place_cb callback,
+* void *user_data, int *request_id); */
+session::command_search_by_area_place::command_search_by_area_place(
+ maps_service_h ms, const maps_area_h b,
+ const maps_item_hashtable_h pref,
+ const maps_place_filter_h flt,
+ maps_service_search_place_cb cb,
+ void *ud, int *request_id)
+ : command(ms)
+ , boundary(NULL)
+ , preference(NULL)
+ , filter(NULL)
+ , callback(cb)
+ , user_data(ud)
+ , error(MAPS_ERROR_NONE)
+{
+ *request_id = command::command_request_id++;
+ my_req_id = *request_id;
+
+ if (maps_area_clone(b, &boundary) != MAPS_ERROR_NONE)
+ error = MAPS_ERROR_INVALID_PARAMETER;
+
+ if (pref &&
+ (maps_item_hashtable_clone(pref, &preference) != MAPS_ERROR_NONE))
+ error = MAPS_ERROR_INVALID_PARAMETER;
+
+ if (maps_place_filter_clone(flt, &filter) != MAPS_ERROR_NONE)
+ error = MAPS_ERROR_INVALID_PARAMETER;
+}
+
+session::command_search_by_area_place::~command_search_by_area_place()
+{
+ maps_area_destroy(boundary);
+ maps_item_hashtable_destroy(preference);
+ maps_place_filter_destroy(filter);
+}
+
+int session::command_search_by_area_place::run()
+{
+
+ if (error != MAPS_ERROR_NONE)
+ return error;
+
+ pending_request pr(plugin());
+
+ /* Get the plugin interface function */
+ maps_plugin_search_place_by_area_f func =
+ interface()->maps_plugin_search_place_by_area;
+ command_search_place_handler *handler = NULL;
+ if (func) {
+ /* No need to create the handler when the function is NULL */
+ pr.add(my_req_id);
+ handler = new command_search_place_handler(plugin(),
+ callback,
+ user_data,
+ my_req_id);
+ if (handler) {
+
+ /* Run the plugin interface function */
+ error = func(boundary, filter,
+ preference, command_search_place_handler::foreach_place_cb,
+ handler, &handler->plg_req_id);
+
+ pr.update(my_req_id, handler);
+
+ MAPS_LOGD("session::command_search_by_area_place::run: %d", my_req_id);
+ }
+ else {
+ error = MAPS_ERROR_OUT_OF_MEMORY;
+ }
+ }
+ else {
+ /* Plugin Function is NULL: use default empty function */
+ /*
+ func = plugin::get_empty_interface().
+ maps_plugin_search_place_by_area;
+ */
+
+ MAPS_LOGE("MAPS_ERROR_NOT_SUPPORTED: Can't get any plugin");
+ error = MAPS_ERROR_NOT_SUPPORTED;
+ }
+
+ const int ret = error;
+ destroy();
+ return ret;
+}
+
+/*----------------------------------------------------------------------------*/
+/*typedef int (*maps_plugin_search_place_by_address_f)(maps_service_h maps,
+* const char *address, maps_area_h boundary, maps_item_hashtable_h preference,
+* maps_place_filter_h filter, maps_service_search_place_cb callback,
+* void *user_data, int *request_id); */
+session::command_search_by_address_place::command_search_by_address_place(
+ maps_service_h ms, const char *a,
+ const maps_area_h b,
+ const maps_item_hashtable_h pref,
+ const maps_place_filter_h flt,
+ maps_service_search_place_cb cb,
+ void *ud, int *request_id)
+ : command(ms)
+ , address(a)
+ , boundary(NULL)
+ , preference(NULL)
+ , filter(NULL)
+ , callback(cb)
+ , user_data(ud)
+ , error(MAPS_ERROR_NONE)
+{
+ *request_id = command::command_request_id++;
+ my_req_id = *request_id;
+
+ if (maps_area_clone(b, &boundary) != MAPS_ERROR_NONE)
+ error = MAPS_ERROR_INVALID_PARAMETER;
+
+ if (pref &&
+ (maps_item_hashtable_clone(pref, &preference) != MAPS_ERROR_NONE))
+ error = MAPS_ERROR_INVALID_PARAMETER;
+
+ if (maps_place_filter_clone(flt, &filter) != MAPS_ERROR_NONE)
+ error = MAPS_ERROR_INVALID_PARAMETER;
+}
+
+session::command_search_by_address_place::~command_search_by_address_place()
+{
+ maps_area_destroy(boundary);
+ maps_item_hashtable_destroy(preference);
+ maps_place_filter_destroy(filter);
+}
+
+int session::command_search_by_address_place::run()
+{
+ if (error != MAPS_ERROR_NONE)
+ return error;
+
+ pending_request pr(plugin());
+
+ /* Get the plugin interface function */
+ maps_plugin_search_place_by_address_f func =
+ interface()->maps_plugin_search_place_by_address;
+ command_search_place_handler *handler = NULL;
+ if (func) {
+ /* No need to create the handler when the function is NULL */
+ pr.add(my_req_id);
+ handler = new command_search_place_handler(plugin(),
+ callback,
+ user_data,
+ my_req_id);
+ if (handler) {
+ /* Run the plugin interface function */
+ error = func(address.c_str(), boundary, filter, preference,
+ command_search_place_handler::foreach_place_cb, handler,
+ &handler->plg_req_id);
+
+ pr.update(my_req_id, handler);
+
+ MAPS_LOGD("session::command_search_by_address_place::run: %d",
+ my_req_id);
+
+ }
+ else {
+ error = MAPS_ERROR_OUT_OF_MEMORY;
+ }
+ }
+ else {
+ /* Plugin Function is NULL: use default empty function */
+ /*
+ func = plugin::get_empty_interface().
+ maps_plugin_search_place_by_address;
+ */
+ MAPS_LOGE("MAPS_ERROR_NOT_SUPPORTED: Can't get any plugin");
+ error = MAPS_ERROR_NOT_SUPPORTED;
+ }
+
+ const int ret = error;
+ destroy();
+ return ret;
+}
+
+/*----------------------------------------------------------------------------*/
+/*typedef int (*maps_plugin_search_route_f)(maps_service_h maps,
+* maps_item_hashtable_h preference, maps_coordinates_h origin,
+* maps_coordinates_h destination, maps_service_search_route_cb callback,
+* void *user_data, int *request_id); */
+session::command_search_route::command_search_route(maps_service_h ms,
+ const maps_item_hashtable_h pref,
+ const maps_coordinates_h orig,
+ const maps_coordinates_h dest,
+ maps_service_search_route_cb cb,
+ void *ud, int *request_id)
+ : command(ms)
+ , preference(NULL)
+ , origin(NULL)
+ , destination(NULL)
+ , callback(cb)
+ , user_data(ud)
+ , error(MAPS_ERROR_NONE)
+{
+ *request_id = command::command_request_id++;
+ my_req_id = *request_id;
+
+ if (pref &&
+ (maps_item_hashtable_clone(pref, &preference) != MAPS_ERROR_NONE))
+ error = MAPS_ERROR_INVALID_PARAMETER;
+
+ if (maps_coordinates_clone(orig, &origin) != MAPS_ERROR_NONE)
+ error = MAPS_ERROR_INVALID_PARAMETER;
+
+ if (maps_coordinates_clone(dest, &destination) != MAPS_ERROR_NONE)
+ error = MAPS_ERROR_INVALID_PARAMETER;
+
+}
+
+session::command_search_route::~command_search_route()
+{
+ maps_item_hashtable_destroy(preference);
+ maps_coordinates_destroy(origin);
+ maps_coordinates_destroy(destination);
+}
+
+int session::command_search_route::run()
+{
+
+ if (error != MAPS_ERROR_NONE)
+ return error;
+
+ pending_request pr(plugin());
+
+ /* Get the plugin interface function */
+ maps_plugin_search_route_f func = interface()->maps_plugin_search_route;
+ command_search_route_handler *handler = NULL;
+ if (func) {
+ /* No need to create the handler when the function is NULL */
+ pr.add(my_req_id);
+ handler = new command_search_route_handler(plugin(),
+ callback,
+ user_data,
+ my_req_id);
+
+ if (handler) {
+ /* Run the plugin interface function */
+ error = func(origin, destination, preference,
+ command_search_route_handler::foreach_route_cb,
+ handler, &handler->plg_req_id);
+
+ pr.update(my_req_id, handler);
+
+ MAPS_LOGD("session::command_search_route::run: %d", my_req_id);
+ }
+ else {
+ error = MAPS_ERROR_OUT_OF_MEMORY;
+ }
+ }
+ else {
+ /* Plugin Function is NULL: use default empty function */
+ /*
+ func = plugin::get_empty_interface().maps_plugin_search_route;
+ */
+ MAPS_LOGE("MAPS_ERROR_NOT_SUPPORTED: Can't get any plugin");
+ error = MAPS_ERROR_NOT_SUPPORTED;
+ }
+
+ const int ret = error;
+ destroy();
+ return ret;
+}
+
+/*----------------------------------------------------------------------------*/
+/*typedef int (*maps_plugin_search_route_waypoints_f)(maps_service_h maps,
+* maps_item_hashtable_h preference, maps_coordinates_h *waypoint_list,
+* int waypoint_num, maps_service_search_route_cb callback, void *user_data,
+* int *request_id); */
+session::command_search_route_waypoints::command_search_route_waypoints(
+ maps_service_h ms,
+ const maps_item_hashtable_h pref,
+ const maps_coordinates_h *list,
+ int num, maps_service_search_route_cb cb,
+ void *ud, int *request_id)
+ : command(ms)
+ , preference(NULL)
+ , waypoint_list(NULL)
+ , waypoint_num(num)
+ , callback(cb)
+ , user_data(ud)
+ , error(MAPS_ERROR_NONE)
+{
+ *request_id = command::command_request_id++;
+ my_req_id = *request_id;
+
+ if (pref &&
+ (maps_item_hashtable_clone(pref, &preference) != MAPS_ERROR_NONE))
+ error = MAPS_ERROR_INVALID_PARAMETER;
+
+ waypoint_list = new maps_coordinates_h[num];
+ for (int index = 0; index < num; index++) {
+ if (list[index] != NULL) {
+ maps_coordinates_clone(list[index],
+ &waypoint_list[index]);
+ }
+ }
+}
+
+session::command_search_route_waypoints::~command_search_route_waypoints()
+{
+ maps_item_hashtable_destroy(preference);
+
+ for (int index = 0; index < waypoint_num; index++) {
+ if (waypoint_list[index] != NULL) {
+ maps_coordinates_destroy(waypoint_list[index]);
+ }
+ }
+ delete [] waypoint_list;
+}
+
+int session::command_search_route_waypoints::run()
+{
+
+ if (error != MAPS_ERROR_NONE)
+ return error;
+
+ pending_request pr(plugin());
+
+ /* Get the plugin interface function */
+ maps_plugin_search_route_waypoints_f func =
+ interface()->maps_plugin_search_route_waypoints;
+
+ command_search_route_handler *handler = NULL;
+ if (func) {
+ /* No need to create the handler when the function is NULL */
+ pr.add(my_req_id);
+ handler = new command_search_route_handler(plugin(),
+ callback,
+ user_data,
+ my_req_id);
+ if (handler) {
+ /* Run the plugin interface function */
+ error = func(waypoint_list, waypoint_num, preference,
+ command_search_route_handler::foreach_route_cb, handler,
+ &handler->plg_req_id);
+
+ pr.update(my_req_id, handler);
+
+ MAPS_LOGD("session::command_search_place::run: %d", my_req_id);
+ }
+ else {
+ error = MAPS_ERROR_OUT_OF_MEMORY;
+ }
+ }
+ else {
+ /* Plugin Function is NULL: use default empty function */
+ /*
+ func = plugin::get_empty_interface().
+ maps_plugin_search_route_waypoints;
+ */
+ MAPS_LOGE("MAPS_ERROR_NOT_SUPPORTED: Can't get any plugin");
+ error = MAPS_ERROR_NOT_SUPPORTED;
+ }
+
+ const int ret = error;
+ destroy();
+ return ret;
+}
+
+session::command_search_route_handler::command_search_route_handler(
+ plugin::plugin_s *p,
+ maps_service_search_route_cb cb,
+ void *ud, int urid)
+ : command_handler(p, ud, urid)
+ , callback(cb)
+{
+}
+
+void session::command_search_route_handler::set_supported_data(maps_route_h
+ route)
+{
+ if (!route || !plugin())
+ return;
+
+ maps_string_hashtable_h data_supported = NULL;
+ if (maps_string_hashtable_create(&data_supported) != MAPS_ERROR_NONE)
+ return;
+
+ __put_to_hashtable(this, MAPS_ROUTE_PATH, _S(MAPS_ROUTE_PATH),
+ data_supported);
+ __put_to_hashtable(this, MAPS_ROUTE_SEGMENTS_PATH,
+ _S(MAPS_ROUTE_SEGMENTS_PATH), data_supported);
+ __put_to_hashtable(this, MAPS_ROUTE_SEGMENTS_MANEUVERS,
+ _S(MAPS_ROUTE_SEGMENTS_MANEUVERS), data_supported);
+
+ _maps_route_set_supported_data(route, data_supported);
+ maps_string_hashtable_destroy(data_supported);
+}
+
+bool session::command_search_route_handler::foreach_route_cb(maps_error_e error,
+ int request_id,
+ int index,
+ int length,
+ maps_route_h route,
+ void *user_data)
+{
+ command_search_route_handler *handler =
+ (command_search_route_handler *) user_data;
+
+ if (request_id != handler->plg_req_id) {
+ MAPS_LOGE(
+"\n\nERROR! Incorrect request id [%d] come from the plugin; expected [%d]\n\n",
+ request_id, handler->plg_req_id);
+ }
+
+ /* Make a user's copy of result data */
+ maps_route_h cloned_result = NULL;
+ if (error == MAPS_ERROR_NONE)
+ error = (maps_error_e) maps_route_clone(route, &cloned_result);
+ maps_route_destroy(route);
+
+ /* Check which data features are supported */
+ if (cloned_result)
+ handler->set_supported_data(cloned_result);
+
+ /* Send data to user */
+ const bool b =
+ handler->callback(error, handler->user_req_id, index, length,
+ cloned_result, handler->user_data);
+ if (!b || (index >= (length - 1))) {
+ pending_request pr(handler->plugin());
+ pr.remove(handler->user_req_id);
+ }
+
+ return b;
+}
+
+/*----------------------------------------------------------------------------*/
+/*typedef int (*maps_plugin_cancel_request_f)(maps_service_h maps,
+* int request_id); */
+int session::command_cancel_request::run()
+{
+ pending_request pr(plugin());
+ MAPS_LOGD("session::command_cancel_request::run: %d, %d", request_id,
+ pr.look_up(request_id));
+ const int error =
+ (pr.contains(request_id)) ? interface()->
+ maps_plugin_cancel_request(pr.
+ extract_plg_id(request_id)) : MAPS_ERROR_NOT_FOUND;
+
+ const int ret = error;
+ destroy();
+ return ret;
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_SERVICE_SESSION_COMMANDS_H__
+#define __MAPS_SERVICE_SESSION_COMMANDS_H__
+
+#include "command.h"
+
+namespace session
+{
+
+/*----------------------------------------------------------------------------*/
+ /*typedef int (*maps_plugin_geocode_f)(maps_service_h maps,
+ * const char *address, maps_service_geocode_cb callback,
+ * void *user_data, int* request_id); */
+ class command_geocode : public command
+ {
+ public:
+ const string address;
+ maps_item_hashtable_h preference;
+ maps_service_geocode_cb callback;
+ void *user_data;
+ int error;
+ public:
+ command_geocode(maps_service_h ms,
+ const string address,
+ const maps_item_hashtable_h preference,
+ maps_service_geocode_cb callback,
+ void *user_data, int *request_id);
+ virtual ~command_geocode();
+ private:
+ command_geocode() : command(NULL)
+ {
+ }
+ command_geocode(const command_geocode &src) : command(NULL)
+ {
+ }
+ command_geocode &operator=(const command_geocode &src)
+ {
+ return *this;
+ }
+ private:
+ virtual int run();
+ };
+
+ class command_geocode_handler : public command_handler
+ {
+ maps_service_geocode_cb callback;
+ public:
+ command_geocode_handler(plugin::plugin_s *plugin,
+ maps_service_geocode_cb callback,
+ void *user_data,
+ int user_req_id);
+ virtual ~command_geocode_handler()
+ {
+ };
+ private:
+ command_geocode_handler() : command_handler(NULL, NULL, 0) {}
+ command_geocode_handler(const command_geocode_handler &src) :
+ command_handler(NULL, NULL, 0)
+ {
+ }
+ command_geocode_handler &operator=(
+ const command_geocode_handler &src)
+ {
+ return *this;
+ }
+ private:
+ static bool foreach_geocode_cb(maps_error_e result,
+ int request_id, int index,
+ int total_count,
+ maps_coordinates_h coordinates,
+ void *user_data);
+ friend class command_geocode;
+ friend class command_geocode_inside_bounds;
+ friend class command_geocode_by_structured_address;
+ };
+
+/*----------------------------------------------------------------------------*/
+
+ /* TODO: rename to command_geocode_inside_area */
+
+ /*typedef int (*maps_plugin_geocode_inside_area_f)(maps_service_h maps,
+ * const char *address, maps_area_h bounds,
+ * maps_service_geocode_cb callback, void *user_data,
+ * int* request_id); */
+ class command_geocode_inside_bounds : public command
+ {
+ public:
+ string address;
+ maps_area_h bounds;
+ maps_item_hashtable_h preference;
+ maps_service_geocode_cb callback;
+ void *user_data;
+ int error;
+ public:
+ command_geocode_inside_bounds(maps_service_h ms,
+ const char *address,
+ const maps_area_h bounds,
+ const maps_item_hashtable_h
+ preference,
+ maps_service_geocode_cb callback,
+ void *user_data,
+ int *request_id);
+ virtual ~command_geocode_inside_bounds();
+ private:
+ command_geocode_inside_bounds() : command(NULL)
+ {
+ }
+ command_geocode_inside_bounds(
+ const command_geocode_inside_bounds &src)
+ : command(NULL)
+ {
+ }
+ command_geocode_inside_bounds &operator=(
+ const command_geocode_inside_bounds &src)
+ {
+ return *this;
+ }
+ private:
+ virtual int run();
+ };
+
+/*----------------------------------------------------------------------------*/
+ /*typedef int (*maps_plugin_geocode_by_structured_address_f)(
+ * maps_service_h maps, maps_address_h address,
+ * maps_preference_h preference, maps_service_geocode_cb callback,
+ * void *user_data, int *request_id); */
+ class command_geocode_by_structured_address : public command
+ {
+ public:
+ maps_address_h address;
+ maps_item_hashtable_h preference;
+ maps_service_geocode_cb callback;
+ void *user_data;
+ int error;
+ public:
+ command_geocode_by_structured_address(maps_service_h ms,
+ const maps_address_h
+ address,
+ const
+ maps_item_hashtable_h
+ preference,
+ maps_service_geocode_cb
+ callback,
+ void *user_data,
+ int *request_id);
+ virtual ~command_geocode_by_structured_address();
+ private:
+ command_geocode_by_structured_address() : command(NULL)
+ {
+ }
+ command_geocode_by_structured_address(
+ const command_geocode_by_structured_address &src)
+ : command(NULL)
+ {
+ }
+ command_geocode_by_structured_address &operator=(
+ const command_geocode_by_structured_address &src)
+ {
+ return *this;
+ }
+ private:
+ virtual int run();
+ };
+
+/*----------------------------------------------------------------------------*/
+ /*typedef int (*maps_plugin_reverse_geocode_f)(maps_service_h maps,
+ * double latitude, double longitude,
+ * maps_service_reverse_geocode_cb callback, void *user_data,
+ * int *request_id); */
+ class command_reverse_geocode : public command
+ {
+ public:
+ const string address;
+ double latitude;
+ double longitude;
+ maps_item_hashtable_h preference;
+ maps_service_reverse_geocode_cb callback;
+ void *user_data;
+ int error;
+ public:
+ command_reverse_geocode(maps_service_h ms,
+ double latitude, double longitude,
+ const maps_item_hashtable_h preference,
+ maps_service_reverse_geocode_cb
+ callback,
+ void *user_data, int *request_id);
+ virtual ~command_reverse_geocode();
+ private:
+ command_reverse_geocode() : command(NULL)
+ {
+ }
+ command_reverse_geocode(const command_reverse_geocode &src)
+ : command(NULL)
+ {
+ }
+ command_reverse_geocode& operator=(
+ const command_reverse_geocode &src)
+ {
+ return *this;
+ }
+ private:
+ virtual int run();
+ };
+
+ class command_reverse_geocode_handler : public command_handler
+ {
+ maps_service_reverse_geocode_cb callback;
+ public:
+ command_reverse_geocode_handler(plugin::plugin_s *plugin,
+ maps_service_reverse_geocode_cb
+ callback,
+ void *user_data,
+ int user_req_id);
+ virtual ~command_reverse_geocode_handler()
+ {
+ };
+ private:
+ command_reverse_geocode_handler()
+ : command_handler(NULL, NULL, 0)
+ {
+ }
+ command_reverse_geocode_handler(
+ command_reverse_geocode_handler &src)
+ : command_handler(NULL, NULL, 0)
+ {
+ }
+ command_reverse_geocode_handler &operator=(
+ const command_reverse_geocode_handler &src)
+ {
+ return *this;
+ }
+ private:
+ static void foreach_reverse_geocode_cb(maps_error_e result,
+ int request_id,
+ int index, int total,
+ maps_address_h address,
+ void *user_data);
+ friend class command_reverse_geocode;
+ };
+
+/*----------------------------------------------------------------------------*/
+ /*typedef int (*maps_plugin_search_place_f)(maps_service_h maps,
+ * maps_coordinates_h position, int distance,
+ * maps_item_hashtable_h preference, maps_place_filter_h filter,
+ * maps_service_search_place_cb callback, void *user_data,
+ * int *request_id); */
+ class command_search_place : public command
+ {
+ public:
+ maps_coordinates_h position;
+ int distance;
+ maps_item_hashtable_h preference;
+ maps_place_filter_h filter;
+ maps_service_search_place_cb callback;
+ void *user_data;
+
+ int error;
+ public:
+ command_search_place(maps_service_h ms,
+ const maps_coordinates_h position,
+ int distance,
+ const maps_item_hashtable_h preference,
+ const maps_place_filter_h filter,
+ maps_service_search_place_cb callback,
+ void *user_data, int *request_id);
+ virtual ~command_search_place();
+ private:
+ command_search_place() : command(NULL)
+ {
+ }
+ command_search_place(const command_search_place &src)
+ : command(NULL)
+ {
+ }
+ command_search_place &operator=(
+ const command_search_place &src)
+ {
+ return *this;
+ }
+ private:
+ virtual int run();
+ };
+
+ class command_search_place_handler : public command_handler
+ {
+ maps_service_search_place_cb callback;
+ public:
+ command_search_place_handler(plugin::plugin_s *plugin,
+ maps_service_search_place_cb
+ callback,
+ void *user_data, int user_req_id);
+ virtual ~command_search_place_handler()
+ {
+ };
+ private:
+ command_search_place_handler()
+ : command_handler(NULL, NULL, 0)
+ {
+ }
+ command_search_place_handler(
+ const command_search_place_handler &src)
+ : command_handler(NULL, NULL, 0)
+ {
+ }
+ command_search_place_handler &operator=(
+ const command_search_place_handler &src)
+ { return *this;
+ }
+ private:
+ static bool foreach_place_cb(maps_error_e error, int request_id,
+ int index, int length,
+ maps_place_h place,
+ void *user_data);
+ void set_supported_data(maps_place_h place);
+ friend class command_search_place;
+ friend class command_search_by_area_place;
+ friend class command_search_by_address_place;
+ };
+
+/*----------------------------------------------------------------------------*/
+ /*typedef int (*maps_plugin_search_place_by_area_f)(maps_service_h maps,
+ * maps_area_h boundary , maps_item_hashtable_h preference,
+ * maps_place_filter_h filter, maps_service_search_place_cb callback,
+ * void *user_data, int *request_id); */
+ class command_search_by_area_place : public command
+ {
+ public:
+ maps_area_h boundary;
+ maps_item_hashtable_h preference;
+ maps_place_filter_h filter;
+ maps_service_search_place_cb callback;
+ void *user_data;
+
+ int error;
+ public:
+ command_search_by_area_place(maps_service_h ms,
+ const maps_area_h boundary,
+ const maps_item_hashtable_h
+ preference,
+ const maps_place_filter_h filter,
+ maps_service_search_place_cb
+ callback,
+ void *user_data, int *request_id);
+ virtual ~command_search_by_area_place();
+ private:
+ command_search_by_area_place() : command(NULL)
+ {
+ }
+ command_search_by_area_place(
+ const command_search_by_area_place &src)
+ : command(NULL)
+ {
+ }
+ command_search_by_area_place &operator=(
+ const command_search_by_area_place &src)
+ {
+ return *this;
+ }
+ private:
+ virtual int run();
+ };
+
+/*----------------------------------------------------------------------------*/
+ /*typedef int (*maps_plugin_search_place_by_address_f)(
+ * maps_service_h maps, const char *address, maps_area_h boundary,
+ * maps_place_preference_h preference, maps_place_filter_h filter,
+ * maps_service_search_place_cb callback, void *user_data,
+ * int *request_id); */
+ class command_search_by_address_place : public command
+ {
+ public:
+ const string address;
+ maps_area_h boundary;
+ maps_item_hashtable_h preference;
+ maps_place_filter_h filter;
+ maps_service_search_place_cb callback;
+ void *user_data;
+
+ int error;
+ public:
+ command_search_by_address_place(maps_service_h ms,
+ const char *address,
+ const maps_area_h boundary,
+ const maps_item_hashtable_h preference,
+ const maps_place_filter_h filter,
+ maps_service_search_place_cb callback,
+ void *user_data, int *request_id);
+ virtual ~command_search_by_address_place();
+ private:
+ command_search_by_address_place() : command(NULL)
+ {
+ }
+ command_search_by_address_place(
+ const command_search_by_address_place &src)
+ : command(NULL)
+ {
+ }
+ command_search_by_address_place &operator=(
+ const command_search_by_address_place &src)
+ {
+ return *this;
+ }
+ private:
+ virtual int run();
+ };
+
+/*----------------------------------------------------------------------------*/
+ /*typedef int (*maps_plugin_search_route_f)(
+ * maps_service_h maps, maps_item_hashtable_h preference,
+ * maps_coordinates_h origin, maps_coordinates_h destination,
+ * maps_service_search_route_cb callback, void *user_data,
+ * int *request_id); */
+ class command_search_route_handler : public command_handler
+ {
+ maps_service_search_route_cb callback;
+ public:
+ command_search_route_handler(plugin::plugin_s *plugin,
+ maps_service_search_route_cb
+ callback,
+ void *user_data, int user_req_id);
+ virtual ~command_search_route_handler()
+ {
+ };
+ private:
+ command_search_route_handler()
+ : command_handler(NULL, NULL, 0)
+ {
+ }
+ command_search_route_handler(
+ const command_search_route_handler &src)
+ : command_handler(NULL, NULL, 0)
+ {
+ }
+ command_search_route_handler &operator=(
+ const command_search_route_handler &src)
+ {
+ return *this;
+ }
+ private:
+ static bool foreach_route_cb(maps_error_e error, int request_id,
+ int index, int length,
+ maps_route_h route,
+ void *user_data);
+ void set_supported_data(maps_route_h route);
+ friend class command_search_route;
+ friend class command_search_route_waypoints;
+ };
+
+ class command_search_route : public command
+ {
+ public:
+ maps_item_hashtable_h preference;
+ maps_coordinates_h origin;
+ maps_coordinates_h destination;
+ maps_service_search_route_cb callback;
+ void *user_data;
+
+ int error;
+ public:
+ command_search_route(maps_service_h ms,
+ const maps_item_hashtable_h preference,
+ const maps_coordinates_h origin,
+ const maps_coordinates_h destination,
+ maps_service_search_route_cb callback,
+ void *user_data, int *request_id);
+ virtual ~command_search_route();
+ private:
+ command_search_route() : command(NULL)
+ {
+ }
+ command_search_route(
+ const command_search_route &src)
+ : command(NULL)
+ {
+ }
+ command_search_route &operator=(
+ const command_search_route &src)
+ {
+ return *this;
+ }
+ private:
+ virtual int run();
+ };
+
+/*----------------------------------------------------------------------------*/
+ /*typedef int (*maps_plugin_search_route_f)(maps_service_h maps,
+ * maps_item_hashtable_h preference, maps_coordinates_h *waypoint_list,
+ * int waypoint_num, maps_service_search_route_cb callback,
+ * void *user_data, int *request_id); */
+ class command_search_route_waypoints:public command
+ {
+ public:
+ maps_item_hashtable_h preference;
+ maps_coordinates_h *waypoint_list;
+ int waypoint_num;
+ maps_service_search_route_cb callback;
+ void *user_data;
+
+ int error;
+ public:
+ command_search_route_waypoints(maps_service_h ms,
+ const maps_item_hashtable_h preference,
+ const maps_coordinates_h *waypoint_list,
+ int waypoint_num,
+ maps_service_search_route_cb callback,
+ void *user_data, int *request_id);
+ virtual ~command_search_route_waypoints();
+ private:
+ command_search_route_waypoints() : command(NULL)
+ {
+ }
+ command_search_route_waypoints(
+ const command_search_route_waypoints &src)
+ : command(NULL)
+ {
+ }
+ command_search_route_waypoints &operator=(
+ const command_search_route_waypoints &src)
+ {
+ return *this;
+ }
+ private:
+ virtual int run();
+ };
+
+/*----------------------------------------------------------------------------*/
+ /*typedef int (*maps_plugin_cancel_request_f)(maps_service_h maps,
+ * int request_id); */
+ class command_cancel_request : public command
+ {
+ public:
+ int request_id;
+ public:
+ command_cancel_request(maps_service_h ms, int rid)
+ : command(ms),
+ request_id(rid)
+ {
+ }
+ virtual ~command_cancel_request()
+ {
+ };
+ private:
+ command_cancel_request() : command(NULL)
+ {
+ }
+ command_cancel_request(const command_cancel_request &src)
+ : command(NULL)
+ {
+ }
+ command_cancel_request &operator=(
+ const command_cancel_request &src)
+ {
+ return *this;
+ }
+ private:
+ virtual int run();
+ };
+}
+
+#endif /* __MAPS_SERVICE_SESSION_COMMANDS_H__ */
--- /dev/null
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * 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 <unistd.h>
+#include "thread.h"
+#include "command_queue.h"
+#include "command.h"
+
+session::thread::thread()
+{
+
+}
+
+session::thread::~thread()
+{
+
+}
+
+/* Thread function: pops the item from the queue and performs the command */
+void *session::thread::queue_thread(void *data)
+{
+
+ sleep(0); /* Just switch the thread to accomplish previous
+ initialization routines */
+
+ if (!data)
+ return NULL;
+ plugin::plugin_s *p = (plugin::plugin_s *) data;
+
+ command_queue *cq = session::command_queue::interface();
+ while (p->is_working)
+ cq->process(p); /* Continuously perform queue processing */
+
+ return NULL;
+}
+
+void session::thread::run(plugin::plugin_s *p)
+{
+
+ if (!p)
+ return;
+ if (p->thread)
+ return; /* Check whether the thread is already
+ started, */
+ /* Start if needed */
+
+ p->is_working = true;
+
+ p->thread = g_thread_new("queue_thread", &queue_thread, p);
+ if(p->thread)
+ g_thread_unref(p->thread);
+}
+
+void session::thread::stop(plugin::plugin_s *p)
+{
+ if (!p)
+ return;
+
+ p->is_working = false;
+
+ command_queue *cq = session::command_queue::interface();
+ cq->clear(p);
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_SERVICE_SESSION_THREAD_H__
+#define __MAPS_SERVICE_SESSION_THREAD_H__
+
+#include "module.h"
+
+namespace session
+{
+
+ class thread
+ {
+ public:
+ thread();
+ virtual ~thread();
+ public:
+ void run(plugin::plugin_s *p);
+ void stop(plugin::plugin_s *p);
+ private:
+ /* Thread function: pops the item from the queue and performs
+ * the command */
+ static void *queue_thread(void *data);
+ };
+};
+
+#endif /* __MAPS_SERVICE_SESSION_THREAD_H__ */
\ No newline at end of file
--- /dev/null
+SET(fw_test "${fw_name}-test")
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(${fw_test} REQUIRED )
+FOREACH(flag ${${fw_test}_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -Werror")
+
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -Wall -Werror -fvisibility=default")
+SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
+
+INCLUDE_DIRECTORIES(
+ src
+ src/util
+ src/api
+ src/plugin
+ src/session
+ src/tutorial
+ )
+
+SET (TEST_SRCS
+
+ ###########################################################
+ # Tutorial sources
+ src/tutorial/maps_service_tutorial.cpp
+
+ ###########################################################
+ # Unit test sources
+ src/maps_service_test.cpp
+
+ src/util/maps_object.cpp
+ src/util/maps_test_utils.cpp
+
+ src/plugin/discovery_test.cpp
+ src/plugin/module_test.cpp
+
+ src/session/command_test.cpp
+ src/session/commands_test.cpp
+ src/session/command_queue_test.cpp
+ src/session/thread_test.cpp
+
+
+ src/api/maps_api_test.cpp
+ src/api/maps_area_test.cpp
+ src/api/maps_coordinates_test.cpp
+ src/api/maps_extra_types_test.cpp
+
+
+ src/api/maps_address_test.cpp
+
+
+ src/api/maps_place_test.cpp
+ src/api/maps_place_category_test.cpp
+ src/api/maps_place_attribute_test.cpp
+ src/api/maps_place_contact_test.cpp
+ src/api/maps_place_editorial_test.cpp
+ src/api/maps_place_link_object_test.cpp
+ src/api/maps_place_media_test.cpp
+ src/api/maps_place_url_test.cpp
+ src/api/maps_place_review_test.cpp
+ src/api/maps_place_rating_test.cpp
+ src/api/maps_place_image_test.cpp
+ src/api/maps_place_filter_test.cpp
+
+ src/api/maps_route_test.cpp
+ src/api/maps_route_maneuver_test.cpp
+ src/api/maps_route_segment_test.cpp
+
+ src/api/maps_preference_test.cpp
+ )
+
+#aux_source_directory(src sources)
+#FOREACH(src ${sources})
+# GET_FILENAME_COMPONENT(src_name ${src} NAME_WE)
+#ENDFOREACH()
+MESSAGE(">>>>>>>>>>>>>${TEST_SRCS}")
+
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIBDIR}")
+
+ADD_EXECUTABLE(${fw_test} ${TEST_SRCS})
+TARGET_LINK_LIBRARIES(${fw_test} ${fw_name} ${${fw_test}_LDFLAGS})
+
+#INSTALL(FILES ${CMAKE_SOURCE_DIR}/test/memleak_test.sh DESTINATION /usr/share/packages)
+INSTALL(TARGETS capi-maps-service-test DESTINATION /opt/usr/devel/)
+INSTALL(FILES capi-maps-service-test.efl DESTINATION /etc/smack/accesses.d)
+
+ADD_SUBDIRECTORY(dummy_plugin)
--- /dev/null
+capi-maps-service-test sys-assert::core rwxat- ------
+org.tizen.crash-popup capi-maps-service-test --x--- ------
+capi-maps-service-test privacy-manager::db rwxa-- ------
+capi-maps-service-test privacy-manager::daemon -w---- ------
+capi-maps-service-test sdbd rwx--l ------
+capi-maps-service-test wrt-security-daemon rwx--l ------
+capi-maps-service-test aul::launch --x--- ------
+capi-maps-service-test org.tizen.browser --x--- ------
+capi-maps-service-test xorg -w---- ------
+capi-maps-service-test aul r----- ------
+capi-maps-service-test isf r----- ------
+capi-maps-service-test pkgmgr::db r----l ------
+capi-maps-service-test pkgmgr::info r----- ------
+capi-maps-service-test ail::db r----- ------
+capi-maps-service-test system::vconf_inhouse r----l ------
+capi-maps-service-test system::vconf_system r----l ------
+capi-maps-service-test system::vconf_setting r----l ------
+capi-maps-service-test system::vconf_multimedia r----l ------
+capi-maps-service-test system::vconf_misc rwx--l ------
+capi-maps-service-test system::vconf_privacy rwx--- ------
+capi-maps-service-test system::vconf rwxat- ------
+capi-maps-service-test system::vconf_network rw---- ------
+capi-maps-service-test system::share rwxat- ------
+capi-maps-service-test system::hwcodec rw---- ------
+capi-maps-service-test system::crash -wx--- ------
+capi-maps-service-test system::use_internet rw---- ------
+capi-maps-service-test system::app_logging -w---- ------
+capi-maps-service-test location_fw::vconf rw---- ------
+capi-maps-service-test location_fw::client rw---- ------
+capi-maps-service-test location_fw::server r----- ------
+capi-maps-service-test connman::get w---- ------
--- /dev/null
+<manifest>
+ <define>
+ <domain name="capi-maps-service-test"/>
+ <request>
+ <smack request="sys-assert::core" type="rwxat"/>
+ <smack request="deviced::display" type="rw"/>
+ <smack request="device::app_logging" type="w"/>
+ <smack request="device::sys_logging" type="w"/>
+ <smack request="system::vconf_setting" type="r" />
+ <smack request="system::vconf" type="r" />
+ <smack request="location_fw::client" type="rwx" />
+ <smack request="tizen::vconf::location" type="rw"/>
+ <smack request="tizen::vconf::location::enable" type="rw"/>
+ <smack request="tizen::vconf::public::r" type="rx"/>
+ <smack request="tizen::vconf::public::r::platform::rw" type="rw"/>
+ <smack request="tizen::vconf::platform::rw" type="rw"/>
+ <smack request="system::use_internet" type="rwx"/>
+ <smack request="connman::get" type="w"/>
+ </request>
+ <permit>
+ <smack permit="system::use_internet" type="rwx"/>
+ <smack permit="sdbd" type="rx"/>
+ </permit>
+ </define>
+ <assign>
+ <filesystem path="/usr/share/packages/capi-maps-service-test.xml" label="_"/>
+ </assign>
+</manifest>
--- /dev/null
+SET(DUMMY_PLUGIN "maps-plugin-test")
+
+SET(DUMMY_PLUGIN_SRC
+ dummy_plugin.cpp
+ ../src/util/maps_object.cpp
+ )
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(${DUMMY_PLUGIN} REQUIRED)
+FOREACH(flag ${${DUMMY_PLUGIN}_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -Werror")
+
+ADD_LIBRARY(${DUMMY_PLUGIN} SHARED ${DUMMY_PLUGIN_SRC})
+SET_TARGET_PROPERTIES(${DUMMY_PLUGIN}
+ PROPERTIES
+ VERSION ${FULLVER}
+ SOVERSION ${MAJORVER}
+ CLEAN_DIRECT_OUTPUT 1
+ )
+
+TARGET_LINK_LIBRARIES(${DUMMY_PLUGIN} ${fw_name} ${${DUMMY_PLUGIN}_LDFLAGS})
+
+INSTALL(TARGETS ${DUMMY_PLUGIN} DESTINATION ${LIBDIR}/maps/plugins)
--- /dev/null
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * 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 <maps_service.h>
+#include <maps_error.h>
+#include <maps_plugin.h>
+#include <maps_address.h>
+#include <maps_place_plugin.h>
+#include <maps_route_plugin.h>
+#include <glib.h>
+
+#include <maps_object.h>
+using namespace maps;
+
+static int dummy_geocode_request_id = 101;
+static char __provider_key[1024] = { 0 };
+
+/*----------------------------------------------------------------------------*/
+/* Service API */
+
+EXPORT_API int maps_plugin_init(maps_plugin_h *plugin)
+{
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_plugin_shutdown(maps_plugin_h plugin)
+{
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_plugin_get_info(maps_plugin_info_h *info)
+{
+ /*g_print("\n\nplugin maps_plugin_get_info\n\n"); */
+ maps_plugin_info_create(info);
+ maps_plugin_info_set_provider_name(*info, "Maps Provider");
+ return MAPS_ERROR_NONE;
+}
+
+/*----------------------------------------------------------------------------*/
+/*
+ * Maps API
+ */
+
+EXPORT_API int maps_plugin_set_provider_key(const char *map_key)
+{
+ g_return_val_if_fail(map_key, MAPS_ERROR_INVALID_PARAMETER);
+ g_snprintf(__provider_key, 1024, "%s", map_key);
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_plugin_get_provider_key(char **map_key)
+{
+ g_return_val_if_fail(map_key, MAPS_ERROR_INVALID_PARAMETER);
+ *map_key = g_strndup(__provider_key, 1024);
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_plugin_get_preference(maps_item_hashtable_h *preference)
+{
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_plugin_set_preference(maps_item_hashtable_h preference)
+{
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_plugin_is_service_supported(maps_service_e service,
+ bool *supported)
+{
+ switch (service) {
+ case MAPS_SERVICE_GEOCODE:
+ case MAPS_SERVICE_GEOCODE_INSIDE_AREA:
+ case MAPS_SERVICE_GEOCODE_BY_STRUCTURED_ADDRESS:
+ case MAPS_SERVICE_REVERSE_GEOCODE:
+ case MAPS_SERVICE_SEARCH_PLACE:
+ case MAPS_SERVICE_SEARCH_PLACE_BY_AREA:
+ case MAPS_SERVICE_SEARCH_PLACE_BY_ADDRESS:
+ case MAPS_SERVICE_SEARCH_ROUTE:
+ case MAPS_SERVICE_SEARCH_ROUTE_WAYPOINTS:
+ case MAPS_SERVICE_CANCEL_REQUEST:
+ *supported = true;
+ return MAPS_ERROR_NONE;
+ default:
+ *supported = false;
+ return MAPS_ERROR_NOT_SUPPORTED;
+ }
+}
+
+EXPORT_API int maps_plugin_is_data_supported(maps_service_data_e data,
+ bool *supported)
+{
+ switch (data) {
+ case MAPS_PLACE_ADDRESS:
+ case MAPS_PLACE_RATING:
+ case MAPS_PLACE_CATEGORIES:
+ case MAPS_PLACE_ATTRIBUTES:
+ case MAPS_PLACE_CONTACTS:
+ case MAPS_PLACE_EDITORIALS:
+ case MAPS_PLACE_REVIEWS:
+ case MAPS_PLACE_IMAGE:
+ case MAPS_PLACE_SUPPLIER:
+ case MAPS_PLACE_RELATED:
+ case MAPS_ROUTE_PATH:
+ case MAPS_ROUTE_SEGMENTS_PATH:
+ case MAPS_ROUTE_SEGMENTS_MANEUVERS:
+ *supported = true;
+ return MAPS_ERROR_NONE;
+ default:
+ *supported = false;
+ return MAPS_ERROR_NOT_SUPPORTED;
+ }
+}
+
+
+EXPORT_API int maps_plugin_geocode(const char *address,
+ const maps_item_hashtable_h preference,
+ maps_service_geocode_cb callback,
+ void *user_data, int *request_id)
+{
+ g_return_val_if_fail(address, MAPS_ERROR_INVALID_PARAMETER);
+ g_return_val_if_fail(callback, MAPS_ERROR_INVALID_PARAMETER);
+ g_return_val_if_fail(request_id, MAPS_ERROR_INVALID_PARAMETER);
+ g_return_val_if_fail(preference, MAPS_ERROR_INVALID_PARAMETER);
+
+ *request_id = dummy_geocode_request_id++;
+
+ /* For testing purposes */
+ bool no_need_callback = false;
+ maps_item_hashtable_contains(preference, "no_need_callback",
+ &no_need_callback);
+ if (no_need_callback)
+ return MAPS_ERROR_NONE;
+
+ coordinates c(11.1, 22.2);
+ callback(MAPS_ERROR_NONE, *request_id, 0, 1, c.clone(), user_data);
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_plugin_geocode_inside_area(const char *address,
+ const maps_area_h bounds,
+ const maps_item_hashtable_h
+ preference,
+ maps_service_geocode_cb callback,
+ void *user_data, int *request_id)
+{
+ g_return_val_if_fail(address, MAPS_ERROR_INVALID_PARAMETER);
+ g_return_val_if_fail(bounds, MAPS_ERROR_INVALID_PARAMETER);
+ g_return_val_if_fail(callback, MAPS_ERROR_INVALID_PARAMETER);
+ g_return_val_if_fail(request_id, MAPS_ERROR_INVALID_PARAMETER);
+ g_return_val_if_fail(preference, MAPS_ERROR_INVALID_PARAMETER);
+
+ *request_id = dummy_geocode_request_id++;
+
+ /* For testing purposes */
+ bool no_need_callback = false;
+ maps_item_hashtable_contains(preference, "no_need_callback",
+ &no_need_callback);
+ if (no_need_callback)
+ return MAPS_ERROR_NONE;
+
+ coordinates c(11.1, 22.2);
+ callback(MAPS_ERROR_NONE, *request_id, 0, 1, c.clone(), user_data);
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_plugin_geocode_by_structured_address(const maps_address_h
+ address,
+ const maps_preference_h
+ preference,
+ maps_service_geocode_cb
+ callback,
+ void *user_data,
+ int *request_id)
+{
+ g_return_val_if_fail(address, MAPS_ERROR_INVALID_PARAMETER);
+ g_return_val_if_fail(callback, MAPS_ERROR_INVALID_PARAMETER);
+ g_return_val_if_fail(request_id, MAPS_ERROR_INVALID_PARAMETER);
+ g_return_val_if_fail(preference, MAPS_ERROR_INVALID_PARAMETER);
+
+ *request_id = dummy_geocode_request_id++;
+
+ /* For testing purposes */
+ bool no_need_callback = false;
+ maps_item_hashtable_contains(preference, "no_need_callback",
+ &no_need_callback);
+ if (no_need_callback)
+ return MAPS_ERROR_NONE;
+
+ coordinates c(11.1, 22.2);
+ callback(MAPS_ERROR_NONE, *request_id, 0, 1, c.clone(), user_data);
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_plugin_reverse_geocode(double latitude, double longitude,
+ const maps_item_hashtable_h
+ preference,
+ maps_service_reverse_geocode_cb
+ callback,
+ void *user_data,
+ int *request_id)
+{
+ g_return_val_if_fail(request_id, MAPS_ERROR_INVALID_PARAMETER);
+ g_return_val_if_fail(preference, MAPS_ERROR_INVALID_PARAMETER);
+
+ *request_id = dummy_geocode_request_id++;
+
+ /* For testing purposes */
+ bool no_need_callback = false;
+ maps_item_hashtable_contains(preference, "no_need_callback",
+ &no_need_callback);
+ if (no_need_callback)
+ return MAPS_ERROR_NONE;
+
+ address a;
+ maps_address_set_building_number(a, "12");
+ maps_address_set_street(a, "Na Boyishti");
+ callback(MAPS_ERROR_NONE, *request_id, 0, 1, a.clone(), user_data);
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_plugin_search_place(const maps_coordinates_h position,
+ int distance,
+ const maps_place_filter_h filter,
+ maps_preference_h preference,
+ maps_service_search_place_cb callback,
+ void *user_data, int *request_id)
+{
+
+ *request_id = dummy_geocode_request_id++;
+
+ /* For testing purposes */
+ bool no_need_callback = false;
+ maps_item_hashtable_contains(preference, "no_need_callback",
+ &no_need_callback);
+ if (no_need_callback)
+ return MAPS_ERROR_NONE;
+
+ place p;
+ maps_place_set_id(p, "1722/12");
+ maps_place_set_name(p, "U Kalicha");
+ callback(MAPS_ERROR_NONE, *request_id, 0, 1, p.clone(), user_data);
+
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_plugin_search_place_by_area(const maps_area_h boundary,
+ const maps_place_filter_h
+ filter,
+ maps_preference_h preference,
+ maps_service_search_place_cb
+ callback,
+ void *user_data,
+ int *request_id)
+{
+
+ *request_id = dummy_geocode_request_id++;
+
+ /* For testing purposes */
+ bool no_need_callback = false;
+ maps_item_hashtable_contains(preference, "no_need_callback",
+ &no_need_callback);
+ if (no_need_callback)
+ return MAPS_ERROR_NONE;
+
+ place p;
+ maps_place_set_id(p, "1722/12");
+ maps_place_set_name(p, "U Kalicha");
+ callback(MAPS_ERROR_NONE, *request_id, 0, 1, p.clone(), user_data);
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_plugin_search_place_by_address(const char *address,
+ const maps_area_h boundary,
+ const maps_place_filter_h
+ filter,
+ maps_preference_h preference,
+ maps_service_search_place_cb
+ callback,
+ void *user_data,
+ int *request_id)
+{
+
+ *request_id = dummy_geocode_request_id++;
+
+ /* For testing purposes */
+ bool no_need_callback = false;
+ maps_item_hashtable_contains(preference, "no_need_callback",
+ &no_need_callback);
+ if (no_need_callback)
+ return MAPS_ERROR_NONE;
+
+ place p;
+ maps_place_set_id(p, "1722/12");
+ maps_place_set_name(p, "U Kalicha");
+ callback(MAPS_ERROR_NONE, *request_id, 0, 1, p.clone(), user_data);
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_plugin_search_route(const maps_coordinates_h origin,
+ const maps_coordinates_h destination,
+ maps_preference_h preference,
+ maps_service_search_route_cb callback,
+ void *user_data,
+ int *request_id)
+{
+
+ /*g_print("Maps Plugin Search Route\n\n"); */
+ *request_id = dummy_geocode_request_id++;
+
+ /* For testing purposes */
+ bool no_need_callback = false;
+ maps_item_hashtable_contains(preference, "no_need_callback",
+ &no_need_callback);
+ if (no_need_callback)
+ return MAPS_ERROR_NONE;
+
+ route route;
+
+ item_list <route_maneuver> maneuvers;
+ route_maneuver m1, m2;
+ maneuvers.add(m1);
+ maneuvers.add(m2);
+
+ item_list <route_segment> segments;
+ route_segment s1, s2;
+
+ maps_route_segment_set_origin(s1, coordinates(11.1, 12.1));
+ maps_route_segment_set_destination(s1, coordinates(21.1, 22.1));
+
+ maps_route_segment_set_origin(s2, coordinates(11.1, 12.1));
+ maps_route_segment_set_destination(s2, coordinates(21.1, 22.1));
+
+ maps_route_segment_set_maneuvers(s1, maneuvers);
+ maps_route_segment_set_maneuvers(s2, maneuvers);
+
+ segments.add(s1);
+ segments.add(s2);
+ maps_route_set_segments(route, segments);
+
+ callback(MAPS_ERROR_NONE, *request_id, 0, 1, route.clone(), user_data);
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_plugin_search_route_waypoints(const maps_coordinates_h *
+ waypoint_list,
+ int waypoint_num,
+ maps_preference_h preference,
+ maps_service_search_route_cb
+ callback,
+ void *user_data,
+ int *request_id)
+{
+ *request_id = dummy_geocode_request_id++;
+
+ /* For testing purposes */
+ bool no_need_callback = false;
+ maps_item_hashtable_contains(preference, "no_need_callback",
+ &no_need_callback);
+ if (no_need_callback)
+ return MAPS_ERROR_NONE;
+
+ route route;
+
+ item_list <route_maneuver> maneuvers;
+ route_maneuver m1, m2;
+ maneuvers.add(m1);
+ maneuvers.add(m2);
+
+ item_list <route_segment> segments;
+ route_segment s1, s2;
+
+ maps_route_segment_set_origin(s1, coordinates(11.1, 12.1));
+ maps_route_segment_set_destination(s1, coordinates(21.1, 22.1));
+
+ maps_route_segment_set_origin(s2, coordinates(11.1, 12.1));
+ maps_route_segment_set_destination(s2, coordinates(21.1, 22.1));
+
+ maps_route_segment_set_maneuvers(s1, maneuvers);
+ maps_route_segment_set_maneuvers(s2, maneuvers);
+
+ segments.add(s1);
+ segments.add(s2);
+ maps_route_set_segments(route, segments);
+
+ callback(MAPS_ERROR_NONE, *request_id, 0, 1, route.clone(), user_data);
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_plugin_cancel_request(int request_id)
+{
+ return MAPS_ERROR_NONE;
+}
--- /dev/null
+<manifest>
+ <request>
+ <domain name="_"/>
+ </request>
+</manifest>
\ No newline at end of file
--- /dev/null
+#!/bin/bash
+valgrind --leak-check=yes /usr/bin/capi-maps-service-test
+#G_DEBUG=gc-friendly G_SLICE=always-malloc valgrind ./maps_test
--- /dev/null
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * 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 "maps_address_test.h"
+#include "maps_address.h"
+#include "maps_error.h"
+#include <glib.h>
+
+/* int utc_maps_address_create (maps_address_h* address) */
+/* int maps_address_destroy (maps_address_h* address); */
+void utc_maps_address_create_p(void)
+{
+ maps_address_h address = NULL;
+ int error = maps_address_create(&address);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(address);
+
+ error = maps_address_destroy(address);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_address_create_n(void)
+{
+ int error = maps_address_create(NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/*----------------------------------------------------------------------------*/
+class test_env
+{
+ public:
+ maps_address_h a;
+ public:
+ test_env():a(NULL)
+ {
+ const int error = maps_address_create(&a);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(a);
+ }
+ ~test_env()
+ {
+ const int error = maps_address_destroy(a);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ }
+};
+
+/*----------------------------------------------------------------------------*/
+
+/* int maps_address_clone (maps_address_h origin, maps_address_h* cloned); */
+void utc_maps_address_clone_p()
+{
+ test_env e;
+
+ /* set test values for original address */
+ /*------------------------------------ */
+ int error = maps_address_set_building_number(e.a, "building_number");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_address_set_street(e.a, "street");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_address_set_district(e.a, "district");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_address_set_city(e.a, "city");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_address_set_state(e.a, "state");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_address_set_country(e.a, "country");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_address_set_country_code(e.a, "country_code");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_address_set_county(e.a, "county");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_address_set_postal_code(e.a, "postal_code");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_address_set_freetext(e.a, "freetext");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ /*------------------------------------ */
+
+ maps_address_h cloned = NULL;
+ error = maps_address_clone(e.a, &cloned);
+
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(cloned);
+
+ /* test if values are cloned correctly */
+ /*------------------------------------ */
+ char* building_number = NULL;
+ error = maps_address_get_building_number(cloned, &building_number);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(building_number, ==, "building_number");
+ g_free(building_number);
+
+ char* street = NULL;
+ error = maps_address_get_street(cloned, &street);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(street, ==, "street");
+ g_free(street);
+
+ char* district = NULL;
+ error = maps_address_get_district(cloned, &district);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(district, ==, "district");
+ g_free(district);
+
+ char* city = NULL;
+ error = maps_address_get_city(cloned, &city);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(city, ==, "city");
+ g_free(city);
+
+ char* state = NULL;
+ error = maps_address_get_state(cloned, &state);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(state, ==, "state");
+ g_free(state);
+
+ char* country = NULL;
+ error = maps_address_get_country(cloned, &country);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(country, ==, "country");
+ g_free(country);
+
+ char* country_code = NULL;
+ error = maps_address_get_country_code(cloned, &country_code);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(country_code, ==, "country_code");
+ g_free(country_code);
+
+ char* county = NULL;
+ error = maps_address_get_county(cloned, &county);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(county, ==, "county");
+ g_free(county);
+
+ char* postal_code = NULL;
+ error = maps_address_get_postal_code(cloned, &postal_code);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(postal_code, ==, "postal_code");
+ g_free(postal_code);
+
+ char* freetext = NULL;
+ error = maps_address_get_freetext(cloned, &freetext);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(freetext, ==, "freetext");
+ g_free(freetext);
+ /*------------------------------------ */
+
+ error = maps_address_destroy(cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_address_clone_n()
+{
+ test_env e;
+
+ int error = maps_address_clone(e.a, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ maps_address_h a = NULL;
+ error = maps_address_clone(NULL, &a);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!a);
+
+ error = maps_address_clone(NULL, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_address_set_building_number(maps_address_h addr,
+* const char* building_number); */
+/* int maps_address_get_building_number(maps_address_h addr,
+* char** building_number); */
+void utc_maps_address_building_number_p(void)
+{
+ test_env e;
+
+ int error = maps_address_set_building_number(e.a, "13");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* building_number = NULL;
+ error = maps_address_get_building_number(e.a, &building_number);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(building_number, ==, "13");
+ g_free(building_number);
+}
+
+void utc_maps_address_building_number_n(void)
+{
+ test_env e;
+
+ int error = maps_address_set_building_number(e.a, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_address_set_building_number(NULL, "13");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_address_set_building_number(NULL, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* building_number = NULL;
+ error = maps_address_get_building_number(NULL, &building_number);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!building_number);
+
+ error = maps_address_get_building_number(e.a, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!building_number);
+
+ error = maps_address_get_building_number(NULL, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!building_number);
+}
+
+/* int maps_address_set_street(maps_address_h addr, const char* street); */
+/* int maps_address_get_street(maps_address_h addr, char** street); */
+void utc_maps_address_street_p(void)
+{
+ test_env e;
+
+ int error = maps_address_set_street(e.a, "Gangnam");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* street = NULL;
+ error = maps_address_get_street(e.a, &street);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(street, ==, "Gangnam");
+ g_free(street);
+}
+
+void utc_maps_address_street_n(void)
+{
+ test_env e;
+
+ int error = maps_address_set_street(e.a, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_address_set_street(NULL, "Gangnam");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_address_set_street(NULL, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* street = NULL;
+ error = maps_address_get_street(NULL, &street);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!street);
+
+ error = maps_address_get_street(e.a, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!street);
+
+ error = maps_address_get_street(NULL, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!street);
+}
+
+/* int maps_address_set_district(maps_address_h addr, const char* district); */
+/*int maps_address_get_district(maps_address_h addr, char** district); */
+void utc_maps_address_district_p(void)
+{
+ test_env e;
+
+ int error = maps_address_set_district(e.a, "Gangnam");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* district = NULL;
+ error = maps_address_get_district(e.a, &district);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(district, ==, "Gangnam");
+ g_free(district);
+}
+
+void utc_maps_address_district_n(void)
+{
+ test_env e;
+
+ int error = maps_address_set_district(e.a, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_address_set_district(NULL, "Gangnam");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_address_set_district(NULL, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* district = NULL;
+ error = maps_address_get_district(NULL, &district);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!district);
+
+ error = maps_address_get_district(e.a, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!district);
+
+ error = maps_address_get_district(NULL, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!district);
+}
+
+/* int maps_address_set_city(maps_address_h addr, const char* city); */
+/* int maps_address_get_city(maps_address_h addr, char** city); */
+void utc_maps_address_city_p(void)
+{
+ test_env e;
+
+ int error = maps_address_set_city(e.a, "Seoul");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* city = NULL;
+ error = maps_address_get_city(e.a, &city);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(city, ==, "Seoul");
+ g_free(city);
+}
+
+void utc_maps_address_city_n(void)
+{
+ test_env e;
+
+ int error = maps_address_set_city(e.a, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_address_set_city(NULL, "Seoul");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_address_set_city(NULL, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* city = NULL;
+ error = maps_address_get_city(NULL, &city);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!city);
+
+ error = maps_address_get_city(e.a, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!city);
+
+ error = maps_address_get_city(NULL, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!city);
+}
+
+/* int maps_address_set_state(maps_address_h addr, const char* state); */
+/* int maps_address_get_state(maps_address_h addr, char** state); */
+void utc_maps_address_state_p(void)
+{
+ test_env e;
+
+ int error = maps_address_set_state(e.a, "Gyeonggi");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* state = NULL;
+ error = maps_address_get_state(e.a, &state);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(state, ==, "Gyeonggi");
+ g_free(state);
+}
+
+void utc_maps_address_state_n(void)
+{
+ test_env e;
+
+ int error = maps_address_set_state(e.a, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_address_set_state(NULL, "Gyeonggi");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_address_set_state(NULL, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* state = NULL;
+ error = maps_address_get_state(NULL, &state);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!state);
+
+ error = maps_address_get_state(e.a, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!state);
+
+ error = maps_address_get_state(NULL, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!state);
+}
+
+/* int maps_address_set_country(maps_address_h addr, const char* country); */
+/* int maps_address_get_country(maps_address_h addr, char** country); */
+void utc_maps_address_country_p(void)
+{
+ test_env e;
+
+ int error = maps_address_set_country(e.a, "ROK");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* country = NULL;
+ error = maps_address_get_country(e.a, &country);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(country, ==, "ROK");
+ g_free(country);
+}
+
+void utc_maps_address_country_n(void)
+{
+ test_env e;
+
+ int error = maps_address_set_country(e.a, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_address_set_country(NULL, "ROK");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_address_set_country(NULL, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* country = NULL;
+ error = maps_address_get_country(NULL, &country);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!country);
+
+ error = maps_address_get_country(e.a, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!country);
+
+ error = maps_address_get_country(NULL, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!country);
+}
+
+/* int maps_address_set_country_code(maps_address_h addr,
+* const char* country_code); */
+/* int maps_address_get_country_code(maps_address_h addr,
+* char** country_code); */
+void utc_maps_address_country_code_p(void)
+{
+ test_env e;
+
+ int error = maps_address_set_country_code(e.a, "+82");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* country_code = NULL;
+ error = maps_address_get_country_code(e.a, &country_code);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(country_code, ==, "+82");
+ g_free(country_code);
+}
+
+void utc_maps_address_country_code_n(void)
+{
+ test_env e;
+
+ int error = maps_address_set_country_code(e.a, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_address_set_country_code(NULL, "+82");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_address_set_country_code(NULL, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* country_code = NULL;
+ error = maps_address_get_country_code(NULL, &country_code);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!country_code);
+
+ error = maps_address_get_country_code(e.a, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!country_code);
+
+ error = maps_address_get_country_code(NULL, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!country_code);
+}
+
+/* int maps_address_set_county(maps_address_h addr, const char* county); */
+/* int maps_address_get_county(maps_address_h addr, char** county); */
+void utc_maps_address_county_p(void)
+{
+ test_env e;
+
+ int error = maps_address_set_county(e.a, "---");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* county = NULL;
+ error = maps_address_get_county(e.a, &county);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(county, ==, "---");
+ g_free(county);
+}
+
+void utc_maps_address_county_n(void)
+{
+ test_env e;
+
+ int error = maps_address_set_county(e.a, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_address_set_county(NULL, "---");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_address_set_county(NULL, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* county = NULL;
+ error = maps_address_get_county(NULL, &county);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!county);
+
+ error = maps_address_get_county(e.a, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!county);
+
+ error = maps_address_get_county(NULL, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!county);
+}
+
+/* int maps_address_set_postal_code(maps_address_h addr,
+* const char* postal_code); */
+/* int maps_address_get_postal_code(maps_address_h addr,
+* char** postal_code); */
+void utc_maps_address_postal_code_p(void)
+{
+ test_env e;
+
+ int error = maps_address_set_postal_code(e.a, "123");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* postal_code = NULL;
+ error = maps_address_get_postal_code(e.a, &postal_code);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(postal_code, ==, "123");
+ g_free(postal_code);
+}
+
+void utc_maps_address_postal_code_n(void)
+{
+ test_env e;
+
+ int error = maps_address_set_postal_code(e.a, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_address_set_postal_code(NULL, "123");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_address_set_postal_code(NULL, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* postal_code = NULL;
+ error = maps_address_get_postal_code(NULL, &postal_code);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!postal_code);
+
+ error = maps_address_get_postal_code(e.a, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!postal_code);
+
+ error = maps_address_get_postal_code(NULL, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!postal_code);
+}
+
+/* int maps_address_set_freetext(maps_address_h addr, const char* freetext); */
+/* int maps_address_get_freetext(maps_address_h addr, char** freetext); */
+void utc_maps_address_destroytext_p(void)
+{
+ test_env e;
+
+ int error = maps_address_set_freetext(e.a, "---");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* freetext = NULL;
+ error = maps_address_get_freetext(e.a, &freetext);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(freetext, ==, "---");
+ g_free(freetext);
+}
+
+void utc_maps_address_destroytext_n(void)
+{
+ test_env e;
+
+ int error = maps_address_set_freetext(e.a, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_address_set_freetext(NULL, "---");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_address_set_freetext(NULL, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* freetext = NULL;
+ error = maps_address_get_freetext(NULL, &freetext);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!freetext);
+
+ error = maps_address_get_freetext(e.a, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!freetext);
+
+ error = maps_address_get_freetext(NULL, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!freetext);
+}
+
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_SERVICE_TEST_API_ADDRESS_H__
+#define __MAPS_SERVICE_TEST_API_ADDRESS_H__
+
+void utc_maps_address_create_p(void);
+void utc_maps_address_create_n(void);
+
+void utc_maps_address_clone_p(void);
+void utc_maps_address_clone_n(void);
+
+void utc_maps_address_building_number_p(void);
+void utc_maps_address_building_number_n(void);
+
+void utc_maps_address_street_p(void);
+void utc_maps_address_street_n(void);
+
+void utc_maps_address_district_p(void);
+void utc_maps_address_district_n(void);
+
+void utc_maps_address_city_p(void);
+void utc_maps_address_city_n(void);
+
+void utc_maps_address_state_p(void);
+void utc_maps_address_state_n(void);
+
+void utc_maps_address_country_p(void);
+void utc_maps_address_country_n(void);
+
+void utc_maps_address_country_code_p(void);
+void utc_maps_address_country_code_n(void);
+
+void utc_maps_address_county_p(void);
+void utc_maps_address_county_n(void);
+
+void utc_maps_address_postal_code_p(void);
+void utc_maps_address_postal_code_n(void);
+
+void utc_maps_address_destroytext_p(void);
+void utc_maps_address_destroytext_n(void);
+
+#endif /* __MAPS_SERVICE_TEST_API_ADDRESS_H__ */
+
--- /dev/null
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * 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 "maps_api_test.h"
+#include "maps_service.h"
+#include <glib.h>
+#include "maps_address.h"
+#include "maps_test_utils.h"
+#include "maps_object.h"
+
+class test_env
+{
+ public:
+ maps_service_h m;
+ maps_preference_h p;
+ int rid;
+ bool async;
+ int iterations;
+
+ enum TEST_PLUGIN
+ {
+ DUMMY,
+ HERE,
+ };
+ struct test_plugin_info_s
+ {
+ /* Maps Provider name, returned by the Plugin */
+ const char* provider;
+ /* Maps Provider key */
+ const char* key;
+ /* Does the Plugin have asynchronous requests */
+ bool async;
+ };
+ int test_plugin_type;
+ test_plugin_info_s i;
+ GMainLoop* mainloop;
+
+ int last_time;
+
+ private:
+ test_plugin_info_s get_plugin_info(int idx) const
+ {
+ static test_plugin_info_s info[] = {
+ /* DUMMY */
+ { "Maps Provider",
+ "test_key",
+ false },
+
+ /* HERE */
+ { "HERE",
+ "gMutJ6Bo9jyMtOfJRGG1/nXvwmBWgoCqp9U5_yslkcw",
+ true }
+ };
+ return info[idx];
+ }
+ public:
+ test_env():m(NULL), p(NULL), rid(-1), async(false), iterations(0),
+ mainloop(NULL), last_time(0)
+ {
+
+ /* Chose the Plugin for testing */
+ test_plugin_type =
+ DUMMY /* Dummy plugin */
+ /*HERE*/ /* Nokia Here Maps */
+ ;
+
+ i = get_plugin_info(test_plugin_type);
+
+ /* Create an instance of Maps Service */
+ int error = maps_service_create(i.provider, &m);
+ async = i.async;
+ if (error != MAPS_ERROR_NONE)
+ __utc_print_error_string(error);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_preference_create(&p);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /* Set up general preferenes for real plugins */
+ error = maps_service_set_provider_key(m, i.key);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_preference_set_max_results(p, 4);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ }
+ ~test_env() {
+ int error = maps_service_destroy(m);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_item_hashtable_destroy(p);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ }
+
+ public:
+ void finish_request()
+ {
+ delete this;
+ }
+ void finish_response()
+ {
+ /*g_print("\nfinishing response...\n");*/
+ if (async && mainloop)
+ test_env::stop_waiting_for_response(this);
+ /*g_print("\nfinished response...\n");*/
+ }
+ private:
+ static gboolean stop_waiting_for_response(gpointer data)
+ {
+ /*g_print("\nquite main loop\n");*/
+ /*int milsec = -1;*/
+ if (data) {
+ test_env* e = (test_env*) data;
+ if (e->mainloop) {
+ /*milsec = __get_milli_span(e->last_time);*/
+ g_main_loop_unref(e->mainloop);
+ g_main_loop_quit(e->mainloop);
+ e->mainloop = NULL;
+ }
+ }
+ /*g_print("return from main loop: %d msec\n", milsec);*/
+ return FALSE;
+ }
+ public:
+ void wait_for_response(void)
+ {
+ if (!async)
+ return;
+ last_time = __get_milli_count();
+ /*g_print("\nenter main loop\n"); */
+ mainloop = g_main_loop_new(NULL, FALSE);
+ const int timeout_id =
+ g_timeout_add_seconds(15, stop_waiting_for_response,
+ this);
+ g_main_loop_run(mainloop);
+ g_source_remove(timeout_id);
+ }
+};
+
+/*----------------------------------------------------------------------------*/
+/* Create and Destroy */
+void utc_maps_service_create_destroy_p(void)
+{
+ test_env e;
+}
+
+/*----------------------------------------------------------------------------*/
+/* Keys and properties */
+/* */
+
+/*int maps_service_set_provider_key(maps_service_h maps,
+* const char* map_key); */
+/*int maps_service_get_provider_key(const maps_service_h maps,
+* char** map_key); */
+void utc_maps_provider_key_p(void)
+{
+ test_env e;
+
+ int error = maps_service_set_provider_key(e.m, e.i.key);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* obtained_key = NULL;
+ error = maps_service_get_provider_key(e.m, &obtained_key);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(obtained_key);
+ g_assert_cmpstr(obtained_key, ==, e.i.key);
+ g_free(obtained_key);
+}
+
+void utc_maps_provider_key_n(void)
+{
+ test_env e;
+
+ int error = maps_service_set_provider_key(NULL, "TEST_KEY");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_service_set_provider_key(e.m, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* obtained_key = NULL;
+ error = maps_service_get_provider_key(NULL, &obtained_key);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!obtained_key);
+
+ error = maps_service_get_provider_key(e.m, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!obtained_key);
+}
+
+/*int maps_service_get_preference(maps_service_h maps,
+* maps_preference_h* preference); */
+/*int maps_service_set_preference(maps_service_h maps,
+* maps_preference_h preference); */
+void utc_maps_service_set_preference_p(void)
+{
+ test_env e;
+
+ int error =
+ maps_item_hashtable_set_string(e.p, "MAP_SERVICE_PREF_LANGUAGE",
+ "value");
+
+ /* test start --------------------------------- */
+ error = maps_service_set_preference(e.m, e.p);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ /* test finish --------------------------------- */
+}
+
+void utc_maps_service_set_preference_n(void)
+{
+ test_env e;
+
+ int error =
+ maps_item_hashtable_set_string(e.p, "MAP_SERVICE_PREF_LANGUAGE",
+ "value");
+
+ /* test start --------------------------------- */
+ error = maps_service_set_preference(NULL, e.p);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_service_set_preference(e.m, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ /* test finish --------------------------------- */
+}
+
+/*int maps_service_provider_is_service_supported(const maps_service_h maps, */
+void utc_maps_service_provider_is_service_supported_p(void)
+{
+ test_env e;
+
+ bool supported = false;
+ g_assert_cmpint(maps_service_provider_is_service_supported(e.m,
+ MAPS_SERVICE_GEOCODE, &supported), ==, MAPS_ERROR_NONE);
+ g_assert(supported);
+
+ g_assert_cmpint(maps_service_provider_is_service_supported(e.m,
+ MAPS_SERVICE_GEOCODE_INSIDE_AREA, &supported), ==,
+ MAPS_ERROR_NONE);
+ g_assert(supported);
+
+ g_assert_cmpint(maps_service_provider_is_service_supported(e.m,
+ MAPS_SERVICE_GEOCODE_BY_STRUCTURED_ADDRESS, &supported),
+ ==, MAPS_ERROR_NONE);
+ g_assert(supported);
+
+ g_assert_cmpint(maps_service_provider_is_service_supported(e.m,
+ MAPS_SERVICE_REVERSE_GEOCODE, &supported), ==,
+ MAPS_ERROR_NONE);
+ g_assert(supported);
+
+ g_assert_cmpint(maps_service_provider_is_service_supported(e.m,
+ MAPS_SERVICE_SEARCH_PLACE, &supported), ==,
+ MAPS_ERROR_NONE);
+ g_assert(supported);
+
+ g_assert_cmpint(maps_service_provider_is_service_supported(e.m,
+ MAPS_SERVICE_SEARCH_PLACE_BY_AREA, &supported), ==,
+ MAPS_ERROR_NONE);
+ g_assert(supported);
+
+ g_assert_cmpint(maps_service_provider_is_service_supported(e.m,
+ MAPS_SERVICE_SEARCH_PLACE_BY_ADDRESS, &supported), ==,
+ MAPS_ERROR_NONE);
+ g_assert(supported);
+
+ g_assert_cmpint(maps_service_provider_is_service_supported(e.m,
+ MAPS_SERVICE_SEARCH_ROUTE, &supported), ==,
+ MAPS_ERROR_NONE);
+ g_assert(supported);
+
+ g_assert_cmpint(maps_service_provider_is_service_supported(e.m,
+ MAPS_SERVICE_SEARCH_ROUTE_WAYPOINTS, &supported), ==,
+ MAPS_ERROR_NONE);
+ g_assert(supported);
+
+ g_assert_cmpint(maps_service_provider_is_service_supported(e.m,
+ MAPS_SERVICE_CANCEL_REQUEST, &supported), ==,
+ MAPS_ERROR_NONE);
+ g_assert(supported);
+}
+
+void utc_maps_service_provider_is_service_supported_n(void)
+{
+ test_env e;
+
+ bool supported = false;
+ g_assert_cmpint(maps_service_provider_is_service_supported(NULL,
+ MAPS_SERVICE_GEOCODE, &supported), ==,
+ MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!supported);
+
+ /*g_assert_cmpint(maps_service_provider_is_service_supported(e.m,
+ (maps_service_e) (-1), &supported), ==,
+ MAPS_ERROR_NOT_SUPPORTED);*/
+ int error = maps_service_provider_is_service_supported(e.m,
+ (maps_service_e) (-1), &supported);
+ if (error != MAPS_ERROR_INVALID_PARAMETER)
+ __utc_print_error_string(error);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!supported);
+
+ g_assert_cmpint(maps_service_provider_is_service_supported(e.m,
+ MAPS_SERVICE_GEOCODE, NULL), ==,
+ MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!supported);
+}
+
+void utc_maps_service_provider_is_data_supported_p(void)
+{
+ test_env e;
+
+ bool supported = false;
+
+ g_assert_cmpint(maps_service_provider_is_data_supported(e.m,
+ MAPS_PLACE_ADDRESS, &supported), ==, MAPS_ERROR_NONE);
+ g_assert(supported);
+
+ g_assert_cmpint(maps_service_provider_is_data_supported(e.m,
+ MAPS_PLACE_RATING, &supported), ==,
+ MAPS_ERROR_NONE);
+ g_assert(supported);
+
+ g_assert_cmpint(maps_service_provider_is_data_supported(e.m,
+ MAPS_PLACE_CATEGORIES, &supported), ==,
+ MAPS_ERROR_NONE);
+ g_assert(supported);
+
+ g_assert_cmpint(maps_service_provider_is_data_supported(e.m,
+ MAPS_PLACE_ATTRIBUTES, &supported), ==,
+ MAPS_ERROR_NONE);
+ g_assert(supported);
+
+ g_assert_cmpint(maps_service_provider_is_data_supported(e.m,
+ MAPS_PLACE_CONTACTS, &supported), ==,
+ MAPS_ERROR_NONE);
+ g_assert(supported);
+
+ g_assert_cmpint(maps_service_provider_is_data_supported(e.m,
+ MAPS_PLACE_EDITORIALS, &supported), ==,
+ MAPS_ERROR_NONE);
+ g_assert(supported);
+
+ g_assert_cmpint(maps_service_provider_is_data_supported(e.m,
+ MAPS_PLACE_REVIEWS, &supported), ==,
+ MAPS_ERROR_NONE);
+ g_assert(supported);
+
+ g_assert_cmpint(maps_service_provider_is_data_supported(e.m,
+ MAPS_PLACE_IMAGE, &supported), ==,
+ MAPS_ERROR_NONE);
+ g_assert(supported);
+
+ g_assert_cmpint(maps_service_provider_is_data_supported(e.m,
+ MAPS_PLACE_SUPPLIER, &supported), ==,
+ MAPS_ERROR_NONE);
+ g_assert(supported);
+
+ g_assert_cmpint(maps_service_provider_is_data_supported(e.m,
+ MAPS_PLACE_RELATED, &supported), ==,
+ MAPS_ERROR_NONE);
+ g_assert(supported);
+
+ g_assert_cmpint(maps_service_provider_is_data_supported(e.m,
+ MAPS_ROUTE_PATH, &supported), ==, MAPS_ERROR_NONE);
+ g_assert(supported);
+
+ g_assert_cmpint(maps_service_provider_is_data_supported(e.m,
+ MAPS_ROUTE_SEGMENTS_PATH, &supported), ==,
+ MAPS_ERROR_NONE);
+ g_assert(supported);
+
+ g_assert_cmpint(maps_service_provider_is_data_supported(e.m,
+ MAPS_ROUTE_SEGMENTS_MANEUVERS, &supported), ==,
+ MAPS_ERROR_NONE);
+ g_assert(supported);
+}
+
+void utc_maps_service_provider_is_data_supported_n(void)
+{
+ test_env e;
+
+ bool supported = false;
+ g_assert_cmpint(maps_service_provider_is_data_supported(NULL,
+ MAPS_PLACE_ADDRESS, &supported), ==,
+ MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!supported);
+
+ g_assert_cmpint(maps_service_provider_is_data_supported(e.m,
+ (maps_service_data_e) (-1), &supported), ==,
+ MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!supported);
+
+ g_assert_cmpint(maps_service_provider_is_data_supported(e.m,
+ MAPS_PLACE_ADDRESS, NULL), ==,
+ MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!supported);
+}
+
+/*----------------------------------------------------------------------------*/
+/* Geocode */
+/* */
+/* int maps_service_geocode(maps_service_h maps, const char* address,
+* maps_service_geocode_cb callback, void* user_data, int* request_id); */
+/* typedef bool (*maps_service_geocode_cb)(maps_error_e result, int request_id,
+* int index, int total_count, maps_coordinates_h coordinates,
+* void* user_data); */
+
+static bool __utc_maps_service_geocode_cb(maps_error_e result, int request_id,
+ int index, int total_count, maps_coordinates_h coordinates,
+ void* user_data)
+{
+/*g_print("\n\n__utc_maps_service_geocode_cb [%d of %d]\n\n", index, total_count);*/
+
+ if (result != MAPS_ERROR_NONE)
+ __utc_print_error_string(result);
+ g_assert_cmpint(result, ==, MAPS_ERROR_NONE);
+
+ test_env* e = (test_env*) user_data;
+ g_assert(e);
+
+ e->iterations++;
+
+ if (e->rid > 0) {
+ g_assert_cmpint(e->rid, ==, request_id);
+ }
+
+ g_assert(index >= 0);
+ g_assert(total_count > 0);
+
+ g_assert(coordinates);
+
+ double latitude = .0, longitude = .0, altitude = .0;
+ int error = maps_coordinates_get_latitude(coordinates, &latitude);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ error = maps_coordinates_get_longitude(coordinates, &longitude);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ g_assert(latitude > -90 || latitude < 90);
+ g_assert(longitude > -180 || longitude < 180);
+ g_assert(altitude > -100 || altitude < 100);
+
+ error = maps_coordinates_destroy(coordinates);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ if (index == (total_count - 1)) {
+ e->finish_response();
+ }
+ return true;
+}
+
+void utc_maps_service_geocode_p(void)
+{
+ test_env* e = new test_env;
+
+ /* test start --------------------------------- */
+ int error =
+ maps_service_geocode(e->m, "Seoul", e->p,
+ __utc_maps_service_geocode_cb, (void*) e, &e->rid);
+ /*int error = maps_service_geocode(e->m, "Berlin", e->p,
+ * __utc_maps_service_geocode_cb, (void*)e, &e->rid); */
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ e->wait_for_response();
+
+ g_assert(e->rid > 0);
+ g_assert(e->iterations > 0);
+ /* test finish --------------------------------- */
+
+ /*if(!e->async) delete e; */
+ /*else e->wait_for_response(); */
+ e->finish_request();
+}
+
+void utc_maps_service_geocode_n(void)
+{
+ test_env e;
+
+ /* test start --------------------------------- */
+ int error =
+ maps_service_geocode(NULL, "Seoul", e.p,
+ __utc_maps_service_geocode_cb, NULL, &e.rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_service_geocode(e.m, NULL, e.p,
+ __utc_maps_service_geocode_cb, NULL, &e.rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ /*error = maps_service_geocode(e.m, "Seoul", NULL,
+ __utc_maps_service_geocode_cb, NULL, &e.rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);*/
+
+ error = maps_service_geocode(e.m, "Seoul", e.p, NULL, NULL, &e.rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_service_geocode(e.m, "Seoul", e.p,
+ __utc_maps_service_geocode_cb, NULL, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ /* test finish --------------------------------- */
+}
+
+/*int maps_service_geocode_inside_area(maps_service_h maps,
+* const char* address, maps_area_h bounds, maps_service_geocode_cb callback,
+* void* user_data, int* request_id); */
+void utc_maps_service_geocode_inside_area_p(void)
+{
+ test_env* e = new test_env;
+
+ maps_coordinates_h c1 = NULL;
+ /*int error = maps_coordinates_create(38.0, 127.0, &c1); */
+ int error = maps_coordinates_create(15.665354, 74.311523, &c1);
+ g_assert(c1);
+
+ maps_coordinates_h c2 = NULL;
+ /*error = maps_coordinates_create(37.0, 128.0, &c2); */
+ error = maps_coordinates_create(10.617418, 79.145508, &c2);
+ g_assert(c2);
+
+ maps_area_h bounds = NULL;
+ error = maps_area_create_rectangle(c1, c2, &bounds);
+ g_assert(bounds);
+
+ /* test start --------------------------------- */
+ error = maps_service_geocode_inside_area(e->m,
+ /*"Seoul", */
+ "Berlin",
+ bounds,
+ e->p, __utc_maps_service_geocode_cb, (void*) e, &e->rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ e->wait_for_response();
+
+ g_assert(e->rid > 0);
+ /* test finish --------------------------------- */
+
+ error = maps_area_destroy(bounds);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ error = maps_coordinates_destroy(c1);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ error = maps_coordinates_destroy(c2);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /*if(!e->async) delete e; */
+ e->finish_request();
+}
+
+void utc_maps_service_geocode_inside_area_n(void)
+{
+ test_env e;
+
+ maps_coordinates_h center = NULL;
+ int error = maps_coordinates_create(11.1, 22.2, ¢er);
+ g_assert(center);
+
+ maps_area_h bounds = NULL;
+ error = maps_area_create_circle(center, 200, &bounds);
+ g_assert(bounds);
+
+ /* test start --------------------------------- */
+ error = maps_service_geocode_inside_area(NULL, "Seoul", bounds, e.p,
+ __utc_maps_service_geocode_cb, NULL, &e.rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_service_geocode_inside_area(e.m, NULL, bounds, e.p,
+ __utc_maps_service_geocode_cb, NULL, &e.rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ /*error = maps_service_geocode_inside_area(e.m, "Seoul", bounds, NULL,
+ __utc_maps_service_geocode_cb, NULL, &e.rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);*/
+
+ error = maps_service_geocode_inside_area(e.m, "Seoul", bounds, e.p,
+ NULL, NULL, &e.rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_service_geocode_inside_area(e.m, "Seoul", bounds, e.p,
+ __utc_maps_service_geocode_cb, NULL, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ /* test finish --------------------------------- */
+
+ error = maps_area_destroy(bounds);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ error = maps_coordinates_destroy(center);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_service_geocode_by_structured_address_p(void)
+{
+ test_env* e = new test_env;
+
+ maps_address_h address = NULL;
+ int error = maps_address_create(&address);
+ g_assert(address);
+ error = maps_address_set_city(address, "Prague");
+ error = maps_address_set_street(address, "Na Bojisti");
+ error = maps_address_set_building_number(address, "1733/12");
+
+ /* test start --------------------------------- */
+ error = maps_service_geocode_by_structured_address(e->m,
+ address,
+ e->p, __utc_maps_service_geocode_cb, (void*) e, &e->rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ e->wait_for_response();
+
+ g_assert(e->rid > 0);
+ /* test finish --------------------------------- */
+
+ error = maps_address_destroy(address);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /*if(!e->async) delete e; */
+ e->finish_request();
+}
+
+void utc_maps_service_geocode_by_structured_address_n(void)
+{
+ test_env e;
+
+ maps_address_h address = NULL;
+ int error = maps_address_create(&address);
+ g_assert(address);
+
+ /* test start --------------------------------- */
+ error = maps_service_geocode_by_structured_address(NULL, address, e.p,
+ __utc_maps_service_geocode_cb, NULL, &e.rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_service_geocode_by_structured_address(e.m, NULL, e.p,
+ __utc_maps_service_geocode_cb, NULL, &e.rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ /*error = maps_service_geocode_by_structured_address(e.m, address, NULL,
+ __utc_maps_service_geocode_cb, NULL, &e.rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);*/
+
+ error = maps_service_geocode_by_structured_address(e.m, address, e.p,
+ NULL, NULL, &e.rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_service_geocode_by_structured_address(e.m, address, e.p,
+ __utc_maps_service_geocode_cb, NULL, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ /* test finish --------------------------------- */
+
+ error = maps_address_destroy(address);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+static void __utc_maps_service_reverse_geocode_cb(maps_error_e result,
+ int request_id, int index, int total, maps_address_h address,
+ void* user_data)
+{
+
+ g_assert_cmpint(result, ==, MAPS_ERROR_NONE);
+
+ g_assert(address);
+
+ int error = 0;
+
+ if (address) {
+ g_print("[%s] address\n", __FUNCTION__);
+
+ char *building_number = NULL;
+ if (maps_address_get_building_number(address,
+ &building_number) == MAPS_ERROR_NONE)
+ g_print("\tbuilding number\t: %s\n", building_number);
+ g_free(building_number);
+
+ char *street = NULL;
+ if (maps_address_get_street(address, &street) == MAPS_ERROR_NONE)
+ g_print("\tstreet\t: %s\n", street);
+ g_free(street);
+
+ char *district = NULL;
+ if (maps_address_get_district(address,
+ &district) == MAPS_ERROR_NONE)
+ g_print("\tdistrict\t: %s\n", district);
+ g_free(district);
+
+ char *city = NULL;
+ if (maps_address_get_city(address, &city) == MAPS_ERROR_NONE)
+ g_print("\tcity\t: %s\n", city);
+ g_free(city);
+
+ char *state = NULL;
+ if (maps_address_get_state(address, &state) == MAPS_ERROR_NONE)
+ g_print("\tstate\t: %s\n", state);
+ g_free(state);
+
+ char *country = NULL;
+ if (maps_address_get_country(address,
+ &country) == MAPS_ERROR_NONE)
+ g_print("\tcountry\t: %s\n", country);
+ g_free(country);
+
+ char *country_code = NULL;
+ if (maps_address_get_country_code(address,
+ &country_code) == MAPS_ERROR_NONE)
+ g_print("\tcountry code\t: %s\n", country_code);
+ g_free(country_code);
+
+ char *county = NULL;
+ if (maps_address_get_county(address, &county) == MAPS_ERROR_NONE)
+ g_print("\tcounty\t: %s\n", county);
+ g_free(county);
+
+ char *postal_code = NULL;
+ if (maps_address_get_postal_code(address,
+ &postal_code) == MAPS_ERROR_NONE)
+ g_print("\tpostal code\t: %s\n", postal_code);
+ g_free(postal_code);
+
+ char *free_text = NULL;
+ if (maps_address_get_freetext(address,
+ &free_text) == MAPS_ERROR_NONE)
+ g_print("\tfreetext\t: %s\n", free_text);
+ g_free(free_text);
+
+ error = maps_address_destroy(address);
+ }
+
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ test_env* e = (test_env*) user_data;
+ g_assert(e);
+
+ if (e->rid > 0) {
+ g_assert_cmpint(e->rid, ==, request_id);
+ }
+
+ g_assert_cmpint(index, ==, 0);
+ g_assert_cmpint(total, ==, 1);
+
+ /*if(e->async) delete e; */
+ e->finish_response();
+}
+
+/*int maps_service_reverse_geocode(maps_service_h maps, double latitude,
+* double longitude, maps_service_reverse_geocode_cb callback, void* user_data,
+* int* request_id); */
+void utc_maps_service_reverse_geocode_p(void)
+{
+ test_env* e = new test_env;
+
+ /* test start --------------------------------- */
+ int error =
+ maps_service_reverse_geocode(e->m, 12.944594, 77.554303, e->p,
+ __utc_maps_service_reverse_geocode_cb, (void*) e, &e->rid);
+ if (error != MAPS_ERROR_NONE)
+ __utc_print_error_string(error);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ e->wait_for_response();
+
+ g_assert(e->rid > 0);
+ /* test finish --------------------------------- */
+
+ /*if(!e->async) delete e; */
+ e->finish_request();
+}
+
+void utc_maps_service_reverse_geocode_n(void)
+{
+ test_env e;
+
+ /* test start --------------------------------- */
+ int error =
+ maps_service_reverse_geocode(NULL, 11.1, 22.2, e.p,
+ __utc_maps_service_reverse_geocode_cb, NULL, &e.rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ /*error = maps_service_reverse_geocode(e.m, 11.1, 22.2, NULL,
+ __utc_maps_service_reverse_geocode_cb, NULL, &e.rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);*/
+
+ error = maps_service_reverse_geocode(e.m, 11.1, 22.2, e.p,
+ __utc_maps_service_reverse_geocode_cb, NULL, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ /* test finish --------------------------------- */
+}
+
+/*int maps_cancel_geocode(maps_service_h maps, int request_id); */
+static bool __utc_maps_cancel_geocode_cb(maps_error_e result, int request_id,
+ int index, int total_count, maps_coordinates_h coordinates,
+ void* user_data)
+{
+ return true;
+}
+
+void utc_maps_cancel_geocode_p(void)
+{
+ test_env e;
+
+ maps_item_hashtable_set_string(e.p, "no_need_callback",
+ "no_need_callback");
+
+ int error =
+ maps_service_geocode(e.m, "Seoul", e.p,
+ __utc_maps_cancel_geocode_cb, (void*) &e, &e.rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(e.rid > 0);
+
+ /*error = maps_cancel_geocode(e.m, e.rid); */
+ error = maps_service_cancel_request(e.m, e.rid);
+ if (error != MAPS_ERROR_NONE)
+ __utc_print_error_string(error);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_cancel_geocode_p02(void)
+{
+ test_env e;
+
+ maps_item_hashtable_set_string(e.p, "no_need_callback",
+ "no_need_callback");
+
+ for (int i = 0; i < 5; i++) {
+ int error =
+ maps_service_geocode(e.m, "Seoul", e.p,
+ __utc_maps_cancel_geocode_cb, (void*) &e, &e.rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(e.rid > 0);
+
+ error = maps_service_cancel_request(e.m, e.rid);
+ if (error != MAPS_ERROR_NONE)
+ __utc_print_error_string(error);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ }
+}
+
+void utc_maps_cancel_geocode_n(void)
+{
+ const int error = maps_service_cancel_request(NULL, 1);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/*int maps_cancel_reverse_geocode(maps_service_h maps, int request_id); */
+static void __utc_maps_cancel_reverse_geocode_cb(maps_error_e result,
+ int request_id, int index, int total, maps_address_h address,
+ void* user_data)
+{
+ return;
+}
+
+void utc_maps_cancel_reverse_geocode_p(void)
+{
+ test_env e;
+
+ maps_item_hashtable_set_string(e.p, "no_need_callback",
+ "no_need_callback");
+
+ int error =
+ maps_service_reverse_geocode(e.m, 11.1, 22.2, e.p,
+ __utc_maps_cancel_reverse_geocode_cb, (void*) &e, &e.rid);;
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(e.rid > 0);
+
+ error = maps_service_cancel_request(e.m, e.rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_cancel_reverse_geocode_n(void)
+{
+ const int error = maps_service_cancel_request(NULL, 1);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/*----------------------------------------------------------------------------*/
+/* Place */
+static bool __utc_place_contact_cb(int index, int total,
+ maps_place_contact_h contact_h, void* user_data)
+{
+ if (!contact_h)
+ return FALSE;
+
+ maps::place_contact contact(contact_h);
+
+ g_print("contact [%d/%d]\n", index + 1, total);
+
+ maps::string_holder label;
+ if (maps_place_contact_get_label(contact, label) == MAPS_ERROR_NONE)
+ g_print("\tlabel\t: %s\n", label.str);
+
+ maps::string_holder type;
+ if (maps_place_contact_get_type(contact, type) == MAPS_ERROR_NONE)
+ g_print("\ttype\t: %s\n", type.str);
+
+ maps::string_holder value;
+ if (maps_place_contact_get_value(contact, value) == MAPS_ERROR_NONE)
+ g_print("\tvalue\t: %s\n", value.str);
+
+ return TRUE;
+}
+
+static bool __utc_place_category_cb(int index, int total,
+ maps_place_category_h category_h, void* user_data)
+{
+ if (!category_h)
+ return FALSE;
+
+ maps::place_category category(category_h);
+
+ g_print("category [%d/%d]\n", index + 1, total);
+
+ maps::string_holder name;
+ if (maps_place_category_get_name(category, name) == MAPS_ERROR_NONE)
+ g_print("\tname\t: %s\n", name.str);
+
+ maps::string_holder id;
+ if (maps_place_category_get_id(category, id) == MAPS_ERROR_NONE)
+ g_print("\tid\t: %s\n", id.str);
+
+ maps::string_holder url;
+ if (maps_place_category_get_url(category, url) == MAPS_ERROR_NONE)
+ g_print("\turl\t: %s\n", url.str);
+
+ return TRUE;
+}
+
+static bool __utc_place_link_object(const char* tag,
+ maps_place_link_object_h link_object_h)
+{
+ if (!link_object_h)
+ return FALSE;
+
+ maps::place_link_object link_object(link_object_h);
+
+ maps::string_holder id;
+ if (maps_place_link_object_get_id(link_object, id) == MAPS_ERROR_NONE)
+ g_print("%sid\t: %s\n", tag, id.str);
+
+ maps::string_holder name;
+ if (maps_place_link_object_get_name(link_object,
+ name) == MAPS_ERROR_NONE)
+ g_print("%sname\t: %s\n", tag, name.str);
+
+ maps::string_holder string;
+ if (maps_place_link_object_get_string(link_object,
+ string) == MAPS_ERROR_NONE)
+ g_print("%sstring\t: %s\n", tag, string.str);
+
+ maps::string_holder type;
+ if (maps_place_link_object_get_type(link_object,
+ type) == MAPS_ERROR_NONE)
+ g_print("%stype\t: %s\n", tag, type.str);
+
+ return TRUE;
+}
+
+static bool __utc_place_image_cb(int index, int total,
+ maps_place_image_h image_h, void* user_data)
+{
+ if (!image_h)
+ return FALSE;
+
+ g_print("image [%d/%d]\n", index + 1, total);
+
+ maps::place_image image(image_h);
+
+ maps::string_holder url;
+ if (maps_place_image_get_url(image, url) == MAPS_ERROR_NONE)
+ g_print("\turl\t: %s\n", url.str);
+
+ maps::string_holder id;
+ if (maps_place_image_get_id(image, id) == MAPS_ERROR_NONE)
+ g_print("\tid\t: %s\n", id.str);
+
+ int nval = 0;
+ if (maps_place_image_get_width(image, &nval) == MAPS_ERROR_NONE
+ && nval > 0)
+ g_print("\twidth\t: %d\n", nval);
+
+ if (maps_place_image_get_height(image, &nval) == MAPS_ERROR_NONE
+ && nval > 0)
+ g_print("\theight\t: %d\n", nval);
+
+ maps::place_link_object user_link(NULL);
+ if (maps_place_image_get_user_link(image, user_link) ==
+ MAPS_ERROR_NONE) {
+ g_print("\tuserlink\n");
+ __utc_place_link_object("\t\t", user_link.clone());
+ }
+
+ maps::place_media media(NULL);
+ if (maps_place_image_get_media(image, media) == MAPS_ERROR_NONE) {
+ g_print("\tmedia\n");
+ maps::string_holder attribution;
+ if (maps_place_media_get_attribution(media,
+ attribution) == MAPS_ERROR_NONE)
+ g_print("\t\tattribution\t: %s\n", attribution.str);
+
+ maps::place_link_object supplier(NULL);
+ if (maps_place_media_get_supplier(media,
+ supplier) == MAPS_ERROR_NONE) {
+ g_print("\t\tsupplier link\n");
+ __utc_place_link_object("\t\t\t", supplier.clone());
+ }
+
+ maps::place_link_object via(NULL);
+ if (maps_place_media_get_via(media, via) == MAPS_ERROR_NONE) {
+ g_print("\t\tvia\n");
+ __utc_place_link_object("\t\t\t", via.clone());
+ }
+ }
+
+ return TRUE;
+}
+
+static bool __utc_place_editorial_cb(int index, int total,
+ maps_place_editorial_h editorial_h, void* user_data)
+{
+ /* TODO: */
+ maps::place_editorial editorial(editorial_h);
+ return TRUE;
+}
+
+static bool __utc_place_review_cb(int index, int total,
+ maps_place_review_h review_h, void* user_data)
+{
+ /* TODO: */
+ maps::place_review review(review_h);
+ return TRUE;
+}
+
+static bool __utc_maps_service_search_place_cb(maps_error_e error,
+ int request_id, int index, int length, maps_place_h place_h,
+ void* user_data)
+{
+
+ if((error != MAPS_ERROR_NONE) && (error != MAPS_ERROR_NOT_FOUND)) {
+ __utc_print_error_string(error);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ }
+
+ test_env* e = (test_env*) user_data;
+ g_assert(e);
+
+ e->iterations++;
+
+ if (e->rid > 0) {
+ g_assert_cmpint(e->rid, ==, request_id);
+ }
+
+ g_assert(index >= 0);
+ g_assert(length > 0);
+
+ if(error == MAPS_ERROR_NOT_FOUND) {
+ g_assert(index == 0);
+ g_assert(length == 1);
+ e->finish_response();
+ return true;
+ }
+
+
+ g_assert(place_h);
+
+ maps::place place(place_h);
+
+ /* Parsing Result Data ------------------------------------- */
+ /*g_print("Search Place [%d/%d]\n", index + 1, length);*/
+
+ maps::coordinates coord(NULL);
+ if (maps_place_get_location(place, coord) == MAPS_ERROR_NONE) {
+ g_print("\tposition\t: %f, %f\n", coord.get_latitude(),
+ coord.get_longitude());
+ }
+
+ maps::string_holder name;
+ if (maps_place_get_name(place, name) == MAPS_ERROR_NONE)
+ g_print("\ttitle\t: %s\n", name.str);
+
+ maps::string_holder uri;
+ if (maps_place_get_uri(place, uri) == MAPS_ERROR_NONE)
+ g_print("\thref\t: %s\n", uri.str);
+
+ maps::string_holder id;
+ if (maps_place_get_id(place, id) == MAPS_ERROR_NONE)
+ g_print("\tid\t: %s\n", id.str);
+
+ maps::place_rating rating(NULL);
+ if (maps_place_get_rating(place, rating) == MAPS_ERROR_NONE) {
+ int count = 0;
+ double value = .0;
+ maps_place_rating_get_average(rating, &value);
+ maps_place_rating_get_count(rating, &count);
+ g_print("\trating\t: %f\n", value);
+ g_print("\tcount\t: %d\n", count);
+ }
+
+ maps::address address(NULL);
+ if (maps_place_get_address(place, address) == MAPS_ERROR_NONE) {
+ g_print("address\n");
+
+ maps::string_holder building_number;
+ if (maps_address_get_building_number(address,
+ building_number) == MAPS_ERROR_NONE)
+ g_print("\tbuilding number\t: %s\n",
+ building_number.str);
+
+ maps::string_holder street;
+ if (maps_address_get_street(address, street) == MAPS_ERROR_NONE)
+ g_print("\tstreet\t: %s\n", street.str);
+
+ maps::string_holder district;
+ if (maps_address_get_district(address,
+ district) == MAPS_ERROR_NONE)
+ g_print("\tdistrict\t: %s\n", district.str);
+
+ maps::string_holder city;
+ if (maps_address_get_city(address, city) == MAPS_ERROR_NONE)
+ g_print("\tcity\t: %s\n", city.str);
+
+ maps::string_holder state;
+ if (maps_address_get_state(address, state) == MAPS_ERROR_NONE)
+ g_print("\tstate\t: %s\n", state.str);
+
+ maps::string_holder country;
+ if (maps_address_get_country(address,
+ country) == MAPS_ERROR_NONE)
+ g_print("\tcountry\t: %s\n", country.str);
+
+ maps::string_holder country_code;
+ if (maps_address_get_country_code(address,
+ country_code) == MAPS_ERROR_NONE)
+ g_print("\tcountry code\t: %s\n", country_code.str);
+
+ maps::string_holder county;
+ if (maps_address_get_county(address, county) == MAPS_ERROR_NONE)
+ g_print("\tcounty\t: %s\n", county.str);
+
+ maps::string_holder postal_code;
+ if (maps_address_get_postal_code(address,
+ postal_code) == MAPS_ERROR_NONE)
+ g_print("\tpostal code\t: %s\n", postal_code.str);
+
+ maps::string_holder free_text;
+ if (maps_address_get_freetext(address,
+ free_text) == MAPS_ERROR_NONE)
+ g_print("\tfreetext\t: %s\n", free_text.str);
+ }
+
+ maps_place_foreach_contact(place, __utc_place_contact_cb, user_data);
+ maps_place_foreach_category(place, __utc_place_category_cb, user_data);
+ maps_place_foreach_image(place, __utc_place_image_cb, user_data);
+ maps_place_foreach_editorial(place, __utc_place_editorial_cb,
+ user_data);
+ maps_place_foreach_review(place, __utc_place_review_cb, user_data);
+
+ /*g_print("\n");*/
+
+ /* End Parsing Result Data --------------------------------- */
+
+ if (index == (length - 1)) {
+ /*if(e->async) delete e; */
+ e->finish_response();
+ }
+
+ return true;
+}
+
+/*int maps_service_search_place(maps_service_h maps,
+* maps_coordinates_h position, int distance, maps_place_preference_h preference,
+* maps_place_filter_h filter, maps_service_search_place_cb callback,
+* void* user_data, int* request_id); */
+void utc_maps_service_search_place_p(void)
+{
+ test_env* e = new test_env;
+
+ maps::coordinates position(37.7942, -122.4070);
+ //maps::coordinates position(37.7555302, 127.002253);
+
+ maps::place_filter filter;
+ //int error = maps_place_filter_set_place_name(filter, "Seoul");
+ int error = maps_place_filter_set_place_name(filter, "San Francisco");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /* test start --------------------------------- */
+ /* shlg, 20150716, as recommended by HERE Plugin developer, the distance
+ * is extended in 10 times to 50000 */
+ error = maps_service_search_place(e->m, position, 50000, filter, e->p,
+ __utc_maps_service_search_place_cb, (void*) e, &e->rid);
+ if (error != MAPS_ERROR_NONE)
+ __utc_print_error_string(error);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(e->rid > 0);
+ /* test finish --------------------------------- */
+
+ e->wait_for_response();
+ e->finish_request();
+}
+
+void utc_maps_service_search_place_n(void)
+{
+ test_env e;
+ /*maps::coordinates position(37.7942, -122.4070);*/
+ maps::coordinates position(37.7555302, 127.002253);
+ maps::place_filter filter;
+
+ /* test start --------------------------------- */
+ int error =
+ maps_service_search_place(NULL, position, 5000, filter, e.p,
+ __utc_maps_service_search_place_cb, &e, &e.rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_service_search_place(e.m, NULL, 5000, filter, e.p,
+ __utc_maps_service_search_place_cb, &e, &e.rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ /*error = maps_service_search_place(e.m, position, 5000, filter, NULL,
+ __utc_maps_service_search_place_cb, &e, &e.rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);*/
+
+ error = maps_service_search_place(e.m, position, 5000, NULL, e.p,
+ __utc_maps_service_search_place_cb, &e, &e.rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_service_search_place(e.m, position, 5000, filter, e.p, NULL,
+ &e, &e.rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ /* test finish --------------------------------- */
+}
+
+/*int maps_service_search_place_by_area(maps_service_h maps,
+* maps_area_h boundary , maps_place_preference_h preference,
+* maps_place_filter_h filter, maps_service_search_place_cb callback,
+* void* user_data, int* request_id); */
+void utc_maps_service_search_place_by_area_p(void)
+{
+ test_env* e = new test_env;
+
+ maps::place_filter filter;
+ int error = maps_place_filter_set_place_name(filter, "Seoul");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps::place_category category;
+ //error = maps_place_category_set_id(category, "eat-drink");
+ error = maps_place_category_set_id(category, "cafe");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ error = maps_place_filter_set_category(filter, category);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /*maps::area area(37.7942 + 0.2, -122.407 - 0.2,
+ 37.7942 - 0.2, -122.407 + 0.2);*/
+ maps::area area(37.7555302 + 0.2, 127.002253 - 0.2,
+ 37.7555302 - 0.2, 127.002253 + 0.2);
+
+ /* test start --------------------------------- */
+ error = maps_service_search_place_by_area(e->m, area, filter, e->p,
+ __utc_maps_service_search_place_cb, (void*) e, &e->rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(e->rid > 0);
+ /* test finish --------------------------------- */
+
+ e->wait_for_response();
+ e->finish_request();
+}
+
+void utc_maps_service_search_place_by_area_n(void)
+{
+ test_env e;
+ maps::place_filter filter;
+ /*maps::area area(37.7942 + 0.2, -122.407 - 0.2, 37.7942 - 0.2,
+ -122.407 + 0.2);*/
+ maps::area area(37.7555302 + 0.2, 127.002253 - 0.2,
+ 37.7555302 - 0.2, 127.002253 + 0.2);
+
+ /* test start --------------------------------- */
+ int error =
+ maps_service_search_place_by_area(NULL, area, filter, e.p,
+ __utc_maps_service_search_place_cb, &e, &e.rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_service_search_place_by_area(e.m, NULL, filter, e.p,
+ __utc_maps_service_search_place_cb, &e, &e.rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ /*error = maps_service_search_place_by_area(e.m, area, filter, NULL,
+ __utc_maps_service_search_place_cb, &e, &e.rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);*/
+
+ error = maps_service_search_place_by_area(e.m, area, NULL, e.p,
+ __utc_maps_service_search_place_cb, &e, &e.rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_service_search_place_by_area(e.m, area, filter, e.p, NULL,
+ &e, &e.rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ /* test finish --------------------------------- */
+}
+
+/*int maps_service_search_place_by_address(maps_service_h maps,
+* const char* address, maps_area_h boundary, maps_place_preference_h preference,
+* maps_place_filter_h filter, maps_service_search_place_cb callback,
+* void* user_data, int* request_id); */
+void utc_maps_service_search_place_by_address_p(void)
+{
+ test_env* e = new test_env;
+
+ maps::place_filter filter;
+ int error = maps_place_filter_set_place_name(filter, "Seoul");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps::area area(37.7942 + 0.2, -122.407 - 0.2,
+ 37.7942 - 0.2, -122.407 + 0.2);
+ /*maps::area area(37.7555302 + 0.2, 127.002253 - 0.2,
+ 37.7555302 - 0.2, 127.002253 + 0.2);*/
+
+ /* test start --------------------------------- */
+ error = maps_service_search_place_by_address(e->m, "Jackson", area,
+ filter, e->p, __utc_maps_service_search_place_cb, (void*) e,
+ &e->rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(e->rid > 0);
+ /* test finish --------------------------------- */
+
+ e->wait_for_response();
+ e->finish_request();
+}
+
+void utc_maps_service_search_place_by_address_n(void)
+{
+ test_env e;
+
+ maps::place_filter filter;
+ int error = maps_place_filter_set_place_name(filter, "Seoul");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /*maps::area area(37.7942 + 0.2, -122.407 - 0.2, 37.7942 - 0.2,
+ -122.407 + 0.2);*/
+ maps::area area(37.7555302 + 0.2, 127.002253 - 0.2,
+ 37.7555302 - 0.2, 127.002253 + 0.2);
+
+ /* test start --------------------------------- */
+ error = maps_service_search_place_by_address(NULL, "Seoul", area,
+ filter, e.p, __utc_maps_service_search_place_cb, &e, &e.rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_service_search_place_by_address(e.m, NULL, area, filter,
+ e.p, __utc_maps_service_search_place_cb, &e, &e.rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ /*error = maps_service_search_place_by_address(e.m, "Seoul", filter, NULL,
+ filter, __utc_maps_service_search_place_cb, &e, &e.rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);*/
+
+ error = maps_service_search_place_by_address(e.m, "Seoul", area, NULL,
+ e.p, __utc_maps_service_search_place_cb, &e, &e.rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_service_search_place_by_address(e.m, "Seoul", area, filter,
+ e.p, NULL, &e, &e.rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ /* test finish --------------------------------- */
+}
+
+/*int maps_cancel_place(maps_service_h maps, int request_id); */
+static bool __utc_maps_cancel_place_cb(maps_error_e error, int request_id,
+ int index, int length, maps_place_h place, void* user_data)
+{
+ return true;
+}
+
+void utc_maps_cancel_place_p(void)
+{
+ test_env e;
+
+ maps_item_hashtable_set_string(e.p, "no_need_callback",
+ "no_need_callback");
+
+ maps::coordinates position(37.34, 126.58);
+
+ maps::place_filter filter;
+ int error = maps_place_filter_set_place_name(filter, "Seoul");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_service_search_place(e.m, position, 5000, filter, e.p,
+ __utc_maps_cancel_place_cb, (void*) &e, &e.rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(e.rid > 0);
+
+ error = maps_service_cancel_request(e.m, e.rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /* TODO: add tests for canceling maps_service_search_place_by_area,
+ * maps_service_search_place_by_address APIs */
+}
+
+void utc_maps_cancel_place_n(void)
+{
+ const int error = maps_service_cancel_request(NULL, 1);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/*----------------------------------------------------------------------------*/
+/* Route */
+/*typedef bool(*maps_service_search_route_cb)(maps_error_e error,
+* int request_id, int index, int total, maps_route_h route, void* user_data); */
+static bool __utc_maps_service_search_route_cb(maps_error_e error,
+ int request_id, int index, int total, maps_route_h route,
+ void* user_data)
+{
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ test_env* e = (test_env*) user_data;
+ g_assert(e);
+
+ e->iterations++;
+
+ if (e->rid > 0) {
+ g_assert_cmpint(e->rid, ==, request_id);
+ }
+
+ g_assert(index >= 0);
+ g_assert(total > 0);
+
+ g_assert(route);
+ int err = maps_route_destroy(route);
+ g_assert_cmpint(err, ==, MAPS_ERROR_NONE);
+
+ if (index == (total - 1)) {
+ e->finish_response();
+ }
+
+ return true;
+}
+
+/*int maps_service_search_route(maps_service_h maps,
+* maps_item_hashtable_h preference, maps_coordinates_h origin,
+* maps_coordinates_h destination, maps_service_search_route_cb callback,
+* void* user_data, int* request_id); */
+void utc_maps_service_search_route_p(void)
+{
+ test_env* e = new test_env;
+
+ maps_coordinates_h origin = NULL;
+ int error = maps_coordinates_create(37.34, 126.58, &origin);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_coordinates_h destination = NULL;
+ error = maps_coordinates_create(37.34, 126.58, &destination);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /* test start --------------------------------- */
+ error = maps_service_search_route(e->m, origin, destination, e->p,
+ __utc_maps_service_search_route_cb, (void*) e, &e->rid);
+ if (error != MAPS_ERROR_NONE)
+ __utc_print_error_string(error);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(e->rid > 0);
+ /* test finish --------------------------------- */
+
+ e->wait_for_response();
+
+ error = maps_coordinates_destroy(origin);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_coordinates_destroy(destination);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ e->finish_request();
+}
+
+void utc_maps_service_search_route_n(void)
+{
+ test_env e;
+
+ maps_coordinates_h origin = NULL;
+ int error = maps_coordinates_create(37.34, 126.58, &origin);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_coordinates_h destination = NULL;
+ error = maps_coordinates_create(37.34, 126.58, &destination);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /* test start --------------------------------- */
+ error = maps_service_search_route(NULL, origin, destination, e.p,
+ __utc_maps_service_search_route_cb, &e, &e.rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ /*error = maps_service_search_route(e.m, origin, destination, NULL,
+ __utc_maps_service_search_route_cb, &e, &e.rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);*/
+
+ error = maps_service_search_route(e.m, NULL, destination, e.p,
+ __utc_maps_service_search_route_cb, &e, &e.rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_service_search_route(e.m, origin, NULL, e.p,
+ __utc_maps_service_search_route_cb, &e, &e.rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_service_search_route(e.m, origin, destination, e.p, NULL,
+ &e, &e.rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_service_search_route(e.m, origin, destination, e.p,
+ __utc_maps_service_search_route_cb, &e, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ /* test finish --------------------------------- */
+
+ error = maps_coordinates_destroy(origin);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_coordinates_destroy(destination);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+/*int maps_service_search_route_waypoints(maps_service_h maps,
+* maps_item_hashtable_h preference, maps_coordinates_h* waypoint_list,
+* int waypoint_num, maps_service_search_route_cb callback, void* user_data,
+* int* request_id); */
+void utc_maps_service_search_route_waypoints_p(void)
+{
+ test_env* e = new test_env;
+
+ maps_coordinates_h origin = NULL;
+ int error = maps_coordinates_create(37.34, 126.58, &origin);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_coordinates_h destination = NULL;
+ error = maps_coordinates_create(37.34, 126.58, &destination);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_coordinates_h waypoint_list[2] = { origin, destination };
+
+ /* test start --------------------------------- */
+ error = maps_service_search_route_waypoints(e->m, waypoint_list, 2,
+ e->p, __utc_maps_service_search_route_cb, (void*) e, &e->rid);
+ if (error != MAPS_ERROR_NONE)
+ __utc_print_error_string(error);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(e->rid > 0);
+ /* test finish --------------------------------- */
+
+ e->wait_for_response();
+
+ error = maps_coordinates_destroy(origin);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_coordinates_destroy(destination);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /*if(!e->async) delete e; */
+ e->finish_request();
+}
+
+void utc_maps_service_search_route_waypoints_n(void)
+{
+ test_env e;
+
+ maps_coordinates_h origin = NULL;
+ int error = maps_coordinates_create(37.34, 126.58, &origin);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_coordinates_h destination = NULL;
+ error = maps_coordinates_create(37.34, 126.58, &destination);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_coordinates_h waypoint_list[2] = { origin, destination };
+
+ /* test start --------------------------------- */
+ error = maps_service_search_route_waypoints(NULL, waypoint_list, 2, e.p,
+ __utc_maps_service_search_route_cb, &e, &e.rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ /*error = maps_service_search_route_waypoints(e.m, waypoint_list, 2, NULL,
+ __utc_maps_service_search_route_cb, &e, &e.rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);*/
+
+ error = maps_service_search_route_waypoints(e.m, NULL, 2, e.p,
+ __utc_maps_service_search_route_cb, &e, &e.rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_service_search_route_waypoints(e.m, waypoint_list, 2, e.p,
+ NULL, &e, &e.rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_service_search_route_waypoints(e.m, waypoint_list, 2, e.p,
+ __utc_maps_service_search_route_cb, &e, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ /* test finish --------------------------------- */
+
+ error = maps_coordinates_destroy(origin);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_coordinates_destroy(destination);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+static bool __utc_maps_cancel_search_route_cb(maps_error_e error,
+ int request_id, int index, int total, maps_route_h route,
+ void* user_data)
+{
+ return true;
+}
+
+/*int maps_cancel_route(maps_service_h maps, int request_id); */
+void utc_maps_cancel_route_p(void)
+{
+ test_env e;
+
+ maps_item_hashtable_set_string(e.p, "no_need_callback",
+ "no_need_callback");
+
+ maps_coordinates_h origin = NULL;
+ int error = maps_coordinates_create(37.34, 126.58, &origin);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_coordinates_h destination = NULL;
+ error = maps_coordinates_create(37.34, 126.58, &destination);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /* test start --------------------------------- */
+ error = maps_service_search_route(e.m, origin, destination, e.p,
+ __utc_maps_cancel_search_route_cb, &e, &e.rid);
+ if (error != MAPS_ERROR_NONE)
+ __utc_print_error_string(error);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(e.rid > 0);
+
+ /*error = maps_cancel_route(e.m, e.rid); */
+ error = maps_service_cancel_request(e.m, e.rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /* TODO: add tests for canceling
+ * maps_service_search_route_waypoints API */
+ /* test finish --------------------------------- */
+
+ error = maps_coordinates_destroy(origin);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_coordinates_destroy(destination);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_cancel_route_n(void)
+{
+ /*const int error = maps_cancel_route(NULL, 1); */
+ const int error = maps_service_cancel_request(NULL, 1);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/*----------------------------------------------------------------------------*/
+/* Route Search with realistic input */
+static bool __utc_maps_route_segment_maneuver_cb(int index, int total,
+ maps_route_maneuver_h maneuver, void* user_data)
+{
+ /*g_print(" Maneuver >> %d\n", (index+1)); */
+
+ int error = maps_route_maneuver_destroy(maneuver);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ return true;
+}
+
+static bool __utc_maps_route_segment_cb(int index, int total,
+ maps_route_segment_h segment, void* user_data)
+{
+ if (!segment) {
+ g_print("critical error : FAILED\n");
+ return false;
+ }
+
+ maps_coordinates_h _origin = NULL, _destination = NULL;
+ double lat = 0.0, lon = 0.0;
+
+ int error = maps_route_segment_get_origin(segment, &_origin);
+ if (error != MAPS_ERROR_NONE)
+ __utc_print_error_string(error);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ if (_origin) {
+ error = maps_coordinates_get_latitude(_origin, &lat);
+ if (error != MAPS_ERROR_NONE)
+ __utc_print_error_string(error);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_coordinates_get_longitude(_origin, &lon);
+ if (error != MAPS_ERROR_NONE)
+ __utc_print_error_string(error);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /*g_print("Segment Origin Lat : %f, Lon : %f\n", lat, lon); */
+
+ error = maps_coordinates_destroy(_origin);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ }
+
+ error = maps_route_segment_get_destination(segment, &_destination);
+ if (error != MAPS_ERROR_NONE)
+ __utc_print_error_string(error);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ if (_destination) {
+ error = maps_coordinates_get_latitude(_destination, &lat);
+ if (error != MAPS_ERROR_NONE)
+ __utc_print_error_string(error);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_coordinates_get_longitude(_destination, &lon);
+ if (error != MAPS_ERROR_NONE)
+ __utc_print_error_string(error);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /*g_print("Segment Destination Lat : %f, Lon : %f\n", lat,
+ * lon); */
+
+ error = maps_coordinates_destroy(_destination);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ }
+
+ /*g_print(">>>>>> Parsing segments <<<<<<<<<<\n"); */
+ error = maps_route_segment_foreach_maneuver(segment,
+ __utc_maps_route_segment_maneuver_cb, user_data);
+ if (error != MAPS_ERROR_NONE)
+ __utc_print_error_string(error);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /*g_print("maneuver is supported, error code :: %d\n", error); */
+
+ error = maps_route_segment_destroy(segment);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ return true;
+}
+
+/*typedef bool(*maps_service_search_route_cb)(maps_error_e error,
+* int request_id, int index, int total, maps_route_h route, void* user_data); */
+static bool __utc_maps_service_search_route_real_cb(maps_error_e error,
+ int request_id, int index, int total, maps_route_h route,
+ void* user_data)
+{
+ /*g_print("Received route callback [%d of %d]\n\n", index, total);*/
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ test_env* e = (test_env*) user_data;
+ g_assert(e);
+
+ g_assert(index >= 0);
+ g_assert(total > 0);
+
+ /*------------------------------------------------------ */
+ if (error == MAPS_ERROR_NONE) {
+ /*g_print("\nDisplaying route result..\n"); */
+
+ double dist = 0.0;
+ long duration = 0;
+ int err = maps_route_get_total_distance(route, &dist);
+ g_assert_cmpint(err, ==, MAPS_ERROR_NONE);
+
+ err = maps_route_get_total_duration(route, &duration);
+ g_assert_cmpint(err, ==, MAPS_ERROR_NONE);
+
+ /*g_print("Distance: %f\tDuration: %ld secs\n", dist,
+ * duration); */
+
+ /*g_print("Route ptr: %p\n", route); */
+ err = maps_route_foreach_segment(route,
+ __utc_maps_route_segment_cb, NULL);
+ if (err != MAPS_ERROR_NONE)
+ __utc_print_error_string(err);
+ g_assert_cmpint(err, ==, MAPS_ERROR_NONE);
+ }
+ /*------------------------------------------------------ */
+
+ g_assert(route);
+ int err = maps_route_destroy(route);
+ g_assert_cmpint(err, ==, MAPS_ERROR_NONE);
+
+ if (index == (total - 1)) {
+ e->finish_response();
+ }
+
+ return true;
+}
+
+/*int maps_service_search_route(maps_service_h maps,
+* maps_item_hashtable_h preference, maps_coordinates_h origin,
+* maps_coordinates_h destination, maps_service_search_route_cb callback,
+* void* user_data, int* request_id); */
+void utc_maps_service_search_route_real_p(void)
+{
+ test_env* e = new test_env;
+
+ /*utc_main_loop_master mlm(&__utc_main_loop); */
+
+ double srcLat = 12.733027;
+ double srcLon = 77.83015999;
+
+ double destLat = 12.9165167;
+ double destLon = 79.1324985999;
+
+ /* Creating route preference */
+ maps_preference_h preference;
+ int error = maps_preference_create(&preference);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /* Call Route Search API */
+ maps_coordinates_h origin = NULL;
+ maps_coordinates_h destination = NULL;
+ int request_id = 0;
+
+ /* Setting Origin and Destination coordinates */
+ maps_coordinates_create(srcLat, srcLon, &origin);
+ maps_coordinates_create(destLat, destLon, &destination);
+
+ error = maps_preference_set_route_transport_mode(preference,
+ MAPS_ROUTE_TRANSPORT_MODE_CAR);
+ /*MAPS_ROUTE_TRANSPORT_MODE_PEDESTRIAN); */
+ /*MAPS_ROUTE_TRANSPORT_MODE_PUBLICTRANSIT); */
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /* Set Route Optimization */
+ error = maps_preference_set_route_optimization(preference,
+ MAPS_ROUTE_TYPE_FASTEST);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /*g_print("Run Routing Service!\n"); */
+ error = maps_service_search_route(e->m, origin, destination, preference,
+ __utc_maps_service_search_route_real_cb, e, &request_id);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ e->wait_for_response();
+
+ error = maps_coordinates_destroy(origin);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_coordinates_destroy(destination);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_preference_destroy(preference);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /*if(!e->async) delete e; */
+ e->finish_request();
+}
+
+
+
+
+/*----------------------------------------------------------------------------*/
+/* Serial API test */
+
+void utc_maps_service_serial_p(void)
+{
+ test_env *e = new test_env;
+ const int serial_test_number = 5;
+
+ /* Some test parameters */
+ maps::coordinates berlin_c1(15.665354, 74.311523);
+ maps::coordinates berlin_c2(10.617418, 79.145508);
+ maps::area berlin_area(berlin_c1, berlin_c2);
+
+ maps::address address;
+ maps_address_set_city(address, "Prague");
+ maps_address_set_street(address, "Na Bojisti");
+ maps_address_set_building_number(address, "1733/12");
+
+ maps::coordinates seoul_position(37.7555302, 127.002253);
+ maps::place_filter filter;
+ maps_place_filter_set_place_name(filter, "Seoul");
+ maps::area seoul_area(37.7555302 + 0.2, 127.002253 - 0.2,
+ 37.7555302 - 0.2, 127.002253 + 0.2);
+ maps::area sf_area(37.7942 + 0.2, -122.407 - 0.2,
+ 37.7942 - 0.2, -122.407 + 0.2);
+
+
+ maps::coordinates origin(37.34, 126.58);
+ maps::coordinates destination(37.34, 126.58);
+ maps_coordinates_h waypoint_list[2] = { origin, destination };
+
+ for(int i = 0; i < serial_test_number; i ++) {
+ g_print("\n\n\tIteration: %d**************************\n\n", i);
+
+ /* Geocode */
+ g_print("\t * Geocode [%d]\n", i);
+ int error = maps_service_geocode(e->m,
+ "Seoul",
+ e->p,
+ __utc_maps_service_geocode_cb,
+ (void*) e,
+ &e->rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ e->wait_for_response();
+ g_assert(e->rid > 0);
+ g_assert(e->iterations > 0);
+ e->rid = 0;
+ e->iterations = 0;
+
+
+ g_print("\t * Geocode Inside Area [%d]\n", i);
+ error = maps_service_geocode_inside_area(e->m,
+ "Berlin",
+ berlin_area,
+ e->p,
+ __utc_maps_service_geocode_cb,
+ (void*) e,
+ &e->rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ e->wait_for_response();
+ g_assert(e->rid > 0);
+ g_assert(e->iterations > 0);
+ e->rid = 0;
+ e->iterations = 0;
+
+ g_print("\t * Geocode by Structured Address [%d]\n", i);
+ error = maps_service_geocode_by_structured_address(e->m,
+ address,
+ e->p,
+ __utc_maps_service_geocode_cb,
+ (void*) e,
+ &e->rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ e->wait_for_response();
+ g_assert(e->rid > 0);
+ g_assert(e->iterations > 0);
+ e->rid = 0;
+ e->iterations = 0;
+
+ /* Reverse Geocode */
+ g_print("\t * Reverse Geocode [%d]\n", i);
+ error = maps_service_reverse_geocode(e->m,
+ 12.944594,
+ 77.554303,
+ e->p,
+ __utc_maps_service_reverse_geocode_cb,
+ (void*) e,
+ &e->rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ e->wait_for_response();
+ g_assert(e->rid > 0);
+ e->rid = 0;
+ /* In this request we have only one iteration
+ * g_assert(e->iterations > 0);
+ * e->iterations = 0;*/
+
+ /* Place */
+ g_print("\t * Search Place [%d]\n", i);
+ error = maps_service_search_place(e->m,
+ seoul_position,
+ 50000,
+ filter,
+ e->p,
+ __utc_maps_service_search_place_cb,
+ (void*) e,
+ &e->rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ e->wait_for_response();
+ g_assert(e->rid > 0);
+ g_assert(e->iterations > 0);
+ e->rid = 0;
+ e->iterations = 0;
+
+
+ g_print("\t * Search Place by Area [%d]\n", i);
+ error = maps_service_search_place_by_area(e->m,
+ seoul_area,
+ filter,
+ e->p,
+ __utc_maps_service_search_place_cb,
+ (void*) e,
+ &e->rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ e->wait_for_response();
+ g_assert(e->rid > 0);
+ g_assert(e->iterations > 0);
+ e->rid = 0;
+ e->iterations = 0;
+
+
+ g_print("\t * Search Place by Address [%d]\n", i);
+ error = maps_service_search_place_by_address(e->m,
+ "Jackson",
+ sf_area,
+ filter,
+ e->p,
+ __utc_maps_service_search_place_cb,
+ (void*) e,
+ &e->rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ e->wait_for_response();
+ g_assert(e->rid > 0);
+ g_assert(e->iterations > 0);
+ e->rid = 0;
+ e->iterations = 0;
+
+
+ /* Route */
+ g_print("\t * Search Route [%d]\n", i);
+ error = maps_service_search_route(e->m,
+ origin,
+ destination,
+ e->p,
+ __utc_maps_service_search_route_cb,
+ (void*) e,
+ &e->rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ e->wait_for_response();
+ g_assert(e->rid > 0);
+ g_assert(e->iterations > 0);
+ e->rid = 0;
+ e->iterations = 0;
+
+
+ g_print("\t * Search Route by Waypoints [%d]\n", i);
+ error = maps_service_search_route_waypoints(e->m,
+ waypoint_list,
+ 2,
+ e->p,
+ __utc_maps_service_search_route_cb,
+ (void*) e,
+ &e->rid);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ e->wait_for_response();
+ g_assert(e->rid > 0);
+ g_assert(e->iterations > 0);
+ e->rid = 0;
+ e->iterations = 0;
+ }
+
+ e->finish_request();
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_SERVICE_TEST_API_H__
+#define __MAPS_SERVICE_TEST_API_H__
+
+void utc_maps_service_create_destroy_p(void);
+
+void utc_maps_provider_key_p(void);
+void utc_maps_provider_key_n(void);
+
+void utc_maps_service_set_preference_p(void);
+void utc_maps_service_set_preference_n(void);
+
+void utc_maps_service_provider_is_service_supported_p(void);
+void utc_maps_service_provider_is_service_supported_n(void);
+
+void utc_maps_service_provider_is_data_supported_p(void);
+void utc_maps_service_provider_is_data_supported_n(void);
+
+void utc_maps_service_geocode_p(void);
+void utc_maps_service_geocode_n(void);
+
+void utc_maps_service_geocode_inside_area_p(void);
+void utc_maps_service_geocode_inside_area_n(void);
+
+void utc_maps_service_geocode_by_structured_address_p(void);
+void utc_maps_service_geocode_by_structured_address_n(void);
+
+void utc_maps_service_reverse_geocode_p(void);
+void utc_maps_service_reverse_geocode_n(void);
+
+void utc_maps_cancel_geocode_p(void);
+void utc_maps_cancel_geocode_p02(void);
+void utc_maps_cancel_geocode_n(void);
+
+void utc_maps_cancel_reverse_geocode_p(void);
+void utc_maps_cancel_reverse_geocode_n(void);
+
+void utc_maps_service_search_place_p(void);
+void utc_maps_service_search_place_n(void);
+
+void utc_maps_service_search_place_by_area_p(void);
+void utc_maps_service_search_place_by_area_n(void);
+
+void utc_maps_service_search_place_by_address_p(void);
+void utc_maps_service_search_place_by_address_n(void);
+
+void utc_maps_cancel_place_p(void);
+void utc_maps_cancel_place_n(void);
+
+void utc_maps_service_search_route_p(void);
+void utc_maps_service_search_route_n(void);
+
+void utc_maps_service_search_route_waypoints_p(void);
+void utc_maps_service_search_route_waypoints_n(void);
+
+void utc_maps_cancel_route_p(void);
+void utc_maps_cancel_route_n(void);
+
+void utc_maps_service_search_route_real_p(void);
+
+void utc_maps_service_serial_p(void);
+
+#endif /* __MAPS_SERVICE_TEST_API_H__ */
+
--- /dev/null
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * 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 "maps_area_test.h"
+#include "maps_area.h"
+#include "maps_error.h"
+#include <glib.h>
+
+/* int maps_area_create_rectangle (maps_coordinates_h top_left,
+* maps_coordinates_h bottom_right maps_area_h* area); */
+void utc_maps_area_create_rectangle_p(void)
+{
+
+ maps_coordinates_h top_left = NULL;
+ int error = maps_coordinates_create(44.4, 22.2, &top_left);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_coordinates_h bottom_right = NULL;
+ error = maps_coordinates_create(11.1, 55.5, &bottom_right);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_area_h area = NULL;
+ error = maps_area_create_rectangle(top_left, bottom_right, &area);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(area);
+
+ error = maps_area_destroy(area);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_coordinates_destroy(top_left);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_coordinates_destroy(bottom_right);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_area_create_rectangle_n(void)
+{
+ maps_coordinates_h top_left = NULL;
+ int error = maps_coordinates_create(11.1, 22.2, &top_left);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_coordinates_h bottom_right = NULL;
+ error = maps_coordinates_create(44.4, 55.5, &bottom_right);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_area_h area = NULL;
+ error = maps_area_create_rectangle(NULL, bottom_right, &area);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!area);
+
+ error = maps_area_create_rectangle(top_left, NULL, &area);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!area);
+
+ error = maps_area_create_rectangle(top_left, bottom_right, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!area);
+
+ error = maps_coordinates_destroy(top_left);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_coordinates_destroy(bottom_right);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+/* int maps_area_create_circle (maps_coordinates_h center, double radius,
+* maps_area_h* area); */
+void utc_maps_area_create_circle_p(void)
+{
+ maps_coordinates_h center = NULL;
+ int error = maps_coordinates_create(11.1, 22.2, ¢er);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_area_h area = NULL;
+ error = maps_area_create_circle(center, 200, &area);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(area);
+
+ error = maps_area_destroy(area);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_coordinates_destroy(center);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_area_create_circle_n(void)
+{
+ maps_coordinates_h center = NULL;
+ int error = maps_coordinates_create(11.1, 22.2, ¢er);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_area_h area = NULL;
+ error = maps_area_create_circle(NULL, 200, &area);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!area);
+
+ error = maps_area_create_circle(center, 200, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!area);
+
+ error = maps_coordinates_destroy(center);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+/* int maps_area_destroy(maps_area_h area); */
+void utc_maps_area_destroy_p(void)
+{
+ /* empty */
+}
+
+void utc_maps_area_destroy_n(void)
+{
+ const int error = maps_area_destroy(NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_area_clone(const maps_area_h origin, maps_area_h* cloned); */
+void utc_maps_area_clone_p(void)
+{
+
+ { /* Clone circular area */
+ maps_coordinates_h center = NULL;
+ int error = maps_coordinates_create(11.1, 22.2, ¢er);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_area_h area = NULL;
+ error = maps_area_create_circle(center, 200, &area);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(area);
+
+ maps_area_h cloned = NULL;
+ maps_area_clone(area, &cloned);
+ g_assert(cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_area_destroy(area);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_area_destroy(cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_coordinates_destroy(center);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ }
+
+ { /* Clone rectangular area */
+ maps_coordinates_h top_left = NULL;
+ int error = maps_coordinates_create(44.4, 22.2, &top_left);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_coordinates_h bottom_right = NULL;
+ error = maps_coordinates_create(11.1, 55.5, &bottom_right);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_area_h area = NULL;
+ error = maps_area_create_rectangle(top_left, bottom_right,
+ &area);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(area);
+
+ maps_area_h cloned = NULL;
+ maps_area_clone(area, &cloned);
+ g_assert(cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_area_destroy(area);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_area_destroy(cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_coordinates_destroy(top_left);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_coordinates_destroy(bottom_right);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ }
+}
+
+void utc_maps_area_clone_n(void)
+{
+ maps_coordinates_h center = NULL;
+ int error = maps_coordinates_create(11.1, 22.2, ¢er);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_area_h area = NULL;
+ error = maps_area_create_circle(center, 200, &area);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(area);
+
+ maps_area_h cloned = NULL;
+ error = maps_area_clone(area, NULL);
+ g_assert(!cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_area_clone(NULL, &cloned);
+ g_assert(!cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_area_destroy(area);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_coordinates_destroy(center);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_SERVICE_TEST_AREA_H__
+#define __MAPS_SERVICE_TEST_AREA_H__
+
+void utc_maps_area_create_rectangle_p(void);
+void utc_maps_area_create_rectangle_n(void);
+
+void utc_maps_area_create_circle_p(void);
+void utc_maps_area_create_circle_n(void);
+
+void utc_maps_area_destroy_p(void);
+void utc_maps_area_destroy_n(void);
+
+void utc_maps_area_clone_p(void);
+void utc_maps_area_clone_n(void);
+
+#endif /* __MAPS_SERVICE_TEST_AREA_H__ */
+
--- /dev/null
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * 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 "maps_coordinates_test.h"
+#include "maps_coordinates.h"
+#include "maps_error.h"
+#include <glib.h>
+
+/* int maps_coordinates_create(double latitude, double longitude, double
+* altitude, const maps_coordinates_h* coordinates); */
+void utc_maps_coordinates_create_p(void)
+{
+ maps_coordinates_h c = NULL;
+ int error = maps_coordinates_create(44.4, 22.2,
+#if _MAPS_COORDS_3D_
+ 33.3,
+#endif
+ &c);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(c);
+
+ error = maps_coordinates_destroy(c);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_coordinates_create_n(void)
+{
+ int error = maps_coordinates_create(44.4, 22.2,
+#if _MAPS_COORDS_3D_
+ 33.3,
+#endif
+ NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_coordinates_destroy(maps_coordinates_h coordinates); */
+void utc_maps_coordinates_destroy_p(void)
+{
+ /* empty */
+ /* same as utc_maps_coordinates_create_p */
+}
+
+void utc_maps_coordinates_destroy_n(void)
+{
+ const int error = maps_coordinates_destroy(NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+class test_env
+{
+ public:
+ maps_coordinates_h c;
+ double lat;
+ double lon;
+#if _MAPS_COORDS_3D_
+ double alt;
+#endif
+ public:
+ test_env():c(NULL), lat(44.4), lon(22.2)
+#if _MAPS_COORDS_3D_
+ , alt(33.3)
+#endif
+ {
+ const int error = maps_coordinates_create(lat, lon,
+#if _MAPS_COORDS_3D_
+ alt,
+#endif
+ &c);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(c);
+ }
+ ~test_env()
+ {
+ const int error = maps_coordinates_destroy(c);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ }
+};
+
+/* int maps_coordinates_clone(const maps_coordinates_h origin,
+*maps_coordinates_h* cloned); */
+void utc_maps_coordinates_clone_p(void)
+{
+ test_env e;
+
+ maps_coordinates_h cloned = NULL;
+ int error = maps_coordinates_clone(e.c, &cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(cloned);
+
+ double lat = .0, lon = .0;
+
+#if _MAPS_COORDS_3D_
+ double alt = .0;
+#endif
+
+ error = maps_coordinates_get_latitude(cloned, &lat);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpfloat(lat, ==, e.lat);
+
+ error = maps_coordinates_get_longitude(cloned, &lon);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpfloat(lon, ==, e.lon);
+
+#if _MAPS_COORDS_3D_
+ error = maps_coordinates_get_altitude(cloned, &alt);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpfloat(alt, ==, e.alt);
+#endif
+
+ error = maps_coordinates_destroy(cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_coordinates_clone_n(void)
+{
+ test_env e;
+
+ maps_coordinates_h cloned = NULL;
+ int error = maps_coordinates_clone(e.c, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!cloned);
+
+ error = maps_coordinates_clone(NULL, &cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!cloned);
+}
+
+/* int maps_coordinates_get_latitude(maps_coordinates_h coordinates,
+* double* latitude); */
+/* int maps_coordinates_set_latitude(maps_coordinates_h coordinates,
+* double latitude); */
+void utc_maps_coordinates_latitude_p(void)
+{
+ test_env e;
+ double lat = .0;
+ const int error = maps_coordinates_get_latitude(e.c, &lat);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpfloat(lat, ==, e.lat);
+}
+
+void utc_maps_coordinates_latitude_n(void)
+{
+ test_env e;
+ double lat = .0;
+
+ int error = maps_coordinates_get_latitude(NULL, &lat);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert_cmpfloat(lat, ==, 0);
+
+ error = maps_coordinates_get_latitude(e.c, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert_cmpfloat(lat, ==, 0);
+}
+
+/* int maps_coordinates_get_longitude(maps_coordinates_h coordinates,
+* double* longitude); */
+/* int maps_coordinates_set_longitude(maps_coordinates_h coordinates,
+* double longitude); */
+void utc_maps_coordinates_longitude_p(void)
+{
+ test_env e;
+ double lon = .0;
+ const int error = maps_coordinates_get_longitude(e.c, &lon);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpfloat(lon, ==, e.lon);
+}
+
+void utc_maps_coordinates_longitude_n(void)
+{
+ test_env e;
+ double lon = .0;
+
+ int error = maps_coordinates_get_longitude(NULL, &lon);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert_cmpfloat(lon, ==, .0);
+
+ error = maps_coordinates_get_longitude(e.c, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert_cmpfloat(lon, ==, .0);
+}
+
+#if _MAPS_COORDS_3D_
+/* int maps_coordinates_get_altitude(maps_coordinates_h coordinates,
+* double* altitude); */
+/* int maps_coordinates_set_altitude(maps_coordinates_h coordinates,
+* double altitude); */
+void utc_maps_coordinates_altitude_p(void)
+{
+ test_env e;
+ double alt = .0;
+ const int error = maps_coordinates_get_altitude(e.c, &alt);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpfloat(alt, ==, e.alt);
+}
+
+void utc_maps_coordinates_altitude_n(void)
+{
+ test_env e;
+ double alt = .0;
+
+ int error = maps_coordinates_get_altitude(NULL, &alt);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert_cmpfloat(alt, ==, .0);
+
+ error = maps_coordinates_get_altitude(e.c, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert_cmpfloat(alt, ==, .0);
+}
+#endif
+
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_SERVICE_TEST_COORDINATES_H__
+#define __MAPS_SERVICE_TEST_COORDINATES_H__
+
+/* int maps_coordinates_create(double latitude, double longitude,
+* double altitude, maps_coordinates_h* coordinates); */
+void utc_maps_coordinates_create_p(void);
+void utc_maps_coordinates_create_n(void);
+
+/* int maps_coordinates_destroy(maps_coordinates_h coordinates); */
+void utc_maps_coordinates_destroy_p(void);
+void utc_maps_coordinates_destroy_n(void);
+
+/* int maps_coordinates_clone(const maps_coordinates_h origin,
+* maps_coordinates_h* cloned); */
+void utc_maps_coordinates_clone_p(void);
+void utc_maps_coordinates_clone_n(void);
+
+/* int maps_coordinates_get_latitude(maps_coordinates_h coordinates,
+* double* latitude); */
+/* int maps_coordinates_set_latitude(maps_coordinates_h coordinates,
+* double latitude); */
+void utc_maps_coordinates_latitude_p(void);
+void utc_maps_coordinates_latitude_n(void);
+
+/* int maps_coordinates_get_longitude(maps_coordinates_h coordinates,
+* double* longitude); */
+/* int maps_coordinates_set_longitude(maps_coordinates_h coordinates,
+* double longitude); */
+void utc_maps_coordinates_longitude_p(void);
+void utc_maps_coordinates_longitude_n(void);
+
+#if _MAPS_COORDS_3D_
+/* int maps_coordinates_get_altitude(maps_coordinates_h coordinates,
+* double* altitude); */
+/* int maps_coordinates_set_altitude(maps_coordinates_h coordinates,
+* double altitude); */
+void utc_maps_coordinates_altitude_p(void);
+void utc_maps_coordinates_altitude_n(void);
+#endif
+
+#endif /* __MAPS_SERVICE_TEST_COORDINATES_H__ */
+
--- /dev/null
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * 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 "maps_extra_types_test.h"
+#include "maps_extra_types.h"
+#include "maps_error.h"
+#include <glib.h>
+#include "maps_coordinates.h"
+#include "maps_service.h"
+#include "maps_test_utils.h"
+
+/* int maps_item_list_create(maps_item_list_h* list); */
+/* int maps_item_list_destroy(maps_item_list_h list); */
+void utc_maps_item_list_create_p(void)
+{
+ maps_item_list_h list = NULL;
+ int error = maps_item_list_create(&list);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(list);
+
+ error = maps_item_list_destroy(list);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_item_list_create_n(void)
+{
+ int error = maps_item_list_create(NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_item_list_destroy(NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+class test_env_list
+{
+ public:
+ maps_item_list_h list;
+ public:
+ test_env_list():list(NULL)
+ {
+ const int error = maps_item_list_create(&list);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(list);
+ }
+ ~test_env_list()
+ {
+ const int error = maps_item_list_destroy(list);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ }
+};
+
+/* int maps_item_list_append(maps_item_list_h list, const void* data); */
+/* int maps_item_list_remove(maps_item_list_h list); */
+void utc_maps_item_list_append_p(void)
+{
+ test_env_list e;
+
+ const char* str = "test string";
+ int error =
+ maps_item_list_append(e.list, str,
+ maps_item_hashtable_clone_string);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_item_list_remove_all(e.list,
+ maps_item_hashtable_free_string);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_item_list_append_n(void)
+{
+ test_env_list e;
+
+ const char* str = "test string";
+
+ int error =
+ maps_item_list_append(NULL, str,
+ maps_item_hashtable_clone_string);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_item_list_append(e.list, NULL,
+ maps_item_hashtable_clone_string);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_item_list_append(e.list, str, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+}
+
+/* typedef bool (*maps_item_list_foreach_cb)(void *data, void *user_data); */
+/* int maps_item_list_foreach(maps_item_list_h list, maps_item_list_foreach_cb
+* callback, void* user_data); */
+static bool __utc_maps_item_list_foreach_cb(int index, int total, void* data,
+ void* user_data)
+{
+ char* str = (char*) data;
+
+ g_assert_cmpint(total, ==, 3);
+
+ if ((g_strcmp0(str, "AAA") == 0) || (g_strcmp0(str, "BBBB") == 0)
+ || (g_strcmp0(str, "CCCCC") == 0)) {
+ /* OK */
+ }
+ else {
+ g_print("\n\n%s\n\n", str);
+ g_assert(false);
+ }
+
+ /*maps_service_string_release((char*)data); */
+ if (data)
+ g_free((char*) data);
+
+ return true;
+}
+
+static int __utc_maps_item_list_free_cb(void* data)
+{
+ /*return maps_service_string_release((char*)data); */
+ if (data)
+ g_free((char*) data);
+ return MAPS_ERROR_NONE;
+}
+
+void utc_maps_item_list_foreach_p(void)
+{
+ test_env_list e;
+
+ int error =
+ maps_item_list_append(e.list, "AAA",
+ maps_item_hashtable_clone_string);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_item_list_append(e.list, "BBBB",
+ maps_item_hashtable_clone_string);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_item_list_append(e.list, "CCCCC",
+ maps_item_hashtable_clone_string);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_item_list_foreach(e.list, maps_item_hashtable_clone_string,
+ __utc_maps_item_list_foreach_cb, NULL);
+
+ error = maps_item_list_remove_all(e.list, __utc_maps_item_list_free_cb);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_item_list_foreach_n(void)
+{
+ test_env_list e;
+
+ int error =
+ maps_item_list_foreach(NULL, maps_item_hashtable_clone_string,
+ __utc_maps_item_list_foreach_cb, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_item_list_foreach(e.list, NULL,
+ __utc_maps_item_list_foreach_cb, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_item_list_foreach(e.list, maps_item_hashtable_clone_string,
+ NULL, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_item_list_get_data(maps_item_list_h list, void** data); */
+/* int maps_item_list_get_next(maps_item_list_h list); */
+
+/*----------------------------------------------------------------------------*/
+
+/* int maps_string_hashtable_create(maps_string_hashtable_h* table); */
+/* int maps_string_hashtable_destroy(maps_string_hashtable_h table); */
+void utc_maps_string_hashtable_create_p(void)
+{
+ maps_string_hashtable_h table = NULL;
+ int error = maps_string_hashtable_create(&table);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(table);
+
+ error = maps_string_hashtable_destroy(table);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_string_hashtable_create_n(void)
+{
+ int error = maps_string_hashtable_create(NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_string_hashtable_destroy(NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+class test_env_string_hashtable
+{
+ public:
+ maps_string_hashtable_h table;
+ public:
+ test_env_string_hashtable():table(NULL)
+ {
+ const int error = maps_string_hashtable_create(&table);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(table);
+ }
+ ~test_env_string_hashtable()
+ {
+ const int error = maps_string_hashtable_destroy(table);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ }
+};
+
+/* int maps_string_hashtable_set(maps_string_hashtable_h table, char* key,
+* const char* value); */
+/* int maps_string_hashtable_get(maps_string_hashtable_h table, char* key,
+* char** value); */
+/* int maps_string_hashtable_remove(maps_string_hashtable_h map,
+* const char* key); */
+void utc_maps_string_hashtable_set_p(void)
+{
+ test_env_string_hashtable e;
+
+ int error = maps_string_hashtable_set(e.table, "key1", "value1");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ error = maps_string_hashtable_set(e.table, "key2", "value2");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ error = maps_string_hashtable_set(e.table, "key3", "value3");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* value1 = NULL;
+ error = maps_string_hashtable_get(e.table, "key1", &value1);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_free(value1);
+
+ char* value2 = NULL;
+ error = maps_string_hashtable_get(e.table, "key2", &value2);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_free(value2);
+
+ char* value3 = NULL;
+ error = maps_string_hashtable_get(e.table, "key3", &value3);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_free(value3);
+}
+
+void utc_maps_string_hashtable_set_n(void)
+{
+ test_env_string_hashtable e;
+
+ int error = maps_string_hashtable_set(NULL, "key1", "value1");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_string_hashtable_set(e.table, NULL, "value1");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_string_hashtable_set(e.table, "key1", NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* typedef bool (*maps_string_hashtable_foreach_cb)(char *key, char *value,
+* void* user_data); */
+/* int maps_string_hashtable_foreach(maps_string_hashtable_h table,
+* maps_string_hashtable_foreach_cb callback, void* user_data); */
+static bool __utc_maps_string_hashtable_foreach_cb(int index, int total,
+ char* key, char* value, void* user_data)
+{
+ g_assert_cmpint(total, ==, 3);
+
+ if (g_strcmp0(key, "key1") == 0) {
+ g_assert_cmpstr(value, ==, "value1");
+
+ }
+ else if (g_strcmp0(key, "key2") == 0) {
+ g_assert_cmpstr(value, ==, "value2");
+
+ }
+ else if (g_strcmp0(key, "key3") == 0) {
+ g_assert_cmpstr(value, ==, "value3");
+
+ }
+ else {
+ g_print("\n\n%s, %s\n\n", key, value);
+ g_assert(false);
+ }
+ g_free(key);
+ g_free(value);
+ return true;
+}
+
+void utc_maps_string_hashtable_foreach_p(void)
+{
+ test_env_string_hashtable e;
+
+ int error = maps_string_hashtable_set(e.table, "key1", "value1");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ error = maps_string_hashtable_set(e.table, "key2", "value2");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ error = maps_string_hashtable_set(e.table, "key3", "value3");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_string_hashtable_foreach(e.table,
+ __utc_maps_string_hashtable_foreach_cb, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_string_hashtable_foreach_n(void)
+{
+ test_env_string_hashtable e;
+
+ int error =
+ maps_string_hashtable_foreach(NULL,
+ __utc_maps_string_hashtable_foreach_cb, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_string_hashtable_foreach(e.table, NULL, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/*----------------------------------------------------------------------------*/
+
+/* int maps_item_hashtable_create(maps_item_hashtable_h* table); */
+/* int maps_item_hashtable_destroy(maps_item_hashtable_h table); */
+void utc_maps_item_hashtable_create_p(void)
+{
+ maps_item_hashtable_h table = NULL;
+ int error = maps_item_hashtable_create(&table);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(table);
+
+ error = maps_item_hashtable_destroy(table);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_item_hashtable_create_n(void)
+{
+ int error = maps_item_hashtable_create(NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_item_hashtable_destroy(NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+class test_env_item_hashtable
+{
+ public:
+ maps_item_hashtable_h table;
+ public:
+ test_env_item_hashtable():table(NULL)
+ {
+ const int error = maps_item_hashtable_create(&table);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(table);
+ }
+ ~test_env_item_hashtable()
+ {
+ const int error = maps_item_hashtable_destroy(table);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ }
+};
+
+/* int maps_item_hashtable_set(maps_item_hashtable_h table, char* key,
+* const char* value); */
+/* int maps_item_hashtable_get(maps_item_hashtable_h table, char* key,
+* char** value); */
+/* int maps_item_hashtable_remove(maps_item_hashtable_h map,
+* const char* key); */
+void utc_maps_item_hashtable_set_p(void)
+{
+ test_env_item_hashtable e;
+
+ { /* Setting items to the table */
+
+ /* First item is a string */
+ int error =
+ maps_item_hashtable_set(e.table, "key1", "value1",
+ maps_item_hashtable_clone_string,
+ maps_item_hashtable_free_string);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /* Second item is an integer */
+ int value2 = 2;
+ error = maps_item_hashtable_set(e.table, "key2", &value2,
+ maps_item_hashtable_clone_int,
+ maps_item_hashtable_free_int);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /* Third item is coordinates */
+ maps_coordinates_h value3 = NULL;
+ error = maps_coordinates_create(11.1, 22.2,
+#if _MAPS_COORDS_3D_
+ 33.3,
+#endif
+ &value3);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(value3);
+ error = maps_item_hashtable_set(e.table, "key3", value3,
+ maps_coordinates_clone, maps_coordinates_destroy);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ error = maps_coordinates_destroy(value3);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ }
+
+ { /* Getting items from the table */
+
+ /* Try to get the first item: string */
+ char* value1 = NULL;
+ int error =
+ maps_item_hashtable_get(e.table, "key1",
+ (void**) &value1);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(value1, ==, "value1");
+ g_free(value1);
+
+ /* Try to get the second item: integer */
+ int* value2 = NULL;
+ error = maps_item_hashtable_get(e.table, "key2",
+ (void**) &value2);
+ if (error != MAPS_ERROR_NONE)
+ __utc_print_error_string(error);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpint(*value2, ==, 2);
+ maps_item_hashtable_free_int(value2);
+
+ /* Try to get the third item: coordinates */
+ maps_coordinates_h value3 = NULL;
+ error = maps_item_hashtable_get(e.table, "key3",
+ (void**) &value3);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ double lat = .0;
+ error = maps_coordinates_get_latitude(value3, &lat);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpfloat(lat, ==, 11.1);
+
+ double lon = .0;
+ error = maps_coordinates_get_longitude(value3, &lon);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpfloat(lon, ==, 22.2);
+
+ maps_coordinates_destroy(value3);
+ }
+}
+
+void utc_maps_item_hashtable_set_n(void)
+{
+ test_env_item_hashtable e;
+
+ int error =
+ maps_item_hashtable_set(NULL, "key1", "value1",
+ maps_item_hashtable_clone_string,
+ maps_item_hashtable_free_string);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_item_hashtable_set(e.table, NULL, "value1",
+ maps_item_hashtable_clone_string,
+ maps_item_hashtable_free_string);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_item_hashtable_set(e.table, "key1", NULL,
+ maps_item_hashtable_clone_string,
+ maps_item_hashtable_free_string);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_item_hashtable_set(e.table, "key1", "value1", NULL,
+ maps_item_hashtable_free_string);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_item_hashtable_set(e.table, "key1", "value1",
+ maps_item_hashtable_clone_string, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* typedef bool (*maps_item_hashtable_foreach_cb)(char *key, char *value,
+* void* user_data); */
+/* int maps_item_hashtable_foreach(maps_item_hashtable_h table,
+* maps_item_hashtable_foreach_cb callback, void* user_data); */
+static bool __utc_maps_item_hashtable_foreach_cb(int index, int total,
+ char* key, void* value, void* user_data)
+{
+ g_assert_cmpint(total, ==, 3);
+
+ if (g_strcmp0(key, "key1") == 0) {
+ g_assert_cmpstr((char*) value, ==, "value1");
+
+ }
+ else if (g_strcmp0(key, "key2") == 0) {
+ g_assert_cmpstr((char*) value, ==, "value2");
+
+ }
+ else if (g_strcmp0(key, "key3") == 0) {
+ g_assert_cmpstr((char*) value, ==, "value3");
+
+ }
+ else {
+ g_print("\n\n%s, %s\n\n", key, (const char*) value);
+ g_assert(false);
+ }
+
+ g_free((char*) key);
+ g_free((char*) value);
+ return true;
+}
+
+void utc_maps_item_hashtable_foreach_p(void)
+{
+ test_env_item_hashtable e;
+
+ int error =
+ maps_item_hashtable_set(e.table, "key1", "value1",
+ maps_item_hashtable_clone_string,
+ maps_item_hashtable_free_string);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ error = maps_item_hashtable_set(e.table, "key2", "value2",
+ maps_item_hashtable_clone_string,
+ maps_item_hashtable_free_string);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ error = maps_item_hashtable_set(e.table, "key3", "value3",
+ maps_item_hashtable_clone_string,
+ maps_item_hashtable_free_string);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_item_hashtable_foreach(e.table,
+ __utc_maps_item_hashtable_foreach_cb, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_item_hashtable_foreach_n(void)
+{
+ test_env_item_hashtable e;
+
+ int error =
+ maps_item_hashtable_foreach(NULL,
+ __utc_maps_item_hashtable_foreach_cb, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_item_hashtable_foreach(e.table, NULL, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* #define maps_item_hashtable_set_string(table, key, value)
+* maps_item_hashtable_set(table, key, value, maps_item_hashtable_clone_string,
+* maps_item_hashtable_free_string) */
+/* #define maps_item_hashtable_set_int(table, key, value)
+* maps_item_hashtable_set(table, key, value, maps_item_hashtable_clone_int,
+* maps_item_hashtable_free_int) */
+/* #define maps_item_hashtable_set_float(table, key, value)
+* maps_item_hashtable_set(table, key, value, maps_item_hashtable_clone_float,
+* maps_item_hashtable_free_float) */
+void utc_maps_item_hashtable_set_macro_p(void)
+{
+ test_env_item_hashtable e;
+
+ { /* Setting items to the table */
+ /* First item is a string */
+ int error =
+ maps_item_hashtable_set_string(e.table, "key1",
+ "value1");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /* Second item is an integer */
+ error = maps_item_hashtable_set_int(e.table, "key2", 2);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /* Third item is float */
+ error = maps_item_hashtable_set_float(e.table, "key3", .3);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ }
+
+ { /* Getting items from the table */
+
+ /* Try to get the first item: string */
+ char* value1 = NULL;
+ int error =
+ maps_item_hashtable_get(e.table, "key1",
+ (void**) &value1);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(value1, ==, "value1");
+ maps_item_hashtable_free_string(value1);
+
+ /* Try to get the second item: integer */
+ int* value2 = NULL;
+ error = maps_item_hashtable_get(e.table, "key2",
+ (void**) &value2);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpint(*value2, ==, 2);
+ maps_item_hashtable_free_int(value2);
+
+ /* Try to get the third item: float */
+ double* value3 = NULL;
+ error = maps_item_hashtable_get(e.table, "key3",
+ (void**) &value3);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpfloat(*value3, ==, .3);
+ maps_item_hashtable_free_float(value3);
+ }
+}
+
+void utc_maps_item_hashtable_set_macro_n(void)
+{
+ test_env_item_hashtable e;
+
+ int error = maps_item_hashtable_set_string(NULL, "key1", "value1");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_item_hashtable_set_string(e.table, NULL, "value1");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_item_hashtable_set_string(e.table, "key1", NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_item_hashtable_set_int(NULL, "key2", 2);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_item_hashtable_set_int(e.table, NULL, 2);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_item_hashtable_set_float(NULL, "key3", .3);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_item_hashtable_set_float(e.table, NULL, .3);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+void utc_maps_item_hashtable_set_overwrited_macro_p(void)
+{
+ test_env_item_hashtable e;
+
+ { /* Setting items to the table */
+
+ /* First item is a string: SET */
+ int error =
+ maps_item_hashtable_set_string(e.table, "key1",
+ "value1");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /* Second item is an integer: OVERWRITE */
+ error = maps_item_hashtable_set_int(e.table, "key1", 2);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /* Third item is float: OVERWRITE */
+ error = maps_item_hashtable_set_float(e.table, "key1", .3);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ }
+
+ { /* Getting item from the table */
+
+ /* Try to get the item: float */
+ double* value3 = NULL;
+ int error =
+ maps_item_hashtable_get(e.table, "key1",
+ (void**) &value3);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpfloat(*value3, ==, .3);
+
+ maps_item_hashtable_free_float(value3);
+ }
+}
+
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_SERVICE_TEST_API_EXTRA_TYPES_H__
+#define __MAPS_SERVICE_TEST_API_EXTRA_TYPES_H__
+
+void utc_maps_item_list_create_p(void);
+void utc_maps_item_list_create_n(void);
+
+void utc_maps_item_list_append_p(void);
+void utc_maps_item_list_append_n(void);
+
+void utc_maps_item_list_foreach_p(void);
+void utc_maps_item_list_foreach_n(void);
+
+/*----------------------------------------------------------------------------*/
+
+void utc_maps_string_hashtable_create_p(void);
+void utc_maps_string_hashtable_create_n(void);
+
+void utc_maps_string_hashtable_set_p(void);
+void utc_maps_string_hashtable_set_n(void);
+
+void utc_maps_string_hashtable_foreach_p(void);
+void utc_maps_string_hashtable_foreach_n(void);
+
+/*----------------------------------------------------------------------------*/
+
+void utc_maps_item_hashtable_create_p(void);
+void utc_maps_item_hashtable_create_n(void);
+
+void utc_maps_item_hashtable_set_p(void);
+void utc_maps_item_hashtable_set_n(void);
+
+void utc_maps_item_hashtable_set_macro_p(void);
+void utc_maps_item_hashtable_set_macro_n(void);
+
+void utc_maps_item_hashtable_set_overwrited_macro_p(void);
+
+void utc_maps_item_hashtable_foreach_p(void);
+void utc_maps_item_hashtable_foreach_n(void);
+
+#endif /* __MAPS_SERVICE_TEST_API_EXTRA_TYPES_H__ */
+
--- /dev/null
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * 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 "maps_place_attribute_test.h"
+#include "maps_place_attribute_plugin.h"
+#include "maps_error.h"
+#include <glib.h>
+
+/* int maps_place_attribute_create(maps_place_attribute_h* place); */
+/* int maps_place_attribute_destroy(maps_place_attribute_h place); */
+void utc_maps_place_attribute_create_p(void)
+{
+ maps_place_attribute_h attribute = NULL;
+ int error = maps_place_attribute_create(&attribute);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(attribute);
+
+ error = maps_place_attribute_destroy(attribute);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_place_attribute_create_n(void)
+{
+ int error = maps_place_attribute_create(NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_attribute_destroy(NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/*----------------------------------------------------------------------------*/
+class test_env
+{
+ public:
+ maps_place_attribute_h a;
+ public:
+ test_env():a(NULL)
+ {
+ const int error = maps_place_attribute_create(&a);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(a);
+ }
+ ~test_env()
+ {
+ const int error = maps_place_attribute_destroy(a);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ }
+};
+
+/*----------------------------------------------------------------------------*/
+
+/* int maps_place_attribute_clone(const maps_place_attribute_h origin,
+* maps_place_attribute_h* cloned); */
+void utc_maps_place_attribute_clone_p(void)
+{
+ test_env e;
+
+ /* set test values for original */
+ /*------------------------------------ */
+ int error = maps_place_attribute_set_id(e.a, "id");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_attribute_set_label(e.a, "label");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_attribute_set_text(e.a, "text");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ /*------------------------------------ */
+
+ maps_place_attribute_h cloned = NULL;
+ error = maps_place_attribute_clone(e.a, &cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(cloned);
+
+ /* test if values are cloned correctly */
+ /*------------------------------------ */
+ char* label = NULL;
+ error = maps_place_attribute_get_label(cloned, &label);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(label, ==, "label");
+ g_free(label);
+
+ char* text = NULL;
+ error = maps_place_attribute_get_text(cloned, &text);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(text, ==, "text");
+ g_free(text);
+
+ char* id = NULL;
+ error = maps_place_attribute_get_id(cloned, &id);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(id, ==, "id");
+ g_free(id);
+ /*------------------------------------ */
+
+ error = maps_place_attribute_destroy(cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_place_attribute_clone_n(void)
+{
+ test_env e;
+
+ maps_place_attribute_h cloned = NULL;
+ int error = maps_place_attribute_clone(e.a, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_attribute_clone(NULL, &cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_place_attribute_set_id(maps_place_attribute_h place,
+* const char* id); */
+/* int maps_place_attribute_get_id(maps_place_attribute_h place, char** id); */
+void utc_maps_place_attribute_id_p(void)
+{
+ test_env e;
+
+ int error = maps_place_attribute_set_id(e.a, "attribute_id");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* id = NULL;
+ error = maps_place_attribute_get_id(e.a, &id);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(id, ==, "attribute_id");
+ g_free(id);
+}
+
+void utc_maps_place_attribute_id_n(void)
+{
+ test_env e;
+
+ int error = maps_place_attribute_set_id(NULL, "attribute_id");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_attribute_set_id(e.a, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* id = NULL;
+ error = maps_place_attribute_get_id(NULL, &id);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_attribute_get_id(e.a, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_place_attribute_set_label(maps_place_attribute_h place,
+* const char* label); */
+/* int maps_place_attribute_get_label(maps_place_attribute_h place,
+* char** label); */
+void utc_maps_place_attribute_label_p(void)
+{
+ test_env e;
+
+ int error = maps_place_attribute_set_label(e.a, "attribute_label");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* label = NULL;
+ error = maps_place_attribute_get_label(e.a, &label);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(label, ==, "attribute_label");
+ g_free(label);
+}
+
+void utc_maps_place_attribute_label_n(void)
+{
+ test_env e;
+
+ int error = maps_place_attribute_set_label(NULL, "attribute_label");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_attribute_set_label(e.a, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* label = NULL;
+ error = maps_place_attribute_get_label(NULL, &label);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_attribute_get_label(e.a, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_place_attribute_set_text(maps_place_attribute_h place,
+* const char* text); */
+/* int maps_place_attribute_get_text(maps_place_attribute_h place,
+* const char** text); */
+void utc_maps_place_attribute_text_p(void)
+{
+ test_env e;
+
+ int error = maps_place_attribute_set_text(e.a, "attribute_text");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* text = NULL;
+ error = maps_place_attribute_get_text(e.a, &text);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(text, ==, "attribute_text");
+ g_free(text);
+}
+
+void utc_maps_place_attribute_text_n(void)
+{
+ test_env e;
+
+ int error = maps_place_attribute_set_text(NULL, "attribute_text");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_attribute_set_text(e.a, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* text = NULL;
+ error = maps_place_attribute_get_text(NULL, &text);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_attribute_get_text(e.a, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_SERVICE_TEST_API_PLACE_ATTRIBUTE_H__
+#define __MAPS_SERVICE_TEST_API_PLACE_ATTRIBUTE_H__
+
+/* int maps_place_attribute_create(maps_place_attribute_h* place); */
+/* int maps_place_attribute_destroy(maps_place_attribute_h place); */
+void utc_maps_place_attribute_create_p(void);
+void utc_maps_place_attribute_create_n(void);
+
+/* int maps_place_attribute_clone(const maps_place_attribute_h origin,
+* maps_place_attribute_h* cloned); */
+void utc_maps_place_attribute_clone_p(void);
+void utc_maps_place_attribute_clone_n(void);
+
+/* int maps_place_attribute_set_id(maps_place_attribute_h place,
+* const char* id); */
+/* int maps_place_attribute_get_id(maps_place_attribute_h place, char** id); */
+void utc_maps_place_attribute_id_p(void);
+void utc_maps_place_attribute_id_n(void);
+
+/* int maps_place_attribute_set_label(maps_place_attribute_h place,
+* const char* label); */
+/* int maps_place_attribute_get_label(maps_place_attribute_h place,
+* char** label); */
+void utc_maps_place_attribute_label_p(void);
+void utc_maps_place_attribute_label_n(void);
+
+/* int maps_place_attribute_set_text(maps_place_attribute_h place,
+* const char* text); */
+/* int maps_place_attribute_get_text(maps_place_attribute_h place,
+* const char** text); */
+void utc_maps_place_attribute_text_p(void);
+void utc_maps_place_attribute_text_n(void);
+
+#endif /* __MAPS_SERVICE_TEST_API_PLACE_ATTRIBUTE_H__ */
+
--- /dev/null
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * 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 "maps_place_category_test.h"
+#include "maps_place_category.h"
+#include "maps_error.h"
+#include <glib.h>
+
+/* int maps_place_category_create(maps_place_category_h* place); */
+/* int maps_place_category_destroy(maps_place_category_h place); */
+void utc_maps_place_category_create_p(void)
+{
+ maps_place_category_h category = NULL;
+ int error = maps_place_category_create(&category);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(category);
+
+ error = maps_place_category_destroy(category);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_place_category_create_n(void)
+{
+ int error = maps_place_category_create(NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_category_destroy(NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/*----------------------------------------------------------------------------*/
+class test_env
+{
+ public:
+ maps_place_category_h c;
+ int iteration;
+ public:
+ test_env():c(NULL), iteration(0)
+ {
+ const int error = maps_place_category_create(&c);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(c);
+ }
+ ~test_env()
+ {
+ const int error = maps_place_category_destroy(c);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ }
+};
+
+/*----------------------------------------------------------------------------*/
+
+void utc_maps_place_category_clone_p(void)
+{
+ test_env e;
+
+ /* set test values for original */
+ /*------------------------------------ */
+ int error = maps_place_category_set_id(e.c, "id");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_category_set_name(e.c, "name");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_category_set_url(e.c, "url");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_place_category_h cloned = NULL;
+ error = maps_place_category_clone(e.c, &cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(cloned);
+
+ /* test if values are cloned correctly */
+ /*------------------------------------ */
+ char* name = NULL;
+ error = maps_place_category_get_name(cloned, &name);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(name, ==, "name");
+ g_free(name);
+
+ char* id = NULL;
+ error = maps_place_category_get_id(cloned, &id);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(id, ==, "id");
+ g_free(id);
+
+ char* url = NULL;
+ error = maps_place_category_get_url(cloned, &url);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(url, ==, "url");
+ g_free(url);
+
+ error = maps_place_category_destroy(cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_place_category_clone_n(void)
+{
+ test_env e;
+
+ maps_place_category_h cloned = NULL;
+ int error = maps_place_category_clone(e.c, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_category_clone(NULL, &cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_place_category_get_name(maps_place_category_h place,
+* char** name); */
+/* int maps_place_category_set_name(maps_place_category_h place,
+* const char* name); */
+void utc_maps_place_category_name_p(void)
+{
+ test_env e;
+
+ int error = maps_place_category_set_name(e.c, "category_name");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* name = NULL;
+ error = maps_place_category_get_name(e.c, &name);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(name, ==, "category_name");
+ g_free(name);
+}
+
+void utc_maps_place_category_name_n(void)
+{
+ test_env e;
+
+ int error = maps_place_category_set_name(NULL, "category_name");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_category_set_name(e.c, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* name = NULL;
+ error = maps_place_category_get_name(NULL, &name);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_category_get_name(e.c, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_place_category_get_id(maps_place_category_h place, char** id); */
+/* int maps_place_category_set_id(maps_place_category_h place,
+* const char* id); */
+void utc_maps_place_category_id_p(void)
+{
+ test_env e;
+
+ int error = maps_place_category_set_id(e.c, "category_id");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* id = NULL;
+ error = maps_place_category_get_id(e.c, &id);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(id, ==, "category_id");
+ g_free(id);
+}
+
+void utc_maps_place_category_id_n(void)
+{
+ test_env e;
+
+ int error = maps_place_category_set_id(NULL, "category_id");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_category_set_id(e.c, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* id = NULL;
+ error = maps_place_category_get_id(NULL, &id);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_category_get_id(e.c, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_place_category_get_url(maps_place_category_h place, char** url); */
+/* int maps_place_category_set_url(maps_place_category_h place,
+* const char* url); */
+void utc_maps_place_category_url_p(void)
+{
+ test_env e;
+
+ int error = maps_place_category_set_url(e.c, "http://category_url.com");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* url = NULL;
+ error = maps_place_category_get_url(e.c, &url);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(url, ==, "http://category_url.com");
+ g_free(url);
+}
+
+void utc_maps_place_category_url_n(void)
+{
+ test_env e;
+
+ int error =
+ maps_place_category_set_url(NULL, "http://category_url.com");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_category_set_url(e.c, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* url = NULL;
+ error = maps_place_category_get_url(NULL, &url);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_category_get_url(e.c, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_SERVICE_TEST_API_PLACE_CATEGORY_H__
+#define __MAPS_SERVICE_TEST_API_PLACE_CATEGORY_H__
+
+/* int maps_place_category_create(maps_place_category_h* place); */
+/* int maps_place_category_destroy(maps_place_category_h place); */
+void utc_maps_place_category_create_p(void);
+void utc_maps_place_category_create_n(void);
+
+/* int maps_place_category_clone(cloned, const maps_place_category_h origin,
+* maps_place_category_h*); */
+void utc_maps_place_category_clone_p(void);
+void utc_maps_place_category_clone_n(void);
+
+/* int maps_place_category_get_name(maps_place_category_h place,
+* char** name); */
+/* int maps_place_category_set_name(maps_place_category_h place,
+* const char* name); */
+void utc_maps_place_category_name_p(void);
+void utc_maps_place_category_name_n(void);
+
+/* int maps_place_category_get_id(maps_place_category_h place, char** id); */
+/* int maps_place_category_set_id(maps_place_category_h place,
+* const char* id); */
+void utc_maps_place_category_id_p(void);
+void utc_maps_place_category_id_n(void);
+
+/* int maps_place_category_get_url(maps_place_category_h place, char** url); */
+/* int maps_place_category_set_url(maps_place_category_h place,
+* const char* url); */
+void utc_maps_place_category_url_p(void);
+void utc_maps_place_category_url_n(void);
+
+#endif /* __MAPS_SERVICE_TEST_API_PLACE_CATEGORY_H__ */
+
--- /dev/null
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * 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 "maps_place_contact_test.h"
+#include "maps_place_contact_plugin.h"
+#include "maps_error.h"
+#include <glib.h>
+
+/* int maps_place_contact_create(maps_place_contact_h* place); */
+/* int maps_place_contact_destroy(maps_place_contact_h place); */
+void utc_maps_place_contact_create_p(void)
+{
+ maps_place_contact_h contact = NULL;
+ int error = maps_place_contact_create(&contact);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(contact);
+
+ error = maps_place_contact_destroy(contact);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_place_contact_create_n(void)
+{
+ int error = maps_place_contact_create(NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_contact_destroy(NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/*----------------------------------------------------------------------------*/
+class test_env
+{
+ public:
+ maps_place_contact_h c;
+ public:
+ test_env():c(NULL)
+ {
+ const int error = maps_place_contact_create(&c);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(c);
+ }
+ ~test_env()
+ {
+ const int error = maps_place_contact_destroy(c);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ }
+};
+
+/*----------------------------------------------------------------------------*/
+
+/* int maps_place_contact_clone(const maps_place_contact_h origin,
+* maps_place_contact_h* cloned); */
+void utc_maps_place_contact_clone_p(void)
+{
+ test_env e;
+
+ /* set test values for original */
+ /*------------------------------------ */
+ int error = maps_place_contact_set_label(e.c, "label");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_contact_set_type(e.c, "type");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_contact_set_value(e.c, "value");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ /*------------------------------------ */
+
+ maps_place_contact_h cloned = NULL;
+ error = maps_place_contact_clone(e.c, &cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(cloned);
+
+ /* test if values are cloned correctly */
+ /*------------------------------------ */
+ char* label = NULL;
+ error = maps_place_contact_get_label(cloned, &label);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(label, ==, "label");
+ g_free(label);
+
+ char* type = NULL;
+ error = maps_place_contact_get_type(cloned, &type);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(type, ==, "type");
+ g_free(type);
+
+ char* value = NULL;
+ error = maps_place_contact_get_value(cloned, &value);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(value, ==, "value");
+ g_free(value);
+ /*------------------------------------ */
+
+ error = maps_place_contact_destroy(cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_place_contact_clone_n(void)
+{
+ test_env e;
+
+ maps_place_contact_h cloned = NULL;
+ int error = maps_place_contact_clone(e.c, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_contact_clone(NULL, &cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_place_contact_set_label(maps_place_contact_h place,
+* const char* label); */
+/* int maps_place_contact_get_label(maps_place_contact_h place,
+* char** label); */
+void utc_maps_place_contact_label_p(void)
+{
+ test_env e;
+
+ int error = maps_place_contact_set_label(e.c, "contact_label");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* label = NULL;
+ error = maps_place_contact_get_label(e.c, &label);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(label, ==, "contact_label");
+ g_free(label);
+}
+
+void utc_maps_place_contact_label_n(void)
+{
+ test_env e;
+
+ int error = maps_place_contact_set_label(NULL, "contact_label");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_contact_set_label(e.c, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* label = NULL;
+ error = maps_place_contact_get_label(NULL, &label);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_contact_get_label(e.c, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_place_contact_set_type(maps_place_contact_h place,
+* const char* type); */
+/* int maps_place_contact_get_type(maps_place_contact_h place, char** type); */
+void utc_maps_place_contact_type_p(void)
+{
+ test_env e;
+
+ int error = maps_place_contact_set_type(e.c, "contact_type");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* type = NULL;
+ error = maps_place_contact_get_type(e.c, &type);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(type, ==, "contact_type");
+ g_free(type);
+}
+
+void utc_maps_place_contact_type_n(void)
+{
+ test_env e;
+
+ int error = maps_place_contact_set_type(NULL, "contact_type");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_contact_set_type(e.c, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* type = NULL;
+ error = maps_place_contact_get_type(NULL, &type);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_contact_get_type(e.c, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_place_contact_set_value(maps_place_contact_h place,
+* const char* value); */
+/* int maps_place_contact_get_value(maps_place_contact_h place,
+* char** value); */
+void utc_maps_place_contact_value_p(void)
+{
+ test_env e;
+
+ int error = maps_place_contact_set_value(e.c, "contact_value");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* value = NULL;
+ error = maps_place_contact_get_value(e.c, &value);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(value, ==, "contact_value");
+ g_free(value);
+}
+
+void utc_maps_place_contact_value_n(void)
+{
+ test_env e;
+
+ int error = maps_place_contact_set_value(NULL, "contact_value");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_contact_set_value(e.c, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* value = NULL;
+ error = maps_place_contact_get_value(NULL, &value);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_contact_get_value(e.c, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_SERVICE_TEST_API_PLACE_CONTACT_H__
+#define __MAPS_SERVICE_TEST_API_PLACE_CONTACT_H__
+
+/* int maps_place_contact_create(maps_place_contact_h* place); */
+/* int maps_place_contact_destroy(maps_place_contact_h place); */
+void utc_maps_place_contact_create_p(void);
+void utc_maps_place_contact_create_n(void);
+
+/* int maps_place_contact_clone(const maps_place_contact_h origin,
+* maps_place_contact_h* cloned); */
+void utc_maps_place_contact_clone_p(void);
+void utc_maps_place_contact_clone_n(void);
+
+/* int maps_place_contact_set_label(maps_place_contact_h place,
+* const char* label); */
+/* int maps_place_contact_get_label(maps_place_contact_h place,
+* char** label); */
+void utc_maps_place_contact_label_p(void);
+void utc_maps_place_contact_label_n(void);
+
+/* int maps_place_contact_set_type(maps_place_contact_h place,
+* const char* type); */
+/* int maps_place_contact_get_type(maps_place_contact_h place, char** type); */
+void utc_maps_place_contact_type_p(void);
+void utc_maps_place_contact_type_n(void);
+
+/* int maps_place_contact_set_value(maps_place_contact_h place,
+* const char* value); */
+/* int maps_place_contact_get_value(maps_place_contact_h place,
+* char** value); */
+void utc_maps_place_contact_value_p(void);
+void utc_maps_place_contact_value_n(void);
+
+#endif /* __MAPS_SERVICE_TEST_API_PLACE_CONTACT_H__ */
+
--- /dev/null
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * 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 "maps_place_editorial_test.h"
+#include "maps_place_editorial_plugin.h"
+#include "maps_place_media_plugin.h"
+#include "maps_place_link_object_plugin.h"
+#include "maps_error.h"
+#include <glib.h>
+
+void utc_maps_place_editorial_create_p(void)
+{
+ maps_place_editorial_h editorial = NULL;
+ int error = maps_place_editorial_create(&editorial);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(editorial);
+
+ error = maps_place_editorial_destroy(editorial);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_place_editorial_create_n(void)
+{
+ int error = maps_place_editorial_create(NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_editorial_destroy(NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/*----------------------------------------------------------------------------*/
+class test_env
+{
+ public:
+ maps_place_editorial_h e;
+ public:
+ test_env():e(NULL)
+ {
+ const int error = maps_place_editorial_create(&e);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(e);
+ }
+ ~test_env()
+ {
+ const int error = maps_place_editorial_destroy(e);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ }
+};
+
+/*----------------------------------------------------------------------------*/
+/*
+static maps_place_link_object_h __utc_prepare_place_link_object(const char* id,
+const char* string, const char* type, const char* name) {
+ maps_place_link_object_h l = NULL;
+
+ int error = maps_place_link_object_create(&l);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_link_object_set_id(l, id);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_link_object_set_name(l, name);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_link_object_set_type(l, type);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_link_object_set_string(l, string);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ return l;
+}
+
+static maps_place_media_h __utc_prepare_place_media() {
+ maps_place_media_h m = NULL;
+
+ int error = maps_place_media_create(&m);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_media_set_attribution(m, "attribution");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_place_link_object_h supplier = __utc_prepare_place_link_object(
+ "supplier id", "supplier string", "supplier type", "supplier name");
+ error = maps_place_media_set_supplier(m, supplier);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ error = maps_place_link_object_destroy(supplier);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_place_link_object_h via = __utc_prepare_place_link_object("via id",
+ "via string", "via type", "via name");
+ error = maps_place_media_set_via(m, via);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ error = maps_place_link_object_destroy(via);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ return m;
+}*/
+
+void utc_maps_place_editorial_clone_p(void)
+{
+ test_env e;
+
+ maps_place_editorial_h cloned = NULL;
+ int error = maps_place_editorial_clone(e.e, &cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(cloned);
+
+ error = maps_place_editorial_destroy(cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /*
+ * * set test values for original *
+ * *------------------------------------ *
+ * int error = maps_place_editorial_set_description(e.e, "description");
+ * g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ *
+ * error = maps_place_editorial_set_language(e.e, "language");
+ * g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ *
+ * maps_place_media_h media = __utc_prepare_place_media();
+ *
+ * error = maps_place_editorial_set_media(e.e, media);
+ * g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ *
+ * error = maps_place_media_destroy(media);
+ * g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ * *------------------------------------ *
+ *
+ * maps_place_editorial_h cloned = NULL;
+ * error = maps_place_editorial_clone(e.e, &cloned);
+ * g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ * g_assert(cloned);
+ *
+ *
+ * * test if values are cloned correctly *
+ * *------------------------------------ *
+ * char* description = NULL;
+ * error = maps_place_editorial_get_description(cloned, &description);
+ * g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ * g_assert_cmpstr(description, ==, "description");
+ * g_free(description);
+ *
+ * char* language = NULL;
+ * error = maps_place_editorial_get_language(cloned, &language);
+ * g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ * g_assert_cmpstr(language, ==, "language");
+ * g_free(language);
+ *
+ * {* Checking the object "media" *
+ * maps_place_media_h media_obtained = NULL;
+ * error = maps_place_editorial_get_media(cloned, &media_obtained);
+ * g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ * g_assert(media_obtained);
+ *
+ * char* attribution = NULL;
+ * error = maps_place_media_get_attribution(media_obtained,
+ * &attribution);
+ * g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ * g_assert_cmpstr(attribution, ==, "attribution");
+ * g_free(attribution);
+ *
+ * maps_place_link_object_h supplier_obtained = NULL;
+ * error = maps_place_media_get_supplier(media_obtained,
+ * &supplier_obtained);
+ * g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ * g_assert(supplier_obtained);
+ *
+ * {* Checking link object "supplier" *
+ * char* supplier_string = NULL;
+ * error = maps_place_link_object_get_string(supplier_obtained,
+ * &supplier_string);
+ * g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ * g_assert_cmpstr(supplier_string, ==, "supplier string");
+ * g_free(supplier_string);
+ *
+ * char* supplier_type = NULL;
+ * error = maps_place_link_object_get_type(supplier_obtained,
+ * &supplier_type);
+ * g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ * g_assert_cmpstr(supplier_type, ==, "supplier type");
+ * g_free(supplier_type);
+ *
+ * char* supplier_id = NULL;
+ * error = maps_place_link_object_get_id(supplier_obtained,
+ * &supplier_id);
+ * g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ * g_assert_cmpstr(supplier_id, ==, "supplier id");
+ * g_free(supplier_id);
+ *
+ * char* supplier_name = NULL;
+ * error = maps_place_link_object_get_name(supplier_obtained,
+ * &supplier_name);
+ * g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ * g_assert_cmpstr(supplier_name, ==, "supplier name");
+ * g_free(supplier_name);
+ * }
+ * maps_place_link_object_destroy(supplier_obtained);
+ *
+ * maps_place_link_object_h via_obtained = NULL;
+ * error = maps_place_media_get_via(media_obtained, &via_obtained);
+ * g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ * g_assert(via_obtained);
+ * {* Checking link object "via" *
+ * char* via_string = NULL;
+ * error = maps_place_link_object_get_string(via_obtained, &via_string);
+ * g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ * g_assert_cmpstr(via_string, ==, "via string");
+ * g_free(via_string);
+ *
+ * char* via_type = NULL;
+ * error = maps_place_link_object_get_type(via_obtained, &via_type);
+ * g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ * g_assert_cmpstr(via_type, ==, "via type");
+ * g_free(via_type);
+ *
+ * char* via_id = NULL;
+ * error = maps_place_link_object_get_id(via_obtained, &via_id);
+ * g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ * g_assert_cmpstr(via_id, ==, "via id");
+ * g_free(via_id);
+ *
+ * char* via_name = NULL;
+ * error = maps_place_link_object_get_name(via_obtained, &via_name);
+ * g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ * g_assert_cmpstr(via_name, ==, "via name");
+ * g_free(via_name);
+ * }
+ * maps_place_link_object_destroy(via_obtained);
+ *
+ * maps_place_media_destroy(media_obtained);
+ * }
+ * *------------------------------------ *
+ *
+ *
+ * error = maps_place_editorial_destroy(cloned);
+ * g_assert_cmpint(error, ==, MAPS_ERROR_NONE); */
+}
+
+void utc_maps_place_editorial_clone_n(void)
+{
+ test_env e;
+
+ maps_place_editorial_h cloned = NULL;
+ int error = maps_place_editorial_clone(e.e, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_editorial_clone(NULL, &cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+void utc_maps_place_editorial_description_p(void)
+{
+ test_env e;
+
+ int error =
+ maps_place_editorial_set_description(e.e,
+ "editorial_description");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* description = NULL;
+ error = maps_place_editorial_get_description(e.e, &description);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(description, ==, "editorial_description");
+ g_free(description);
+}
+
+void utc_maps_place_editorial_description_n(void)
+{
+ test_env e;
+
+ int error =
+ maps_place_editorial_set_description(NULL,
+ "editorial_description");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_editorial_set_description(e.e, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* description = NULL;
+ error = maps_place_editorial_get_description(NULL, &description);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_editorial_get_description(e.e, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+void utc_maps_place_editorial_language_p(void)
+{
+ test_env e;
+
+ int error =
+ maps_place_editorial_set_language(e.e, "editorial_language");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* language = NULL;
+ error = maps_place_editorial_get_language(e.e, &language);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(language, ==, "editorial_language");
+ g_free(language);
+}
+
+void utc_maps_place_editorial_language_n(void)
+{
+ test_env e;
+
+ int error =
+ maps_place_editorial_set_language(NULL, "editorial_language");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_editorial_set_language(e.e, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* language = NULL;
+ error = maps_place_editorial_get_language(NULL, &language);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_editorial_get_language(e.e, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+void utc_maps_place_editorial_media_p(void)
+{
+ test_env e;
+
+ maps_place_media_h media = NULL;
+ int error = maps_place_media_create(&media);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_editorial_set_media(e.e, media);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_place_media_h media_obtained = NULL;
+ error = maps_place_editorial_get_media(e.e, &media_obtained);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(media_obtained);
+
+ maps_place_media_destroy(media_obtained);
+
+ error = maps_place_media_destroy(media);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_place_editorial_media_n(void)
+{
+ test_env e;
+
+ maps_place_media_h media = NULL;
+ int error = maps_place_media_create(&media);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_editorial_set_media(NULL, media);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_editorial_set_media(e.e, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ maps_place_media_h obtain_media = NULL;
+ error = maps_place_editorial_get_media(NULL, &obtain_media);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_editorial_get_media(e.e, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_media_destroy(media);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_SERVICE_TEST_API_PLACE_EDITORIAL_H__
+#define __MAPS_SERVICE_TEST_API_PLACE_EDITORIAL_H__
+
+void utc_maps_place_editorial_create_p(void);
+void utc_maps_place_editorial_create_n(void);
+
+void utc_maps_place_editorial_clone_p(void);
+void utc_maps_place_editorial_clone_n(void);
+
+void utc_maps_place_editorial_description_p(void);
+void utc_maps_place_editorial_description_n(void);
+
+void utc_maps_place_editorial_language_p(void);
+void utc_maps_place_editorial_language_n(void);
+
+void utc_maps_place_editorial_media_p(void);
+void utc_maps_place_editorial_media_n(void);
+
+#endif /* __MAPS_SERVICE_TEST_API_PLACE_EDITORIAL_H__ */
+
--- /dev/null
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * 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 "maps_place_filter_test.h"
+#include "maps_place_filter.h"
+#include "maps_error.h"
+#include <glib.h>
+
+/* int maps_place_filter_create(maps_place_filter_h* filter); */
+/* int maps_place_filter_destroy(maps_place_filter_h filter); */
+void utc_maps_place_filter_create_p(void)
+{
+ maps_place_filter_h filter = NULL;
+ int error = maps_place_filter_create(&filter);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(filter);
+
+ error = maps_place_filter_destroy(filter);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_place_filter_create_n(void)
+{
+ int error = maps_place_filter_create(NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_filter_destroy(NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/*----------------------------------------------------------------------------*/
+class test_env
+{
+ public:
+ maps_place_filter_h h;
+ int iterations;
+ public:
+ test_env():h(NULL), iterations(0)
+ {
+ const int error = maps_place_filter_create(&h);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(h);
+ }
+ ~test_env()
+ {
+ const int error = maps_place_filter_destroy(h);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ }
+};
+
+/*----------------------------------------------------------------------------*/
+
+/* int maps_place_filter_clone(const maps_place_filter_h origin,
+* maps_place_filter_h* cloned); */
+void utc_maps_place_filter_clone_p(void)
+{
+ test_env e;
+
+ /* set test values for original */
+ /*------------------------------------ */
+ int error = maps_place_filter_set(e.h, "key1", "value1");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_filter_set(e.h, "key2", "value2");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ /*------------------------------------ */
+
+ maps_place_filter_h cloned = NULL;
+ error = maps_place_filter_clone(e.h, &cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(cloned);
+
+ /* test if values are cloned correctly */
+ /*------------------------------------ */
+ char* value1 = NULL;
+ error = maps_place_filter_get(cloned, "key1", &value1);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(value1, ==, "value1");
+ g_free(value1);
+
+ char* value2 = NULL;
+ error = maps_place_filter_get(cloned, "key2", &value2);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(value2, ==, "value2");
+ g_free(value2);
+ /*------------------------------------ */
+
+ error = maps_place_filter_destroy(cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_place_filter_clone_n(void)
+{
+ test_env e;
+
+ maps_place_filter_h cloned = NULL;
+ int error = maps_place_filter_clone(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_filter_clone(NULL, &cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* typedef bool (*maps_place_filter_properties_cb)(char* key, char* value ,
+* void* user_data); */
+/* int maps_place_filter_set(maps_place_filter_h filter, const char* key,
+* const char* value); */
+/* int maps_place_filter_get(maps_place_filter_h filter, const char* key,
+* char** value); */
+/* int maps_place_filter_foreach_property(maps_place_filter_h filter,
+* maps_place_filter_properties_cb callback , void* user_data); */
+static bool __utc_maps_place_filter_cb(int index, int total, char* key,
+ void* value, void* user_data)
+{
+ g_assert(key);
+ g_assert(value);
+ g_assert(user_data);
+
+ test_env* e = (test_env*) user_data;
+
+ e->iterations++;
+
+ g_free(key);
+ g_free(value);
+
+ return true;
+}
+
+void utc_maps_place_filter_set_p(void)
+{
+ test_env e;
+
+ int error = maps_place_filter_set(e.h, "key", "value");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* value = NULL;
+ error = maps_place_filter_get(e.h, "key", &value);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(value, ==, "value");
+ g_free(value);
+
+ error = maps_place_filter_foreach_property(e.h,
+ __utc_maps_place_filter_cb, &e);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpint(e.iterations, ==, 1);
+}
+
+void utc_maps_place_filter_set_n(void)
+{
+ test_env e;
+
+ int error = maps_place_filter_set(NULL, "key", "value");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_filter_set(e.h, NULL, "value");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_filter_set(e.h, "key", NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* value = NULL;
+ error = maps_place_filter_get(NULL, "key", &value);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert_cmpstr(value, !=, "value");
+
+ error = maps_place_filter_get(e.h, NULL, &value);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert_cmpstr(value, !=, "value");
+
+ error = maps_place_filter_get(e.h, "key", NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert_cmpstr(value, !=, "value");
+
+ error = maps_place_filter_foreach_property(NULL,
+ __utc_maps_place_filter_cb, &e);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert_cmpint(e.iterations, ==, 0);
+
+ error = maps_place_filter_foreach_property(e.h, NULL, &e);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert_cmpint(e.iterations, ==, 0);
+};
+
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_SERVICE_TEST_API_PLACE_FILTER_H__
+#define __MAPS_SERVICE_TEST_API_PLACE_FILTER_H__
+
+/* int maps_place_filter_create(maps_place_filter_h* filter); */
+/* int maps_place_filter_destroy(maps_place_filter_h filter); */
+void utc_maps_place_filter_create_p(void);
+void utc_maps_place_filter_create_n(void);
+
+/* int maps_place_filter_clone(const maps_place_filter_h origin,
+* maps_place_filter_h* cloned); */
+void utc_maps_place_filter_clone_p(void);
+void utc_maps_place_filter_clone_n(void);
+
+/* typedef bool (*maps_place_filter_properties_cb)(const char* key ,
+* const char* value , void *user_data); */
+/* int maps_place_filter_set(maps_place_filter_h filter, const char* key,
+* const char* value); */
+/* int maps_place_filter_get(maps_place_filter_h filter, const char* key,
+* char** value); */
+/* int maps_place_filter_foreach_property(maps_place_filter_h filter,
+* maps_place_filter_properties_cb callback , void* user_data); */
+void utc_maps_place_filter_set_p(void);
+void utc_maps_place_filter_set_n(void);
+
+#endif /* __MAPS_SERVICE_TEST_API_PLACE_FILTER_H__ */
+
--- /dev/null
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * 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 "maps_place_image_test.h"
+#include "maps_place_image_plugin.h"
+#include "maps_place_link_object_plugin.h"
+#include "maps_place_media_plugin.h"
+#include "maps_error.h"
+#include <glib.h>
+
+/* int maps_place_image_create(maps_place_image_h* place); */
+/* int maps_place_image_destroy(maps_place_image_h place); */
+void utc_maps_place_image_create_p(void)
+{
+ maps_place_image_h h = NULL;
+ int error = maps_place_image_create(&h);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(h);
+
+ error = maps_place_image_destroy(h);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_place_image_create_n(void)
+{
+ int error = maps_place_image_create(NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_image_destroy(NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/*----------------------------------------------------------------------------*/
+class test_env
+{
+ public:
+ maps_place_image_h h;
+ public:
+ test_env():h(NULL)
+ {
+ const int error = maps_place_image_create(&h);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(h);
+ }
+ ~test_env()
+ {
+ const int error = maps_place_image_destroy(h);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ }
+};
+
+/*----------------------------------------------------------------------------*/
+
+/* int maps_place_image_clone(const maps_place_image_h origin,
+* maps_place_image_h* cloned); */
+static maps_place_link_object_h __utc_prepare_place_link_object(const char* id,
+ const char* string, const char* type, const char* name)
+{
+ maps_place_link_object_h l = NULL;
+
+ int error = maps_place_link_object_create(&l);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_link_object_set_id(l, id);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_link_object_set_name(l, name);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_link_object_set_type(l, type);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_link_object_set_string(l, string);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ return l;
+}
+
+static maps_place_media_h __utc_prepare_place_media()
+{
+ maps_place_media_h m = NULL;
+
+ int error = maps_place_media_create(&m);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_media_set_attribution(m, "attribution");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_place_link_object_h supplier =
+ __utc_prepare_place_link_object("supplier id",
+ "supplier string", "supplier type", "supplier name");
+ error = maps_place_media_set_supplier(m, supplier);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ error = maps_place_link_object_destroy(supplier);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_place_link_object_h via =
+ __utc_prepare_place_link_object("via id", "via string",
+ "via type", "via name");
+ error = maps_place_media_set_via(m, via);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ error = maps_place_link_object_destroy(via);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ return m;
+}
+
+void utc_maps_place_image_clone_p(void)
+{
+ test_env e;
+
+ /* set test values for original */
+ /*------------------------------------ */
+ int error = maps_place_image_set_id(e.h, "id");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_image_set_url(e.h, "url");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_image_set_width(e.h, 3);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_image_set_height(e.h, 4);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_place_link_object_h user =
+ __utc_prepare_place_link_object("user id", "user string",
+ "user type", "user name");
+ error = maps_place_image_set_user_link(e.h, user);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ error = maps_place_link_object_destroy(user);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_place_media_h media = __utc_prepare_place_media();
+ error = maps_place_image_set_media(e.h, media);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ error = maps_place_media_destroy(media);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ /*------------------------------------ */
+
+ maps_place_image_h cloned = NULL;
+ error = maps_place_image_clone(e.h, &cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(cloned);
+
+ /* test if values are cloned correctly */
+ /*------------------------------------ */
+ char* url = NULL;
+ error = maps_place_image_get_url(cloned, &url);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(url, ==, "url");
+ g_free(url);
+
+ char* id = NULL;
+ error = maps_place_image_get_id(cloned, &id);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(id, ==, "id");
+ g_free(id);
+
+ int width = 0;
+ error = maps_place_image_get_width(cloned, &width);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpint(width, ==, 3);
+
+ int height = 0;
+ error = maps_place_image_get_height(cloned, &height);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpint(height, ==, 4);
+
+ maps_place_link_object_h user_obtained = NULL;
+ error = maps_place_image_get_user_link(cloned, &user_obtained);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(user_obtained);
+
+ { /* Checking link object "supplier" */
+ char* user_string = NULL;
+ error = maps_place_link_object_get_string(user_obtained,
+ &user_string);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(user_string, ==, "user string");
+ g_free(user_string);
+
+ char* user_type = NULL;
+ error = maps_place_link_object_get_type(user_obtained,
+ &user_type);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(user_type, ==, "user type");
+ g_free(user_type);
+
+ char* user_id = NULL;
+ error = maps_place_link_object_get_id(user_obtained, &user_id);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(user_id, ==, "user id");
+ g_free(user_id);
+
+ char* user_name = NULL;
+ error = maps_place_link_object_get_name(user_obtained,
+ &user_name);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(user_name, ==, "user name");
+ g_free(user_name);
+ }
+ maps_place_link_object_destroy(user_obtained);
+
+ {
+ maps_place_media_h media_obtained = NULL;
+ error = maps_place_image_get_media(cloned, &media_obtained);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(media_obtained);
+
+ char* attribution = NULL;
+ error = maps_place_media_get_attribution(media_obtained,
+ &attribution);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(attribution, ==, "attribution");
+ g_free(attribution);
+
+ maps_place_link_object_h supplier_obtained = NULL;
+ error = maps_place_media_get_supplier(media_obtained,
+ &supplier_obtained);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(supplier_obtained);
+
+ { /* Checking link object "supplier" */
+ char* supplier_string = NULL;
+ error = maps_place_link_object_get_string
+ (supplier_obtained, &supplier_string);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(supplier_string, ==, "supplier string");
+ g_free(supplier_string);
+
+ char* supplier_type = NULL;
+ error = maps_place_link_object_get_type
+ (supplier_obtained, &supplier_type);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(supplier_type, ==, "supplier type");
+ g_free(supplier_type);
+
+ char* supplier_id = NULL;
+ error = maps_place_link_object_get_id(supplier_obtained,
+ &supplier_id);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(supplier_id, ==, "supplier id");
+ g_free(supplier_id);
+
+ char* supplier_name = NULL;
+ error = maps_place_link_object_get_name
+ (supplier_obtained, &supplier_name);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(supplier_name, ==, "supplier name");
+ g_free(supplier_name);
+ }
+ maps_place_link_object_destroy(supplier_obtained);
+
+ maps_place_link_object_h via_obtained = NULL;
+ error = maps_place_media_get_via(media_obtained, &via_obtained);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(via_obtained);
+ { /* Checking link object "via" */
+ char* via_string = NULL;
+ error = maps_place_link_object_get_string(via_obtained,
+ &via_string);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(via_string, ==, "via string");
+ g_free(via_string);
+
+ char* via_type = NULL;
+ error = maps_place_link_object_get_type(via_obtained,
+ &via_type);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(via_type, ==, "via type");
+ g_free(via_type);
+
+ char* via_id = NULL;
+ error = maps_place_link_object_get_id(via_obtained,
+ &via_id);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(via_id, ==, "via id");
+ g_free(via_id);
+
+ char* via_name = NULL;
+ error = maps_place_link_object_get_name(via_obtained,
+ &via_name);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(via_name, ==, "via name");
+ g_free(via_name);
+ }
+ maps_place_link_object_destroy(via_obtained);
+ maps_place_media_destroy(media_obtained);
+ }
+ /*------------------------------------ */
+
+ error = maps_place_image_destroy(cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_place_image_clone_n(void)
+{
+ test_env e;
+
+ maps_place_image_h cloned = NULL;
+ int error = maps_place_image_clone(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_image_clone(NULL, &cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_place_image_set_id(maps_place_image_h place, const char* id); */
+/* int maps_place_image_get_id(maps_place_image_h place, char** id); */
+void utc_maps_place_image_id_p(void)
+{
+ test_env e;
+
+ int error = maps_place_image_set_id(e.h, "test_string");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* str = NULL;
+ error = maps_place_image_get_id(e.h, &str);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(str, ==, "test_string");
+ g_free(str);
+}
+
+void utc_maps_place_image_id_n(void)
+{
+ test_env e;
+
+ int error = maps_place_image_set_id(NULL, "test_string");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_image_set_id(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* str = NULL;
+ error = maps_place_image_get_id(NULL, &str);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_image_get_id(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_place_image_set_url(maps_place_image_h place, const char* url); */
+/* int maps_place_image_get_url(maps_place_image_h place, char** url); */
+void utc_maps_place_image_url_p(void)
+{
+ test_env e;
+
+ int error = maps_place_image_set_url(e.h, "test_string");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* str = NULL;
+ error = maps_place_image_get_url(e.h, &str);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(str, ==, "test_string");
+ g_free(str);
+}
+
+void utc_maps_place_image_url_n(void)
+{
+ test_env e;
+
+ int error = maps_place_image_set_url(NULL, "test_string");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_image_set_url(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* str = NULL;
+ error = maps_place_image_get_url(NULL, &str);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_image_get_url(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_place_image_set_width(maps_place_image_h place, const int width); */
+/* int maps_place_image_get_width(maps_place_image_h place, int* width); */
+void utc_maps_place_image_width_p(void)
+{
+ test_env e;
+
+ int error = maps_place_image_set_width(e.h, 42);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ int n = 0;
+ error = maps_place_image_get_width(e.h, &n);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpint(n, ==, 42);
+}
+
+void utc_maps_place_image_width_n(void)
+{
+ test_env e;
+
+ int error = maps_place_image_set_width(NULL, 42);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ int n = 0;
+ error = maps_place_image_get_width(NULL, &n);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_image_get_width(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_place_image_set_height(maps_place_image_h place,
+* const int height); */
+/* int maps_place_image_get_height(maps_place_image_h place, int* height); */
+void utc_maps_place_image_height_p(void)
+{
+ test_env e;
+
+ int error = maps_place_image_set_height(e.h, 42);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ int n = 0;
+ error = maps_place_image_get_height(e.h, &n);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpint(n, ==, 42);
+}
+
+void utc_maps_place_image_height_n(void)
+{
+ test_env e;
+
+ int error = maps_place_image_set_height(NULL, 42);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ int n = 0;
+ error = maps_place_image_get_height(NULL, &n);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_image_get_height(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_place_image_set_user_link(maps_place_image_h place,
+* maps_place_link_object_h user); */
+/* int maps_place_image_get_user_link(maps_place_image_h place,
+* maps_place_link_object_h* user); */
+void utc_maps_place_image_user_link_p(void)
+{
+ test_env e;
+
+ maps_place_link_object_h obj = NULL;
+ int error = maps_place_link_object_create(&obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_image_set_user_link(e.h, obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_place_link_object_h obj_obtained = NULL;
+ error = maps_place_image_get_user_link(e.h, &obj_obtained);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(obj_obtained);
+
+ maps_place_link_object_destroy(obj_obtained);
+
+ error = maps_place_link_object_destroy(obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_place_image_user_link_n(void)
+{
+ test_env e;
+
+ maps_place_link_object_h obj = NULL;
+ int error = maps_place_link_object_create(&obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_image_set_user_link(NULL, obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_image_set_user_link(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ maps_place_link_object_h obj_obtain = NULL;
+ error = maps_place_image_get_user_link(NULL, &obj_obtain);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_image_get_user_link(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_link_object_destroy(obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+/* int maps_place_image_set_media(maps_place_image_h place,
+* maps_place_media_h media); */
+/* int maps_place_image_get_media(maps_place_image_h place,
+* maps_place_media_h* media); */
+void utc_maps_place_image_media_p(void)
+{
+ test_env e;
+
+ maps_place_media_h obj = NULL;
+ int error = maps_place_media_create(&obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_image_set_media(e.h, obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_place_media_h obj_obtained = NULL;
+ error = maps_place_image_get_media(e.h, &obj_obtained);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(obj_obtained);
+
+ maps_place_media_destroy(obj_obtained);
+
+ error = maps_place_media_destroy(obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_place_image_media_n(void)
+{
+ test_env e;
+
+ maps_place_media_h obj = NULL;
+ int error = maps_place_media_create(&obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_image_set_media(NULL, obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_image_set_media(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ maps_place_media_h obj_obtain = NULL;
+ error = maps_place_image_get_media(NULL, &obj_obtain);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_image_get_media(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_media_destroy(obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_SERVICE_TEST_API_PLACE_IMAGE_H__
+#define __MAPS_SERVICE_TEST_API_PLACE_IMAGE_H__
+
+/* int maps_place_image_create(maps_place_image_h* place); */
+/* int maps_place_image_destroy(maps_place_image_h place); */
+void utc_maps_place_image_create_p(void);
+void utc_maps_place_image_create_n(void);
+
+/* int maps_place_image_clone(const maps_place_image_h origin,
+* maps_place_image_h* cloned); */
+void utc_maps_place_image_clone_p(void);
+void utc_maps_place_image_clone_n(void);
+
+/* int maps_place_image_set_id(maps_place_image_h place, const char* id); */
+/* int maps_place_image_get_id(maps_place_image_h place, char** id); */
+void utc_maps_place_image_id_p(void);
+void utc_maps_place_image_id_n(void);
+
+/* int maps_place_image_set_url(maps_place_image_h place, const char* url); */
+/* int maps_place_image_get_url(maps_place_image_h place, char** url); */
+void utc_maps_place_image_url_p(void);
+void utc_maps_place_image_url_n(void);
+
+/* int maps_place_image_set_width(maps_place_image_h place, const int width); */
+/* int maps_place_image_get_width(maps_place_image_h place, int* width); */
+void utc_maps_place_image_width_p(void);
+void utc_maps_place_image_width_n(void);
+
+/* int maps_place_image_set_height(maps_place_image_h place, const int height); */
+/* int maps_place_image_get_height(maps_place_image_h place, int* height); */
+void utc_maps_place_image_height_p(void);
+void utc_maps_place_image_height_n(void);
+
+/* int maps_place_image_set_user_link(maps_place_image_h place,
+* maps_place_link_object_h user); */
+/* int maps_place_image_get_user_link(maps_place_image_h place,
+* maps_place_link_object_h* user); */
+void utc_maps_place_image_user_link_p(void);
+void utc_maps_place_image_user_link_n(void);
+
+/* int maps_place_image_set_media(maps_place_image_h place,
+* maps_place_media_h media); */
+/* int maps_place_image_get_media(maps_place_image_h place,
+* maps_place_media_h* media); */
+void utc_maps_place_image_media_p(void);
+void utc_maps_place_image_media_n(void);
+
+#endif /* __MAPS_SERVICE_TEST_API_PLACE_IMAGE_H__ */
+
--- /dev/null
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * 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 "maps_place_link_object_test.h"
+#include "maps_place_link_object_plugin.h"
+#include "maps_error.h"
+#include <glib.h>
+
+/* int maps_place_link_object_create(maps_place_link_object_h* place); */
+/* int maps_place_link_object_destroy(maps_place_link_object_h place); */
+void utc_maps_place_link_object_create_p(void)
+{
+ maps_place_link_object_h link_object = NULL;
+ int error = maps_place_link_object_create(&link_object);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(link_object);
+
+ error = maps_place_link_object_destroy(link_object);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_place_link_object_create_n(void)
+{
+ int error = maps_place_link_object_create(NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_link_object_destroy(NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/*----------------------------------------------------------------------------*/
+class test_env
+{
+ public:
+ maps_place_link_object_h lo;
+ public:
+ test_env():lo(NULL)
+ {
+ const int error = maps_place_link_object_create(&lo);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(lo);
+ }
+ ~test_env()
+ {
+ const int error = maps_place_link_object_destroy(lo);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ }
+};
+
+/*----------------------------------------------------------------------------*/
+
+/* int maps_place_link_object_clone(const maps_place_link_object_h origin,
+* maps_place_link_object_h* cloned); */
+void utc_maps_place_link_object_clone_p(void)
+{
+ test_env e;
+
+ /* set test values for original */
+ /*------------------------------------ */
+ int error = maps_place_link_object_set_id(e.lo, "id");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_link_object_set_string(e.lo, "string");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_link_object_set_type(e.lo, "type");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_link_object_set_name(e.lo, "name");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ /*------------------------------------ */
+
+ maps_place_link_object_h cloned = NULL;
+ error = maps_place_link_object_clone(e.lo, &cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(cloned);
+
+ /* test if values are cloned correctly */
+ /*------------------------------------ */
+ char* string = NULL;
+ error = maps_place_link_object_get_string(cloned, &string);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(string, ==, "string");
+ g_free(string);
+
+ char* type = NULL;
+ error = maps_place_link_object_get_type(cloned, &type);
+ g_assert_cmpstr(type, ==, "type");
+ g_free(type);
+
+ char* id = NULL;
+ error = maps_place_link_object_get_id(cloned, &id);
+ g_assert_cmpstr(id, ==, "id");
+ g_free(id);
+
+ char* name = NULL;
+ error = maps_place_link_object_get_name(cloned, &name);
+ g_assert_cmpstr(name, ==, "name");
+ g_free(name);
+ /*------------------------------------ */
+
+ error = maps_place_link_object_destroy(cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_place_link_object_clone_n(void)
+{
+ test_env e;
+
+ maps_place_link_object_h cloned = NULL;
+ int error = maps_place_link_object_clone(e.lo, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_link_object_clone(NULL, &cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_place_link_object_set_id(maps_place_link_object_h place,
+* const char* id); */
+/* int maps_place_link_object_get_id(maps_place_link_object_h place,
+* char** id); */
+void utc_maps_place_link_object_id_p(void)
+{
+ test_env e;
+
+ int error = maps_place_link_object_set_id(e.lo, "link_object_id");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* id = NULL;
+ error = maps_place_link_object_get_id(e.lo, &id);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(id, ==, "link_object_id");
+ g_free(id);
+}
+
+void utc_maps_place_link_object_id_n(void)
+{
+ test_env e;
+
+ int error = maps_place_link_object_set_id(NULL, "link_object_id");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_link_object_set_id(e.lo, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* id = NULL;
+ error = maps_place_link_object_get_id(NULL, &id);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_link_object_get_id(e.lo, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_place_link_object_set_name(maps_place_link_object_h place,
+* const char* name); */
+/* int maps_place_link_object_get_name(maps_place_link_object_h place,
+* char** name); */
+void utc_maps_place_link_object_name_p(void)
+{
+ test_env e;
+
+ int error = maps_place_link_object_set_name(e.lo, "link_object_name");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* name = NULL;
+ error = maps_place_link_object_get_name(e.lo, &name);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(name, ==, "link_object_name");
+ g_free(name);
+}
+
+void utc_maps_place_link_object_name_n(void)
+{
+ test_env e;
+
+ int error = maps_place_link_object_set_name(NULL, "link_object_name");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_link_object_set_name(e.lo, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* name = NULL;
+ error = maps_place_link_object_get_name(NULL, &name);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_link_object_get_name(e.lo, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_place_link_object_set_type(maps_place_link_object_h place,
+* const char* type); */
+/* int maps_place_link_object_get_type(maps_place_link_object_h place,
+* char** type); */
+void utc_maps_place_link_object_type_p(void)
+{
+ test_env e;
+
+ int error = maps_place_link_object_set_type(e.lo, "link_object_type");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* type = NULL;
+ error = maps_place_link_object_get_type(e.lo, &type);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(type, ==, "link_object_type");
+ g_free(type);
+}
+
+void utc_maps_place_link_object_type_n(void)
+{
+ test_env e;
+
+ int error = maps_place_link_object_set_type(NULL, "link_object_type");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_link_object_set_type(e.lo, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* type = NULL;
+ error = maps_place_link_object_get_type(NULL, &type);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_link_object_get_type(e.lo, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_place_link_object_set_string(maps_place_link_object_h place,
+* const char* string); */
+/* int maps_place_link_object_get_string(maps_place_link_object_h place,
+* char** string); */
+void utc_maps_place_link_object_string_p(void)
+{
+ test_env e;
+
+ int error =
+ maps_place_link_object_set_string(e.lo, "link_object_string");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* string = NULL;
+ error = maps_place_link_object_get_string(e.lo, &string);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(string, ==, "link_object_string");
+ g_free(string);
+}
+
+void utc_maps_place_link_object_string_n(void)
+{
+ test_env e;
+
+ int error =
+ maps_place_link_object_set_string(NULL, "link_object_string");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_link_object_set_string(e.lo, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* string = NULL;
+ error = maps_place_link_object_get_string(NULL, &string);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_link_object_get_string(e.lo, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_SERVICE_TEST_API_PLACE_LINK_OBJECT_H__
+#define __MAPS_SERVICE_TEST_API_PLACE_LINK_OBJECT_H__
+
+/* int maps_place_link_object_create(maps_place_link_object_h* place); */
+/* int maps_place_link_object_destroy(maps_place_link_object_h place); */
+void utc_maps_place_link_object_create_p(void);
+void utc_maps_place_link_object_create_n(void);
+
+/* int maps_place_link_object_clone(const maps_place_link_object_h origin,
+* maps_place_link_object_h* cloned); */
+void utc_maps_place_link_object_clone_p(void);
+void utc_maps_place_link_object_clone_n(void);
+
+/* int maps_place_link_object_set_id(maps_place_link_object_h place,
+* const char* id); */
+/* int maps_place_link_object_get_id(maps_place_link_object_h place,
+* char** id); */
+void utc_maps_place_link_object_id_p(void);
+void utc_maps_place_link_object_id_n(void);
+
+/* int maps_place_link_object_set_name(maps_place_link_object_h place,
+* const char* name); */
+/* int maps_place_link_object_get_name(maps_place_link_object_h place,
+* char** name); */
+void utc_maps_place_link_object_name_p(void);
+void utc_maps_place_link_object_name_n(void);
+
+/* int maps_place_link_object_set_type(maps_place_link_object_h place,
+* const char* type); */
+/* int maps_place_link_object_get_type(maps_place_link_object_h place,
+* char** type); */
+void utc_maps_place_link_object_type_p(void);
+void utc_maps_place_link_object_type_n(void);
+
+/* int maps_place_link_object_set_string(maps_place_link_object_h place,
+* const char* string); */
+/* int maps_place_link_object_get_string(maps_place_link_object_h place,
+* char** string); */
+void utc_maps_place_link_object_string_p(void);
+void utc_maps_place_link_object_string_n(void);
+
+#endif /* __MAPS_SERVICE_TEST_API_PLACE_LINK_OBJECT_H__ */
+
--- /dev/null
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * 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 "maps_place_media_test.h"
+#include "maps_place_media_plugin.h"
+#include "maps_place_link_object_plugin.h"
+#include "maps_error.h"
+#include <glib.h>
+
+/* int maps_place_media_create(maps_place_media_h* place); */
+/* int maps_place_media_destroy(maps_place_media_h place); */
+void utc_maps_place_media_create_p(void)
+{
+ maps_place_media_h media = NULL;
+ int error = maps_place_media_create(&media);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(media);
+
+ error = maps_place_media_destroy(media);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_place_media_create_n(void)
+{
+ int error = maps_place_media_create(NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_media_destroy(NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/*----------------------------------------------------------------------------*/
+class test_env
+{
+ public:
+ maps_place_media_h m;
+ public:
+ test_env():m(NULL)
+ {
+ const int error = maps_place_media_create(&m);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(m);
+ }
+ ~test_env()
+ {
+ const int error = maps_place_media_destroy(m);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ }
+};
+
+/*----------------------------------------------------------------------------*/
+
+/*
+static maps_place_link_object_h __utc_prepare_place_link_object(const char* id,
+const char* string, const char* type, const char* name) {
+ maps_place_link_object_h l = NULL;
+
+ int error = maps_place_link_object_create(&l);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_link_object_set_id(l, id);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_link_object_set_name(l, name);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_link_object_set_type(l, type);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_link_object_set_string(l, string);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ return l;
+}*/
+
+/* int maps_place_media_clone(const maps_place_media_h origin,
+* maps_place_media_h* cloned); */
+void utc_maps_place_media_clone_p(void)
+{
+ test_env e;
+
+ maps_place_media_h cloned = NULL;
+ int error = maps_place_media_clone(e.m, &cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(cloned);
+ error = maps_place_media_destroy(cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+/*
+
+ * set test values for original *
+ *------------------------------------ *
+ int error = maps_place_media_set_attribution(e.m, "attribution");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_place_link_object_h supplier = __utc_prepare_place_link_object(
+ "supplier id", "supplier string", "supplier type", "supplier name");
+ error = maps_place_media_set_supplier(e.m, supplier);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ error = maps_place_link_object_destroy(supplier);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_place_link_object_h via = __utc_prepare_place_link_object(
+ "via id", "via string", "via type", "via name");
+ error = maps_place_media_set_via(e.m, via);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ error = maps_place_link_object_destroy(via);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ *------------------------------------ *
+
+ maps_place_media_h cloned = NULL;
+ error = maps_place_media_clone(e.m, &cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(cloned);
+
+ * test if values are cloned correctly *
+ *------------------------------------ *
+ char* attribution = NULL;
+ error = maps_place_media_get_attribution(cloned, &attribution);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(attribution, ==, "attribution");
+ g_free(attribution);
+
+ maps_place_link_object_h supplier_obtained = NULL;
+ error = maps_place_media_get_supplier(cloned, &supplier_obtained);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(supplier_obtained);
+
+ { * Checking link object "supplier" *
+ char* supplier_string = NULL;
+ error = maps_place_link_object_get_string(
+ supplier_obtained, &supplier_string);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(supplier_string, ==, "supplier string");
+ g_free(supplier_string);
+
+ char* supplier_type = NULL;
+ error = maps_place_link_object_get_type(
+ supplier_obtained, &supplier_type);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(supplier_type, ==, "supplier type");
+ g_free(supplier_type);
+
+ char* supplier_id = NULL;
+ error = maps_place_link_object_get_id(
+ supplier_obtained, &supplier_id);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(supplier_id, ==, "supplier id");
+ g_free(supplier_id);
+
+ char* supplier_name = NULL;
+ error = maps_place_link_object_get_name(supplier_obtained,
+ &supplier_name);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(supplier_name, ==, "supplier name");
+ g_free(supplier_id);
+ }
+ maps_place_link_object_destroy(supplier_obtained);
+
+ maps_place_link_object_h via_obtained = NULL;
+ error = maps_place_media_get_via(cloned, &via_obtained);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(via_obtained);
+
+ { * Checking link object "via" *
+ char* via_string = NULL;
+ error = maps_place_link_object_get_string(via_obtained,
+ &via_string);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(via_string, ==, "via string");
+ g_free(via_string);
+
+ char* via_type = NULL;
+ error = maps_place_link_object_get_type(via_obtained,
+ &via_type);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(via_type, ==, "via type");
+ g_free(via_type);
+
+ char* via_id = NULL;
+ error = maps_place_link_object_get_id(via_obtained, &via_id);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(via_id, ==, "via id");
+ g_free(via_id);
+
+ char* via_name = NULL;
+ error = maps_place_link_object_get_name(via_obtained,
+ &via_name);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(via_name, ==, "via name");
+ g_free(via_name);
+ }
+ maps_place_link_object_destroy(via_obtained);
+ *------------------------------------ *
+
+ error = maps_place_media_destroy(cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ */
+}
+
+void utc_maps_place_media_clone_n(void)
+{
+ test_env e;
+
+ maps_place_media_h cloned = NULL;
+ int error = maps_place_media_clone(e.m, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_media_clone(NULL, &cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_place_media_set_attribution(maps_place_media_h place,
+* const char* attribution); */
+/* int maps_place_media_get_attribution(maps_place_media_h place,
+* char** attribution); */
+void utc_maps_place_media_attribution_p(void)
+{
+ test_env e;
+
+ int error = maps_place_media_set_attribution(e.m, "media_attribution");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* attribution = NULL;
+ error = maps_place_media_get_attribution(e.m, &attribution);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(attribution, ==, "media_attribution");
+ g_free(attribution);
+}
+
+void utc_maps_place_media_attribution_n(void)
+{
+ test_env e;
+
+ int error = maps_place_media_set_attribution(NULL, "media_attribution");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_media_set_attribution(e.m, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* attribution = NULL;
+ error = maps_place_media_get_attribution(NULL, &attribution);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_media_get_attribution(e.m, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_place_media_set_supplier(maps_place_media_h place,
+* maps_place_link_object_h supplier); */
+/* int maps_place_media_get_supplier(maps_place_media_h place,
+* maps_place_link_object_h* supplier); */
+void utc_maps_place_media_supplier_p(void)
+{
+ test_env e;
+
+ maps_place_link_object_h supplier = NULL;
+ int error = maps_place_link_object_create(&supplier);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_media_set_supplier(e.m, supplier);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_place_link_object_h supplier_obtained = NULL;
+ error = maps_place_media_get_supplier(e.m, &supplier_obtained);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(supplier_obtained);
+
+ maps_place_link_object_destroy(supplier_obtained);
+
+ error = maps_place_link_object_destroy(supplier);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_place_media_supplier_n(void)
+{
+ test_env e;
+
+ maps_place_link_object_h supplier = NULL;
+ int error = maps_place_link_object_create(&supplier);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_media_set_supplier(NULL, supplier);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_media_set_supplier(e.m, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ maps_place_link_object_h supplier_obtained = NULL;
+ error = maps_place_media_get_supplier(NULL, &supplier_obtained);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_media_get_supplier(e.m, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_link_object_destroy(supplier);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+/* int maps_place_media_set_via(maps_place_media_h place,
+* maps_place_link_object_h via); */
+/* int maps_place_media_get_via(maps_place_media_h place,
+* maps_place_link_object_h* via); */
+void utc_maps_place_media_via_p(void)
+{
+ test_env e;
+
+ maps_place_link_object_h via = NULL;
+ int error = maps_place_link_object_create(&via);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_media_set_via(e.m, via);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_place_link_object_h via_obtained = NULL;
+ error = maps_place_media_get_via(e.m, &via_obtained);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(via_obtained);
+
+ maps_place_link_object_destroy(via_obtained);
+
+ error = maps_place_link_object_destroy(via);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_place_media_via_n(void)
+{
+ test_env e;
+
+ maps_place_link_object_h via = NULL;
+ int error = maps_place_link_object_create(&via);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_media_set_via(NULL, via);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_media_set_via(e.m, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ maps_place_link_object_h via_obtained = NULL;
+ error = maps_place_media_get_via(NULL, &via_obtained);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_media_get_via(e.m, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_link_object_destroy(via);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_SERVICE_TEST_API_PLACE_MEDIA_H__
+#define __MAPS_SERVICE_TEST_API_PLACE_MEDIA_H__
+
+/* int maps_place_media_create(maps_place_media_h* place); */
+/* int maps_place_media_destroy(maps_place_media_h place); */
+void utc_maps_place_media_create_p(void);
+void utc_maps_place_media_create_n(void);
+
+/* int maps_place_media_clone(const maps_place_media_h origin,
+* maps_place_media_h* cloned); */
+void utc_maps_place_media_clone_p(void);
+void utc_maps_place_media_clone_n(void);
+
+/* int maps_place_media_set_attribution(maps_place_media_h place,
+* const char* attribution); */
+/* int maps_place_media_get_attribution(maps_place_media_h place,
+* char** attribution); */
+void utc_maps_place_media_attribution_p(void);
+void utc_maps_place_media_attribution_n(void);
+
+/* int maps_place_media_set_supplier(maps_place_media_h place,
+* maps_place_link_object_h supplier); */
+/* int maps_place_media_get_supplier(maps_place_media_h place,
+* maps_place_link_object_h* supplier); */
+void utc_maps_place_media_supplier_p(void);
+void utc_maps_place_media_supplier_n(void);
+
+/* int maps_place_media_set_via(maps_place_media_h place,
+* maps_place_link_object_h via); */
+/* int maps_place_media_get_via(maps_place_media_h place,
+* aps_place_link_object_h* via); */
+void utc_maps_place_media_via_p(void);
+void utc_maps_place_media_via_n(void);
+
+#endif /* __MAPS_SERVICE_TEST_API_PLACE_MEDIA_H__ */
+
--- /dev/null
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * 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 "maps_place_rating_test.h"
+#include "maps_place_rating_plugin.h"
+#include "maps_error.h"
+#include <glib.h>
+
+/* int maps_place_rating_create(maps_place_rating_h* place); */
+/* int maps_place_rating_destroy(maps_place_rating_h place); */
+void utc_maps_place_rating_create_p(void)
+{
+ maps_place_rating_h h = NULL;
+ int error = maps_place_rating_create(&h);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(h);
+
+ error = maps_place_rating_destroy(h);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_place_rating_create_n(void)
+{
+ int error = maps_place_rating_create(NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_rating_destroy(NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/*----------------------------------------------------------------------------*/
+class test_env
+{
+ public:
+ maps_place_rating_h h;
+ public:
+ test_env():h(NULL)
+ {
+ const int error = maps_place_rating_create(&h);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(h);
+ }
+ ~test_env()
+ {
+ const int error = maps_place_rating_destroy(h);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ }
+};
+
+/*----------------------------------------------------------------------------*/
+
+/* int maps_place_rating_clone(const maps_place_rating_h origin,
+* maps_place_rating_h* cloned); */
+void utc_maps_place_rating_clone_p(void)
+{
+ test_env e;
+
+ /* set test values for original */
+ /*------------------------------------ */
+ int error = maps_place_rating_set_count(e.h, 42);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_rating_set_average(e.h, 6.0221);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ /*------------------------------------ */
+
+ maps_place_rating_h cloned = NULL;
+ error = maps_place_rating_clone(e.h, &cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(cloned);
+
+ /* test if values are cloned correctly */
+ /*------------------------------------ */
+ int count = 0;
+ error = maps_place_rating_get_count(cloned, &count);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpint(count, ==, 42);
+
+ double average = .0;
+ error = maps_place_rating_get_average(cloned, &average);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpfloat(average, ==, 6.0221);
+ /*------------------------------------ */
+
+ error = maps_place_rating_destroy(cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_place_rating_clone_n(void)
+{
+ test_env e;
+
+ maps_place_rating_h cloned = NULL;
+ int error = maps_place_rating_clone(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_rating_clone(NULL, &cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_place_rating_set_count(maps_place_rating_h place,
+* const int count); */
+/* int maps_place_rating_get_count(maps_place_rating_h place, int* count); */
+void utc_maps_place_rating_count_p(void)
+{
+ test_env e;
+
+ int error = maps_place_rating_set_count(e.h, 42);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ int n = 0;
+ error = maps_place_rating_get_count(e.h, &n);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpint(n, ==, 42);
+}
+
+void utc_maps_place_rating_count_n(void)
+{
+ test_env e;
+
+ int error = maps_place_rating_set_count(NULL, 42);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ int n = 0;
+ error = maps_place_rating_get_count(NULL, &n);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_rating_get_count(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_place_rating_set_average(maps_place_rating_h place,
+* const double average); */
+/* int maps_place_rating_get_average(maps_place_rating_h place,
+* double* average); */
+void utc_maps_place_rating_average_p(void)
+{
+ test_env e;
+
+ int error = maps_place_rating_set_average(e.h, 1.1);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ double d = .0;
+ error = maps_place_rating_get_average(e.h, &d);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpfloat(d, ==, 1.1);
+}
+
+void utc_maps_place_rating_average_n(void)
+{
+ test_env e;
+
+ int error = maps_place_rating_set_average(NULL, 1.1);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ double d = .0;
+ error = maps_place_rating_get_average(NULL, &d);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_rating_get_average(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_SERVICE_TEST_API_PLACE_RATING_H__
+#define __MAPS_SERVICE_TEST_API_PLACE_RATING_H__
+
+/* int maps_place_rating_create(maps_place_rating_h* place); */
+/* int maps_place_rating_destroy(maps_place_rating_h place); */
+void utc_maps_place_rating_create_p(void);
+void utc_maps_place_rating_create_n(void);
+
+/* int maps_place_rating_clone(const maps_place_rating_h origin,
+* maps_place_rating_h* cloned); */
+void utc_maps_place_rating_clone_p(void);
+void utc_maps_place_rating_clone_n(void);
+
+/* int maps_place_rating_set_count(maps_place_rating_h place,
+* const int count); */
+/* int maps_place_rating_get_count(maps_place_rating_h place, int* count); */
+void utc_maps_place_rating_count_p(void);
+void utc_maps_place_rating_count_n(void);
+
+/* int maps_place_rating_set_average(maps_place_rating_h place,
+* const double average); */
+/* int maps_place_rating_get_average(maps_place_rating_h place,
+* double* average); */
+void utc_maps_place_rating_average_p(void);
+void utc_maps_place_rating_average_n(void);
+
+#endif /* __MAPS_SERVICE_TEST_API_PLACE_RATING_H__ */
+
--- /dev/null
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * 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 "maps_place_review_test.h"
+#include "maps_place_review_plugin.h"
+#include "maps_place_media_plugin.h"
+#include "maps_place_link_object_plugin.h"
+#include "maps_error.h"
+#include <glib.h>
+
+/* int maps_place_review_create(maps_place_review_h* place); */
+/* int maps_place_review_destroy(maps_place_review_h place); */
+void utc_maps_place_review_create_p(void)
+{
+ maps_place_review_h h = NULL;
+ int error = maps_place_review_create(&h);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(h);
+
+ error = maps_place_review_destroy(h);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_place_review_create_n(void)
+{
+ int error = maps_place_review_create(NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_review_destroy(NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/*----------------------------------------------------------------------------*/
+class test_env
+{
+ public:
+ maps_place_review_h h;
+ public:
+ test_env():h(NULL)
+ {
+ const int error = maps_place_review_create(&h);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(h);
+ }
+ ~test_env()
+ {
+ const int error = maps_place_review_destroy(h);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ }
+};
+
+/*----------------------------------------------------------------------------*/
+/*
+* int maps_place_review_clone(const maps_place_review_h origin,
+* maps_place_review_h* cloned); *
+static maps_place_link_object_h __utc_prepare_place_link_object(const char* id,
+const char* string, const char* type, const char* name) {
+ maps_place_link_object_h l = NULL;
+
+ int error = maps_place_link_object_create(&l);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_link_object_set_id(l, id);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_link_object_set_name(l, name);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_link_object_set_type(l, type);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_link_object_set_string(l, string);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ return l;
+}
+
+static maps_place_media_h __utc_prepare_place_media() {
+ maps_place_media_h m = NULL;
+
+ int error = maps_place_media_create(&m);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_media_set_attribution(m, "attribution");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_place_link_object_h supplier = __utc_prepare_place_link_object(
+ "supplier id", "supplier string", "supplier type", "supplier name");
+ error = maps_place_media_set_supplier(m, supplier);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ error = maps_place_link_object_destroy(supplier);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_place_link_object_h via = __utc_prepare_place_link_object(
+ "via id", "via string", "via type", "via name");
+ error = maps_place_media_set_via(m, via);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ error = maps_place_link_object_destroy(via);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ return m;
+}*/
+
+void utc_maps_place_review_clone_p(void)
+{
+ test_env e;
+
+ maps_place_review_h cloned = NULL;
+ int error = maps_place_review_clone(e.h, &cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(cloned);
+
+ error = maps_place_review_destroy(cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+/* * set test values for original *
+ *------------------------------------ *
+ int error = maps_place_review_set_date(e.h, "date");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_review_set_title(e.h, "title");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_review_set_rating(e.h, 6.0221);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_review_set_description(e.h, "description");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_review_set_language(e.h, "language");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_place_media_h media = __utc_prepare_place_media();
+ error = maps_place_review_set_media(e.h, media);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ error = maps_place_media_destroy(media);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_place_link_object_h user = __utc_prepare_place_link_object(
+ "user id", "user string", "user type", "user name");
+ error = maps_place_review_set_user_link(e.h, user);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ error = maps_place_link_object_destroy(user);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ *------------------------------------ *
+
+ maps_place_review_h cloned = NULL;
+ error = maps_place_review_clone(e.h, &cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(cloned);
+
+ * test if values are cloned correctly *
+ *------------------------------------ *
+ char* date = NULL;
+ error = maps_place_review_get_date(cloned, &date);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(date, ==, "date");
+ g_free(date);
+
+ char* title = NULL;
+ error = maps_place_review_get_title(cloned, &title);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(title, ==, "title");
+ g_free(title);
+
+ double rating = .0;
+ error = maps_place_review_get_rating(cloned, &rating);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpfloat(rating, ==, 6.0221);
+
+ char* description = NULL;
+ error = maps_place_review_get_description(cloned, &description);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(description, ==, "description");
+ g_free(description);
+
+ char* language = NULL;
+ error = maps_place_review_get_language(cloned, &language);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(language, ==, "language");
+ g_free(language);
+
+ {
+ maps_place_media_h media_obtained = NULL;
+ error = maps_place_review_get_media(cloned, &media_obtained);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(media_obtained);
+
+ char* attribution = NULL;
+ error = maps_place_media_get_attribution(media_obtained,
+ &attribution);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(attribution, ==, "attribution");
+ g_free(attribution);
+
+ maps_place_link_object_h supplier_obtained = NULL;
+ error = maps_place_media_get_supplier(media_obtained,
+ &supplier_obtained);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(supplier_obtained);
+
+ { * Checking link object "supplier" *
+ char* supplier_string = NULL;
+ error = maps_place_link_object_get_string(
+ supplier_obtained, &supplier_string);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(supplier_string, ==, "supplier string");
+ g_free(supplier_string);
+
+ char* supplier_type = NULL;
+ error = maps_place_link_object_get_type(
+ supplier_obtained, &supplier_type);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(supplier_type, ==, "supplier type");
+ g_free(supplier_type);
+
+ char* supplier_id = NULL;
+ error = maps_place_link_object_get_id(
+ supplier_obtained, &supplier_id);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(supplier_id, ==, "supplier id");
+ g_free(supplier_id);
+
+ char* supplier_name = NULL;
+ error = maps_place_link_object_get_name(
+ supplier_obtained, &supplier_name);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(supplier_name, ==, "supplier name");
+ g_free(supplier_name);
+ }
+ maps_place_link_object_destroy(supplier_obtained);
+
+ maps_place_link_object_h via_obtained = NULL;
+ error = maps_place_media_get_via(media_obtained, &via_obtained);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(via_obtained);
+ { * Checking link object "via" *
+ char* via_string = NULL;
+ error = maps_place_link_object_get_string(
+ via_obtained, &via_string);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(via_string, ==, "via string");
+ g_free(via_string);
+
+ char* via_type = NULL;
+ error = maps_place_link_object_get_type(
+ via_obtained, &via_type);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(via_type, ==, "via type");
+ g_free(via_type);
+
+ char* via_id = NULL;
+ error = maps_place_link_object_get_id(
+ via_obtained, &via_id);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(via_id, ==, "via id");
+ g_free(via_id);
+
+ char* via_name = NULL;
+ error = maps_place_link_object_get_name(
+ via_obtained, &via_name);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(via_name, ==, "via name");
+ g_free(via_name);
+ }
+ maps_place_link_object_destroy(via_obtained);
+ maps_place_media_destroy(media_obtained);
+ }
+
+ maps_place_link_object_h user_obtained = NULL;
+ error = maps_place_review_get_user_link(cloned, &user_obtained);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(user_obtained);
+
+ { * Checking link object "supplier" *
+ char* user_string = NULL;
+ error = maps_place_link_object_get_string(
+ user_obtained, &user_string);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(user_string, ==, "user string");
+ g_free(user_string);
+
+ char* user_type = NULL;
+ error = maps_place_link_object_get_type(user_obtained,
+ &user_type);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(user_type, ==, "user type");
+ g_free(user_type);
+
+ char* user_id = NULL;
+ error = maps_place_link_object_get_id(user_obtained, &user_id);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(user_id, ==, "user id");
+ g_free(user_id);
+
+ char* user_name = NULL;
+ error = maps_place_link_object_get_name(user_obtained,
+ &user_name);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(user_name, ==, "user name");
+ g_free(user_name);
+ }
+ maps_place_link_object_destroy(user_obtained);
+ *------------------------------------ *
+
+ error = maps_place_review_destroy(cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);*/
+}
+
+void utc_maps_place_review_clone_n(void)
+{
+ test_env e;
+
+ maps_place_review_h cloned = NULL;
+ int error = maps_place_review_clone(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_review_clone(NULL, &cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_place_review_set_date(maps_place_review_h place,
+* const char* date); */
+/* int maps_place_review_get_date(maps_place_review_h place, char** date); */
+void utc_maps_place_review_date_p(void)
+{
+ test_env e;
+
+ int error = maps_place_review_set_date(e.h, "test_string");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* str = NULL;
+ error = maps_place_review_get_date(e.h, &str);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(str, ==, "test_string");
+ g_free(str);
+}
+
+void utc_maps_place_review_date_n(void)
+{
+ test_env e;
+
+ int error = maps_place_review_set_date(NULL, "test_string");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_review_set_date(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* str = NULL;
+ error = maps_place_review_get_date(NULL, &str);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_review_get_date(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_place_review_set_title(maps_place_review_h place,
+* const char* title); */
+/* int maps_place_review_get_title(maps_place_review_h place, char** title); */
+void utc_maps_place_review_title_p(void)
+{
+ test_env e;
+
+ int error = maps_place_review_set_title(e.h, "test_string");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* str = NULL;
+ error = maps_place_review_get_title(e.h, &str);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(str, ==, "test_string");
+ g_free(str);
+}
+
+void utc_maps_place_review_title_n(void)
+{
+ test_env e;
+
+ int error = maps_place_review_set_title(NULL, "test_string");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_review_set_title(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* str = NULL;
+ error = maps_place_review_get_title(NULL, &str);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_review_get_title(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_place_review_set_rating(maps_place_review_h place,
+* const double rating); */
+/* int maps_place_review_get_rating(maps_place_review_h place,
+* double* rating); */
+void utc_maps_place_review_rating_p(void)
+{
+ test_env e;
+
+ int error = maps_place_review_set_rating(e.h, 1.1);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ double d = .0;
+ error = maps_place_review_get_rating(e.h, &d);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpfloat(d, ==, 1.1);
+}
+
+void utc_maps_place_review_rating_n(void)
+{
+ int error = maps_place_review_set_rating(NULL, 1.1);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ double d = .0;
+ error = maps_place_review_get_rating(NULL, &d);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_place_review_set_description(maps_place_review_h place,
+* const char* description); */
+/* int maps_place_review_get_description(maps_place_review_h place,
+* char** description); */
+void utc_maps_place_review_description_p(void)
+{
+ test_env e;
+
+ int error = maps_place_review_set_description(e.h, "test_string");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* str = NULL;
+ error = maps_place_review_get_description(e.h, &str);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(str, ==, "test_string");
+ g_free(str);
+}
+
+void utc_maps_place_review_description_n(void)
+{
+ test_env e;
+
+ int error = maps_place_review_set_description(NULL, "test_string");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_review_set_description(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* str = NULL;
+ error = maps_place_review_get_description(NULL, &str);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_review_get_description(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_place_review_set_language(maps_place_review_h place,
+* const char* language); */
+/* int maps_place_review_get_language(maps_place_review_h place,
+* char** language); */
+void utc_maps_place_review_language_p(void)
+{
+ test_env e;
+
+ int error = maps_place_review_set_language(e.h, "test_string");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* str = NULL;
+ error = maps_place_review_get_language(e.h, &str);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(str, ==, "test_string");
+ g_free(str);
+}
+
+void utc_maps_place_review_language_n(void)
+{
+ test_env e;
+
+ int error = maps_place_review_set_language(NULL, "test_string");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_review_set_language(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* str = NULL;
+ error = maps_place_review_get_language(NULL, &str);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_review_get_language(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_place_review_set_media(maps_place_review_h place,
+* maps_place_media_h media); */
+/* int maps_place_review_get_media(maps_place_review_h place,
+* maps_place_media_h* media); */
+void utc_maps_place_review_media_p(void)
+{
+ test_env e;
+
+ maps_place_media_h obj = NULL;
+ int error = maps_place_media_create(&obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_review_set_media(e.h, obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_place_media_h obj_obtained = NULL;
+ error = maps_place_review_get_media(e.h, &obj_obtained);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(obj_obtained);
+ maps_place_media_destroy(obj_obtained);
+
+ error = maps_place_media_destroy(obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_place_review_media_n(void)
+{
+ test_env e;
+
+ maps_place_media_h obj = NULL;
+ int error = maps_place_media_create(&obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_review_set_media(NULL, obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_review_set_media(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ maps_place_media_h obj_obtain = NULL;
+ error = maps_place_review_get_media(NULL, &obj_obtain);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_review_get_media(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_media_destroy(obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+/* int maps_place_review_set_user_link(maps_place_review_h place,
+* maps_place_link_object_h user); */
+/* int maps_place_review_get_user_link(maps_place_review_h place,
+* maps_place_link_object_h* user); */
+void utc_maps_place_review_user_link_p(void)
+{
+ test_env e;
+
+ maps_place_link_object_h obj = NULL;
+ int error = maps_place_link_object_create(&obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_review_set_user_link(e.h, obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_place_link_object_h obj_obtained = NULL;
+ error = maps_place_review_get_user_link(e.h, &obj_obtained);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(obj_obtained);
+
+ maps_place_link_object_destroy(obj_obtained);
+
+ error = maps_place_link_object_destroy(obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_place_review_user_link_n(void)
+{
+ test_env e;
+
+ maps_place_link_object_h obj = NULL;
+ int error = maps_place_link_object_create(&obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_review_set_user_link(NULL, obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_review_set_user_link(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ maps_place_link_object_h obj_obtain = NULL;
+ error = maps_place_review_get_user_link(NULL, &obj_obtain);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_review_get_user_link(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_link_object_destroy(obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_SERVICE_TEST_API_PLACE_REVIEW_H__
+#define __MAPS_SERVICE_TEST_API_PLACE_REVIEW_H__
+
+/* int maps_place_review_create(maps_place_review_h* place); */
+/* int maps_place_review_destroy(maps_place_review_h place); */
+void utc_maps_place_review_create_p(void);
+void utc_maps_place_review_create_n(void);
+
+/* int maps_place_review_clone(const maps_place_review_h origin,
+* maps_place_review_h* cloned); */
+void utc_maps_place_review_clone_p(void);
+void utc_maps_place_review_clone_n(void);
+
+/* int maps_place_review_set_date(maps_place_review_h place,
+* const char* date); */
+/* int maps_place_review_get_date(maps_place_review_h place, char** date); */
+void utc_maps_place_review_date_p(void);
+void utc_maps_place_review_date_n(void);
+
+/* int maps_place_review_set_title(maps_place_review_h place,
+* const char* title); */
+/* int maps_place_review_get_title(maps_place_review_h place, char** title); */
+void utc_maps_place_review_title_p(void);
+void utc_maps_place_review_title_n(void);
+
+/* int maps_place_review_set_rating(maps_place_review_h place,
+* const double rating); */
+/* int maps_place_review_get_rating(maps_place_review_h place,
+* double* rating); */
+void utc_maps_place_review_rating_p(void);
+void utc_maps_place_review_rating_n(void);
+
+/* int maps_place_review_set_description(maps_place_review_h place,
+* const char* description); */
+/* int maps_place_review_get_description(maps_place_review_h place,
+* char** description); */
+void utc_maps_place_review_description_p(void);
+void utc_maps_place_review_description_n(void);
+
+/* int maps_place_review_set_language(maps_place_review_h place,
+* const char* language); */
+/* int maps_place_review_get_language(maps_place_review_h place,
+* char** language); */
+void utc_maps_place_review_language_p(void);
+void utc_maps_place_review_language_n(void);
+
+/* int maps_place_review_set_media(maps_place_review_h place,
+* maps_place_media_h media); */
+/* int maps_place_review_get_media(maps_place_review_h place,
+* maps_place_media_h* media); */
+void utc_maps_place_review_media_p(void);
+void utc_maps_place_review_media_n(void);
+
+/* int maps_place_review_set_user_link(maps_place_review_h place,
+* maps_place_link_object_h user); */
+/* int maps_place_review_get_user_link(maps_place_review_h place,
+* maps_place_link_object_h* user); */
+void utc_maps_place_review_user_link_p(void);
+void utc_maps_place_review_user_link_n(void);
+
+#endif /* __MAPS_SERVICE_TEST_API_PLACE_REVIEW_H__ */
+
--- /dev/null
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * 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 "maps_place_test.h"
+#include "maps_place_plugin.h"
+#include "maps_place_category.h"
+#include "maps_place_attribute_plugin.h"
+#include "maps_error.h"
+#include <glib.h>
+#include "maps_place_private.h"
+#include "maps_util.h"
+
+ /* int maps_place_create(maps_place_h* place); */
+/* int maps_place_destroy(maps_place_h place); */
+void utc_maps_place_create_p(void)
+{
+ maps_place_h place = NULL;
+ int error = maps_place_create(&place);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(place);
+
+ error = maps_place_destroy(place);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_place_create_n(void)
+{
+ int error = maps_place_create(NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_destroy(NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/*----------------------------------------------------------------------------*/
+static int __utc_put_to_hashtable(const char* feature_str,
+ maps_string_hashtable_h t)
+{
+ if (!feature_str || !t)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_string_hashtable_set(t, feature_str, feature_str);
+}
+
+class test_env
+{
+ public:
+ maps_place_h p;
+ int iteration;
+ public:
+ test_env():p(NULL), iteration(0)
+ {
+ const int error = maps_place_create(&p);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(p);
+
+ maps_string_hashtable_h data_supported = NULL;
+ if (maps_string_hashtable_create(&data_supported) !=
+ MAPS_ERROR_NONE)
+ return;
+
+ __utc_put_to_hashtable(_S(MAPS_PLACE_ADDRESS), data_supported);
+ __utc_put_to_hashtable(_S(MAPS_PLACE_RATING), data_supported);
+ __utc_put_to_hashtable(_S(MAPS_PLACE_CATEGORIES),
+ data_supported);
+ __utc_put_to_hashtable(_S(MAPS_PLACE_ATTRIBUTES),
+ data_supported);
+ __utc_put_to_hashtable(_S(MAPS_PLACE_CONTACTS),
+ data_supported);
+ __utc_put_to_hashtable(_S(MAPS_PLACE_EDITORIALS),
+ data_supported);
+ __utc_put_to_hashtable(_S(MAPS_PLACE_REVIEWS), data_supported);
+ __utc_put_to_hashtable(_S(MAPS_PLACE_IMAGE), data_supported);
+ __utc_put_to_hashtable(_S(MAPS_PLACE_SUPPLIER),
+ data_supported);
+ __utc_put_to_hashtable(_S(MAPS_PLACE_RELATED), data_supported);
+
+ _maps_place_set_supported_data(p, data_supported);
+ maps_string_hashtable_destroy(data_supported);
+
+ }
+ ~test_env()
+ {
+ const int error = maps_place_destroy(p);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ }
+};
+
+/*----------------------------------------------------------------------------*/
+
+/* int maps_place_clone(const maps_place_h origin, maps_place_h* cloned); */
+void utc_maps_place_clone_p(void)
+{
+ test_env e;
+
+ maps_place_h cloned = NULL;
+ int error = maps_place_clone(e.p, &cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(cloned);
+
+ /* TODO: it is better to add meaningful values to the origin and check
+ * if they are clonned correctly */
+
+ error = maps_place_destroy(cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_place_clone_n(void)
+{
+ test_env e;
+
+ maps_place_h cloned = NULL;
+ int error = maps_place_clone(e.p, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_clone(NULL, &cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_place_set_id(maps_place_h place, const char* id); */
+/* int maps_place_get_id(maps_place_h place, char** id); */
+void utc_maps_place_set_id_p(void)
+{
+ test_env e;
+
+ int error = maps_place_set_id(e.p, "place_id_1");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* id = NULL;
+ error = maps_place_get_id(e.p, &id);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(id, ==, "place_id_1");
+ g_free(id);
+}
+
+void utc_maps_place_set_id_n(void)
+{
+ test_env e;
+
+ int error = maps_place_set_id(NULL, "place_id_1");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_set_id(e.p, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* id = NULL;
+ error = maps_place_get_id(NULL, &id);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_get_id(e.p, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_place_set_name(maps_place_h place, const char* name); */
+/* int maps_place_get_name(maps_place_h place, char** name); */
+void utc_maps_place_set_name_p(void)
+{
+ test_env e;
+
+ int error = maps_place_set_name(e.p, "place_name");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* name = NULL;
+ error = maps_place_get_name(e.p, &name);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(name, ==, "place_name");
+ g_free(name);
+}
+
+void utc_maps_place_set_name_n(void)
+{
+ test_env e;
+
+ int error = maps_place_set_name(NULL, "place_name");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_set_name(e.p, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* name = NULL;
+ error = maps_place_get_name(NULL, &name);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_get_name(e.p, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_place_set_uri(maps_place_h place, const char* uri); */
+/* int maps_place_get_uri(maps_place_h place, char** uri); */
+void utc_maps_place_set_uri_p(void)
+{
+ test_env e;
+
+ int error = maps_place_set_uri(e.p, "place_uri");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* uri = NULL;
+ error = maps_place_get_uri(e.p, &uri);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(uri, ==, "place_uri");
+ g_free(uri);
+}
+
+void utc_maps_place_set_uri_n(void)
+{
+ test_env e;
+
+ int error = maps_place_set_uri(NULL, "place_uri");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_set_uri(e.p, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* uri = NULL;
+ error = maps_place_get_uri(NULL, &uri);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_get_uri(e.p, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_place_set_location(maps_place_h place,
+* maps_coordinates_h location); */
+/* int maps_place_get_location(maps_place_h place,
+* maps_coordinates_h* location); */
+void utc_maps_place_set_location_p(void)
+{
+ test_env e;
+
+ maps_coordinates_h location = NULL;
+ int error = maps_coordinates_create(44.4, 22.2,
+#if _MAPS_COORDS_3D_
+ 33.3,
+#endif
+ &location);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(location);
+
+ error = maps_place_set_location(e.p, location);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_coordinates_h location_obtained = NULL;
+ error = maps_place_get_location(e.p, &location_obtained);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(location_obtained);
+
+ double lat = .0, lon = .0;
+#if _MAPS_COORDS_3D_
+ double alt = .0;
+#endif
+
+ error = maps_coordinates_get_latitude(location_obtained, &lat);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ error = maps_coordinates_get_longitude(location_obtained, &lon);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+#if _MAPS_COORDS_3D
+ error = maps_coordinates_get_altitude(location_obtained, &alt);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+#endif
+
+ g_assert_cmpfloat(44.4, ==, lat);
+ g_assert_cmpfloat(22.2, ==, lon);
+#if _MAPS_COORDS_3D_
+ g_assert_cmpfloat(33.3, ==, alt);
+#endif
+
+ error = maps_coordinates_destroy(location);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_coordinates_destroy(location_obtained);
+}
+
+void utc_maps_place_set_location_n(void)
+{
+ test_env e;
+
+ maps_coordinates_h location = NULL;
+ int error = maps_coordinates_create(44.4, 22.2,
+#if _MAPS_COORDS_3D_
+ 33.3,
+#endif
+ &location);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(location);
+
+ error = maps_place_set_location(NULL, location);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_set_location(e.p, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ maps_coordinates_h location_obtained = NULL;
+ error = maps_place_get_location(NULL, &location_obtained);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_get_location(e.p, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_coordinates_destroy(location);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+/* int maps_place_set_categories(maps_place_h place,
+* maps_item_list_h* categories); */
+/* int maps_place_foreach_category(maps_place_h place,
+* maps_place_categories_cb callback, void* user_data); */
+/* typedef bool (*maps_place_categories_cb)(
+* const maps_place_category_h category, void* user_data); */
+static bool __utc_maps_place_categories_cb(int index, int total,
+ const maps_place_category_h category, void* user_data)
+{
+ g_assert(category);
+ test_env* e = (test_env*) user_data;
+ g_assert(e);
+
+ e->iteration++;
+
+ maps_place_category_destroy(category);
+
+ return true;
+}
+
+void utc_maps_place_set_category_p(void)
+{
+ test_env e;
+
+ maps_item_list_h categories = NULL;
+ int error = maps_item_list_create(&categories);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(categories);
+
+ maps_place_category_h category = NULL;
+ error = maps_place_category_create(&category);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(category);
+
+ error = maps_item_list_append(categories, category,
+ maps_place_category_clone);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /* test start --------------------------------- */
+ error = maps_place_set_categories(e.p, categories);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_foreach_category(e.p, __utc_maps_place_categories_cb,
+ &e);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpint(e.iteration, ==, 1);
+ /* test finish --------------------------------- */
+
+ error = maps_place_category_destroy(category);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_item_list_remove_all(categories,
+ maps_place_category_destroy);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_item_list_destroy(categories);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_place_set_category_n(void)
+{
+ test_env e;
+
+ maps_item_list_h categories = NULL;
+ int error = maps_item_list_create(&categories);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(categories);
+
+ maps_place_category_h category = NULL;
+ error = maps_place_category_create(&category);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(category);
+
+ error = maps_item_list_append(categories, category,
+ maps_place_category_clone);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /* test start --------------------------------- */
+ error = maps_place_set_categories(NULL, categories);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_set_categories(e.p, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_foreach_category(NULL,
+ __utc_maps_place_categories_cb, &e);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert_cmpint(e.iteration, ==, 0);
+
+ error = maps_place_foreach_category(e.p, NULL, &e);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert_cmpint(e.iteration, ==, 0);
+ /* test finish --------------------------------- */
+
+ error = maps_place_category_destroy(category);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_item_list_remove_all(categories,
+ maps_place_category_destroy);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_item_list_destroy(categories);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+/* int maps_place_set_attributes(maps_place_h place, GList* attributes); */
+/* int maps_place_foreach_attribute(maps_place_h place,
+* maps_place_attributes_cb callback, void* user_data); */
+static bool __utc_maps_place_attributes_cb(int index, int total,
+ const maps_place_attribute_h attribute, void* user_data)
+{
+ g_assert(attribute);
+ test_env* e = (test_env*) user_data;
+ g_assert(e);
+
+ e->iteration++;
+
+ maps_place_attribute_destroy(attribute);
+
+ return true;
+}
+
+void utc_maps_place_set_attribute_p(void)
+{
+ test_env e;
+
+ maps_item_list_h attributes = NULL;
+ int error = maps_item_list_create(&attributes);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(attributes);
+
+ maps_place_attribute_h attribute = NULL;
+ error = maps_place_attribute_create(&attribute);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(attribute);
+
+ error = maps_item_list_append(attributes, attribute,
+ maps_place_attribute_clone);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /* test start --------------------------------- */
+ error = maps_place_set_attributes(e.p, attributes);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_foreach_attribute(e.p,
+ __utc_maps_place_attributes_cb, &e);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpint(e.iteration, ==, 1);
+ /* test finish --------------------------------- */
+
+ error = maps_place_attribute_destroy(attribute);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_item_list_remove_all(attributes,
+ maps_place_attribute_destroy);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_item_list_destroy(attributes);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_place_set_attribute_n(void)
+{
+ test_env e;
+
+ maps_item_list_h attributes = NULL;
+ int error = maps_item_list_create(&attributes);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(attributes);
+
+ maps_place_attribute_h attribute = NULL;
+ error = maps_place_attribute_create(&attribute);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(attribute);
+
+ error = maps_item_list_append(attributes, attribute,
+ maps_place_attribute_clone);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /* test start --------------------------------- */
+ error = maps_place_set_attributes(NULL, attributes);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_set_attributes(e.p, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_foreach_attribute(NULL,
+ __utc_maps_place_attributes_cb, &e);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert_cmpint(e.iteration, ==, 0);
+
+ error = maps_place_foreach_attribute(e.p, NULL, &e);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert_cmpint(e.iteration, ==, 0);
+ /* test finish --------------------------------- */
+
+ error = maps_place_attribute_destroy(attribute);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_item_list_remove_all(attributes,
+ maps_place_attribute_destroy);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_item_list_destroy(attributes);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+/* int maps_place_set_contact(maps_place_h place, GList* contacts); */
+/* int maps_place_foreach_contact(maps_place_h place,
+* maps_place_contacts_cb callback, void* user_data); */
+void utc_maps_place_set_contacts_p(void)
+{
+
+}
+
+void utc_maps_place_set_contacts_n(void)
+{
+
+}
+
+/* int maps_place_set_editorials(maps_place_h place, GList* editorials); */
+/* int maps_place_foreach_editorial(maps_place_h place,
+* maps_place_editorials_cb callback, void* user_data); */
+void utc_maps_place_set_editorial_p(void)
+{
+
+}
+
+void utc_maps_place_set_editorial_n(void)
+{
+
+}
+
+/* int maps_place_set_images(maps_place_h place, GList* images); */
+/* int maps_place_foreach_image(maps_place_h place,
+* maps_place_images_cb callback, void* user_data); */
+void utc_maps_place_set_image_p(void)
+{
+
+}
+
+void utc_maps_place_set_image_n(void)
+{
+
+}
+
+/* int maps_place_set_reviews(maps_place_h place, GList* reviews); */
+/* int maps_place_foreach_review(maps_place_h place,
+* maps_place_reviews_cb callback, void* user_data); */
+void utc_maps_place_set_review_p(void)
+{
+
+}
+
+void utc_maps_place_set_review_n(void)
+{
+
+}
+
+/* int maps_place_set_properties(maps_place_h place,
+* maps_item_hashtable_h properties) */
+/* int maps_place_foreach_property(maps_place_h place,
+* maps_place_properties_cb callback, void* user_data) { */
+void utc_maps_place_set_properties_p(void)
+{
+
+}
+
+void utc_maps_place_set_properties_n(void)
+{
+
+}
+
+/* int maps_place_set_rating(maps_place_h place,
+* maps_place_rating_h rating); */
+/* int maps_place_get_rating(maps_place_h place ,
+* maps_place_rating_h* rating); */
+void utc_maps_place_set_rating_p(void)
+{
+
+}
+
+void utc_maps_place_set_rating_n(void)
+{
+
+}
+
+/* int maps_place_set_supplier_link(maps_place_h place,
+* maps_place_link_object_h supplier); */
+/* int maps_place_get_supplier_link(maps_place_image_h place,
+* maps_place_link_object_h* supplier); */
+void utc_maps_place_set_supplier_link_p(void)
+{
+
+}
+
+void utc_maps_place_set_supplier_link_n(void)
+{
+
+}
+
+/* int maps_place_set_related_link(maps_place_h place,
+* maps_place_link_object_h related); */
+/* int maps_place_get_related_link(maps_place_image_h place,
+* maps_place_link_object_h* related); */
+void utc_maps_place_set_related_link_p(void)
+{
+
+}
+
+void utc_maps_place_set_related_link_n(void)
+{
+
+}
+
+/* int maps_place_foreach_property(maps_place_h place,
+* maps_place_properties_cb callback, void* user_data); */
+void utc_maps_place_foreach_property_p(void)
+{
+
+}
+
+void utc_maps_place_foreach_property_n(void)
+{
+
+}
+
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_SERVICE_TEST_API_PLACE_H__
+#define __MAPS_SERVICE_TEST_API_PLACE_H__
+
+/* int maps_place_create(maps_place_h* place); */
+/* int maps_place_destroy(maps_place_h place); */
+void utc_maps_place_create_p(void);
+void utc_maps_place_create_n(void);
+
+/* int maps_place_clone(const maps_place_h origin, maps_place_h* cloned); */
+void utc_maps_place_clone_p(void);
+void utc_maps_place_clone_n(void);
+
+/* int maps_place_set_id(maps_place_h place, const char* id); */
+/* int maps_place_get_id(maps_place_h place, char** id); */
+void utc_maps_place_set_id_p(void);
+void utc_maps_place_set_id_n(void);
+
+/* int maps_place_set_name(maps_place_h place, const char* name); */
+/* int maps_place_get_name(maps_place_h place, char** name); */
+void utc_maps_place_set_name_p(void);
+void utc_maps_place_set_name_n(void);
+
+/* int maps_place_set_location(maps_place_h place,
+* maps_coordinates_h location); */
+/* int maps_place_get_location(maps_place_h place,
+* maps_coordinates_h* location); */
+void utc_maps_place_set_location_p(void);
+void utc_maps_place_set_location_n(void);
+
+/* int maps_place_set_categories(maps_place_h place, GList* categories); */
+/* int maps_place_foreach_category(maps_place_h place,
+* maps_place_categories_cb callback, void* user_data); */
+void utc_maps_place_set_category_p(void);
+void utc_maps_place_set_category_n(void);
+
+/* int maps_place_set_uri(maps_place_h place, const char* uri); */
+/* int maps_place_get_uri(maps_place_h place, char** uri); */
+void utc_maps_place_set_uri_p(void);
+void utc_maps_place_set_uri_n(void);
+
+/* int maps_place_set_attributes(maps_place_h place, GList* attributes); */
+/* int maps_place_foreach_attribute(maps_place_h place,
+* maps_place_attributes_cb callback, void* user_data); */
+void utc_maps_place_set_attribute_p(void);
+void utc_maps_place_set_attribute_n(void);
+
+/* int maps_place_set_contacts(maps_place_h place, GList* contacts); */
+/* int maps_place_foreach_contact(maps_place_h place,
+* maps_place_contacts_cb callback, void* user_data); */
+void utc_maps_place_set_contacts_p(void);
+void utc_maps_place_set_contacts_n(void);
+
+/* int maps_place_set_editorials(maps_place_h place, GList* editorials); */
+/* int maps_place_foreach_editorial(maps_place_h place,
+* maps_place_editorials_cb callback, void* user_data); */
+void utc_maps_place_set_editorial_p(void);
+void utc_maps_place_set_editorial_n(void);
+
+/* int maps_place_set_images(maps_place_h place, GList* images); */
+/* int maps_place_foreach_image(maps_place_h place,
+* maps_place_images_cb callback, void* user_data); */
+void utc_maps_place_set_image_p(void);
+void utc_maps_place_set_image_n(void);
+
+/* int maps_place_set_reviews(maps_place_h place, GList* reviews); */
+/* int maps_place_foreach_review(maps_place_h place,
+* maps_place_reviews_cb callback, void* user_data); */
+void utc_maps_place_set_review_p(void);
+void utc_maps_place_set_review_n(void);
+
+/* int maps_place_set_properties(maps_place_h place,
+* maps_item_hashtable_h properties) */
+/* int maps_place_foreach_property(maps_place_h place,
+* maps_place_properties_cb callback, void* user_data) { */
+void utc_maps_place_set_properties_p(void);
+void utc_maps_place_set_properties_n(void);
+
+/* int maps_place_set_rating(maps_place_h place,
+* maps_place_rating_h rating); */
+/* int maps_place_get_rating(maps_place_h place ,
+* maps_place_rating_h* rating); */
+void utc_maps_place_set_rating_p(void);
+void utc_maps_place_set_rating_n(void);
+
+/* int maps_place_set_supplier_link(maps_place_h place,
+* maps_place_link_object_h supplier); */
+/* int maps_place_get_supplier_link(maps_place_image_h place,
+* maps_place_link_object_h* supplier); */
+void utc_maps_place_set_supplier_link_p(void);
+void utc_maps_place_set_supplier_link_n(void);
+
+/* int maps_place_set_related_link(maps_place_h place,
+* maps_place_link_object_h related); */
+/* int maps_place_get_related_link(maps_place_image_h place,
+* maps_place_link_object_h* related); */
+void utc_maps_place_set_related_link_p(void);
+void utc_maps_place_set_related_link_n(void);
+
+/* int maps_place_foreach_property(maps_place_h place,
+* maps_place_properties_cb callback, void* user_data); */
+void utc_maps_place_foreach_property_p(void);
+void utc_maps_place_foreach_property_n(void);
+
+#endif /* __MAPS_SERVICE_TEST_API_PLACE_H__ */
+
--- /dev/null
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * 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 "maps_place_url_test.h"
+#include "maps_place_url_plugin.h"
+#include "maps_error.h"
+#include <glib.h>
+
+/* int maps_place_url_create(maps_place_url_h* place); */
+/* int maps_place_url_destroy(maps_place_url_h place); */
+void utc_maps_place_url_create_p(void)
+{
+ maps_place_url_h h = NULL;
+ int error = maps_place_url_create(&h);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(h);
+
+ error = maps_place_url_destroy(h);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_place_url_create_n(void)
+{
+ int error = maps_place_url_create(NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_url_destroy(NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/*----------------------------------------------------------------------------*/
+class test_env
+{
+ public:
+ maps_place_url_h h;
+ public:
+ test_env():h(NULL)
+ {
+ const int error = maps_place_url_create(&h);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(h);
+ }
+ ~test_env()
+ {
+ const int error = maps_place_url_destroy(h);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ }
+};
+
+/*----------------------------------------------------------------------------*/
+
+/* int maps_place_url_clone(const maps_place_url_h origin,
+* maps_place_url_h* cloned); */
+void utc_maps_place_url_clone_p(void)
+{
+ test_env e;
+
+ /* set test values for original */
+ /*------------------------------------ */
+ int error = maps_place_url_set_path(e.h, "path");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_place_url_set_description(e.h, "desc");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ /*------------------------------------ */
+
+ maps_place_url_h cloned = NULL;
+ error = maps_place_url_clone(e.h, &cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(cloned);
+
+ /* test if values are cloned correctly */
+ /*------------------------------------ */
+ char* path = NULL;
+ error = maps_place_url_get_path(cloned, &path);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(path, ==, "path");
+ g_free(path);
+
+ char* desc = NULL;
+ error = maps_place_url_get_description(cloned, &desc);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(desc, ==, "desc");
+ g_free(desc);
+ /*------------------------------------ */
+
+ error = maps_place_url_destroy(cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_place_url_clone_n(void)
+{
+ test_env e;
+
+ maps_place_url_h cloned = NULL;
+ int error = maps_place_url_clone(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_url_clone(NULL, &cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_place_url_set_path(maps_place_url_h place, const char* path); */
+/* int maps_place_url_get_path(maps_place_url_h place, char** path); */
+void utc_maps_place_url_path_p(void)
+{
+ test_env e;
+
+ int error = maps_place_url_set_path(e.h, "test_string");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* str = NULL;
+ error = maps_place_url_get_path(e.h, &str);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(str, ==, "test_string");
+ g_free(str);
+}
+
+void utc_maps_place_url_path_n(void)
+{
+ test_env e;
+
+ int error = maps_place_url_set_path(NULL, "test_string");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_url_set_path(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* str = NULL;
+ error = maps_place_url_get_path(NULL, &str);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_url_get_path(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_place_url_set_description(maps_place_url_h place,
+* const char* desc); */
+/* int maps_place_url_get_description(maps_place_url_h place, char** desc); */
+void utc_maps_place_url_description_p(void)
+{
+ test_env e;
+
+ int error = maps_place_url_set_description(e.h, "test_string");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* str = NULL;
+ error = maps_place_url_get_description(e.h, &str);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(str, ==, "test_string");
+ g_free(str);
+}
+
+void utc_maps_place_url_description_n(void)
+{
+ test_env e;
+
+ int error = maps_place_url_set_description(NULL, "test_string");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_url_set_description(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* str = NULL;
+ error = maps_place_url_get_description(NULL, &str);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_place_url_get_description(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_SERVICE_TEST_API_PLACE_URL_H__
+#define __MAPS_SERVICE_TEST_API_PLACE_URL_H__
+
+/* int maps_place_url_create(maps_place_url_h* place); */
+/* int maps_place_url_destroy(maps_place_url_h place); */
+void utc_maps_place_url_create_p(void);
+void utc_maps_place_url_create_n(void);
+
+/* int maps_place_url_clone(const maps_place_url_h origin,
+* maps_place_url_h* cloned); */
+void utc_maps_place_url_clone_p(void);
+void utc_maps_place_url_clone_n(void);
+
+/* int maps_place_url_set_path(maps_place_url_h place, const char* path); */
+/* int maps_place_url_get_path(maps_place_url_h place, char** path); */
+void utc_maps_place_url_path_p(void);
+void utc_maps_place_url_path_n(void);
+
+/* int maps_place_url_set_description(maps_place_url_h place,
+* const char* desc); */
+/* int maps_place_url_get_description(maps_place_url_h place, char** desc); */
+void utc_maps_place_url_description_p(void);
+void utc_maps_place_url_description_n(void);
+
+#endif /* __MAPS_SERVICE_TEST_API_PLACE_URL_H__ */
+
--- /dev/null
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * 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 "maps_preference_test.h"
+#include "maps_preference.h"
+#include "maps_error.h"
+#include <glib.h>
+
+/*int maps_preference_create(maps_preference_h* preference); */
+/*int maps_preference_destroy(maps_preference_h preference); */
+void utc_maps_preference_create_p(void)
+{
+ maps_preference_h preference = NULL;
+ int error = maps_preference_create(&preference);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(preference);
+
+ error = maps_preference_destroy(preference);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_preference_create_n(void)
+{
+ int error = maps_preference_create(NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_preference_destroy(NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+};
+
+/*----------------------------------------------------------------------------*/
+class test_env
+{
+ public:
+ maps_preference_h h;
+ int iterations;
+ public:
+ test_env():h(NULL), iterations(0)
+ {
+ const int error = maps_preference_create(&h);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(h);
+ }
+ ~test_env()
+ {
+ const int error = maps_preference_destroy(h);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ }
+};
+
+/*----------------------------------------------------------------------------*/
+
+/*int maps_preference_clone(const maps_preference_h origin,
+* maps_preference_h* cloned); */
+void utc_maps_preference_clone_p(void)
+{
+ test_env e;
+
+ /* set test values for original */
+ /*------------------------------------ */
+ int error =
+ maps_preference_set_distance_unit(e.h, MAPS_DISTANCE_UNIT_KM);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_preference_set_language(e.h, "Russian");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_preference_set_max_results(e.h, 42);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_preference_set_country_code(e.h, "RU");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_preference_set_route_optimization(e.h,
+ MAPS_ROUTE_TYPE_FASTEST);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_preference_set_route_transport_mode(e.h,
+ MAPS_ROUTE_TRANSPORT_MODE_CAR);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_preference_set_route_feature_weight(e.h,
+ MAPS_ROUTE_FEATURE_WEIGHT_NORMAL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_preference_set_route_feature(e.h, MAPS_ROUTE_FEATURE_NO);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_preference_set_property(e.h, "key", "value");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ /*------------------------------------ */
+
+ maps_preference_h cloned = NULL;
+ error = maps_preference_clone(e.h, &cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(cloned);
+
+ /* test if values are cloned correctly */
+ /*------------------------------------ */
+ maps_distance_unit_e unit = MAPS_DISTANCE_UNIT_YD;
+ error = maps_preference_get_distance_unit(cloned, &unit);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpint(unit, ==, MAPS_DISTANCE_UNIT_KM);
+
+ char* language = NULL;
+ error = maps_preference_get_language(cloned, &language);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(language, ==, "Russian");
+ g_free(language);
+
+ int max_results = 0;
+ error = maps_preference_get_max_results(cloned, &max_results);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpint(max_results, ==, 42);
+
+ char* country_code = NULL;
+ error = maps_preference_get_country_code(cloned, &country_code);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(country_code, ==, "RU");
+ g_free(country_code);
+
+ maps_route_optimization_e optimization = MAPS_ROUTE_TYPE_DIRECTDRIVE;
+ error = maps_preference_get_route_optimization(cloned, &optimization);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpint(optimization, ==, MAPS_ROUTE_TYPE_FASTEST);
+
+ maps_route_transport_mode_e transport_mode =
+ MAPS_ROUTE_TRANSPORT_MODE_TRUCK;
+ error = maps_preference_get_route_transport_mode(cloned,
+ &transport_mode);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpint(transport_mode, ==, MAPS_ROUTE_TRANSPORT_MODE_CAR);
+
+ maps_route_feature_weight_e feature_weight =
+ MAPS_ROUTE_FEATURE_WEIGHT_STRICTEXCLUDE;
+ error = maps_preference_get_route_feature_weight(cloned,
+ &feature_weight);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpint(feature_weight, ==, MAPS_ROUTE_FEATURE_WEIGHT_NORMAL);
+
+ maps_route_feature_e feature = MAPS_ROUTE_FEATURE_STAIRS;
+ error = maps_preference_get_route_feature(cloned, &feature);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpint(feature, ==, MAPS_ROUTE_FEATURE_NO);
+
+ char* value = NULL;
+ error = maps_preference_get(cloned, "key", &value);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(value, ==, "value");
+ g_free(value);
+
+ /*------------------------------------ */
+
+ error = maps_preference_destroy(cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_preference_clone_n(void)
+{
+ test_env e;
+
+ maps_preference_h cloned = NULL;
+
+ int error = maps_preference_clone(NULL, &cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_preference_clone(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/*int maps_preference_get_distance_unit(const maps_preference_h preference,
+* maps_distance_unit_e* unit); */
+/*int maps_preference_set_distance_unit(maps_preference_h preference,
+* const maps_distance_unit_e unit); */
+void utc_maps_preference_distance_unit_p(void)
+{
+ test_env e;
+
+ int error =
+ maps_preference_set_distance_unit(NULL, MAPS_DISTANCE_UNIT_M);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ maps_distance_unit_e unit = MAPS_DISTANCE_UNIT_YD;
+ error = maps_preference_get_distance_unit(e.h, &unit);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_preference_distance_unit_n(void)
+{
+ test_env e;
+
+ int error =
+ maps_preference_set_distance_unit(NULL, MAPS_DISTANCE_UNIT_M);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ maps_distance_unit_e unit = MAPS_DISTANCE_UNIT_YD;
+ error = maps_preference_get_distance_unit(NULL, &unit);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_preference_get_distance_unit(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/*int maps_p:reference_get_language(const maps_preference_h preference,
+* char** language); */
+/*int maps_preference_set_language(maps_preference_h preference,
+* const char* language); */
+void utc_maps_preference_language_p(void)
+{
+ test_env e;
+
+ int error = maps_preference_set_language(e.h, "Russian");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* language = NULL;
+ error = maps_preference_get_language(e.h, &language);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(language, ==, "Russian");
+ g_free(language);
+
+}
+
+void utc_maps_preference_language_n(void)
+{
+ test_env e;
+
+ int error = maps_preference_set_language(NULL, "Russian");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_preference_set_language(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* language = NULL;
+ error = maps_preference_get_language(NULL, &language);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_preference_get_language(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/*int maps_preference_get_max_results(const maps_preference_h preference,
+* int* max_results); */
+/*int maps_preference_set_max_results(maps_preference_h preference,
+* const int max_results); */
+void utc_maps_preference_max_results_p(void)
+{
+ test_env e;
+
+ int error = maps_preference_set_max_results(e.h, 42);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ int max_results = 0;
+ error = maps_preference_get_max_results(e.h, &max_results);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpint(max_results, ==, 42);
+
+}
+
+void utc_maps_preference_max_results_n(void)
+{
+ test_env e;
+
+ int error = maps_preference_set_max_results(NULL, 42);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ int max_results = 0;
+ error = maps_preference_get_max_results(NULL, &max_results);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_preference_get_max_results(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/*int maps_preference_get_country_code(const maps_preference_h preference,
+* char** country_code); */
+/*int maps_preference_set_country_code(maps_preference_h preference,
+* const char* country_code); */
+void utc_maps_preference_country_code_p(void)
+{
+ test_env e;
+
+ int error = maps_preference_set_country_code(e.h, "RU");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* country_code = NULL;
+ error = maps_preference_get_country_code(e.h, &country_code);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(country_code, ==, "RU");
+ g_free(country_code);
+
+}
+
+void utc_maps_preference_country_code_n(void)
+{
+ test_env e;
+
+ int error = maps_preference_set_country_code(NULL, "RU");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_preference_set_country_code(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* country_code = NULL;
+ error = maps_preference_get_country_code(NULL, &country_code);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_preference_get_country_code(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/*int maps_preference_get_route_optimization(const maps_preference_h preference,
+* maps_route_optimization_e* optimization); */
+/*int maps_preference_set_route_optimization(maps_preference_h preference, const
+* maps_route_optimization_e optimization); */
+void utc_maps_preference_route_optimization_p(void)
+{
+ test_env e;
+
+ int error =
+ maps_preference_set_route_optimization(e.h,
+ MAPS_ROUTE_TYPE_FASTEST);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_route_optimization_e optimization = MAPS_ROUTE_TYPE_DIRECTDRIVE;
+ error = maps_preference_get_route_optimization(e.h, &optimization);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpint(optimization, ==, MAPS_ROUTE_TYPE_FASTEST);
+
+}
+
+void utc_maps_preference_route_optimization_n(void)
+{
+ test_env e;
+
+ int error =
+ maps_preference_set_route_optimization(NULL,
+ MAPS_ROUTE_TYPE_FASTEST);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ maps_route_optimization_e optimization = MAPS_ROUTE_TYPE_DIRECTDRIVE;
+ error = maps_preference_get_route_optimization(NULL, &optimization);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_preference_get_route_optimization(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/*int maps_preference_get_route_transport_mode(
+* const maps_preference_h preference,
+* maps_route_transport_mode_e* transport_mode); */
+/*int maps_preference_set_route_transport_mode(maps_preference_h preference,
+* const maps_route_transport_mode_e transport_mode); */
+void utc_maps_preference_route_transport_mode_p(void)
+{
+ test_env e;
+
+ int error =
+ maps_preference_set_route_transport_mode(e.h,
+ MAPS_ROUTE_TRANSPORT_MODE_CAR);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_route_transport_mode_e transport_mode =
+ MAPS_ROUTE_TRANSPORT_MODE_TRUCK;
+ error = maps_preference_get_route_transport_mode(e.h, &transport_mode);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpint(transport_mode, ==, MAPS_ROUTE_TRANSPORT_MODE_CAR);
+
+}
+
+void utc_maps_preference_route_transport_mode_n(void)
+{
+ test_env e;
+
+ int error =
+ maps_preference_set_route_transport_mode(NULL,
+ MAPS_ROUTE_TRANSPORT_MODE_CAR);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ maps_route_transport_mode_e transport_mode =
+ MAPS_ROUTE_TRANSPORT_MODE_TRUCK;
+ error = maps_preference_get_route_transport_mode(NULL, &transport_mode);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_preference_get_route_transport_mode(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/*int maps_preference_get_route_feature_weight(
+* const maps_preference_h preference,
+* maps_route_feature_weight_e* feature_weight); */
+/*int maps_preference_set_route_feature_weight(maps_preference_h preference,
+* const maps_route_feature_weight_e feature_weight); */
+void utc_maps_preference_route_feature_weight_p(void)
+{
+ test_env e;
+
+ int error =
+ maps_preference_set_route_feature_weight(e.h,
+ MAPS_ROUTE_FEATURE_WEIGHT_NORMAL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_route_feature_weight_e feature_weight =
+ MAPS_ROUTE_FEATURE_WEIGHT_STRICTEXCLUDE;
+ error = maps_preference_get_route_feature_weight(e.h, &feature_weight);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpint(feature_weight, ==, MAPS_ROUTE_FEATURE_WEIGHT_NORMAL);
+
+}
+
+void utc_maps_preference_route_feature_weight_n(void)
+{
+ test_env e;
+
+ int error =
+ maps_preference_set_route_feature_weight(NULL,
+ MAPS_ROUTE_FEATURE_WEIGHT_NORMAL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ maps_route_feature_weight_e feature_weight =
+ MAPS_ROUTE_FEATURE_WEIGHT_STRICTEXCLUDE;
+ error = maps_preference_get_route_feature_weight(NULL, &feature_weight);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_preference_get_route_feature_weight(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/*int maps_preference_get_route_feature(const maps_preference_h preference,
+* maps_route_feature_weight_e* feature); */
+/*int maps_preference_set_route_feature(maps_preference_h preference,
+* const maps_route_feature_e feature); */
+void utc_maps_preference_route_feature_p(void)
+{
+ test_env e;
+
+ int error =
+ maps_preference_set_route_feature(e.h, MAPS_ROUTE_FEATURE_NO);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_route_feature_e feature = MAPS_ROUTE_FEATURE_STAIRS;
+ error = maps_preference_get_route_feature(e.h, &feature);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpint(feature, ==, MAPS_ROUTE_FEATURE_NO);
+
+}
+
+void utc_maps_preference_route_feature_n(void)
+{
+ test_env e;
+
+ int error =
+ maps_preference_set_route_feature(NULL, MAPS_ROUTE_FEATURE_NO);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ maps_route_feature_e feature = MAPS_ROUTE_FEATURE_STAIRS;
+ error = maps_preference_get_route_feature(NULL, &feature);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_preference_get_route_feature(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+static bool __utc_maps_preference_properties_cb(int index, int total, char* key,
+ char* value, void* user_data)
+{
+ g_assert(index >= 0);
+ g_assert(total > 0);
+ g_assert(key);
+ g_assert(value);
+ g_free(key);
+ g_free(value);
+ return true;
+}
+
+/*int maps_preference_get(const maps_preference_h preference, const char* key,
+* char** value); */
+/*int maps_preference_set_property(maps_preference_h preference,
+* const char* key, const char* value); */
+/*typedef bool (*maps_preference_properties_cb)(int index, int total, char* key,
+* char* value, void* user_data); */
+/*int maps_preference_foreach_property(const maps_preference_h preference,
+* maps_preference_properties_cb callback , void* user_data); */
+void utc_maps_preference_property_p(void)
+{
+ test_env e;
+
+ int error = maps_preference_set_property(e.h, "key", "value");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* value = NULL;
+ error = maps_preference_get(e.h, "key", &value);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(value, ==, "value");
+ g_free(value);
+
+ error = maps_preference_foreach_property(e.h,
+ __utc_maps_preference_properties_cb, &e);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_preference_property_n(void)
+{
+ test_env e;
+
+ int error = maps_preference_set_property(NULL, "key", "value");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_preference_set_property(e.h, NULL, "value");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_preference_set_property(e.h, "key", NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* value = NULL;
+ error = maps_preference_get(NULL, "key", &value);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_preference_get(e.h, NULL, &value);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_preference_get(e.h, "key", NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_SERVICE_TEST_API_PREFERENCE_H__
+#define __MAPS_SERVICE_TEST_API_PREFERENCE_H__
+
+/*int maps_preference_create(maps_preference_h* preference); */
+/*int maps_preference_destroy(maps_preference_h preference); */
+void utc_maps_preference_create_p(void);
+void utc_maps_preference_create_n(void);
+
+/*int maps_preference_clone(const maps_preference_h origin,
+* maps_preference_h* cloned); */
+void utc_maps_preference_clone_p(void);
+void utc_maps_preference_clone_n(void);
+
+/*int maps_preference_get_distance_unit(const maps_preference_h preference,
+* maps_distance_unit_e* unit); */
+/*int maps_preference_set_distance_unit(maps_preference_h preference,
+* const maps_distance_unit_e unit); */
+void utc_maps_preference_distance_unit_p(void);
+void utc_maps_preference_distance_unit_n(void);
+
+/*int maps_preference_get_language(const maps_preference_h preference,
+* char** language); */
+/*int maps_preference_set_language(maps_preference_h preference,
+* const char* language); */
+void utc_maps_preference_language_p(void);
+void utc_maps_preference_language_n(void);
+
+/*int maps_preference_get_max_results(const maps_preference_h preference,
+* int* max_results); */
+/*int maps_preference_set_max_results(maps_preference_h preference,
+* const int max_results); */
+void utc_maps_preference_max_results_p(void);
+void utc_maps_preference_max_results_n(void);
+
+/*int maps_preference_get_country_code(const maps_preference_h preference,
+* char** country_code); */
+/*int maps_preference_set_country_code(maps_preference_h preference,
+* const char* country_code); */
+void utc_maps_preference_country_code_p(void);
+void utc_maps_preference_country_code_n(void);
+
+/*int maps_preference_get_route_optimization(
+* const maps_preference_h preference,
+* maps_route_optimization_e* optimization); */
+/*int maps_preference_set_route_optimization(maps_preference_h preference,
+* const maps_route_optimization_e optimization); */
+void utc_maps_preference_route_optimization_p(void);
+void utc_maps_preference_route_optimization_n(void);
+
+/*int maps_preference_get_route_transport_mode(
+* const maps_preference_h preference,
+* maps_route_transport_mode_e* transport_mode); */
+/*int maps_preference_set_route_transport_mode(maps_preference_h preference,
+* const maps_route_transport_mode_e transport_mode); */
+void utc_maps_preference_route_transport_mode_p(void);
+void utc_maps_preference_route_transport_mode_n(void);
+
+/*int maps_preference_get_route_feature_weight(
+* const maps_preference_h preference,
+* maps_route_feature_weight_e* feature_weight); */
+/*int maps_preference_set_route_feature_weight(maps_preference_h preference,
+* const maps_route_feature_weight_e feature_weight); */
+void utc_maps_preference_route_feature_weight_p(void);
+void utc_maps_preference_route_feature_weight_n(void);
+
+/*int maps_preference_get_route_feature(const maps_preference_h preference,
+* maps_route_feature_weight_e* feature); */
+/*int maps_preference_set_route_feature(maps_preference_h preference,
+* const maps_route_feature_e feature); */
+void utc_maps_preference_route_feature_p(void);
+void utc_maps_preference_route_feature_n(void);
+
+/*int maps_preference_get(const maps_preference_h preference, const char* key,
+* char** value); */
+/*int maps_preference_set_property(maps_preference_h preference,
+* const char* key, const char* value); */
+/*typedef bool (*maps_preference_properties_cb)(int index, int total, char* key,
+* char* value, void* user_data); */
+/*int maps_preference_foreach_property(const maps_preference_h preference,
+* maps_preference_properties_cb callback , void* user_data); */
+void utc_maps_preference_property_p(void);
+void utc_maps_preference_property_n(void);
+
+#endif /* __MAPS_SERVICE_TEST_API_PREFERENCE_H__ */
+
--- /dev/null
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * 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 "maps_route_maneuver_test.h"
+#include "maps_route_maneuver_plugin.h"
+#include "maps_error.h"
+#include <glib.h>
+
+/* int maps_route_maneuver_create(maps_route_maneuver_h* maneuver); */
+/* int maps_route_maneuver_destroy(maps_route_maneuver_h maneuver); */
+void utc_maps_route_maneuver_create_p(void)
+{
+ maps_route_maneuver_h maneuver = NULL;
+ int error = maps_route_maneuver_create(&maneuver);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(maneuver);
+
+ error = maps_route_maneuver_destroy(maneuver);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_route_maneuver_create_n(void)
+{
+ int error = maps_route_maneuver_create(NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_maneuver_destroy(NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/*----------------------------------------------------------------------------*/
+class test_env
+{
+ public:
+ maps_route_maneuver_h h;
+ public:
+ test_env():h(NULL)
+ {
+ const int error = maps_route_maneuver_create(&h);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(h);
+ }
+ ~test_env()
+ {
+ const int error = maps_route_maneuver_destroy(h);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ }
+};
+
+/*----------------------------------------------------------------------------*/
+
+/* int maps_route_maneuver_clone(const maps_route_maneuver_h origin,
+* maps_route_maneuver_h* cloned); */
+void utc_maps_route_maneuver_clone_p(void)
+{
+ test_env e;
+
+ /* set test values for original */
+ /*------------------------------------ */
+ int error =
+ maps_route_maneuver_set_direction_id(e.h,
+ MAPS_ROUTE_DIRECTION_WEST);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_route_maneuver_set_turn_type(e.h,
+ MAPS_ROUTE_TURN_TYPE_STRAIGHT);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_route_maneuver_set_road_name(e.h, "road_name");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_route_maneuver_set_instruction_text(e.h,
+ "instruction_text");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_route_maneuver_set_locale(e.h, "locale");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_coordinates_h coordinates = NULL;
+ error = (maps_error_e) maps_coordinates_create(11.1, 22.2,
+ &coordinates);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ error = maps_route_maneuver_set_position(e.h, coordinates);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ error = maps_coordinates_destroy(coordinates);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_route_maneuver_set_time_to_next_instruction(e.h, 42);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_route_maneuver_set_distance_to_next_instruction(e.h,
+ 6.0221);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ /*------------------------------------ */
+
+ maps_route_maneuver_h cloned = NULL;
+ error = maps_route_maneuver_clone(e.h, &cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(cloned);
+
+ /* test if values are cloned correctly */
+ /*------------------------------------ */
+ maps_route_direction_e direction_id = MAPS_ROUTE_DIRECTION_NONE;
+ error = maps_route_maneuver_get_direction_id(cloned, &direction_id);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpint(direction_id, ==, MAPS_ROUTE_DIRECTION_WEST);
+
+ maps_route_turn_type_e turn_type = MAPS_ROUTE_TURN_TYPE_NONE;
+ error = maps_route_maneuver_get_turn_type(cloned, &turn_type);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpint(turn_type, ==, MAPS_ROUTE_TURN_TYPE_STRAIGHT);
+
+ maps_coordinates_h position_obtained = NULL;
+ error = maps_route_maneuver_get_position(cloned, &position_obtained);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(position_obtained);
+ maps_coordinates_destroy(position_obtained);
+
+ char* road_name = NULL;
+ error = maps_route_maneuver_get_road_name(cloned, &road_name);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(road_name, ==, "road_name");
+ g_free(road_name);
+
+ char* instruction_text = NULL;
+ error = maps_route_maneuver_get_instruction_text(cloned,
+ &instruction_text);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(instruction_text, ==, "instruction_text");
+ g_free(instruction_text);
+
+ char* locale = NULL;
+ error = maps_route_maneuver_get_locale(cloned, &locale);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(locale, ==, "locale");
+ g_free(locale);
+
+ int time_to_next_instruction = 0;
+ error = maps_route_maneuver_get_time_to_next_instruction(cloned,
+ &time_to_next_instruction);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpint(time_to_next_instruction, ==, 42);
+
+ double distance_to_next_instruction = .0;
+ error = maps_route_maneuver_get_distance_to_next_instruction(cloned,
+ &distance_to_next_instruction);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpfloat(distance_to_next_instruction, >=, 6.0220);
+ g_assert_cmpfloat(distance_to_next_instruction, <=, 6.0222);
+ /*------------------------------------ */
+
+ error = maps_route_maneuver_destroy(cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_route_maneuver_clone_n(void)
+{
+ test_env e;
+
+ maps_route_maneuver_h cloned = NULL;
+ int error = maps_route_maneuver_clone(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_maneuver_clone(NULL, &cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_route_maneuver_get_direction_id(
+* const maps_route_maneuver_h maneuver,
+* maps_route_direction_e* direction_id); */
+/* int maps_route_maneuver_set_direction_id(maps_route_maneuver_h maneuver,
+* const maps_route_direction_e direction_id); */
+void utc_maps_route_maneuver_direction_id_p(void)
+{
+ test_env e;
+
+ int error =
+ maps_route_maneuver_set_direction_id(e.h,
+ MAPS_ROUTE_DIRECTION_WEST);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_route_direction_e ret = MAPS_ROUTE_DIRECTION_NONE;
+ error = maps_route_maneuver_get_direction_id(e.h, &ret);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpint(ret, ==, MAPS_ROUTE_DIRECTION_WEST);
+}
+
+void utc_maps_route_maneuver_direction_id_n(void)
+{
+ test_env e;
+
+ int error =
+ maps_route_maneuver_set_direction_id(NULL,
+ MAPS_ROUTE_DIRECTION_WEST);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ maps_route_direction_e ret = MAPS_ROUTE_DIRECTION_NONE;
+ error = maps_route_maneuver_get_direction_id(NULL, &ret);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_maneuver_get_direction_id(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_route_maneuver_get_turn_type(const maps_route_maneuver_h maneuver,
+* maps_route_turn_type_e* turn_type); */
+/* int maps_route_maneuver_set_turn_type(maps_route_maneuver_h maneuver,
+* const maps_route_turn_type_e turn_type); */
+void utc_maps_route_maneuver_turn_type_p(void)
+{
+ test_env e;
+
+ int error =
+ maps_route_maneuver_set_turn_type(e.h,
+ MAPS_ROUTE_TURN_TYPE_STRAIGHT);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_route_turn_type_e ret = MAPS_ROUTE_TURN_TYPE_NONE;
+ error = maps_route_maneuver_get_turn_type(e.h, &ret);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpint(ret, ==, MAPS_ROUTE_TURN_TYPE_STRAIGHT);
+}
+
+void utc_maps_route_maneuver_turn_type_n(void)
+{
+ test_env e;
+
+ int error =
+ maps_route_maneuver_set_turn_type(NULL,
+ MAPS_ROUTE_TURN_TYPE_STRAIGHT);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ maps_route_turn_type_e ret = MAPS_ROUTE_TURN_TYPE_NONE;
+ error = maps_route_maneuver_get_turn_type(NULL, &ret);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_maneuver_get_turn_type(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_route_maneuver_get_position(maps_route_maneuver_h maneuver,
+* maps_coordinates_h* position); */
+/* int maps_route_maneuver_set_position(maps_route_maneuver_h maneuver,
+* const maps_coordinates_h position); */
+void utc_maps_route_maneuver_position_p(void)
+{
+ test_env e;
+
+ maps_coordinates_h obj = NULL;
+ int error = maps_coordinates_create(11.1, 22.2,
+#if _MAPS_COORDS_3D_
+ 33.3,
+#endif
+ &obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /* start test ---------------------------------------------------------- */
+ error = maps_route_maneuver_set_position(e.h, obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_coordinates_h obtained_obj = NULL;
+ error = maps_route_maneuver_get_position(e.h, &obtained_obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(obtained_obj);
+ maps_coordinates_destroy(obtained_obj);
+ /* finish test ---------------------------------------------------------- */
+
+ error = maps_coordinates_destroy(obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_route_maneuver_position_n(void)
+{
+ test_env e;
+
+ maps_coordinates_h obj = NULL;
+ int error = maps_coordinates_create(11.1, 22.2,
+#if _MAPS_COORDS_3D_
+ 33.3,
+#endif
+ &obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /* start test ---------------------------------------------------------- */
+ error = maps_route_maneuver_set_position(NULL, obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_maneuver_set_position(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ maps_coordinates_h obtained_obj = NULL;
+ error = maps_route_maneuver_get_position(NULL, &obtained_obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_maneuver_get_position(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ /* finish test ---------------------------------------------------------- */
+
+ error = maps_coordinates_destroy(obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+/* int maps_route_maneuver_get_road_name(maps_route_maneuver_h maneuver,
+* char** road_name); */
+/* int maps_route_maneuver_set_road_name(maps_route_maneuver_h maneuver,
+* const char* road_name); */
+void utc_maps_route_maneuver_road_name_p(void)
+{
+ test_env e;
+
+ int error = maps_route_maneuver_set_road_name(e.h, "test_string");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* ret = NULL;
+ error = maps_route_maneuver_get_road_name(e.h, &ret);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(ret, ==, "test_string");
+ g_free(ret);
+}
+
+void utc_maps_route_maneuver_road_name_n(void)
+{
+ test_env e;
+
+ int error = maps_route_maneuver_set_road_name(NULL, "test_string");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_maneuver_set_road_name(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* ret = NULL;
+ error = maps_route_maneuver_get_road_name(NULL, &ret);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_maneuver_get_road_name(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_route_maneuver_get_locale(const maps_route_maneuver_h maneuver,
+* char** locale); */
+/* int maps_route_maneuver_set_locale(maps_route_maneuver_h maneuver,
+* const char* locale); */
+void utc_maps_route_maneuver_locale_p(void)
+{
+ test_env e;
+
+ int error = maps_route_maneuver_set_locale(e.h, "test_string");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* ret = NULL;
+ error = maps_route_maneuver_get_locale(e.h, &ret);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(ret, ==, "test_string");
+ g_free(ret);
+}
+
+void utc_maps_route_maneuver_locale_n(void)
+{
+ test_env e;
+
+ int error = maps_route_maneuver_set_locale(NULL, "test_string");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_maneuver_set_locale(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* ret = NULL;
+ error = maps_route_maneuver_get_locale(NULL, &ret);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_maneuver_get_locale(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_route_maneuver_get_time_to_next_instruction(
+* const maps_route_maneuver_h maneuver, int* time_to_next_instruction); */
+/* int maps_route_maneuver_set_time_to_next_instruction(
+* maps_route_maneuver_h maneuver, int time_to_next_instruction); */
+void utc_maps_route_maneuver_time_to_next_instruction_p(void)
+{
+ test_env e;
+
+ int error = maps_route_maneuver_set_time_to_next_instruction(e.h, 42);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ int ret = 0;
+ error = maps_route_maneuver_get_time_to_next_instruction(e.h, &ret);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpint(ret, ==, 42);
+}
+
+void utc_maps_route_maneuver_time_to_next_instruction_n(void)
+{
+ test_env e;
+
+ int error = maps_route_maneuver_set_time_to_next_instruction(NULL, 42);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ int ret = 0;
+ error = maps_route_maneuver_get_time_to_next_instruction(NULL, &ret);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_maneuver_get_time_to_next_instruction(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_route_maneuver_get_distance_to_next_instruction(
+* const maps_route_maneuver_h maneuver,
+* double* distance_to_next_instruction); */
+/* int maps_route_maneuver_set_distance_to_next_instruction(
+* maps_route_maneuver_h maneuver, double distance_to_next_instruction); */
+void utc_maps_route_maneuver_distance_to_next_instruction_p(void)
+{
+ test_env e;
+
+ int error =
+ maps_route_maneuver_set_distance_to_next_instruction(e.h, 42.1);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ double ret = 0;
+ error = maps_route_maneuver_get_distance_to_next_instruction(e.h, &ret);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpfloat(ret, >=, 42.0);
+ g_assert_cmpfloat(ret, <=, 42.2);
+}
+
+void utc_maps_route_maneuver_distance_to_next_instruction_n(void)
+{
+ test_env e;
+
+ int error =
+ maps_route_maneuver_set_distance_to_next_instruction(NULL, 42);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ double ret = 0;
+ error = maps_route_maneuver_get_distance_to_next_instruction(NULL,
+ &ret);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_maneuver_get_distance_to_next_instruction(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_route_maneuver_get_instruction_text(maps_route_maneuver_h maneuver,
+* char** instruction_text); */
+/* int maps_route_maneuver_set_instruction_text(maps_route_maneuver_h maneuver,
+* const char* instruction_text); */
+void utc_maps_route_maneuver_instruction_text_p(void)
+{
+ test_env e;
+
+ int error =
+ maps_route_maneuver_set_instruction_text(e.h, "test_string");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* ret = NULL;
+ error = maps_route_maneuver_get_instruction_text(e.h, &ret);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(ret, ==, "test_string");
+ g_free(ret);
+}
+
+void utc_maps_route_maneuver_instruction_text_n(void)
+{
+ test_env e;
+
+ int error =
+ maps_route_maneuver_set_instruction_text(NULL, "test_string");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_maneuver_set_instruction_text(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* ret = NULL;
+ error = maps_route_maneuver_get_instruction_text(NULL, &ret);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_maneuver_get_instruction_text(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_SERVICE_TEST_API_ROUTE_MANEUVER_H__
+#define __MAPS_SERVICE_TEST_API_ROUTE_MANEUVER_H__
+
+/* int maps_route_maneuver_create(maps_route_maneuver_h* maneuver); */
+/* int maps_route_maneuver_destroy(maps_route_maneuver_h maneuver); */
+void utc_maps_route_maneuver_create_p(void);
+void utc_maps_route_maneuver_create_n(void);
+
+/* int maps_route_maneuver_clone(const maps_route_maneuver_h origin,
+* maps_route_maneuver_h* cloned); */
+void utc_maps_route_maneuver_clone_p(void);
+void utc_maps_route_maneuver_clone_n(void);
+
+/* int maps_route_maneuver_get_direction_id(
+* const maps_route_maneuver_h maneuver,
+* maps_route_direction_e* direction_id); */
+/* int maps_route_maneuver_set_direction_id(maps_route_maneuver_h maneuver,
+* const maps_route_direction_e direction_id); */
+void utc_maps_route_maneuver_direction_id_p(void);
+void utc_maps_route_maneuver_direction_id_n(void);
+
+/* int maps_route_maneuver_get_turn_type(const maps_route_maneuver_h maneuver,
+* maps_route_turn_type_e* turn_type); */
+/* int maps_route_maneuver_set_turn_type(maps_route_maneuver_h maneuver,
+* const maps_route_turn_type_e turn_type); */
+void utc_maps_route_maneuver_turn_type_p(void);
+void utc_maps_route_maneuver_turn_type_n(void);
+
+/* int maps_route_maneuver_get_position(maps_route_maneuver_h maneuver,
+* maps_coordinates_h* position); */
+/* int maps_route_maneuver_set_position(maps_route_maneuver_h maneuver,
+* const maps_coordinates_h position); */
+void utc_maps_route_maneuver_position_p(void);
+void utc_maps_route_maneuver_position_n(void);
+
+/* int maps_route_maneuver_get_road_name(maps_route_maneuver_h maneuver,
+* char** road_name); */
+/* int maps_route_maneuver_set_road_name(maps_route_maneuver_h maneuver,
+* const char* road_name); */
+void utc_maps_route_maneuver_road_name_p(void);
+void utc_maps_route_maneuver_road_name_n(void);
+
+/* int maps_route_maneuver_get_locale(const maps_route_maneuver_h maneuver,
+* char** locale); */
+/* int maps_route_maneuver_set_locale(maps_route_maneuver_h maneuver,
+* const char* locale); */
+void utc_maps_route_maneuver_locale_p(void);
+void utc_maps_route_maneuver_locale_n(void);
+
+/* int maps_route_maneuver_get_time_to_next_instruction(
+* const maps_route_maneuver_h maneuver, int* time_to_next_instruction); */
+/* int maps_route_maneuver_set_time_to_next_instruction(
+* maps_route_maneuver_h maneuver, int time_to_next_instruction); */
+void utc_maps_route_maneuver_time_to_next_instruction_p(void);
+void utc_maps_route_maneuver_time_to_next_instruction_n(void);
+
+/* int maps_route_maneuver_get_distance_to_next_instruction(
+* const maps_route_maneuver_h maneuver,
+* double* distance_to_next_instruction); */
+/* int maps_route_maneuver_set_distance_to_next_instruction(
+* maps_route_maneuver_h maneuver, double distance_to_next_instruction); */
+void utc_maps_route_maneuver_distance_to_next_instruction_p(void);
+void utc_maps_route_maneuver_distance_to_next_instruction_n(void);
+
+/* int maps_route_maneuver_get_instruction_text(maps_route_maneuver_h maneuver,
+* char** instruction_text); */
+/* int maps_route_maneuver_set_instruction_text(maps_route_maneuver_h maneuver,
+* const char* instruction_text); */
+void utc_maps_route_maneuver_instruction_text_p(void);
+void utc_maps_route_maneuver_instruction_text_n(void);
+
+#endif /* __MAPS_SERVICE_TEST_API_ROUTE_MANEUVER_H__ */
+
--- /dev/null
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * 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 "maps_route_segment_test.h"
+#include "maps_route_segment_plugin.h"
+#include "maps_route_maneuver_plugin.h"
+#include "maps_coordinates.h"
+#include "maps_area.h"
+#include "maps_error.h"
+#include <glib.h>
+#include "maps_route_segment_private.h"
+#include "maps_util.h"
+
+#include <maps_object.h>
+using namespace maps;
+
+/* int maps_route_segment_create(maps_route_segment_h* segment); */
+/* int maps_route_segment_destroy(maps_route_segment_h segment); */
+void utc_maps_route_segment_create_p(void)
+{
+ maps_route_segment_h segment = NULL;
+ int error = maps_route_segment_create(&segment);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(segment);
+
+ error = maps_route_segment_destroy(segment);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_route_segment_create_n(void)
+{
+ int error = maps_route_segment_create(NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_segment_destroy(NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/*----------------------------------------------------------------------------*/
+static int __utc_put_to_hashtable(const char* feature_str,
+ maps_string_hashtable_h t)
+{
+ if (!feature_str || !t)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_string_hashtable_set(t, feature_str, feature_str);
+}
+
+class test_env
+{
+ public:
+ maps_route_segment_h h;
+ int iterations;
+ public:
+ test_env():h(NULL), iterations(0)
+ {
+ const int error = maps_route_segment_create(&h);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(h);
+
+ maps_string_hashtable_h data_supported = NULL;
+ if (maps_string_hashtable_create(&data_supported) !=
+ MAPS_ERROR_NONE)
+ return;
+
+ __utc_put_to_hashtable(_S(MAPS_ROUTE_SEGMENTS_PATH),
+ data_supported);
+ __utc_put_to_hashtable(_S(MAPS_ROUTE_SEGMENTS_MANEUVERS),
+ data_supported);
+
+ _maps_route_segment_set_supported_data(h, data_supported);
+ maps_string_hashtable_destroy(data_supported);
+
+ }
+ ~test_env()
+ {
+ const int error = maps_route_segment_destroy(h);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ }
+};
+
+static bool __utc_maps_route_segment_path_clone_cb(int index, int total,
+ maps_coordinates_h coordinates, void* user_data)
+{
+ g_assert_cmpint(index, >=, 0);
+ g_assert_cmpint(total, >=, 1);
+ g_assert_cmpint(index, <, total);
+ g_assert(coordinates);
+ g_assert(user_data);
+
+ int* cnt = (int*) user_data;
+ *cnt =* cnt + 1;
+ maps_coordinates_destroy(coordinates);
+ return true;
+}
+
+static bool __utc_maps_route_segment_maneuver_clone_cb(int index, int total,
+ maps_route_maneuver_h maneuver, void* user_data)
+{
+ g_assert_cmpint(index, >=, 0);
+ g_assert_cmpint(total, >=, 1);
+ g_assert_cmpint(index, <, total);
+ g_assert(maneuver);
+ g_assert(user_data);
+
+ int* cnt = (int*) user_data;
+ *cnt =* cnt + 1;
+ maps_route_maneuver_destroy(maneuver);
+ return true;
+}
+
+/* int maps_route_segment_clone(const maps_route_segment_h origin,
+* maps_route_segment_h* cloned); */
+void utc_maps_route_segment_clone_p(void)
+{
+ test_env e;
+
+ /*------------------------------------ */
+ /* set test values for original */
+ const coordinates origin(11.1, 12.2);
+ int error = maps_route_segment_set_origin(e.h, origin);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ const coordinates destination(21.1, 22.2);
+ error = maps_route_segment_set_destination(e.h, destination);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ const area bounding_box(44.4, 22.2, 11.1, 55.5);
+ error = maps_route_segment_set_bounding_box(e.h, bounding_box);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_route_segment_set_distance(e.h, 6.0221);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_route_segment_set_duration(e.h, 42);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ item_list < coordinates > path;
+ path.add(origin);
+ path.add(destination);
+ error = maps_route_segment_set_path(e.h, path);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ route_maneuver m1, m2;
+ item_list < route_maneuver > maneuvers;
+ maneuvers.add(m1);
+ maneuvers.add(m2);
+ error = maps_route_segment_set_maneuvers(e.h, maneuvers);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ /*------------------------------------ */
+
+ maps_route_segment_h cloned = NULL;
+ error = maps_route_segment_clone(e.h, &cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(cloned);
+
+ /*------------------------------------ */
+ /* test if values are cloned correctly */
+ coordinates origin_cloned;
+ error = maps_route_segment_get_origin(cloned, origin_cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(origin == origin_cloned);
+
+ coordinates destination_cloned;
+ error = maps_route_segment_get_destination(cloned, destination_cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(destination == destination_cloned);
+
+ area bounding_box_cloned;
+ error = maps_route_segment_get_bounding_box(cloned,
+ bounding_box_cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(bounding_box == bounding_box_cloned);
+
+ double distance_cloned = .0;
+ error = maps_route_segment_get_distance(cloned, &distance_cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(__equal_double(distance_cloned, 6.0221));
+
+ long duration_cloned = 0;
+ error = maps_route_segment_get_duration(cloned, &duration_cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpint(duration_cloned, ==, 42);
+
+ int iterations = 0;
+ error = maps_route_segment_foreach_path(cloned,
+ __utc_maps_route_segment_path_clone_cb, &iterations);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpint(iterations, ==, 2);
+
+ iterations = 0;
+ error = maps_route_segment_foreach_maneuver(cloned,
+ __utc_maps_route_segment_maneuver_clone_cb, &iterations);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpint(iterations, ==, 2);
+ /*------------------------------------ */
+
+ error = maps_route_segment_destroy(cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_route_segment_clone_n(void)
+{
+ test_env e;
+
+ maps_route_segment_h cloned = NULL;
+ int error = maps_route_segment_clone(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_segment_clone(NULL, &cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_route_segment_get_origin(const maps_route_segment_h segment,
+* maps_coordinates_h* origin); */
+/* int maps_route_segment_set_origin(maps_route_segment_h segment,
+* const maps_coordinates_h origin); */
+void utc_maps_route_segment_origin_p(void)
+{
+ test_env e;
+
+ maps_coordinates_h obj = NULL;
+ int error = maps_coordinates_create(11.1, 22.2,
+#if _MAPS_COORDS_3D_
+ 33.3,
+#endif
+ &obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /* start test ------------------------------------------------------- */
+ error = maps_route_segment_set_origin(e.h, obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_coordinates_h obtained_obj = NULL;
+ error = maps_route_segment_get_origin(e.h, &obtained_obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(obtained_obj);
+ maps_coordinates_destroy(obtained_obj);
+ /* finish test ------------------------------------------------------ */
+
+ error = maps_coordinates_destroy(obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_route_segment_origin_n(void)
+{
+ test_env e;
+
+ maps_coordinates_h obj = NULL;
+ int error = maps_coordinates_create(11.1, 22.2,
+#if _MAPS_COORDS_3D_
+ 33.3,
+#endif
+ &obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /* start test ------------------------------------------------------- */
+ error = maps_route_segment_set_origin(NULL, obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_segment_set_origin(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ maps_coordinates_h obtained_obj = NULL;
+ error = maps_route_segment_get_origin(NULL, &obtained_obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_segment_get_origin(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ /* finish test ------------------------------------------------------ */
+
+ error = maps_coordinates_destroy(obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+/* int maps_route_segment_get_destination(const maps_route_segment_h segment,
+* maps_coordinates_h* destination); */
+/* int maps_route_segment_set_destination(maps_route_segment_h segment,
+* const maps_coordinates_h destination); */
+void utc_maps_route_segment_destination_p(void)
+{
+ test_env e;
+
+ maps_coordinates_h obj = NULL;
+ int error = maps_coordinates_create(11.1, 22.2,
+#if _MAPS_COORDS_3D_
+ 33.3,
+#endif
+ &obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /* start test ------------------------------------------------------- */
+ error = maps_route_segment_set_destination(e.h, obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_coordinates_h obtained_obj = NULL;
+ error = maps_route_segment_get_destination(e.h, &obtained_obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(obtained_obj);
+ maps_coordinates_destroy(obtained_obj);
+ /* finish test ------------------------------------------------------ */
+
+ error = maps_coordinates_destroy(obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_route_segment_destination_n(void)
+{
+ test_env e;
+
+ maps_coordinates_h obj = NULL;
+ int error = maps_coordinates_create(11.1, 22.2,
+#if _MAPS_COORDS_3D_
+ 33.3,
+#endif
+ &obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /* start test ------------------------------------------------------ */
+ error = maps_route_segment_set_destination(NULL, obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_segment_set_destination(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ maps_coordinates_h obtained_obj = NULL;
+ error = maps_route_segment_get_destination(NULL, &obtained_obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_segment_get_destination(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ /* finish test ------------------------------------------------------ */
+
+ error = maps_coordinates_destroy(obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+/* int maps_route_segment_get_bounding_box(const maps_route_segment_h segment,
+* maps_area_h* bounding_box); */
+/* int maps_route_segment_set_bounding_box(maps_route_segment_h segment,
+* maps_area_h bounding_box); */
+void utc_maps_route_segment_bounding_box_p(void)
+{
+ test_env e;
+
+ maps_coordinates_h center = NULL;
+ int error = maps_coordinates_create(11.1, 22.2,
+#if _MAPS_COORDS_3D_
+ 33.3,
+#endif
+ ¢er);
+ g_assert(center);
+ maps_area_h bounds = NULL;
+ error = maps_area_create_circle(center, 200, &bounds);
+ g_assert(bounds);
+
+ /* test start --------------------------------- */
+ error = maps_route_segment_set_bounding_box(e.h, bounds);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_area_h obtained_bounds = NULL;
+ error = maps_route_segment_get_bounding_box(e.h, &obtained_bounds);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(obtained_bounds);
+ maps_area_destroy(obtained_bounds);
+ /* test finish --------------------------------- */
+
+ error = maps_area_destroy(bounds);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ error = maps_coordinates_destroy(center);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_route_segment_bounding_box_n(void)
+{
+ test_env e;
+
+ maps_coordinates_h center = NULL;
+ int error = maps_coordinates_create(11.1, 22.2,
+#if _MAPS_COORDS_3D_
+ 33.3,
+#endif
+ ¢er);
+ g_assert(center);
+ maps_area_h bounds = NULL;
+ error = maps_area_create_circle(center, 200, &bounds);
+ g_assert(bounds);
+
+ /* test start --------------------------------- */
+ error = maps_route_segment_set_bounding_box(NULL, bounds);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_segment_set_bounding_box(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ maps_area_h obtained_bounds = NULL;
+ error = maps_route_segment_get_bounding_box(NULL, &obtained_bounds);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert(!obtained_bounds);
+
+ error = maps_route_segment_get_bounding_box(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ /* test finish --------------------------------- */
+
+ error = maps_area_destroy(bounds);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ error = maps_coordinates_destroy(center);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+/* int maps_route_segment_get_distance(const maps_route_segment_h segment,
+* double* distance); */
+/*int maps_route_segment_set_distance(maps_route_segment_h segment,
+* double distance); */
+void utc_maps_route_segment_distance_p(void)
+{
+ test_env e;
+
+ int error = maps_route_segment_set_distance(e.h, 42.1);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ double ret = 0;
+ error = maps_route_segment_get_distance(e.h, &ret);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpfloat(ret, >=, 42.0);
+ g_assert_cmpfloat(ret, <=, 42.2);
+}
+
+void utc_maps_route_segment_distance_n(void)
+{
+ test_env e;
+
+ int error = maps_route_segment_set_distance(NULL, 42);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ double ret = 0;
+ error = maps_route_segment_get_distance(NULL, &ret);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_segment_get_distance(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_route_segment_get_duration(const maps_route_segment_h segment,
+* long* duration); */
+/* int maps_route_segment_set_duration(maps_route_segment_h segment,
+* long duration); */
+void utc_maps_route_segment_duration_p(void)
+{
+ test_env e;
+
+ int error = maps_route_segment_set_duration(e.h, 42);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ long ret = 0;
+ error = maps_route_segment_get_duration(e.h, &ret);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpint(ret, ==, 42);
+}
+
+void utc_maps_route_segment_duration_n(void)
+{
+ test_env e;
+
+ int error = maps_route_segment_set_duration(NULL, 42);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ long ret = 0;
+ error = maps_route_segment_get_duration(NULL, &ret);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_segment_get_duration(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* typedef bool(*maps_route_segment_path_cb)(int index, int total,
+* maps_coordinates_h coordinates, void* user_data); */
+/* int maps_route_segment_foreach_path(const maps_route_segment_h route,
+* maps_route_path_cb callback, void* user_data); */
+/* int maps_route_segment_set_path(const maps_route_segment_h segment,
+* maps_item_list_h path); */
+static bool __utc_maps_route_segment_path_cb(int index, int total,
+ maps_coordinates_h coordinates, void* user_data)
+{
+ test_env* e = (test_env*) user_data;
+ g_assert(e);
+ e->iterations++;
+
+ g_assert(coordinates);
+
+ g_assert_cmpint(index, >=, 0);
+ g_assert_cmpint(total, >=, 1);
+
+ maps_coordinates_destroy(coordinates);
+
+ return true;
+}
+
+void utc_maps_route_segment_path_p(void)
+{
+ test_env e;
+
+ maps_item_list_h path = NULL;
+ int error = maps_item_list_create(&path);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_coordinates_h obj = NULL;
+ error = maps_coordinates_create(11.1, 22.2, &obj);
+
+ error = maps_item_list_append(path, obj, maps_coordinates_clone);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_coordinates_destroy(obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /* test start --------------------------------- */
+ error = maps_route_segment_set_path(e.h, path);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_route_segment_foreach_path(e.h,
+ __utc_maps_route_segment_path_cb, &e);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpint(e.iterations, ==, 1);
+ /* test finish --------------------------------- */
+
+ error = maps_item_list_remove_all(path, maps_coordinates_destroy);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_item_list_destroy(path);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_route_segment_path_n(void)
+{
+ test_env e;
+
+ maps_item_list_h path = NULL;
+ int error = maps_item_list_create(&path);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_coordinates_h obj = NULL;
+ error = maps_coordinates_create(11.1, 22.2, &obj);
+
+ error = maps_item_list_append(path, obj, maps_coordinates_clone);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_coordinates_destroy(obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /* test start --------------------------------- */
+ error = maps_route_segment_set_path(NULL, path);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_segment_set_path(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_segment_foreach_path(NULL,
+ __utc_maps_route_segment_path_cb, &e);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert_cmpint(e.iterations, ==, 0);
+
+ error = maps_route_segment_foreach_path(e.h, NULL, &e);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert_cmpint(e.iterations, ==, 0);
+ /* test finish --------------------------------- */
+
+ error = maps_item_list_remove_all(path, maps_coordinates_destroy);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_item_list_destroy(path);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+/* typedef bool(*maps_route_segment_maneuver_cb)(int index, int total,
+* maps_route_maneuver_h maneuver, void* user_data); */
+/* int maps_route_segment_foreach_maneuver(const maps_route_segment_h route,
+* maps_route_maneuver_cb callback, void* user_data); */
+/* int maps_route_segment_set_maneuvers(maps_route_segment_h route,
+* const maps_item_list_h maneuvers); */
+static bool __utc_maps_route_segment_maneuver_cb(int index, int total,
+ maps_route_maneuver_h maneuver, void* user_data)
+{
+ test_env* e = (test_env*) user_data;
+ g_assert(e);
+ e->iterations++;
+
+ g_assert(maneuver);
+
+ g_assert_cmpint(index, >=, 0);
+ g_assert_cmpint(total, >=, 1);
+
+ maps_route_maneuver_destroy(maneuver);
+
+ return true;
+}
+
+void utc_maps_route_segment_maneuvers_p(void)
+{
+ test_env e;
+
+ maps_item_list_h maneuvers = NULL;
+ int error = maps_item_list_create(&maneuvers);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_route_maneuver_h obj = NULL;
+ error = maps_route_maneuver_create(&obj);
+
+ error = maps_item_list_append(maneuvers, obj,
+ maps_route_maneuver_clone);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ maps_route_maneuver_destroy(obj);
+
+ /* test start --------------------------------- */
+ error = maps_route_segment_set_maneuvers(e.h, maneuvers);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_route_segment_foreach_maneuver(e.h,
+ __utc_maps_route_segment_maneuver_cb, &e);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpint(e.iterations, ==, 1);
+ /* test finish --------------------------------- */
+
+ error = maps_item_list_remove_all(maneuvers,
+ maps_route_maneuver_destroy);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_item_list_destroy(maneuvers);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_route_segment_maneuvers_n(void)
+{
+ test_env e;
+
+ maps_item_list_h maneuvers = NULL;
+ int error = maps_item_list_create(&maneuvers);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_route_maneuver_h obj = NULL;
+ error = maps_route_maneuver_create(&obj);
+
+ error = maps_item_list_append(maneuvers, obj,
+ maps_route_maneuver_clone);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ maps_route_maneuver_destroy(obj);
+
+ /* test start --------------------------------- */
+ error = maps_route_segment_set_maneuvers(NULL, maneuvers);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_segment_set_maneuvers(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_segment_foreach_maneuver(NULL,
+ __utc_maps_route_segment_maneuver_cb, &e);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert_cmpint(e.iterations, ==, 0);
+
+ error = maps_route_segment_foreach_maneuver(e.h, NULL, &e);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert_cmpint(e.iterations, ==, 0);
+ /* test finish --------------------------------- */
+
+ error = maps_item_list_remove_all(maneuvers,
+ maps_route_maneuver_destroy);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_item_list_destroy(maneuvers);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_SERVICE_TEST_API_ROUTE_SEGMENT_H__
+#define __MAPS_SERVICE_TEST_API_ROUTE_SEGMENT_H__
+
+/* int maps_route_segment_create(maps_route_segment_h* segment); */
+/* int maps_route_segment_destroy(maps_route_segment_h segment); */
+void utc_maps_route_segment_create_p(void);
+void utc_maps_route_segment_create_n(void);
+
+/* int maps_route_segment_clone(const maps_route_segment_h origin,
+* maps_route_segment_h* cloned); */
+void utc_maps_route_segment_clone_p(void);
+void utc_maps_route_segment_clone_n(void);
+
+/* int maps_route_segment_get_origin(const maps_route_segment_h segment,
+* maps_coordinates_h* origin); */
+/* int maps_route_segment_set_origin(maps_route_segment_h segment,
+* const maps_coordinates_h origin); */
+void utc_maps_route_segment_origin_p(void);
+void utc_maps_route_segment_origin_n(void);
+
+/* int maps_route_segment_get_destination(const maps_route_segment_h segment,
+* maps_coordinates_h* destination); */
+/* int maps_route_segment_set_destination(maps_route_segment_h segment,
+* const maps_coordinates_h destination); */
+void utc_maps_route_segment_destination_p(void);
+void utc_maps_route_segment_destination_n(void);
+
+/* int maps_route_segment_get_bounding_box(const maps_route_segment_h segment,
+* maps_area_h* bounding_box); */
+/* int maps_route_segment_set_bounding_box(maps_route_segment_h segment,
+* maps_area_h bounding_box); */
+void utc_maps_route_segment_bounding_box_p(void);
+void utc_maps_route_segment_bounding_box_n(void);
+
+/* int maps_route_segment_get_distance(const maps_route_segment_h segment,
+* double* distance); */
+/*int maps_route_segment_set_distance(maps_route_segment_h segment,
+* double distance); */
+void utc_maps_route_segment_distance_p(void);
+void utc_maps_route_segment_distance_n(void);
+
+/* int maps_route_segment_get_duration(const maps_route_segment_h segment,
+* long* duration); */
+/* int maps_route_segment_set_duration(maps_route_segment_h segment,
+* long duration); */
+void utc_maps_route_segment_duration_p(void);
+void utc_maps_route_segment_duration_n(void);
+
+/* int maps_route_foreach_path(const maps_route_segment_h route,
+* maps_route_path_cb callback, void* user_data); */
+/* int maps_route_segment_set_path(const maps_route_segment_h segment,
+* maps_item_list_h path); */
+void utc_maps_route_segment_path_p(void);
+void utc_maps_route_segment_path_n(void);
+
+/* int maps_route_segment_foreach_maneuver(const maps_route_segment_h route,
+* maps_route_maneuver_cb callback, void* user_data); */
+/* int maps_route_segment_set_maneuvers(maps_route_segment_h route,
+* const maps_item_list_h maneuvers); */
+void utc_maps_route_segment_maneuvers_p(void);
+void utc_maps_route_segment_maneuvers_n(void);
+
+#endif /* __MAPS_SERVICE_TEST_API_ROUTE_SEGMENT_H__ */
+
--- /dev/null
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * 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 "maps_route_test.h"
+#include "maps_route_plugin.h"
+#include "maps_route_segment_plugin.h"
+#include "maps_error.h"
+#include <glib.h>
+#include "maps_route_private.h"
+#include "maps_util.h"
+
+/* int maps_route_create(maps_route_h* route); */
+/* int maps_route_destroy(maps_route_h route); */
+void utc_maps_route_create_p(void)
+{
+ maps_route_h route = NULL;
+ int error = maps_route_create(&route);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(route);
+
+ error = maps_route_destroy(route);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_route_create_n(void)
+{
+ int error = maps_route_create(NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_destroy(NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/*----------------------------------------------------------------------------*/
+static int __utc_put_to_hashtable(const char* feature_str,
+ maps_string_hashtable_h t)
+{
+ if (!feature_str || !t)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ return maps_string_hashtable_set(t, feature_str, feature_str);
+}
+
+class test_env
+{
+ public:
+ maps_route_h h;
+ int iterations;
+ public:
+ test_env():h(NULL), iterations(0)
+ {
+ const int error = maps_route_create(&h);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(h);
+
+ maps_string_hashtable_h data_supported = NULL;
+ if (maps_string_hashtable_create(&data_supported) !=
+ MAPS_ERROR_NONE)
+ return;
+
+ __utc_put_to_hashtable(_S(MAPS_ROUTE_PATH), data_supported);
+ __utc_put_to_hashtable(_S(MAPS_ROUTE_SEGMENTS_PATH),
+ data_supported);
+ __utc_put_to_hashtable(_S(MAPS_ROUTE_SEGMENTS_MANEUVERS),
+ data_supported);
+
+ _maps_route_set_supported_data(h, data_supported);
+ maps_string_hashtable_destroy(data_supported);
+
+ }
+ ~test_env()
+ {
+ const int error = maps_route_destroy(h);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ }
+};
+
+/*----------------------------------------------------------------------------*/
+
+/* int maps_route_clone(const maps_route_h origin, maps_route_h* cloned); */
+void utc_maps_route_clone_p(void)
+{
+ test_env e;
+
+ maps_route_h cloned = NULL;
+ int error = maps_route_clone(e.h, &cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(cloned);
+
+ /* TODO: add checking of other fields */
+
+ error = maps_route_destroy(cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_route_clone_n(void)
+{
+ test_env e;
+
+ maps_route_h cloned = NULL;
+ int error = maps_route_clone(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_clone(NULL, &cloned);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_route_set_route_id(maps_route_h route, const char* route_id); */
+/* int maps_route_get_route_id(const maps_route_h route, char** route_id); */
+void utc_maps_route_route_id_p(void)
+{
+ test_env e;
+
+ int error = maps_route_set_route_id(e.h, "test_string");
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ char* ret = NULL;
+ error = maps_route_get_route_id(e.h, &ret);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpstr(ret, ==, "test_string");
+ g_free(ret);
+}
+
+void utc_maps_route_route_id_n(void)
+{
+ test_env e;
+
+ int error = maps_route_set_route_id(NULL, "test_string");
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_set_route_id(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ char* ret = NULL;
+ error = maps_route_get_route_id(NULL, &ret);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_get_route_id(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_route_set_origin(maps_route_h route, maps_coordinates_h origin); */
+/* int maps_route_get_origin(maps_route_h route, maps_coordinates_h* origin); */
+void utc_maps_route_origin_p(void)
+{
+ test_env e;
+
+ maps_coordinates_h coords = NULL;
+ int error = maps_coordinates_create(11.1, 22.2,
+#if _MAPS_COORDS_3D_
+ 33.3,
+#endif
+ &coords);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /* start test ------------------------------------------------------- */
+ error = maps_route_set_origin(e.h, coords);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_coordinates_h obtained_coords = NULL;
+ error = maps_route_get_origin(e.h, &obtained_coords);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(obtained_coords);
+ maps_coordinates_destroy(obtained_coords);
+ /* finish test ------------------------------------------------------ */
+
+ error = maps_coordinates_destroy(coords);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_route_origin_n(void)
+{
+ test_env e;
+
+ maps_coordinates_h coords = NULL;
+ int error = maps_coordinates_create(11.1, 22.2,
+#if _MAPS_COORDS_3D_
+ 33.3,
+#endif
+ &coords);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /* start test ------------------------------------------------------- */
+ error = maps_route_set_origin(NULL, coords);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_set_origin(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ maps_coordinates_h obtained_coords = NULL;
+ error = maps_route_get_origin(NULL, &obtained_coords);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_get_origin(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ /* finish test ------------------------------------------------------ */
+
+ error = maps_coordinates_destroy(coords);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+/* int maps_route_set_destination(maps_route_h route,
+* maps_coordinates_h destination); */
+/* int maps_route_get_destination(maps_route_h route,
+* maps_coordinates_h* destination); */
+void utc_maps_route_destination_p(void)
+{
+ test_env e;
+
+ maps_coordinates_h coords = NULL;
+ int error = maps_coordinates_create(11.1, 22.2,
+#if _MAPS_COORDS_3D_
+ 33.3,
+#endif
+ &coords);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /* start test ------------------------------------------------------- */
+ error = maps_route_set_destination(e.h, coords);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_coordinates_h obtained_coords = NULL;
+ error = maps_route_get_destination(e.h, &obtained_coords);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(obtained_coords);
+ maps_coordinates_destroy(obtained_coords);
+ /* finish test ------------------------------------------------------ */
+
+ error = maps_coordinates_destroy(coords);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_route_destination_n(void)
+{
+ test_env e;
+
+ maps_coordinates_h coords = NULL;
+ int error = maps_coordinates_create(11.1, 22.2,
+#if _MAPS_COORDS_3D_
+ 33.3,
+#endif
+ &coords);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /* start test ------------------------------------------------------- */
+ error = maps_route_set_destination(NULL, coords);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_set_destination(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ maps_coordinates_h obtained_coords = NULL;
+ error = maps_route_get_destination(NULL, &obtained_coords);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_get_destination(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ /* finish test ------------------------------------------------------ */
+
+ error = maps_coordinates_destroy(coords);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+/* int maps_route_set_bounding_box(maps_route_h route,
+* maps_area_h bounding_box); */
+/* int maps_route_get_bounding_box(maps_route_h route,
+* maps_area_h* bounding_box); */
+void utc_maps_route_bounding_box_p(void)
+{
+ test_env e;
+
+ maps_coordinates_h coords = NULL;
+ int error = maps_coordinates_create(11.1, 22.2,
+#if _MAPS_COORDS_3D_
+ 33.3,
+#endif
+ &coords);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_area_h bounding_box = NULL;
+ error = maps_area_create_circle(coords, 123.4, &bounding_box);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /* start test ------------------------------------------------------- */
+ error = maps_route_set_bounding_box(e.h, bounding_box);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_coordinates_h obtained_bounding_box = NULL;
+ error = maps_route_get_bounding_box(e.h, &obtained_bounding_box);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert(obtained_bounding_box);
+ maps_area_destroy(obtained_bounding_box);
+ /* finish test ------------------------------------------------------ */
+
+ error = maps_area_destroy(bounding_box);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_coordinates_destroy(coords);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_route_bounding_box_n(void)
+{
+ test_env e;
+
+ maps_coordinates_h coords = NULL;
+ int error = maps_coordinates_create(11.1, 22.2,
+#if _MAPS_COORDS_3D_
+ 33.3,
+#endif
+ &coords);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_area_h bounding_box = NULL;
+ error = maps_area_create_circle(coords, 123.4, &bounding_box);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /* start test ------------------------------------------------------- */
+ error = maps_route_set_bounding_box(NULL, bounding_box);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_set_bounding_box(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ maps_coordinates_h obtained_bounding_box = NULL;
+ error = maps_route_get_bounding_box(NULL, &obtained_bounding_box);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_get_bounding_box(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ /* finish test ------------------------------------------------------ */
+
+ error = maps_area_destroy(bounding_box);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_coordinates_destroy(coords);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+/* int maps_route_set_total_distance(maps_route_h route,
+* double total_distance); */
+/* int maps_route_get_total_distance(maps_route_h route,
+* double* total_distance); */
+void utc_maps_route_total_distance_p(void)
+{
+ test_env e;
+
+ int error = maps_route_set_total_distance(e.h, 42.0);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ double ret = .0;
+ error = maps_route_get_total_distance(e.h, &ret);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpfloat(ret, ==, 42.0);
+}
+
+void utc_maps_route_total_distance_n(void)
+{
+ test_env e;
+
+ int error = maps_route_set_total_distance(NULL, 42.0);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ double ret = .0;
+ error = maps_route_get_total_distance(NULL, &ret);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_get_total_distance(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_route_set_total_duration(maps_route_h route,
+* long total_duration); */
+/* int maps_route_get_total_duration(maps_route_h route,
+* long* total_duration); */
+void utc_maps_route_total_duration_p(void)
+{
+ test_env e;
+
+ int error = maps_route_set_total_duration(e.h, 42);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ long ret = 0;
+ error = maps_route_get_total_duration(e.h, &ret);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpint(ret, ==, 42);
+}
+
+void utc_maps_route_total_duration_n(void)
+{
+ test_env e;
+
+ int error = maps_route_set_total_duration(NULL, 42);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ long ret = 0;
+ error = maps_route_get_total_duration(NULL, &ret);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_get_total_duration(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_route_set_transport_mode(maps_route_h route,
+* maps_route_transport_mode_e transport_mode); */
+/* int maps_route_get_transport_mode(const maps_route_h route,
+* maps_route_transport_mode_e* transport_mode); */
+void utc_maps_route_transport_mode_p(void)
+{
+ test_env e;
+
+ int error =
+ maps_route_set_transport_mode(e.h,
+ MAPS_ROUTE_TRANSPORT_MODE_CAR);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_route_transport_mode_e transport_mode =
+ MAPS_ROUTE_TRANSPORT_MODE_TRUCK;
+ error = maps_route_get_transport_mode(e.h, &transport_mode);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpint(transport_mode, ==, MAPS_ROUTE_TRANSPORT_MODE_CAR);
+}
+
+void utc_maps_route_transport_mode_n(void)
+{
+ test_env e;
+
+ int error =
+ maps_route_set_transport_mode(NULL,
+ MAPS_ROUTE_TRANSPORT_MODE_CAR);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ maps_route_transport_mode_e transport_mode =
+ MAPS_ROUTE_TRANSPORT_MODE_TRUCK;
+ error = maps_route_get_transport_mode(NULL, &transport_mode);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_get_transport_mode(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* int maps_route_get_distance_unit(const maps_route_h route,
+* maps_distance_unit_e* distance_unit); */
+/* int maps_route_set_distance_unit(const maps_route_h route,
+* const maps_distance_unit_e distance_unit); */
+void utc_maps_route_distance_unit_p(void)
+{
+ test_env e;
+
+ int error = maps_route_set_distance_unit(e.h, MAPS_DISTANCE_UNIT_M);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_distance_unit_e ret = MAPS_DISTANCE_UNIT_YD;
+ error = maps_route_get_distance_unit(e.h, &ret);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpint(ret, ==, MAPS_DISTANCE_UNIT_M);
+}
+
+void utc_maps_route_distance_unit_n(void)
+{
+ test_env e;
+
+ int error = maps_route_set_distance_unit(NULL, MAPS_DISTANCE_UNIT_M);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ maps_distance_unit_e ret = MAPS_DISTANCE_UNIT_YD;
+ error = maps_route_get_distance_unit(NULL, &ret);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_get_distance_unit(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+}
+
+/* typedef bool(*maps_route_properties_cb)(const char* key, const char* value,
+* void* user_data); */
+/* int maps_route_set_properties(maps_route_h route,
+* maps_item_hashtable_h properties); */
+/* int maps_route_foreach_property(maps_route_h route,
+* maps_route_properties_cb callback, void* user_data); */
+static bool __utc_maps_route_properties_cb(int index, int total, char* key,
+ void* value, void* user_data)
+{
+ g_assert(key);
+ g_assert(value);
+
+ g_assert_cmpstr(key, ==, "key");
+ g_assert_cmpstr((const char*) value, ==, "value");
+
+ g_assert(user_data);
+ test_env* e = (test_env*) user_data;
+
+ e->iterations++;
+
+ g_free(key);
+ g_free(value);
+
+ return true;
+}
+
+void utc_maps_route_properties_p(void)
+{
+ test_env e;
+
+ maps_item_list_h obj = NULL;
+ int error = maps_item_hashtable_create(&obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_item_hashtable_set(obj, "key", "value",
+ maps_item_hashtable_clone_string,
+ maps_item_hashtable_free_string);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /* start test ------------------------------------------------------- */
+ error = maps_route_set_properties(e.h, obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_route_foreach_property(e.h, __utc_maps_route_properties_cb,
+ &e);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpint(e.iterations, ==, 1);
+ /* finish test ------------------------------------------------------ */
+
+ error = maps_item_hashtable_destroy(obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_route_properties_n(void)
+{
+ test_env e;
+
+ maps_item_list_h obj = NULL;
+ int error = maps_item_hashtable_create(&obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ /* start test ------------------------------------------------------- */
+ error = maps_route_set_properties(NULL, obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_set_properties(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_foreach_property(NULL,
+ __utc_maps_route_properties_cb, &e);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_foreach_property(e.h, NULL, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ /* finish test ------------------------------------------------------ */
+
+ error = maps_item_hashtable_destroy(obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+/* typedef bool(*maps_route_path_cb)(int index, int total,
+* maps_coordinates_h coordinates, void* user_data); */
+/* int maps_route_foreach_path(const maps_route_h route,
+* maps_route_path_cb callback, void* user_data); */
+/* int maps_route_set_path(maps_route_h route, const maps_item_list_h path); */
+static bool __utc_maps_route_path_cb(int index, int total,
+ maps_coordinates_h coordinates, void* user_data)
+{
+ test_env* e = (test_env*) user_data;
+ g_assert(e);
+ e->iterations++;
+
+ g_assert(coordinates);
+
+ g_assert_cmpint(index, >=, 0);
+ g_assert_cmpint(total, >=, 1);
+
+ maps_coordinates_destroy(coordinates);
+
+ return true;
+}
+
+void utc_maps_route_path_p(void)
+{
+ test_env e;
+
+ maps_item_list_h path = NULL;
+ int error = maps_item_list_create(&path);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_coordinates_h obj = NULL;
+ error = maps_coordinates_create(11.1, 22.2, &obj);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_item_list_append(path, obj, maps_coordinates_clone);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ maps_coordinates_destroy(obj);
+
+ /* test start --------------------------------- */
+ error = maps_route_set_path(e.h, path);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_route_foreach_path(e.h, __utc_maps_route_path_cb, &e);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpint(e.iterations, ==, 1);
+ /* test finish --------------------------------- */
+
+ error = maps_item_list_remove_all(path, maps_coordinates_destroy);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_item_list_destroy(path);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_route_path_n(void)
+{
+ test_env e;
+
+ maps_item_list_h path = NULL;
+ int error = maps_item_list_create(&path);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_coordinates_h obj = NULL;
+ error = maps_coordinates_create(11.1, 22.2, &obj);
+
+ error = maps_item_list_append(path, obj, maps_coordinates_clone);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ maps_coordinates_destroy(obj);
+
+ /* test start --------------------------------- */
+ error = maps_route_set_path(NULL, path);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_set_path(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_foreach_path(NULL, __utc_maps_route_path_cb, &e);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert_cmpint(e.iterations, ==, 0);
+
+ error = maps_route_foreach_path(e.h, NULL, &e);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert_cmpint(e.iterations, ==, 0);
+ /* test finish --------------------------------- */
+
+ /*error = maps_coordinates_destroy(obj); */
+ /*g_assert_cmpint(error, ==, MAPS_ERROR_NONE); */
+
+ error = maps_item_list_remove_all(path, maps_coordinates_destroy);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_item_list_destroy(path);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+/* typedef bool(*maps_route_segment_cb)(int index, int total,
+* maps_route_segment_h segment, void* user_data); */
+/* int maps_route_foreach_segment(const maps_route_h route,
+* maps_route_segment_cb callback, void* user_data); */
+/* int maps_route_set_segments(maps_route_h route,
+* const maps_item_list_h segments); */
+static bool __utc_maps_route_segment_cb(int index, int total,
+ maps_route_segment_h segment, void* user_data)
+{
+ test_env* e = (test_env*) user_data;
+ g_assert(e);
+ e->iterations++;
+
+ g_assert(segment);
+
+ g_assert_cmpint(index, >=, 0);
+ g_assert_cmpint(total, >=, 1);
+
+ maps_route_segment_destroy(segment);
+
+ return true;
+}
+
+void utc_maps_route_segments_p(void)
+{
+ test_env e;
+
+ maps_item_list_h segments = NULL;
+ int error = maps_item_list_create(&segments);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_route_segment_h obj = NULL;
+ error = maps_route_segment_create(&obj);
+
+ error = maps_item_list_append(segments, obj, maps_route_segment_clone);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ maps_route_segment_destroy(obj);
+
+ /* test start --------------------------------- */
+ error = maps_route_set_segments(e.h, segments);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_route_foreach_segment(e.h, __utc_maps_route_segment_cb,
+ &e);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ g_assert_cmpint(e.iterations, ==, 1);
+ /* test finish --------------------------------- */
+
+ error = maps_item_list_remove_all(segments, maps_route_segment_destroy);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_item_list_destroy(segments);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
+void utc_maps_route_segments_n(void)
+{
+ test_env e;
+
+ maps_item_list_h segments = NULL;
+ int error = maps_item_list_create(&segments);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ maps_route_segment_h obj = NULL;
+ error = maps_route_segment_create(&obj);
+
+ error = maps_item_list_append(segments, obj, maps_route_segment_clone);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ maps_route_segment_destroy(obj);
+
+ /* test start --------------------------------- */
+ error = maps_route_set_segments(NULL, segments);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_set_segments(e.h, NULL);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+
+ error = maps_route_foreach_segment(NULL, __utc_maps_route_segment_cb,
+ &e);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert_cmpint(e.iterations, ==, 0);
+
+ error = maps_route_foreach_segment(e.h, NULL, &e);
+ g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER);
+ g_assert_cmpint(e.iterations, ==, 0);
+ /* test finish --------------------------------- */
+
+ error = maps_item_list_remove_all(segments, maps_route_segment_destroy);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+
+ error = maps_item_list_destroy(segments);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+}
+
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_SERVICE_TEST_API_ROUTE_H__
+#define __MAPS_SERVICE_TEST_API_ROUTE_H__
+
+/* int maps_route_create(maps_route_h* route); */
+/* int maps_route_destroy(maps_route_h route); */
+void utc_maps_route_create_p(void);
+void utc_maps_route_create_n(void);
+
+/* int maps_route_clone(const maps_route_h origin, maps_route_h* cloned); */
+void utc_maps_route_clone_p(void);
+void utc_maps_route_clone_n(void);
+
+/* int maps_route_set_route_id(maps_route_h route, const char* route_id); */
+/* int maps_route_get_route_id(const maps_route_h route, char** route_id); */
+void utc_maps_route_route_id_p(void);
+void utc_maps_route_route_id_n(void);
+
+/* int maps_route_set_origin(maps_route_h route, maps_coordinates_h origin); */
+/* int maps_route_get_origin(maps_route_h route, maps_coordinates_h* origin); */
+void utc_maps_route_origin_p(void);
+void utc_maps_route_origin_n(void);
+
+/* int maps_route_set_destination(maps_route_h route,
+* maps_coordinates_h destination); */
+/* int maps_route_get_destination(maps_route_h route,
+* maps_coordinates_h* destination); */
+void utc_maps_route_destination_p(void);
+void utc_maps_route_destination_n(void);
+
+/* int maps_route_set_bounding_box(maps_route_h route,
+* maps_area_h bounding_box); */
+/* int maps_route_get_bounding_box(maps_route_h route,
+* maps_area_h* bounding_box); */
+void utc_maps_route_bounding_box_p(void);
+void utc_maps_route_bounding_box_n(void);
+
+/* int maps_route_set_transport_mode(maps_route_h route,
+* const char* transport_mode); */
+/* int maps_route_get_transport_mode(maps_route_h route,
+* char** transport_mode); */
+void utc_maps_route_transport_mode_p(void);
+void utc_maps_route_transport_mode_n(void);
+
+/* int maps_route_set_total_distance(maps_route_h route,
+* double total_distance); */
+/* int maps_route_get_total_distance(maps_route_h route,
+* double* total_distance); */
+void utc_maps_route_total_distance_p(void);
+void utc_maps_route_total_distance_n(void);
+
+/* int maps_route_set_total_duration(maps_route_h route,
+* long total_duration); */
+/* int maps_route_get_total_duration(maps_route_h route,
+* long* total_duration); */
+void utc_maps_route_total_duration_p(void);
+void utc_maps_route_total_duration_n(void);
+
+/* int maps_route_maneuver_get_distance_unit(
+* const maps_route_maneuver_h maneuver,
+* maps_distance_unit_e* distance_unit); */
+/* int maps_route_maneuver_set_distance_unit(
+* const maps_route_maneuver_h maneuver,
+* const maps_distance_unit_e distance_unit); */
+void utc_maps_route_distance_unit_p(void);
+void utc_maps_route_distance_unit_n(void);
+
+/* int maps_route_foreach_path(const maps_route_h route,
+* maps_route_path_cb callback, void* user_data); */
+/* int maps_route_set_path(maps_route_h route, const maps_item_list_h path); */
+void utc_maps_route_path_p(void);
+void utc_maps_route_path_n(void);
+
+/* int maps_route_foreach_segment(const maps_route_h route,
+* maps_route_segment_cb callback, void* user_data); */
+/* int maps_route_set_segments(maps_route_h route,
+* const maps_item_list_h segments); */
+void utc_maps_route_segments_p(void);
+void utc_maps_route_segments_n(void);
+
+/* int maps_route_set_properties(maps_route_h route,
+* maps_item_hashtable_h properties); */
+/* int maps_route_foreach_property(maps_route_h route,
+* maps_route_properties_cb callback, void* user_data); */
+void utc_maps_route_properties_p(void);
+void utc_maps_route_properties_n(void);
+
+#endif /* __MAPS_SERVICE_TEST_API_ROUTE_H__ */
+
--- /dev/null
+/*
+ * context-manager
+ *
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * 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 <glib/gprintf.h>
+
+/*----------------------------------------------------------------------------*/
+/* */
+/* Select between unit testing mode: */
+/* */
+/* */
+/* - Correctness Unit Tests */
+#define MAPS_SERVICE_CORRECTNESS_TEST
+/* */
+/* - Load Unit Tests */
+/*#define MAPS_SERVICE_LOAD_TEST*/
+/* */
+/* - Valgrind Tests */
+/*#define MAPS_SERVICE_VALGRIND_TEST */
+/* */
+/* */
+/*----------------------------------------------------------- */
+/* Number of iterations Test Cases to be run */
+/* It it is not a memory leak test, */
+/* the value of iterations will be automatically reduced to 1 */
+static long long iterations = 250* 1000; /* For load test */
+
+/* */
+#ifdef MAPS_SERVICE_LOAD_TEST
+ /* Sleep before next iteration */
+static unsigned int sleep_microseconds = 0; /* No delay */
+ /*10*1000;*/ /* 10 milliseconds */
+ /*100*1000;*/ /* 100 milliseconds */
+ /*500*1000;*/ /* Half a second */
+ /*1000*1000;*/ /* 1 second */
+
+#endif /* MAPS_SERVICE_LOAD_TEST */
+/* */
+/*----------------------------------------------------------------------------*/
+
+#ifdef MAPS_SERVICE_VALGRIND_TEST
+
+ /* This macro allows to skip tests, which generate Valgrind warning */
+ /* Usually, these warnings are coming from the depth of glib */
+ /*#define SUPPRESS_VALGRIND_WARNINGS */
+
+ /* This macro turnes off g_assert */
+#define G_DISABLE_ASSERT
+
+#endif /* MAPS_SERVICE_VALGRIND_TEST */
+
+/* Type of each unit test */
+typedef void (*test_funcvoid) (void);
+
+#include <unistd.h>
+
+/* Test Cases */
+#include "discovery_test.h"
+#include "module_test.h"
+
+#include "command_test.h"
+#include "commands_test.h"
+#include "command_queue_test.h"
+#include "thread_test.h"
+
+#include "maps_address_test.h"
+#include "maps_api_test.h"
+#include "maps_area_test.h"
+#include "maps_coordinates_test.h"
+#include "maps_extra_types_test.h"
+
+#include "maps_place_test.h"
+#include "maps_place_category_test.h"
+#include "maps_place_attribute_test.h"
+#include "maps_place_contact_test.h"
+#include "maps_place_editorial_test.h"
+#include "maps_place_link_object_test.h"
+#include "maps_place_media_test.h"
+#include "maps_place_url_test.h"
+#include "maps_place_review_test.h"
+#include "maps_place_rating_test.h"
+#include "maps_place_image_test.h"
+#include "maps_place_filter_test.h"
+
+#include "maps_route_test.h"
+#include "maps_route_maneuver_test.h"
+#include "maps_route_segment_test.h"
+
+#include "maps_preference_test.h"
+
+#include "maps_service_tutorial.h"
+
+static void __test_add_func_load(const char *testpath, test_funcvoid func,
+ const long long i)
+{
+ static char test_name[100] = { 0 };
+ if (i > 0)
+ g_sprintf(test_name, "%lld%s", i, testpath);
+ else
+ g_sprintf(test_name, "%s", testpath);
+
+#ifdef MAPS_SERVICE_CORRECTNESS_TEST
+ g_test_add_func(test_name, func);
+#else
+ g_print("%s\n", test_name);
+ func();
+#endif /* MAPS_SERVICE_CORRECTNESS_TEST */
+}
+
+static void __utc_simple_test(void)
+{
+ g_print("Simple Test");
+ g_assert(true);
+}
+
+static void __add_plugin_tests(int i)
+{
+ __test_add_func_load("/plugin/discovery/provider_info_construct_p",
+ utc_provider_info_construct_p, i);
+ /*__test_add_func_load("/plugin/discovery/operator_provider_info_h_p",
+ * utc_operator_maps_provider_info_h_p, i); */
+ __test_add_func_load("/plugin/discovery/provider_info_empty_p",
+ utc_provider_info_empty_p, i);
+ __test_add_func_load("/plugin/discovery/provider_info_empty_n_01",
+ utc_provider_info_empty_n_01, i);
+ __test_add_func_load("/plugin/discovery/provider_info_empty_n_02",
+ utc_provider_info_empty_n_02, i);
+ __test_add_func_load("/plugin/discovery/provider_info_empty_n_03",
+ utc_provider_info_empty_n_03, i);
+
+#ifndef SUPPRESS_VALGRIND_WARNINGS /* Valgrind warnings!!! */
+ __test_add_func_load("/plugin/discovery/get_available_list_p",
+ utc_get_available_plugin_list, i);
+ __test_add_func_load("/plugin/binary_extractor/init_p",
+ utc_binary_extractor_init_plugin_p, i);
+#endif
+}
+
+static void __add_session_tests(int i)
+{
+ __test_add_func_load("/session/command/get_empty_command_ptr_p",
+ utc_command_empty_ptr_p, i);
+
+#ifndef SUPPRESS_VALGRIND_WARNINGS
+ __test_add_func_load("/session/command_queue/push_p",
+ utc_command_queue_push_p, i);
+ /* Valgrind warnings!!! */
+ __test_add_func_load("/session/command_queue/push_n",
+ utc_command_queue_push_n, i);
+ /* Valgrind warnings!!! */
+
+ __test_add_func_load("/session/glib_hashtable/use_p",
+ utc_use_hash_table_p, i);
+
+ __test_add_func_load("/session/pending_request/add_p",
+ utc_pending_request_add_p, i);
+ __test_add_func_load("/session/pending_request/add_n",
+ utc_pending_request_add_n, i);
+ __test_add_func_load("/session/pending_request/update_p",
+ utc_pending_request_update_p, i);
+ __test_add_func_load("/session/pending_request/update_n",
+ utc_pending_request_update_n, i);
+ __test_add_func_load("/session/pending_request/remove_p",
+ utc_pending_request_remove_p, i);
+ __test_add_func_load("/session/pending_request/remove_n",
+ utc_pending_request_remove_n, i);
+ __test_add_func_load("/session/pending_request/look_up_p",
+ utc_pending_request_look_up_p, i);
+ __test_add_func_load("/session/pending_request/look_up_n",
+ utc_pending_request_look_up_n, i);
+ __test_add_func_load("/session/pending_request/extract_p",
+ utc_pending_request_extract_p, i);
+ __test_add_func_load("/session/pending_request/extract_n",
+ utc_pending_request_extract_n, i);
+ __test_add_func_load("/session/pending_request/contains_p",
+ utc_pending_request_contains_p, i);
+ __test_add_func_load("/session/pending_request/contains_n",
+ utc_pending_request_contains_n, i);
+#endif
+}
+
+static void __add_extra_data_structure_tests(int i)
+{
+#ifndef SUPPRESS_VALGRIND_WARNINGS /* Valgrind warnings!!! */
+ /* API: Extra Data Structures: List */
+ __test_add_func_load("/api/list/create_p", utc_maps_item_list_create_p,
+ i);
+ __test_add_func_load("/api/list/create_n", utc_maps_item_list_create_n,
+ i);
+ __test_add_func_load("/api/list/append_p", utc_maps_item_list_append_p,
+ i);
+ __test_add_func_load("/api/list/append_n", utc_maps_item_list_append_n,
+ i);
+ __test_add_func_load("/api/list/foreach_p",
+ utc_maps_item_list_foreach_p, i);
+ __test_add_func_load("/api/list/foreach_n",
+ utc_maps_item_list_foreach_n, i);
+
+ /* API: Extra Data Structures: Hash Table */
+ __test_add_func_load("/api/string_hashtable/create_p",
+ utc_maps_string_hashtable_create_p, i);
+ __test_add_func_load("/api/string_hashtable/create_n",
+ utc_maps_string_hashtable_create_n, i);
+ __test_add_func_load("/api/string_hashtable/set_p",
+ utc_maps_string_hashtable_set_p, i);
+ __test_add_func_load("/api/string_hashtable/set_n",
+ utc_maps_string_hashtable_set_n, i);
+ __test_add_func_load("/api/string_hashtable/foreach_p",
+ utc_maps_string_hashtable_foreach_p, i);
+ __test_add_func_load("/api/string_hashtable/foreach_n",
+ utc_maps_string_hashtable_foreach_n, i);
+
+ /* API: Extra Data Structures: Hash Table */
+ __test_add_func_load("/api/item_hashtable/create_p",
+ utc_maps_item_hashtable_create_p, i);
+ __test_add_func_load("/api/item_hashtable/create_n",
+ utc_maps_item_hashtable_create_n, i);
+ __test_add_func_load("/api/item_hashtable/set_p",
+ utc_maps_item_hashtable_set_p, i);
+ __test_add_func_load("/api/item_hashtable/set_n",
+ utc_maps_item_hashtable_set_n, i);
+ __test_add_func_load("/api/item_hashtable/set_macro_p",
+ utc_maps_item_hashtable_set_macro_p, i);
+ __test_add_func_load("/api/item_hashtable/set_macro_n",
+ utc_maps_item_hashtable_set_macro_n, i);
+ __test_add_func_load("/api/item_hashtable/set_overwrited_macro_p",
+ utc_maps_item_hashtable_set_overwrited_macro_p, i);
+ __test_add_func_load("/api/item_hashtable/foreach_p",
+ utc_maps_item_hashtable_foreach_p, i);
+ __test_add_func_load("/api/item_hashtable/foreach_n",
+ utc_maps_item_hashtable_foreach_n, i);
+#endif
+}
+
+static void __add_maps_data_structure_tests(int i)
+{
+#ifndef SUPPRESS_VALGRIND_WARNINGS /* Valgrind warnings!!! */
+ /* API: Data Structures: Coordinates */
+ __test_add_func_load("/api/coordinates/create_p",
+ utc_maps_coordinates_create_p, i);
+ __test_add_func_load("/api/coordinates/create_n",
+ utc_maps_coordinates_create_n, i);
+ __test_add_func_load("/api/coordinates/destroy_p",
+ utc_maps_coordinates_destroy_p, i);
+ __test_add_func_load("/api/coordinates/destroy_n",
+ utc_maps_coordinates_destroy_n, i);
+ __test_add_func_load("/api/coordinates/clone_p",
+ utc_maps_coordinates_clone_p, i);
+ __test_add_func_load("/api/coordinates/clone_n",
+ utc_maps_coordinates_clone_n, i);
+ __test_add_func_load("/api/coordinates/latitude_p",
+ utc_maps_coordinates_latitude_p, i);
+ __test_add_func_load("/api/coordinates/latitude_n",
+ utc_maps_coordinates_latitude_n, i);
+ __test_add_func_load("/api/coordinates/longitude_p",
+ utc_maps_coordinates_longitude_p, i);
+ __test_add_func_load("/api/coordinates/longitude_n",
+ utc_maps_coordinates_longitude_n, i);
+
+#if _MAPS_COORDS_3D
+ __test_add_func_load("/api/coordinates/altitude_p",
+ utc_maps_coordinates_altitude_p, i);
+ __test_add_func_load("/api/coordinates/altitude_n",
+ utc_maps_coordinates_altitude_n, i);
+#endif
+
+ /* API: Data Structures: Area */
+ __test_add_func_load("/api/area/create_rectangle_p",
+ utc_maps_area_create_rectangle_p, i);
+ __test_add_func_load("/api/area/create_rectangle_n",
+ utc_maps_area_create_rectangle_n, i);
+ __test_add_func_load("/api/area/create_circle_p",
+ utc_maps_area_create_circle_p, i);
+ __test_add_func_load("/api/area/create_circle_n",
+ utc_maps_area_create_circle_n, i);
+ __test_add_func_load("/api/area/destroy_p", utc_maps_area_destroy_p, i);
+ __test_add_func_load("/api/area/destroy_n", utc_maps_area_destroy_n, i);
+ __test_add_func_load("/api/area/clone_p", utc_maps_area_clone_p, i);
+ __test_add_func_load("/api/area/clone_n", utc_maps_area_clone_n, i);
+#endif
+}
+
+static void __add_geocode_data_structure_tests(int i)
+{
+#ifndef SUPPRESS_VALGRIND_WARNINGS /* Valgrind warnings!!! */
+ /* API: Data Structures: Address */
+ __test_add_func_load("/api/maps_address/new_p",
+ utc_maps_address_create_p, i);
+ __test_add_func_load("/api/maps_address/new_n",
+ utc_maps_address_create_n, i);
+ __test_add_func_load("/api/maps_address/clone_p",
+ utc_maps_address_clone_p, i);
+ __test_add_func_load("/api/maps_address/clone_n",
+ utc_maps_address_clone_n, i);
+ __test_add_func_load("/api/maps_address/building_number_p",
+ utc_maps_address_building_number_p, i);
+ __test_add_func_load("/api/maps_address/building_number_n",
+ utc_maps_address_building_number_n, i);
+ __test_add_func_load("/api/maps_address/street_p",
+ utc_maps_address_street_p, i);
+ __test_add_func_load("/api/maps_address/street_n",
+ utc_maps_address_street_n, i);
+ __test_add_func_load("/api/maps_address/district_p",
+ utc_maps_address_district_p, i);
+ __test_add_func_load("/api/maps_address/district_n",
+ utc_maps_address_district_n, i);
+ __test_add_func_load("/api/maps_address/city_p",
+ utc_maps_address_city_p, i);
+ __test_add_func_load("/api/maps_address/city_n",
+ utc_maps_address_city_n, i);
+ __test_add_func_load("/api/maps_address/state_p",
+ utc_maps_address_state_p, i);
+ __test_add_func_load("/api/maps_address/state_n",
+ utc_maps_address_state_n, i);
+ __test_add_func_load("/api/maps_address/country_p",
+ utc_maps_address_country_p, i);
+ __test_add_func_load("/api/maps_address/country_n",
+ utc_maps_address_country_n, i);
+ __test_add_func_load("/api/maps_address/country_code_p",
+ utc_maps_address_country_code_p, i);
+ __test_add_func_load("/api/maps_address/country_code_n",
+ utc_maps_address_country_code_n, i);
+ __test_add_func_load("/api/maps_address/county_p",
+ utc_maps_address_county_p, i);
+ __test_add_func_load("/api/maps_address/county_n",
+ utc_maps_address_county_n, i);
+ __test_add_func_load("/api/maps_address/postal_code_p",
+ utc_maps_address_postal_code_p, i);
+ __test_add_func_load("/api/maps_address/postal_code_n",
+ utc_maps_address_postal_code_n, i);
+ __test_add_func_load("/api/maps_address/freetext_p",
+ utc_maps_address_destroytext_p, i);
+ __test_add_func_load("/api/maps_address/freetext_n",
+ utc_maps_address_destroytext_n, i);
+#endif
+}
+
+static void __add_place_data_structure_tests(int i)
+{
+#ifndef SUPPRESS_VALGRIND_WARNINGS /* Valgrind warnings!!! */
+ /* API: Data Structures: Place: Category */
+ __test_add_func_load("/api/place/category/create_p",
+ utc_maps_place_category_create_p, i);
+ __test_add_func_load("/api/place/category/create_n",
+ utc_maps_place_category_create_n, i);
+ __test_add_func_load("/api/place/category/clone_p",
+ utc_maps_place_category_clone_p, i);
+ __test_add_func_load("/api/place/category/clone_n",
+ utc_maps_place_category_clone_n, i);
+ __test_add_func_load("/api/place/category/name_p",
+ utc_maps_place_category_name_p, i);
+ __test_add_func_load("/api/place/category/name_n",
+ utc_maps_place_category_name_n, i);
+ __test_add_func_load("/api/place/category/id_p",
+ utc_maps_place_category_id_p, i);
+ __test_add_func_load("/api/place/category/id_n",
+ utc_maps_place_category_id_n, i);
+ __test_add_func_load("/api/place/category/url_p",
+ utc_maps_place_category_url_p, i);
+ __test_add_func_load("/api/place/category/url_n",
+ utc_maps_place_category_url_n, i);
+
+ /* API: Data Structures: Place: Attribute */
+ __test_add_func_load("/api/place/attribute/create_p",
+ utc_maps_place_attribute_create_p, i);
+ __test_add_func_load("/api/place/attribute/create_n",
+ utc_maps_place_attribute_create_n, i);
+ __test_add_func_load("/api/place/attribute/clone_p",
+ utc_maps_place_attribute_clone_p, i);
+ __test_add_func_load("/api/place/attribute/clone_n",
+ utc_maps_place_attribute_clone_n, i);
+ __test_add_func_load("/api/place/attribute/id_p",
+ utc_maps_place_attribute_id_p, i);
+ __test_add_func_load("/api/place/attribute/id_n",
+ utc_maps_place_attribute_id_n, i);
+ __test_add_func_load("/api/place/attribute/label_p",
+ utc_maps_place_attribute_label_p, i);
+ __test_add_func_load("/api/place/attribute/label_n",
+ utc_maps_place_attribute_label_n, i);
+ __test_add_func_load("/api/place/attribute/text_p",
+ utc_maps_place_attribute_text_p, i);
+ __test_add_func_load("/api/place/attribute/text_n",
+ utc_maps_place_attribute_text_n, i);
+
+ /* API: Data Structures: Place: Contact */
+ __test_add_func_load("/api/place/contact/create_p",
+ utc_maps_place_contact_create_p, i);
+ __test_add_func_load("/api/place/contact/create_n",
+ utc_maps_place_contact_create_n, i);
+ __test_add_func_load("/api/place/contact/clone_p",
+ utc_maps_place_contact_clone_p, i);
+ __test_add_func_load("/api/place/contact/clone_n",
+ utc_maps_place_contact_clone_n, i);
+ __test_add_func_load("/api/place/contact/label_p",
+ utc_maps_place_contact_label_p, i);
+ __test_add_func_load("/api/place/contact/label_n",
+ utc_maps_place_contact_label_n, i);
+ __test_add_func_load("/api/place/contact/type_p",
+ utc_maps_place_contact_type_p, i);
+ __test_add_func_load("/api/place/contact/type_n",
+ utc_maps_place_contact_type_n, i);
+ __test_add_func_load("/api/place/contact/value_p",
+ utc_maps_place_contact_value_p, i);
+ __test_add_func_load("/api/place/contact/value_n",
+ utc_maps_place_contact_value_n, i);
+
+ /* API: Data Structures: Place: Editorial */
+ __test_add_func_load("/api/place/editorial/create_p",
+ utc_maps_place_editorial_create_p, i);
+ __test_add_func_load("/api/place/editorial/create_n",
+ utc_maps_place_editorial_create_n, i);
+ __test_add_func_load("/api/place/editorial/clone_p",
+ utc_maps_place_editorial_clone_p, i);
+ __test_add_func_load("/api/place/editorial/clone_n",
+ utc_maps_place_editorial_clone_n, i);
+ __test_add_func_load("/api/place/editorial/description_p",
+ utc_maps_place_editorial_description_p, i);
+ __test_add_func_load("/api/place/editorial/description_n",
+ utc_maps_place_editorial_description_n, i);
+ __test_add_func_load("/api/place/editorial/language_p",
+ utc_maps_place_editorial_language_p, i);
+ __test_add_func_load("/api/place/editorial/language_n",
+ utc_maps_place_editorial_language_n, i);
+ __test_add_func_load("/api/place/editorial/media_p",
+ utc_maps_place_editorial_media_p, i);
+ __test_add_func_load("/api/place/editorial/media_n",
+ utc_maps_place_editorial_media_n, i);
+
+ /* API: Data Structures: Place: Link Object */
+ __test_add_func_load("/api/place/link_object/create_p",
+ utc_maps_place_link_object_create_p, i);
+ __test_add_func_load("/api/place/link_object/create_n",
+ utc_maps_place_link_object_create_n, i);
+ __test_add_func_load("/api/place/link_object/clone_p",
+ utc_maps_place_link_object_clone_p, i);
+ __test_add_func_load("/api/place/link_object/clone_n",
+ utc_maps_place_link_object_clone_n, i);
+ __test_add_func_load("/api/place/link_object/id_p",
+ utc_maps_place_link_object_id_p, i);
+ __test_add_func_load("/api/place/link_object/id_n",
+ utc_maps_place_link_object_id_n, i);
+ __test_add_func_load("/api/place/link_object/name_p",
+ utc_maps_place_link_object_name_p, i);
+ __test_add_func_load("/api/place/link_object/name_n",
+ utc_maps_place_link_object_name_n, i);
+ __test_add_func_load("/api/place/link_object/type_p",
+ utc_maps_place_link_object_type_p, i);
+ __test_add_func_load("/api/place/link_object/type_n",
+ utc_maps_place_link_object_type_n, i);
+ __test_add_func_load("/api/place/link_object/string_p",
+ utc_maps_place_link_object_string_p, i);
+ __test_add_func_load("/api/place/link_object/string_n",
+ utc_maps_place_link_object_string_n, i);
+
+ /* API: Data Structures: Place: Media */
+ __test_add_func_load("/api/place/media/create_p",
+ utc_maps_place_media_create_p, i);
+ __test_add_func_load("/api/place/media/create_n",
+ utc_maps_place_media_create_n, i);
+ __test_add_func_load("/api/place/media/clone_p",
+ utc_maps_place_media_clone_p, i);
+ __test_add_func_load("/api/place/media/clone_n",
+ utc_maps_place_media_clone_n, i);
+ __test_add_func_load("/api/place/media/attribution_p",
+ utc_maps_place_media_attribution_p, i);
+ __test_add_func_load("/api/place/media/attribution_n",
+ utc_maps_place_media_attribution_n, i);
+ __test_add_func_load("/api/place/media/supplier_p",
+ utc_maps_place_media_supplier_p, i);
+ __test_add_func_load("/api/place/media/supplier_n",
+ utc_maps_place_media_supplier_n, i);
+ __test_add_func_load("/api/place/media/via_p",
+ utc_maps_place_media_via_p, i);
+ __test_add_func_load("/api/place/media/via_n",
+ utc_maps_place_media_via_n, i);
+
+ /* API: Data Structures: Place: URL */
+ __test_add_func_load("/api/place/URL/create_p",
+ utc_maps_place_url_create_p, i);
+ __test_add_func_load("/api/place/URL/create_n",
+ utc_maps_place_url_create_n, i);
+ __test_add_func_load("/api/place/URL/clone_p",
+ utc_maps_place_url_clone_p, i);
+ __test_add_func_load("/api/place/URL/clone_n",
+ utc_maps_place_url_clone_n, i);
+ __test_add_func_load("/api/place/URL/path_p", utc_maps_place_url_path_p,
+ i);
+ __test_add_func_load("/api/place/URL/path_n", utc_maps_place_url_path_n,
+ i);
+ __test_add_func_load("/api/place/URL/description_p",
+ utc_maps_place_url_description_p, i);
+ __test_add_func_load("/api/place/URL/description_n",
+ utc_maps_place_url_description_n, i);
+
+ /* API: Data Structures: Place: Review */
+ __test_add_func_load("/api/place/review/create_p",
+ utc_maps_place_review_create_p, i);
+ __test_add_func_load("/api/place/review/create_n",
+ utc_maps_place_review_create_n, i);
+ __test_add_func_load("/api/place/review/clone_p",
+ utc_maps_place_review_clone_p, i);
+ __test_add_func_load("/api/place/review/clone_n",
+ utc_maps_place_review_clone_n, i);
+ __test_add_func_load("/api/place/review/date_p",
+ utc_maps_place_review_date_p, i);
+ __test_add_func_load("/api/place/review/date_n",
+ utc_maps_place_review_date_n, i);
+ __test_add_func_load("/api/place/review/title_p",
+ utc_maps_place_review_title_p, i);
+ __test_add_func_load("/api/place/review/title_n",
+ utc_maps_place_review_title_n, i);
+ __test_add_func_load("/api/place/review/rating_p",
+ utc_maps_place_review_rating_p, i);
+ __test_add_func_load("/api/place/review/rating_n",
+ utc_maps_place_review_rating_n, i);
+ __test_add_func_load("/api/place/review/description_p",
+ utc_maps_place_review_description_p, i);
+ __test_add_func_load("/api/place/review/description_n",
+ utc_maps_place_review_description_n, i);
+ __test_add_func_load("/api/place/review/language_p",
+ utc_maps_place_review_language_p, i);
+ __test_add_func_load("/api/place/review/language_n",
+ utc_maps_place_review_language_n, i);
+ __test_add_func_load("/api/place/review/media_p",
+ utc_maps_place_review_media_p, i);
+ __test_add_func_load("/api/place/review/media_n",
+ utc_maps_place_review_media_n, i);
+ __test_add_func_load("/api/place/review/user_link_p",
+ utc_maps_place_review_user_link_p, i);
+ __test_add_func_load("/api/place/review/user_link_n",
+ utc_maps_place_review_user_link_n, i);
+
+ /* API: Data Structures: Place: Rating */
+ __test_add_func_load("/api/place/rating/create_p",
+ utc_maps_place_rating_create_p, i);
+ __test_add_func_load("/api/place/rating/create_n",
+ utc_maps_place_rating_create_n, i);
+ __test_add_func_load("/api/place/rating/clone_p",
+ utc_maps_place_rating_clone_p, i);
+ __test_add_func_load("/api/place/rating/clone_n",
+ utc_maps_place_rating_clone_n, i);
+ __test_add_func_load("/api/place/rating/count_p",
+ utc_maps_place_rating_count_p, i);
+ __test_add_func_load("/api/place/rating/count_n",
+ utc_maps_place_rating_count_n, i);
+ __test_add_func_load("/api/place/rating/average_p",
+ utc_maps_place_rating_average_p, i);
+ __test_add_func_load("/api/place/rating/average_n",
+ utc_maps_place_rating_average_n, i);
+
+ /* API: Data Structures: Place: Image */
+ __test_add_func_load("/api/place/image/create_p",
+ utc_maps_place_image_create_p, i);
+ __test_add_func_load("/api/place/image/create_n",
+ utc_maps_place_image_create_n, i);
+ __test_add_func_load("/api/place/image/clone_p",
+ utc_maps_place_image_clone_p, i);
+ __test_add_func_load("/api/place/image/clone_n",
+ utc_maps_place_image_clone_n, i);
+ __test_add_func_load("/api/place/image/id_p", utc_maps_place_image_id_p,
+ i);
+ __test_add_func_load("/api/place/image/id_n", utc_maps_place_image_id_n,
+ i);
+ __test_add_func_load("/api/place/image/url_p",
+ utc_maps_place_image_url_p, i);
+ __test_add_func_load("/api/place/image/url_n",
+ utc_maps_place_image_url_n, i);
+ __test_add_func_load("/api/place/image/width_p",
+ utc_maps_place_image_width_p, i);
+ __test_add_func_load("/api/place/image/width_n",
+ utc_maps_place_image_width_n, i);
+ __test_add_func_load("/api/place/image/height_p",
+ utc_maps_place_image_height_p, i);
+ __test_add_func_load("/api/place/image/height_n",
+ utc_maps_place_image_height_n, i);
+ __test_add_func_load("/api/place/image/user_link_p",
+ utc_maps_place_image_user_link_p, i);
+ __test_add_func_load("/api/place/image/user_link_n",
+ utc_maps_place_image_user_link_n, i);
+ __test_add_func_load("/api/place/image/media_p",
+ utc_maps_place_image_media_p, i);
+ __test_add_func_load("/api/place/image/media_n",
+ utc_maps_place_image_media_n, i);
+
+ /* API: Data Structures: Maps: Place: Filter */
+ __test_add_func_load("/api/place/filter/create_p",
+ utc_maps_place_filter_create_p, i);
+ __test_add_func_load("/api/place/filter/create_n",
+ utc_maps_place_filter_create_n, i);
+ __test_add_func_load("/api/place/filter/clone_p",
+ utc_maps_place_filter_clone_p, i);
+ __test_add_func_load("/api/place/filter/clone_n",
+ utc_maps_place_filter_clone_n, i);
+ __test_add_func_load("/api/place/filter/set_p",
+ utc_maps_place_filter_set_p, i);
+ __test_add_func_load("/api/place/filter/set_n",
+ utc_maps_place_filter_set_n, i);
+
+ /* API: Data Structures: Place */
+ __test_add_func_load("/api/place/create_p", utc_maps_place_create_p, i);
+ __test_add_func_load("/api/place/create_n", utc_maps_place_create_n, i);
+ __test_add_func_load("/api/place/clone_p", utc_maps_place_clone_p, i);
+ __test_add_func_load("/api/place/clone_n", utc_maps_place_clone_n, i);
+ __test_add_func_load("/api/place/set_id_p", utc_maps_place_set_id_p, i);
+ __test_add_func_load("/api/place/set_id_n", utc_maps_place_set_id_n, i);
+ __test_add_func_load("/api/place/set_name_p", utc_maps_place_set_name_p,
+ i);
+ __test_add_func_load("/api/place/set_name_n", utc_maps_place_set_name_n,
+ i);
+ __test_add_func_load("/api/place/set_uri_p", utc_maps_place_set_uri_p,
+ i);
+ __test_add_func_load("/api/place/set_uri_n", utc_maps_place_set_uri_n,
+ i);
+ __test_add_func_load("/api/place/set_location_p",
+ utc_maps_place_set_location_p, i);
+ __test_add_func_load("/api/place/set_location_n",
+ utc_maps_place_set_location_n, i);
+ __test_add_func_load("/api/place/set_category_p",
+ utc_maps_place_set_category_p, i);
+ __test_add_func_load("/api/place/set_category_n",
+ utc_maps_place_set_category_n, i);
+ __test_add_func_load("/api/place/set_attribute_p",
+ utc_maps_place_set_attribute_p, i);
+ __test_add_func_load("/api/place/set_attribute_n",
+ utc_maps_place_set_attribute_n, i);
+ __test_add_func_load("/api/place/set_contact_p",
+ utc_maps_place_set_contacts_p, i);
+ __test_add_func_load("/api/place/set_contact_n",
+ utc_maps_place_set_contacts_n, i);
+ __test_add_func_load("/api/place/set_editorial_p",
+ utc_maps_place_set_editorial_p, i);
+ __test_add_func_load("/api/place/set_editorial_n",
+ utc_maps_place_set_editorial_n, i);
+ __test_add_func_load("/api/place/set_image_p",
+ utc_maps_place_set_image_p, i);
+ __test_add_func_load("/api/place/set_image_n",
+ utc_maps_place_set_image_n, i);
+ __test_add_func_load("/api/place/set_review_p",
+ utc_maps_place_set_review_p, i);
+ __test_add_func_load("/api/place/set_review_n",
+ utc_maps_place_set_review_n, i);
+ __test_add_func_load("/api/place/set_properties_p",
+ utc_maps_place_set_properties_p, i);
+ __test_add_func_load("/api/place/set_properties_n",
+ utc_maps_place_set_properties_n, i);
+ __test_add_func_load("/api/place/set_rating_p",
+ utc_maps_place_set_rating_p, i);
+ __test_add_func_load("/api/place/set_rating_n",
+ utc_maps_place_set_rating_n, i);
+ __test_add_func_load("/api/place/set_supplier_link_p",
+ utc_maps_place_set_supplier_link_p, i);
+ __test_add_func_load("/api/place/set_supplier_link_n",
+ utc_maps_place_set_supplier_link_n, i);
+ __test_add_func_load("/api/place/set_related_link_p",
+ utc_maps_place_set_related_link_p, i);
+ __test_add_func_load("/api/place/set_related_link_n",
+ utc_maps_place_set_related_link_n, i);
+ __test_add_func_load("/api/place/foreach_property_p",
+ utc_maps_place_foreach_property_p, i);
+ __test_add_func_load("/api/place/foreach_property_n",
+ utc_maps_place_foreach_property_n, i);
+#endif
+}
+
+static void __add_route_data_structure_tests(int i)
+{
+#ifndef SUPPRESS_VALGRIND_WARNINGS /* Valgrind warnings!!! */
+ /* API: Data Structures: Route: Maneuver */
+ __test_add_func_load("/api/route/maneuver/create_p",
+ utc_maps_route_maneuver_create_p, i);
+ __test_add_func_load("/api/route/maneuver/create_n",
+ utc_maps_route_maneuver_create_n, i);
+ __test_add_func_load("/api/route/maneuver/clone_p",
+ utc_maps_route_maneuver_clone_p, i);
+ __test_add_func_load("/api/route/maneuver/clone_n",
+ utc_maps_route_maneuver_clone_n, i);
+ __test_add_func_load("/api/route/maneuver/direction_p",
+ utc_maps_route_maneuver_direction_id_p, i);
+ __test_add_func_load("/api/route/maneuver/direction_n",
+ utc_maps_route_maneuver_direction_id_n, i);
+ __test_add_func_load("/api/route/maneuver/turn_type_p",
+ utc_maps_route_maneuver_turn_type_p, i);
+ __test_add_func_load("/api/route/maneuver/turn_type_n",
+ utc_maps_route_maneuver_turn_type_n, i);
+ __test_add_func_load("/api/route/maneuver/position_p",
+ utc_maps_route_maneuver_position_p, i);
+ __test_add_func_load("/api/route/maneuver/position_n",
+ utc_maps_route_maneuver_position_n, i);
+ __test_add_func_load("/api/route/maneuver/road_name_p",
+ utc_maps_route_maneuver_road_name_p, i);
+ __test_add_func_load("/api/route/maneuver/road_name_n",
+ utc_maps_route_maneuver_road_name_n, i);
+ __test_add_func_load("/api/route/maneuver/locale_p",
+ utc_maps_route_maneuver_locale_p, i);
+ __test_add_func_load("/api/route/maneuver/locale_n",
+ utc_maps_route_maneuver_locale_n, i);
+ __test_add_func_load("/api/route/maneuver/time_to_next_instruction_p",
+ utc_maps_route_maneuver_time_to_next_instruction_p, i);
+ __test_add_func_load("/api/route/maneuver/time_to_next_instruction_n",
+ utc_maps_route_maneuver_time_to_next_instruction_n, i);
+ __test_add_func_load
+ ("/api/route/maneuver/distance_to_next_instruction_p",
+ utc_maps_route_maneuver_distance_to_next_instruction_p, i);
+ __test_add_func_load
+ ("/api/route/maneuver/distance_to_next_instruction_n",
+ utc_maps_route_maneuver_distance_to_next_instruction_n, i);
+ __test_add_func_load("/api/route/maneuver/instruction_text_p",
+ utc_maps_route_maneuver_instruction_text_p, i);
+ __test_add_func_load("/api/route/maneuver/instruction_text_n",
+ utc_maps_route_maneuver_instruction_text_n, i);
+
+ /* API: Data Structures: Route: Segment */
+ __test_add_func_load("/api/route/segment/create_p",
+ utc_maps_route_segment_create_p, i);
+ __test_add_func_load("/api/route/segment/create_n",
+ utc_maps_route_segment_create_n, i);
+ __test_add_func_load("/api/route/segment/clone_p",
+ utc_maps_route_segment_clone_p, i);
+ __test_add_func_load("/api/route/segment/clone_n",
+ utc_maps_route_segment_clone_n, i);
+ __test_add_func_load("/api/route/segment/origin_p",
+ utc_maps_route_segment_origin_p, i);
+ __test_add_func_load("/api/route/segment/origin_n",
+ utc_maps_route_segment_origin_n, i);
+ __test_add_func_load("/api/route/segment/destination_p",
+ utc_maps_route_segment_destination_p, i);
+ __test_add_func_load("/api/route/segment/destination_n",
+ utc_maps_route_segment_destination_n, i);
+ __test_add_func_load("/api/route/segment/bounding_box_p",
+ utc_maps_route_segment_bounding_box_p, i);
+ __test_add_func_load("/api/route/segment/bounding_box_n",
+ utc_maps_route_segment_bounding_box_n, i);
+ __test_add_func_load("/api/route/segment/distance_p",
+ utc_maps_route_segment_distance_p, i);
+ __test_add_func_load("/api/route/segment/distance_n",
+ utc_maps_route_segment_distance_n, i);
+ __test_add_func_load("/api/route/segment/duration_p",
+ utc_maps_route_segment_duration_p, i);
+ __test_add_func_load("/api/route/segment/duration_n",
+ utc_maps_route_segment_duration_n, i);
+ __test_add_func_load("/api/route/segment/path_p",
+ utc_maps_route_segment_path_p, i);
+ __test_add_func_load("/api/route/segment/path_n",
+ utc_maps_route_segment_path_n, i);
+ __test_add_func_load("/api/route/segment/maneuvers_p",
+ utc_maps_route_segment_maneuvers_p, i);
+ __test_add_func_load("/api/route/segment/maneuvers_n",
+ utc_maps_route_segment_maneuvers_n, i);
+
+ /* API: Data Structures: Route */
+ __test_add_func_load("/api/route/create_p", utc_maps_route_create_p, i);
+ __test_add_func_load("/api/route/create_n", utc_maps_route_create_n, i);
+ __test_add_func_load("/api/route/clone_p", utc_maps_route_clone_p, i);
+ __test_add_func_load("/api/route/clone_n", utc_maps_route_clone_n, i);
+ __test_add_func_load("/api/route/route_id_p", utc_maps_route_route_id_p,
+ i);
+ __test_add_func_load("/api/route/route_id_n", utc_maps_route_route_id_n,
+ i);
+ __test_add_func_load("/api/route/origin_p", utc_maps_route_origin_p, i);
+ __test_add_func_load("/api/route/origin_n", utc_maps_route_origin_n, i);
+ __test_add_func_load("/api/route/destination_p",
+ utc_maps_route_destination_p, i);
+ __test_add_func_load("/api/route/destination_n",
+ utc_maps_route_destination_n, i);
+ __test_add_func_load("/api/route/bounding_box_p",
+ utc_maps_route_bounding_box_p, i);
+ __test_add_func_load("/api/route/bounding_box_n",
+ utc_maps_route_bounding_box_n, i);
+ __test_add_func_load("/api/route/transport_mode_p",
+ utc_maps_route_transport_mode_p, i);
+ __test_add_func_load("/api/route/transport_mode_n",
+ utc_maps_route_transport_mode_n, i);
+ __test_add_func_load("/api/route/total_distance_p",
+ utc_maps_route_total_distance_p, i);
+ __test_add_func_load("/api/route/total_distance_n",
+ utc_maps_route_total_distance_n, i);
+ __test_add_func_load("/api/route/total_duration_p",
+ utc_maps_route_total_duration_p, i);
+ __test_add_func_load("/api/route/total_duration_n",
+ utc_maps_route_total_duration_n, i);
+ __test_add_func_load("/api/route/distance_unit_p",
+ utc_maps_route_distance_unit_p, i);
+ __test_add_func_load("/api/route/distance_unit_n",
+ utc_maps_route_distance_unit_n, i);
+ __test_add_func_load("/api/route/path_p", utc_maps_route_path_p, i);
+ __test_add_func_load("/api/route/path_n", utc_maps_route_path_n, i);
+ __test_add_func_load("/api/route/segments_p", utc_maps_route_segments_p,
+ i);
+ __test_add_func_load("/api/route/segments_n", utc_maps_route_segments_n,
+ i);
+ __test_add_func_load("/api/route/properties_p",
+ utc_maps_route_properties_p, i);
+ __test_add_func_load("/api/route/properties_n",
+ utc_maps_route_properties_n, i);
+#endif
+}
+
+static void __add_preference_data_structure_tests(int i)
+{
+#ifndef SUPPRESS_VALGRIND_WARNINGS /* Valgrind warnings!!! */
+ /* API: Data Structures: Route: Maneuver */
+ __test_add_func_load("/api/preference/create_p",
+ utc_maps_preference_create_p, i);
+ __test_add_func_load("/api/preference/create_n",
+ utc_maps_preference_create_n, i);
+ __test_add_func_load("/api/preference/clone_p",
+ utc_maps_preference_clone_p, i);
+ __test_add_func_load("/api/preference/clone_n",
+ utc_maps_preference_clone_n, i);
+ __test_add_func_load("/api/preference/distance_unit_p",
+ utc_maps_preference_distance_unit_p, i);
+ __test_add_func_load("/api/preference/distance_unit_n",
+ utc_maps_preference_distance_unit_n, i);
+ __test_add_func_load("/api/preference/language_p",
+ utc_maps_preference_language_p, i);
+ __test_add_func_load("/api/preference/language_n",
+ utc_maps_preference_language_n, i);
+ __test_add_func_load("/api/preference/max_results_p",
+ utc_maps_preference_max_results_p, i);
+ __test_add_func_load("/api/preference/max_results_n",
+ utc_maps_preference_max_results_n, i);
+ __test_add_func_load("/api/preference/country_code_p",
+ utc_maps_preference_country_code_p, i);
+ __test_add_func_load("/api/preference/country_code_n",
+ utc_maps_preference_country_code_n, i);
+ __test_add_func_load("/api/preference/route_optimization_p",
+ utc_maps_preference_route_optimization_p, i);
+ __test_add_func_load("/api/preference/route_optimization_n",
+ utc_maps_preference_route_optimization_n, i);
+ __test_add_func_load("/api/preference/route_transport_mode_p",
+ utc_maps_preference_route_transport_mode_p, i);
+ __test_add_func_load("/api/preference/route_transport_mode_n",
+ utc_maps_preference_route_transport_mode_n, i);
+ __test_add_func_load("/api/preference/route_feature_weight_p",
+ utc_maps_preference_route_feature_weight_p, i);
+ __test_add_func_load("/api/preference/route_feature_weight_n",
+ utc_maps_preference_route_feature_weight_n, i);
+ __test_add_func_load("/api/preference/route_feature_p",
+ utc_maps_preference_route_feature_p, i);
+ __test_add_func_load("/api/preference/route_feature_n",
+ utc_maps_preference_route_feature_n, i);
+ __test_add_func_load("/api/preference/property_p",
+ utc_maps_preference_property_p, i);
+ __test_add_func_load("/api/preference/property_n",
+ utc_maps_preference_property_n, i);
+ __test_add_func_load("/api/preference/clone_p",
+ utc_maps_preference_clone_p, i);
+ __test_add_func_load("/api/preference/clone_n",
+ utc_maps_preference_clone_n, i);
+ __test_add_func_load("/api/preference/clone_p",
+ utc_maps_preference_clone_p, i);
+ __test_add_func_load("/api/preference/clone_n",
+ utc_maps_preference_clone_n, i);
+
+#endif
+}
+
+static void __add_maps_api_tests(int i)
+{
+#ifndef SUPPRESS_VALGRIND_WARNINGS /* Valgrind warnings!!! */
+
+ if (1) { /* Create and destroy Maps Service */
+ __test_add_func_load("/api/maps_service/create_destroy_p",
+ utc_maps_service_create_destroy_p, i);
+ }
+
+ if (1) { /* API: Preferences and Capabilities */
+ __test_add_func_load("/api/provider_key/set_get_p",
+ utc_maps_provider_key_p, i);
+ __test_add_func_load("/api/provider_key/set_get_n",
+ utc_maps_provider_key_n, i);
+ __test_add_func_load("/api/preference/set_p",
+ utc_maps_service_set_preference_p, i);
+ __test_add_func_load("/api/preference/set_n",
+ utc_maps_service_set_preference_n, i);
+ __test_add_func_load("/api/get_provider_capabilities_p",
+ utc_maps_service_provider_is_service_supported_p, i);
+ __test_add_func_load("/api/get_provider_capabilities_n",
+ utc_maps_service_provider_is_service_supported_n, i);
+ __test_add_func_load("/api/service_support_feature_p",
+ utc_maps_service_provider_is_data_supported_p, i);
+ __test_add_func_load("/api/service_support_feature_n",
+ utc_maps_service_provider_is_data_supported_n, i);
+ }
+
+ if (1) { /* API: Geocode */
+ __test_add_func_load("/api/geocode_p",
+ utc_maps_service_geocode_p, i);
+ __test_add_func_load("/api/geocode_n",
+ utc_maps_service_geocode_n, i);
+ __test_add_func_load("/api/geocode_inside_bounds_p",
+ utc_maps_service_geocode_inside_area_p, i);
+ __test_add_func_load("/api/geocode_inside_bounds_n",
+ utc_maps_service_geocode_inside_area_n, i);
+ __test_add_func_load("/api/geocode_by_structured_address_p",
+ utc_maps_service_geocode_by_structured_address_p, i);
+ __test_add_func_load("/api/geocode_by_structured_address_n",
+ utc_maps_service_geocode_by_structured_address_n, i);
+ __test_add_func_load("/api/reverse_geocode_p",
+ utc_maps_service_reverse_geocode_p, i);
+ __test_add_func_load("/api/reverse_geocode_n",
+ utc_maps_service_reverse_geocode_n, i);
+ __test_add_func_load("/api/cancel_geocode_p",
+ utc_maps_cancel_geocode_p, i);
+ __test_add_func_load("/api/cancel_geocode_p02",
+ utc_maps_cancel_geocode_p02, i);
+ __test_add_func_load("/api/cancel_geocode_n",
+ utc_maps_cancel_geocode_n, i);
+ __test_add_func_load("/api/cancel_reverse_geocode_p",
+ utc_maps_cancel_reverse_geocode_p, i);
+ __test_add_func_load("/api/cancel_reverse_geocode_n",
+ utc_maps_cancel_reverse_geocode_n, i);
+ }
+
+ if (1) { /* API: Place */
+ __test_add_func_load("/api/place/search_p",
+ utc_maps_service_search_place_p, i);
+ __test_add_func_load("/api/place/search_p",
+ utc_maps_service_search_place_p, i);
+ __test_add_func_load("/api/place/search_n",
+ utc_maps_service_search_place_n, i);
+ __test_add_func_load("/api/place/search_by_area_p",
+ utc_maps_service_search_place_by_area_p, i);
+ __test_add_func_load("/api/place/search_by_area_n",
+ utc_maps_service_search_place_by_area_n, i);
+ __test_add_func_load("/api/place/search_by_address_p",
+ utc_maps_service_search_place_by_address_p, i);
+ __test_add_func_load("/api/place/search_by_address_n",
+ utc_maps_service_search_place_by_address_n, i);
+ __test_add_func_load("/api/place/cancel_search_p",
+ utc_maps_cancel_place_p, i);
+ __test_add_func_load("/api/place/cancel_search_n",
+ utc_maps_cancel_place_n, i);
+ }
+
+ if (1) { /* API: Route */
+ __test_add_func_load("/api/route/search_p",
+ utc_maps_service_search_route_p, i);
+ __test_add_func_load("/api/route/search_n",
+ utc_maps_service_search_route_n, i);
+ __test_add_func_load("/api/route/search_waypoints_p",
+ utc_maps_service_search_route_waypoints_p, i);
+ __test_add_func_load("/api/route/search_waypoints_n",
+ utc_maps_service_search_route_waypoints_n, i);
+ __test_add_func_load("/api/route/cancel_search_p",
+ utc_maps_cancel_route_p, i);
+ __test_add_func_load("/api/route/cancel_search_n",
+ utc_maps_cancel_route_n, i);
+ }
+
+ if (1)
+ __test_add_func_load("/api/route/search_realistic_p",
+ utc_maps_service_search_route_real_p, i);
+
+ if(1) {
+ __test_add_func_load("/api/serial_p",
+ utc_maps_service_serial_p, i);
+ }
+
+#endif
+}
+
+int main(int argc, char **argv)
+{
+ /* Testing the tutorial */
+ _maps_service_main_tutorial();
+
+ g_print("\n");
+ g_print("***********************************************\n");
+ g_print("* Maps Service Unit Test Cases\n");
+ g_print("***********************************************\n");
+ g_print("\n");
+
+#ifdef MAPS_SERVICE_CORRECTNESS_TEST
+ g_test_init(&argc, &argv, NULL);
+#endif /*MAPS_SERVICE_CORRECTNESS_TEST */
+
+#ifndef MAPS_SERVICE_LOAD_TEST
+ iterations = 1; /* No needed too much iterations for correctness
+ of memory leak tests */
+#endif /* MAPS_SERVICE_LOAD_TEST */
+
+ long long i = 0;
+ while (iterations-- > 0) {
+
+ /* Simple Test */
+ if (1)
+ __test_add_func_load("/techno/simple_test",
+ __utc_simple_test, i);
+
+ /* Plugin Management */
+ if (1)
+ __add_plugin_tests(i);
+
+ /* Session Management */
+ if (1)
+ __add_session_tests(i);
+
+ /* API: Extra Data Structures: List */
+ if (1)
+ __add_extra_data_structure_tests(i);
+
+ /* API: Maps Data Structures: Coordinates, Area */
+ if (1)
+ __add_maps_data_structure_tests(i);
+
+ /* API: Geocode Data Structures: Address */
+ if (1)
+ __add_geocode_data_structure_tests(i);
+
+ /* API: Place Data Structures: Category, Attribute, Contact,
+ * Editorial, Link Object, Media, URL, Review, Rating, Image,
+ * Filter Place */
+ if (1)
+ __add_place_data_structure_tests(i);
+
+ /* API: Route Data Structures: Maneuver, Segment, Route */
+ if (1)
+ __add_route_data_structure_tests(i);
+
+ /* API: Preference Data Structure */
+ if (1)
+ __add_preference_data_structure_tests(i);
+
+ /* API: Preference and Capabilities, Geocode, Place, Route */
+ if (1)
+ __add_maps_api_tests(i);
+
+ i++;
+
+#ifdef MAPS_SERVICE_LOAD_TEST
+ if (sleep_microseconds > 0)
+ usleep(sleep_microseconds);
+#endif /* MAPS_SERVICE_LOAD_TEST */
+ }
+
+#ifdef MAPS_SERVICE_CORRECTNESS_TEST
+ return g_test_run();
+#else
+ return 0;
+#endif /* MAPS_SERVICE_CORRECTNESS_TEST */
+}
--- /dev/null
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * 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 "discovery_test.h"
+#include "discovery.h"
+#include <glib.h>
+
+void utc_provider_info_construct_p(void)
+{
+ plugin::provider_info info;
+ info.construct("b", "c");
+ g_assert(info.provider == "b");
+ g_assert(info.file == "c");
+}
+
+/*void utc_operator_maps_provider_info_h_p(void) {
+ plugin::provider_info info("b", "c");
+
+ maps_provider_info_h h = info;
+ g_assert(h);
+
+ maps_provider_info_s* i = (maps_provider_info_s*)h;
+
+ g_assert_cmpstr(i->provider, ==, "b");
+ g_assert_cmpstr(i->file, ==, "c");
+
+ g_slice_free(maps_provider_info_s, i);
+}*/
+
+void utc_provider_info_empty_p(void)
+{
+ plugin::provider_info info;
+ g_assert(info.empty());
+}
+
+void utc_provider_info_empty_n_01(void)
+{
+ plugin::provider_info info;
+ info.construct("b", "c");
+ g_assert(!info.empty());
+}
+
+void utc_provider_info_empty_n_02(void)
+{
+ plugin::provider_info info;
+ info.construct("", "c");
+ g_assert(!info.empty());
+}
+
+void utc_provider_info_empty_n_03(void)
+{
+ plugin::provider_info info;
+ info.construct("b", "");
+ g_assert(!info.empty());
+}
+
+/*----------------------------------------------------------------------------*/
+
+void utc_get_available_plugin_list(void)
+{
+
+ plugin::discovery d;
+
+ vector < plugin::provider_info > v = d.get_available_list();
+
+ g_assert_cmpint(int (v.size()), >=, 1);
+
+ /*for(vector<plugin::provider_info>::iterator it = v.begin();
+ * it != v.end(); ++it) { */
+ for (unsigned int i = 0; i < v.size(); i++) {
+
+ /*const plugin::provider_info pi =* it; */
+ const plugin::provider_info pi = v[i];
+ g_print("\nFound a \tprovider: %s\n\t\tbinary file: %s\n",
+ pi.provider.c_str(), pi.file.c_str());
+
+ if (pi.provider == "Maps Provider") {
+ g_assert(pi.file == "libmaps-plugin-test.so");
+ }
+ }
+
+}
+
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_SERVICE_TEST_PLUGIN_DISCOVERY_H__
+#define __MAPS_SERVICE_TEST_PLUGIN_DISCOVERY_H__
+
+void utc_provider_info_construct_p(void);
+
+/*void utc_operator_maps_provider_info_h_p(void); */
+
+void utc_provider_info_empty_p(void);
+void utc_provider_info_empty_n_01(void);
+void utc_provider_info_empty_n_02(void);
+void utc_provider_info_empty_n_03(void);
+
+void utc_get_available_plugin_list(void);
+
+#endif /* __MAPS_SERVICE_TEST_PLUGIN_DISCOVERY_H__ */
+
--- /dev/null
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * 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 "module_test.h"
+#include "module.h"
+#include <glib.h>
+
+void utc_binary_extractor_get_plugin_info_p(void)
+{
+ plugin::binary_extractor e;
+
+ /*get_plugin_info("libmaps_plugin_test.so"); */
+}
+
+void utc_binary_extractor_get_plugin_info_n(void)
+{
+
+}
+
+void utc_binary_extractor_init_plugin_p(void)
+{
+ const plugin::provider_info info =
+ plugin::find_by_names("Maps Provider");
+ if (info.empty())
+ return;
+
+ plugin::plugin_s* plg =
+ (plugin::plugin_s*) plugin::binary_extractor().init(info);
+ g_assert(plg);
+
+ if (plg)
+ plugin::binary_extractor().shutdown(plg);
+}
+
+void utc_binary_extractor_init_plugin_n(void)
+{
+
+}
+
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_SERVICE_TEST_PLUGIN_MODULE_H__
+#define __MAPS_SERVICE_TEST_PLUGIN_MODULE_H__
+
+void utc_binary_extractor_get_plugin_info_p(void);
+void utc_binary_extractor_get_plugin_info_n(void);
+
+void utc_binary_extractor_init_plugin_p(void);
+void utc_binary_extractor_init_plugin_n(void);
+
+#endif /* __MAPS_SERVICE_TEST_PLUGIN_MODULE_H__ */
+
--- /dev/null
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * 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 "command_queue_test.h"
+#include "command_queue.h"
+#include "module.h"
+#include "commands.h"
+#include <glib.h>
+
+extern plugin::plugin_s* __extract_plugin(maps_service_h maps);
+
+class test_env
+{
+ public:
+ maps_service_h m;
+ plugin::plugin_s* plugin;
+ GAsyncQueue* queue;
+ public:
+ test_env():m(NULL), plugin(NULL), queue(NULL)
+ {
+ const plugin::provider_info info =
+ plugin::find_by_names("Maps Provider");
+ if (info.empty())
+ return; /* For the case when dummy plugin is absent */
+
+ int error = maps_service_create("Maps Provider", &m);
+ /*g_assert_cmpint(error, ==, MAPS_ERROR_NONE); */
+ if (error != MAPS_ERROR_NONE)
+ return; /* For the case when dummy plugin is absent */
+
+ plugin = __extract_plugin(m);
+ g_assert(plugin);
+ queue = plugin->request_queue;
+ if (session::command_queue::is_async())
+ g_assert(queue);
+ else
+ g_assert(!queue);
+
+ }
+ ~test_env()
+ {
+ if (!m)
+ return;
+ int error = maps_service_destroy(m);
+ g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
+ }
+};
+
+void utc_command_queue_push_p(void)
+{
+ test_env e;
+ if (!e.m)
+ return; /* For the case when dummy plugin is absent */
+
+ session::command_queue* cq = session::command_queue::interface();
+
+ /* [OK] 2. Push a valid command: lucky path */
+ cq->push(new session::command_cancel_request(e.m, -1));
+ e.plugin->is_working = false;
+
+ if (session::command_queue::is_async())
+ g_assert_cmpint(g_async_queue_length(e.queue), ==, 1);
+
+ session::command* c = cq->pop(e.plugin);
+ if (session::command_queue::is_async())
+ if (c)
+ delete c;
+}
+
+void utc_command_queue_push_n(void)
+{
+ test_env e;
+ if (!e.m)
+ return; /* For the case when dummy plugin is absent */
+ session::command_queue* cq = session::command_queue::interface();
+
+ /* [FAIL] 1. Push NULL instead of valid command */
+ cq->push(NULL);
+
+ /* [FAIL] 2. Push an instance of empty command: testing empty
+ * behaviour */
+ cq->push(session::command::empty_ptr());
+
+ /* [FAIL] 3. Push invalid command: plugin is NULL */
+ session::command* null_plugin_command = new session::command(NULL);
+ cq->push(null_plugin_command);
+
+ /* [FAIL] 4. Push invalid command: queue in the plugin is NULL */
+ plugin::plugin_s* broken_plugin = g_slice_new0(plugin::plugin_s);
+ session::command* broken_plugin_command =
+ new session::command(broken_plugin);
+ cq->push(broken_plugin_command);
+
+ if (e.queue)
+ g_assert_cmpint(g_async_queue_length(e.queue), ==, 0);
+
+ g_slice_free(plugin::plugin_s, broken_plugin);
+
+ delete null_plugin_command;
+ delete broken_plugin_command;
+}
+
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_SERVICE_TEST_SESSION_COMMAND_QUEUE_H__
+#define __MAPS_SERVICE_TEST_SESSION_COMMAND_QUEUE_H__
+
+void utc_command_queue_push_p(void);
+void utc_command_queue_push_n(void);
+
+#endif /* __MAPS_SERVICE_TEST_SESSION_COMMAND_QUEUE_H__ */
+
--- /dev/null
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * 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 "command_test.h"
+#include "command.h"
+#include <glib.h>
+
+void utc_command_empty_ptr_p(void)
+{
+ g_assert(session::command::empty_ptr());
+}
+
+/*----------------------------------------------------------------------------*/
+class test_env
+{
+ public:
+ plugin::plugin_s* plg;
+ public:
+ test_env():plg(NULL)
+ {
+ const plugin::provider_info info =
+ plugin::find_by_names("Maps Provider");
+ if (info.empty())
+ return; /* For the case when dummy plugin is absent */
+ plg = (plugin::plugin_s*) plugin::binary_extractor().
+ init(info);
+ g_assert(plg);
+ }
+ ~test_env()
+ {
+ if (!plg)
+ return; /* For the case when dummy plugin is absent */
+ g_assert(plg);
+ if (plg)
+ plugin::binary_extractor().shutdown(plg);
+ }
+};
+
+/*----------------------------------------------------------------------------*/
+
+static int* __utc_int_dup(const int n)
+{
+ int* clone = g_new0(int, 1);
+ *clone = n;
+ return clone;
+}
+
+void utc_use_hash_table_p(void)
+{
+ test_env e;
+ if (!e.plg)
+ return; /* For the case when dummy plugin is absent */
+
+ GHashTable* t =
+ g_hash_table_new_full(g_int_hash, g_int_equal, g_free,
+ session::command_handler::destroy);
+ g_assert(t);
+
+ const int key = 1;
+ g_hash_table_insert(t, __utc_int_dup(key),
+ new session::command_handler(e.plg, NULL, 101));
+
+ g_hash_table_remove(t, &key);
+
+ g_hash_table_unref(t);
+}
+
+/* bool add(const int user_req_id); */
+void utc_pending_request_add_p(void)
+{
+ test_env e;
+ if (!e.plg)
+ return; /* For the case when dummy plugin is absent */
+
+ session::pending_request pr(e.plg);
+ bool b = pr.add(1);
+ g_assert(b);
+
+ b = pr.contains(1);
+ g_assert(b);
+}
+
+void utc_pending_request_add_n(void)
+{
+ test_env e;
+ if (!e.plg)
+ return; /* For the case when dummy plugin is absent */
+
+ session::pending_request pr(e.plg);
+ bool b = pr.add(-1);
+ g_assert(!b);
+}
+
+/* void update(int user_req_id, int plg_req_id); */
+void utc_pending_request_update_p(void)
+{
+ test_env e;
+ if (!e.plg)
+ return; /* For the case when dummy plugin is absent */
+
+ session::pending_request pr(e.plg);
+ bool b = pr.add(1);
+ g_assert(b);
+
+ session::command_handler* ch = pr.look_up(1);
+ g_assert(!ch);
+
+ ch = new session::command_handler(e.plg, NULL, 1);
+ ch->plg_req_id = 101;
+ pr.update(1, ch);
+
+ ch = pr.look_up(1);
+ g_assert(ch);
+ g_assert_cmpint(ch->plg_req_id, ==, 101);
+}
+
+void utc_pending_request_update_n(void)
+{
+ test_env e;
+ if (!e.plg)
+ return; /* For the case when dummy plugin is absent */
+
+ session::pending_request pr(e.plg);
+ bool b = pr.add(1);
+ g_assert(b);
+
+ session::command_handler* ch = pr.look_up(1);
+ g_assert(!ch);
+}
+
+/* void remove(int user_req_id); */
+void utc_pending_request_remove_p(void)
+{
+ test_env e;
+ if (!e.plg)
+ return; /* For the case when dummy plugin is absent */
+
+ session::pending_request pr(e.plg);
+ bool b = pr.add(1);
+ g_assert(b);
+
+ b = pr.contains(1);
+ g_assert(b);
+
+ pr.remove(1);
+ g_assert(b);
+
+ b = pr.contains(1);
+ g_assert(!b);
+}
+
+void utc_pending_request_remove_n(void)
+{
+ /* empty */
+}
+
+/* int look_up(const int user_req_id); */
+void utc_pending_request_look_up_p(void)
+{
+ /* empty */
+}
+
+void utc_pending_request_look_up_n(void)
+{
+ /* empty */
+}
+
+/* int extract_plg_id(const int user_req_id); */
+void utc_pending_request_extract_p(void)
+{
+ test_env e;
+ if (!e.plg)
+ return; /* For the case when dummy plugin is absent */
+
+ session::pending_request pr(e.plg);
+ bool b = pr.add(1);
+ g_assert(b);
+
+ session::command_handler* ch =
+ new session::command_handler(e.plg, NULL, 1);
+ ch->plg_req_id = 101;
+ pr.update(1, ch);
+
+ b = pr.contains(1);
+ g_assert(b);
+
+ int n = pr.extract_plg_id(1);
+ g_assert_cmpint(n, ==, 101);
+
+ b = pr.contains(1);
+ g_assert(!b);
+}
+
+void utc_pending_request_extract_n(void)
+{
+ /* empty */
+}
+
+/* bool contains(const int user_req_id); */
+void utc_pending_request_contains_p(void)
+{
+ /* empty */
+}
+
+void utc_pending_request_contains_n(void)
+{
+ /* empty */
+}
+
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_SERVICE_TEST_SESSION_COMMAND_H__
+#define __MAPS_SERVICE_TEST_SESSION_COMMAND_H__
+
+void utc_command_empty_ptr_p(void);
+
+void utc_use_hash_table_p(void);
+
+/* bool add(const int user_req_id); */
+void utc_pending_request_add_p(void);
+void utc_pending_request_add_n(void);
+
+/* void update(int user_req_id, int plg_req_id); */
+void utc_pending_request_update_p(void);
+void utc_pending_request_update_n(void);
+
+/* void remove(int user_req_id); */
+void utc_pending_request_remove_p(void);
+void utc_pending_request_remove_n(void);
+
+/* int look_up(const int user_req_id); */
+void utc_pending_request_look_up_p(void);
+void utc_pending_request_look_up_n(void);
+
+/* int extract_plg_id(const int user_req_id); */
+void utc_pending_request_extract_p(void);
+void utc_pending_request_extract_n(void);
+
+/* bool contains(const int user_req_id); */
+void utc_pending_request_contains_p(void);
+void utc_pending_request_contains_n(void);
+
+#endif /* __MAPS_SERVICE_TEST_SESSION_COMMAND_H__ */
+
--- /dev/null
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * 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 "commands_test.h"
+#include "commands.h"
+#include <glib.h>
+
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_SERVICE_TEST_SESSION_COMMANDS_H__
+#define __MAPS_SERVICE_TEST_SESSION_COMMANDS_H__
+
+#endif /* __MAPS_SERVICE_TEST_SESSION_COMMANDS_H__ */
+
--- /dev/null
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * 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 "thread_test.h"
+#include "thread.h"
+#include <glib.h>
+
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_SERVICE_TEST_SESSION_THREAD_H__
+#define __MAPS_SERVICE_TEST_SESSION_THREAD_H__
+
+#endif /* __MAPS_SERVICE_TEST_SESSION_THREAD_H__ */
+
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+
+/*--------------------------------------------------------------------------- */
+/* 1.1 */
+#include <maps_service.h>
+/*--------------------------------------------------------------------------- */
+
+/*--------------------------------------------------------------------------- */
+/* 1.2 */
+#include <maps_service.h>
+
+static bool __my_maps_service_provider_info_cb(char* maps_provider,
+ void* user_data)
+{
+ /* Operate provider name, stored in maps_provider parameter */
+ return true;
+}
+
+void get_available_providers()
+{
+ const int error =
+ maps_service_foreach_provider
+ (__my_maps_service_provider_info_cb, NULL);
+ if (error == MAPS_ERROR_NONE) {
+ /* Chose one of providers from the available_providers list */
+ }
+ else {
+ /* Handle error */
+ }
+}
+
+/*--------------------------------------------------------------------------- */
+
+/*--------------------------------------------------------------------------- */
+/* 1.3, 1.4 */
+
+#include <maps_service.h>
+
+void create_maps_service(const char* maps_provider_name)
+{
+ maps_service_h maps = NULL;
+ int error = maps_service_create("Maps Provider", &maps);
+
+ error = maps_service_set_provider_key(maps, "XXXYYYZZZ");
+
+ bool supported = false;
+
+ /* Check if Routing is available */
+ error = maps_service_provider_is_service_supported(maps,
+ MAPS_SERVICE_SEARCH_ROUTE, &supported);
+ const bool is_routing_supported =
+ (error == MAPS_ERROR_NONE) ? supported : false;
+
+ /* Check if Routing via specified waypoints is available */
+ error = maps_service_provider_is_service_supported(maps,
+ MAPS_SERVICE_SEARCH_ROUTE_WAYPOINTS, &supported);
+ const bool is_routing_waypoints_supported =
+ (error == MAPS_ERROR_NONE) ? supported : false;
+
+ /* etc for other services, enumerated in maps_service_e */
+
+ if (is_routing_supported || is_routing_waypoints_supported) {
+ /* Check which features of place data structure are available */
+
+ /* Check if route path data is supported */
+ error = maps_service_provider_is_data_supported(maps,
+ MAPS_ROUTE_PATH, &supported);
+ const bool is_route_path_supported =
+ (error == MAPS_ERROR_NONE) ? supported : false;
+ if (is_route_path_supported) {
+ /* Allow route path usage */
+ }
+
+ /* Check if maneuver path data is supported */
+ error = maps_service_provider_is_data_supported(maps,
+ MAPS_ROUTE_SEGMENTS_PATH, &supported);
+ const bool is_route_segment_path_supported =
+ (error == MAPS_ERROR_NONE) ? supported : false;
+ if (is_route_segment_path_supported) {
+ /* Allow segment path usage */
+ }
+
+ /* Check if maneuver sements data is supported */
+ error = maps_service_provider_is_data_supported(maps,
+ MAPS_ROUTE_SEGMENTS_MANEUVERS, &supported);
+ const bool is_route_segment_maneuvers_supported =
+ (error == MAPS_ERROR_NONE) ? supported : false;
+ if (is_route_segment_maneuvers_supported) {
+ /* Allow segment maneuvers usage */
+ }
+
+ /* etc for other data features,
+ * enumerated in maps_service_data_e */
+ }
+
+}
+
+/*--------------------------------------------------------------------------- */
+
+/*--------------------------------------------------------------------------- */
+/* 1.6 */
+#include <maps_service.h>
+void set_general_preference()
+{
+ maps_service_h maps = NULL;
+
+ /* Create an instance of a preference set */
+ maps_preference_h preference = NULL;
+ int error = maps_preference_create(&preference);
+ if (error != MAPS_ERROR_NONE) {
+ /* Handle error */
+ }
+
+ /* Set the distance units preference */
+ error = maps_preference_set_distance_unit(preference,
+ MAPS_DISTANCE_UNIT_M);
+ if (error != MAPS_ERROR_NONE) {
+ /* Handle error */
+ }
+
+ /* Set the language preference */
+ error = maps_preference_set_language(preference, "en-US");
+ if (error != MAPS_ERROR_NONE) {
+ /* Handle error */
+ }
+
+ /* Apply the set of preferences for Maps Service */
+ error = maps_service_set_preference(maps, preference);
+ if (error != MAPS_ERROR_NONE) {
+ /* Handle error */
+ }
+
+ /* Destroy the instance of the preference set */
+ error = maps_preference_destroy(preference);
+ if (error != MAPS_ERROR_NONE) {
+ /* Handle error */
+ }
+}
+
+/*--------------------------------------------------------------------------- */
+/* 1.7 */
+#include <maps_service.h>
+
+static bool __maps_service_geocode_cb(maps_error_e result, int request_id,
+ int index, int total, maps_coordinates_h coordinates, void* user_data)
+{
+
+ /* Handle obtained coordinates data... */
+
+ /* Release results */
+ maps_coordinates_destroy(coordinates);
+ return true;
+}
+
+void geocode()
+{
+ maps_service_h maps = NULL;
+ maps_preference_h preference = NULL;
+ void* user_data = NULL;
+ int error = MAPS_ERROR_NONE;
+ int request_id = 0;
+
+ /* Searching for geocode of the */
+ /* Samsung'c campus "Digital City" in Suwon */
+ error = maps_service_geocode(maps,
+ "Suwon, Digital City",
+ preference, __maps_service_geocode_cb, user_data, &request_id);
+
+ if (error != MAPS_ERROR_NONE) {
+ /* Handle Error */
+ }
+
+ maps_area_h bounds = NULL;
+ /* Use maps_area_create_rectangle() or maps_area_create_circle() */
+ /* to create a geographical bounds of Geocoding */
+
+ /* Searching for geocode of the */
+ /* Samsung's campus Digital City */
+ /* within a specified geographical area */
+ error = maps_service_geocode_inside_area(maps,
+ "Digital City",
+ bounds,
+ preference, __maps_service_geocode_cb, user_data, &request_id);
+
+ if (error != MAPS_ERROR_NONE) {
+ /* Handle Error */
+ }
+
+ maps_address_h address = NULL;
+ /* Use maps_address_create() to create an instance of an address */
+ /* Than use maps_address_set_xxx to initialize the address with */
+ /* desired values */
+
+ /* Searching for a geocode of a place, */
+ /* specified with a structured address */
+ error = maps_service_geocode_by_structured_address(maps,
+ address,
+ preference, __maps_service_geocode_cb, user_data, &request_id);
+
+ if (error != MAPS_ERROR_NONE) {
+ /* Handle Error */
+ }
+}
+
+static void __maps_service_reverse_geocode_cb(maps_error_e result,
+ int request_id, int index, int total, maps_address_h address,
+ void* user_data)
+{
+
+ /* Handle obtained address... */
+
+ /* Release results */
+ maps_address_destroy(address);
+}
+
+/*----------------------------------------------------------------------------*/
+/* */
+/* Geocoder Service */
+
+void reverse_geocode()
+{
+ maps_service_h maps = NULL;
+ maps_preference_h preference = NULL;
+ void* user_data = NULL;
+ int error = MAPS_ERROR_NONE;
+ int request_id = 0;
+
+ /* Obtaining the reverse geocode with a specified coordinates */
+ error = maps_service_reverse_geocode(maps,
+ 37.257865,
+ 127.053659,
+ preference,
+ __maps_service_reverse_geocode_cb, user_data, &request_id);
+
+ if (error != MAPS_ERROR_NONE) {
+ /* Handle Error */
+ }
+}
+
+#include <stdlib.h>
+
+void parse_address_data()
+{
+ maps_address_h address = NULL;
+ int error = 0;
+
+ /* Obtain building number */
+ char* building_number = NULL;
+ error = maps_address_get_building_number(address, &building_number);
+
+ if (error != MAPS_ERROR_NONE) {
+ /* Handle Error */
+ }
+
+ /* Use building_number ... */
+
+ free(building_number);
+
+ /* Obtain street name */
+ char* street = NULL;
+ error = maps_address_get_street(address, &street);
+
+ if (error != MAPS_ERROR_NONE) {
+ /* Handle Error */
+ }
+
+ /* Use street */
+
+ free(street);
+}
+
+/*----------------------------------------------------------------------------*/
+/* */
+/* Place Service */
+
+static bool __maps_service_search_place_cb(maps_error_e error, int request_id,
+ int index, int total, maps_place_h place, void* user_data)
+{
+
+ /* Handle obtained place data... */
+
+ /* Release results */
+ maps_place_destroy(place);
+ return true;
+}
+
+void place()
+{
+ maps_service_h maps = NULL;
+ maps_preference_h preference = NULL;
+ void* user_data = NULL;
+ int error = MAPS_ERROR_NONE;
+ maps_place_filter_h filter = NULL;
+ int request_id = 0;
+
+ /* Create extra preferences for Place Search Service */
+ error = maps_preference_create(&preference);
+ if (error != MAPS_ERROR_NONE) {
+ /* Handle Error */
+ }
+ error = maps_preference_set_property(preference, MAPS_PLACE_FILTER_TYPE,
+ "restaurant");
+ if (error != MAPS_ERROR_NONE) {
+ /* Handle Error */
+ }
+
+ maps_coordinates_h position = NULL;
+ /* Create coordinates with maps_coordinates_create() */
+
+ int distance = 500;
+ error = maps_service_search_place(maps,
+ position,
+ distance,
+ filter,
+ preference,
+ __maps_service_search_place_cb, user_data, &request_id);
+
+ if (error != MAPS_ERROR_NONE) {
+ /* Handle Error */
+ }
+
+ maps_preference_destroy(preference);
+
+ maps_area_h boundary = NULL;
+ /* Create boundary with one of: */
+ /* - maps_area_create_rectangle() */
+ /* - maps_area_create_circle() */
+
+ error = maps_service_search_place_by_area(maps,
+ boundary,
+ filter,
+ preference,
+ __maps_service_search_place_cb, user_data, &request_id);
+
+ if (error != MAPS_ERROR_NONE) {
+ /* Handle Error */
+ }
+
+ /*maps_area_h boundary = NULL; */
+ /* Create boundary with one of: */
+ /* - maps_area_create_rectangle() */
+ /* - maps_area_create_circle() */
+
+ error = maps_service_search_place_by_address(maps,
+ "Digital City",
+ boundary,
+ filter,
+ preference,
+ __maps_service_search_place_cb, user_data, &request_id);
+
+ if (error != MAPS_ERROR_NONE) {
+ /* Handle Error */
+ }
+}
+
+static bool __maps_place_categories_cb(int index, int total,
+ maps_place_category_h category, void* user_data)
+{
+
+ /* Handle obtained place category data... */
+
+ /* Release results */
+ maps_place_category_destroy(category);
+ return true;
+}
+
+static bool __maps_place_properties_cb(int index, int total,
+ char* key, void* value, void* user_data)
+{
+
+ /* Handle obtained a property: */
+ /* property_name = key */
+ /* property_value = value */
+
+ /* Release property name and value */
+ free(key);
+ free(value);
+ return true;
+}
+
+void parse_place_data()
+{
+ maps_service_h maps = NULL;
+ maps_place_h place = NULL;
+ int error = MAPS_ERROR_NONE;
+ void* user_data = NULL;
+
+ /* Obtain place name */
+ char* name = NULL;
+ error = maps_place_get_name(place, &name);
+ if (error != MAPS_ERROR_NONE) {
+ /* Handle Error */
+ }
+
+ /* Use place name */
+
+ free(name);
+
+ /* Obtain place location */
+ maps_coordinates_h location = NULL;
+ error = maps_place_get_location(place, &location);
+ if (error != MAPS_ERROR_NONE) {
+ /* Handle Error */
+ }
+
+ /* Use route location */
+
+ maps_coordinates_destroy(location);
+
+ /* Check if route path data is supported */
+ bool is_place_rating_supported = false;
+ error = maps_service_provider_is_data_supported(maps, MAPS_PLACE_RATING,
+ &is_place_rating_supported);
+
+ if (error == MAPS_ERROR_NONE) {
+ if (is_place_rating_supported) {
+
+ /* Obtain place rating */
+ maps_place_rating_h rating = NULL;
+ error = maps_place_get_rating(place, &rating);
+ if (error != MAPS_ERROR_NONE) {
+ /* Handle Error */
+ }
+
+ /* Use route name */
+
+ maps_place_rating_destroy(rating);
+ }
+ }
+ else {
+ /* Handle Error */
+ }
+
+ /* Obtain a list of place categories */
+ error = maps_place_foreach_category(place, __maps_place_categories_cb,
+ user_data);
+ if (error != MAPS_ERROR_NONE) {
+ /* Handle Error */
+ }
+
+ /* Obtain Maps Provider specific place data properties */
+ error = maps_place_foreach_property(place, __maps_place_properties_cb,
+ user_data);
+ if (error != MAPS_ERROR_NONE) {
+ /* Handle Error */
+ }
+}
+
+/*----------------------------------------------------------------------------*/
+/* */
+/* Route Service */
+
+static bool __maps_service_search_route_cb(maps_error_e error, int request_id,
+ int index, int total, maps_route_h route, void* user_data)
+{
+
+ /* Handle obtained route data... */
+
+ /* Release results */
+ maps_route_destroy(route);
+ return true;
+}
+
+void route()
+{
+ maps_service_h maps = NULL;
+ maps_preference_h preference = NULL;
+ void* user_data = NULL;
+ int error = MAPS_ERROR_NONE;
+ int request_id = 0;
+
+ /* Create extra preferences for Place Search Service */
+ error = maps_preference_create(&preference);
+ if (error != MAPS_ERROR_NONE) {
+ /* Handle Error */
+ }
+ error = maps_preference_set_property(preference,
+ MAPS_ROUTE_FREEFORM_ADDR_TO_AVOID, "Suwon, Digital City");
+ if (error != MAPS_ERROR_NONE) {
+ /* Handle Error */
+ }
+ error = maps_preference_set_route_optimization(preference,
+ MAPS_ROUTE_TYPE_SHORTEST);
+ if (error != MAPS_ERROR_NONE) {
+ /* Handle Error */
+ }
+
+ maps_coordinates_h origin = NULL, destination = NULL;
+ /* Create coordinates with maps_coordinates_create() */
+
+ error = maps_service_search_route(maps,
+ origin,
+ destination,
+ preference,
+ __maps_service_search_route_cb, user_data, &request_id);
+
+ if (error != MAPS_ERROR_NONE) {
+ /* Handle Error */
+ }
+
+ maps_preference_destroy(preference);
+
+ /* Specify amount of way points */
+ const int waypoint_num = 5;
+
+ /* Create array with coordinates of way points */
+ maps_coordinates_h* waypoint_list = NULL;
+
+ error = maps_service_search_route_waypoints(maps,
+ waypoint_list,
+ waypoint_num,
+ preference,
+ __maps_service_search_route_cb, user_data, &request_id);
+
+ if (error != MAPS_ERROR_NONE) {
+ /* Handle Error */
+ }
+}
+
+static bool __maps_route_path_cb(int index, int total,
+ maps_coordinates_h coordinates, void* user_data)
+{
+
+ /* Handle obtained coordinates of route path... */
+
+ /* Release results */
+ maps_coordinates_destroy(coordinates);
+ return true;
+}
+
+static bool __maps_route_segment_cb(int index, int total,
+ maps_route_segment_h segment, void* user_data)
+{
+
+ /* Handle obtained segment of route... */
+
+ /* Release results */
+ maps_route_segment_destroy(segment);
+ return true;
+}
+
+static bool __maps_route_properties_cb(int index, int total,
+ char* key, void* value, void* user_data)
+{
+
+ /* Handle obtained a property: */
+ /* property_name = key */
+ /* property_value = value */
+
+ /* Release property name and value */
+ free(key);
+ free(value);
+ return true;
+}
+
+void parse_route_data()
+{
+ maps_service_h maps = NULL;
+ maps_route_h route = NULL;
+ int error = MAPS_ERROR_NONE;
+ void* user_data = NULL;
+
+ /* Obtain route id */
+ char* id = NULL;
+ error = maps_route_get_route_id(route, &id);
+ if (error != MAPS_ERROR_NONE) {
+ /* Handle Error */
+ }
+
+ /* Use route id */
+
+ free(id);
+
+ /* Obtain route origin and destination */
+ maps_coordinates_h origin = NULL, destination = NULL;
+ error = maps_route_get_origin(route, &origin);
+ if (error != MAPS_ERROR_NONE) {
+ /* Handle Error */
+ }
+ error = maps_route_get_destination(route, &destination);
+ if (error != MAPS_ERROR_NONE) {
+ /* Handle Error */
+ }
+
+ /* Use route origin and destination */
+
+ maps_coordinates_destroy(origin);
+ maps_coordinates_destroy(destination);
+
+ /* Obtain route total distance */
+ double total_distance = .0;
+ error = maps_route_get_total_distance(route, &total_distance);
+ if (error != MAPS_ERROR_NONE) {
+ /* Handle Error */
+ }
+
+ /* Use route total distance */
+
+ error = maps_route_foreach_path(route, __maps_route_path_cb, user_data);
+ if (error != MAPS_ERROR_NONE) {
+ /* Handle Error */
+ }
+
+ error = maps_route_foreach_segment(route, __maps_route_segment_cb,
+ user_data);
+ if (error != MAPS_ERROR_NONE) {
+ /* Handle Error */
+ }
+
+ /* Check if route path data is supported */
+ bool is_route_path_supported = false;
+ error = maps_service_provider_is_data_supported(maps, MAPS_ROUTE_PATH,
+ &is_route_path_supported);
+
+ if (error == MAPS_ERROR_NONE) {
+ if (is_route_path_supported) {
+
+ /* Obtain route path */
+ error = maps_route_foreach_path(route,
+ __maps_route_path_cb, user_data);
+ if (error != MAPS_ERROR_NONE) {
+ /* Handle Error */
+ }
+ }
+ }
+ else {
+ /* Handle Error */
+ }
+
+ /* Check if route segment data is supported */
+
+ bool is_route_segment_path_supported = false;
+ error = maps_service_provider_is_data_supported(maps,
+ MAPS_ROUTE_SEGMENTS_PATH, &is_route_segment_path_supported);
+
+ bool is_route_segment_maneuvers_supported = false;
+ error = maps_service_provider_is_data_supported(maps,
+ MAPS_ROUTE_SEGMENTS_MANEUVERS,
+ &is_route_segment_maneuvers_supported);
+
+ if (error == MAPS_ERROR_NONE) {
+ if (is_route_segment_path_supported
+ || is_route_segment_maneuvers_supported) {
+
+ /* Obtain route segments */
+ error = maps_route_foreach_segment(route,
+ __maps_route_segment_cb, user_data);
+ if (error != MAPS_ERROR_NONE) {
+ /* Handle Error */
+ }
+ }
+ }
+ else {
+ /* Handle Error */
+ }
+
+ /* Obtain Maps Provider specific route data properties */
+ error = maps_route_foreach_property(route, __maps_route_properties_cb,
+ user_data);
+ if (error != MAPS_ERROR_NONE) {
+ /* Handle Error */
+ }
+}
+
+/*----------------------------------------------------------------------------*/
+/* */
+/* Cancel Request */
+
+void cancel()
+{
+ maps_service_h maps = NULL;
+ int error = MAPS_ERROR_NONE;
+ int request_id = 0;
+
+ /* Cancel the request with a specified id */
+ error = maps_service_cancel_request(maps, request_id);
+
+ if (error != MAPS_ERROR_NONE) {
+ /* Handle Error */
+ }
+}
+
+int _maps_service_main_tutorial(void)
+{
+
+ /* 1.2 */
+ if (0)
+ get_available_providers();
+
+ /* 1.3, 1.4 */
+ if (0)
+ create_maps_service("Maps Provider");
+
+ /* 1.6 */
+ if (0)
+ set_general_preference();
+
+ /* 1.7 */
+ if (0)
+ geocode();
+ if (0)
+ parse_address_data();
+
+ /* 1.7 */
+ if (0)
+ place();
+ if (0)
+ parse_place_data();
+
+ /* 1.7 */
+ if (0)
+ route();
+ if (0)
+ parse_route_data();
+
+ /* 1.7 */
+ if (0)
+ cancel();
+
+ return 0;
+}
+
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_SERVICE_TUTORIAL_H__
+#define __MAPS_SERVICE_TUTORIAL_H__
+
+int _maps_service_main_tutorial(void);
+
+#endif /* __MAPS_SERVICE_TUTORIAL_H__ */
+
--- /dev/null
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * 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 "maps_object.h"
+#include "maps_address.h"
+#include "maps_error.h"
+#include <glib.h>
+
+bool __equal_double(const double &d1, const double &d2)
+{
+ static double delta = 0.0000001;
+ if (d1 >= (d2 + delta))
+ return false;
+ if (d1 <= (d2 - delta))
+ return false;
+ return true;
+}
+
+/*----------------------------------------------------------------------------*/
+/* Simple type library, helpful for operating with Maps Objects */
+
+/* Coordinates */
+ maps::coordinates::coordinates():object(NULL)
+{
+}
+
+ maps::coordinates::coordinates(const double &lat, const double &lon):object(NULL)
+{
+ maps_coordinates_create(lat, lon, &handle);
+}
+
+maps::coordinates::coordinates(const maps_coordinates_s & c):object(NULL)
+{
+ maps_coordinates_create(c.latitude, c.longitude, &handle);
+}
+
+maps::coordinates::coordinates(const coordinates & c):object(NULL)
+{
+ *this = c;
+}
+
+maps::coordinates & maps::coordinates::operator=(const coordinates & c)
+{
+ if (this != &c) {
+ maps_coordinates_destroy(handle);
+ maps_coordinates_clone(c.handle, &handle);
+ }
+ return* this;
+}
+
+maps::coordinates::~coordinates()
+{
+}
+
+bool maps::coordinates::operator==(const coordinates & c) const
+{
+ if (this == &c)
+ return true;
+ if (!__equal_double(get_latitude(), c.get_latitude()))
+ return false;
+ if (!__equal_double(get_longitude(), c.get_longitude()))
+ return false;
+ return true;
+}
+
+bool maps::coordinates::operator!=(const coordinates & c) const
+{
+ return !(*this == c);
+}
+
+double maps::coordinates::get_latitude() const
+{
+ double lat = 0;
+ if (handle)
+ maps_coordinates_get_latitude(handle, &lat);
+ return lat;
+}
+
+double maps::coordinates::get_longitude() const
+{
+ double lon = 0;
+ if (handle)
+ maps_coordinates_get_longitude(handle, &lon);
+ return lon;
+}
+
+/* Area */
+ maps::area::area():object(NULL)
+{
+}
+
+maps::area::~area()
+{
+}
+
+ maps::area::area(const coordinates & lt, const coordinates & rb):object(NULL)
+{
+ maps_area_create_rectangle(lt, rb, &handle);
+}
+
+maps::area::area(const double &l, const double &t, const double &r,
+ const double &b):object(NULL)
+{
+ maps_area_create_rectangle(coordinates(l, t), coordinates(r, b),
+ &handle);
+}
+
+maps::area::area(const coordinates & c, const double &r):object(NULL)
+{
+ maps_area_create_circle(c, r, &handle);
+}
+
+maps::area::area(const double &x, const double &y, const double &r):object(NULL)
+{
+ maps_area_create_circle(coordinates(x, y), r, &handle);
+}
+
+maps::area::area(const area & a):object(NULL)
+{
+ *this = a;
+}
+
+maps::area & maps::area::operator=(const area & a)
+{
+ if (this != &a) {
+ maps_area_destroy(handle);
+ maps_area_clone(a.handle, &handle);
+ }
+ return* this;
+}
+
+maps_area_type_e maps::area::get_type() const
+{
+ if (!handle)
+ return MAPS_AREA_NONE;
+ maps_area_s* a = (maps_area_s*) handle;
+ return a->type;
+}
+
+maps::coordinates maps::area::get_top_left() const
+{
+ if (!handle)
+ return coordinates(.0, .0);
+ maps_area_s* a = (maps_area_s*) handle;
+ return coordinates(a->rect.top_left);
+}
+
+maps::coordinates maps::area::get_bottom_right() const
+{
+ if (!handle)
+ return coordinates(.0, .0);
+ maps_area_s* a = (maps_area_s*) handle;
+ return coordinates(a->rect.bottom_right);
+}
+
+maps::coordinates maps::area::get_center() const
+{
+ if (!handle)
+ return coordinates(.0, .0);
+ maps_area_s* a = (maps_area_s*) handle;
+ return coordinates(a->circle.center);
+}
+
+double maps::area::get_radius() const
+{
+ if (!handle)
+ return .0;
+ maps_area_s* a = (maps_area_s*) handle;
+ return a->circle.radius;
+}
+
+bool maps::area::operator==(const area & a) const
+{
+ if (this == &a)
+ return true;
+ if (get_type() != a.get_type())
+ return false;
+ switch (get_type()) {
+ case MAPS_AREA_RECTANGLE:
+ if (get_top_left() != a.get_top_left())
+ return false;
+ if (get_bottom_right() != a.get_bottom_right())
+ return false;
+ break;
+ case MAPS_AREA_CIRCLE:
+ if (get_center() != a.get_center())
+ return false;
+ if (!__equal_double(get_radius(), a.get_radius()))
+ return false;
+ break;
+ case MAPS_AREA_NONE:
+ default:
+ break;
+ }
+ return true;
+}
+
+bool maps::area::operator!=(const area & a) const
+{
+ return !(*this == a);
+}
+
+/*----------------------------------------------------------------------------*/
+
+maps::string_holder::~string_holder()
+{
+ g_free(str);
+}
+
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_SERVICE_TEST_API_OBJECT_H__
+#define __MAPS_SERVICE_TEST_API_OBJECT_H__
+
+#include <maps_service.h>
+#include <maps_plugin.h>
+#include <maps_address.h>
+#include <maps_place_plugin.h>
+#include <maps_place_rating_plugin.h>
+#include <maps_place_editorial_plugin.h>
+#include <maps_place_review_plugin.h>
+#include <maps_place_image_plugin.h>
+#include <maps_place_media_plugin.h>
+#include <maps_place_link_object_plugin.h>
+#include <maps_place_contact_plugin.h>
+#include <maps_place_category.h>
+#include <maps_route_plugin.h>
+#include <maps_route_segment_plugin.h>
+#include <maps_route_maneuver_plugin.h>
+
+bool __equal_double(const double &d1, const double &d2);
+
+/*----------------------------------------------------------------------------*/
+/* Simple type library, helpful for operating with Maps Objects */
+/* */
+/* Implement also a gabage collector */
+namespace maps
+{
+
+ /* Basic functions of each Object */
+ typedef int (*create_f) (void **data);
+ typedef int (*destroy_f) (void *data);
+ typedef int (*clone_f) (void *origin, void **cloned);
+
+ /* The basic class of each Object */
+ template <create_f CRF, destroy_f DF, clone_f CLF> class object
+ {
+ protected:
+ void *handle;
+ public:
+ object() : handle(NULL)
+ {
+ CRF(&handle);
+ }
+ object(void *h) : handle(h)
+ {
+ }
+ object(const object &o)
+ {
+ CLF(o.handle, &handle);
+ }
+ virtual ~object()
+ {
+ DF(handle);
+ }
+ public:
+ object &operator=(const object &o)
+ {
+ if (this != &o) {
+ DF(handle);
+ CLF(o.handle, handle);
+ }
+ return *this;
+ }
+ public:
+ destroy_f destroy_func() const
+ {
+ return DF;
+ }
+ clone_f clone_func() const
+ {
+ return CLF;
+ }
+ public:
+ operator void *()
+ {
+ return handle;
+ }
+ operator void *() const
+ {
+ return handle;
+ }
+ operator void **()
+ {
+ return &handle;
+ }
+ public:
+ void *clone() const
+ {
+ void *c = NULL;
+ CLF(handle, &c);
+ return c;
+ }
+ };
+
+ /* Empty Object */
+ class empty_object
+ {
+ public:
+ virtual ~empty_object();
+ static int create_empty(void **obj)
+ {
+ return 0;
+ }
+ static int destroy_empty(void *obj)
+ {
+ return 0;
+ }
+ static int clone_empty(void *origin, void **cloned)
+ {
+ return 0;
+ }
+ };
+
+ /* The list of objects */
+ template <class T> class item_list :
+ public object <maps_item_list_create,
+ maps_item_list_destroy,
+ empty_object::clone_empty>
+ {
+ public:
+ virtual ~item_list()
+ {
+ clear();
+ }
+ void add(const T &o)
+ {
+ maps_item_list_append(handle, o, o.clone_func());
+ }
+ void clear()
+ {
+ static T empty;
+ maps_item_list_remove_all(handle, empty.destroy_func());
+ }
+ };
+
+ /* Object Classes: */
+
+ /* Coordinates */
+ class coordinates : public object <empty_object::create_empty,
+ maps_coordinates_destroy,
+ maps_coordinates_clone>
+ {
+ public:
+ coordinates();
+ coordinates(const double &lat, const double &lon);
+ coordinates(const maps_coordinates_s &c);
+ coordinates(void *h):object(h)
+ {
+ }
+ coordinates(const coordinates &c);
+ virtual ~coordinates();
+ public:
+ coordinates &operator=(const coordinates &c);
+ bool operator==(const coordinates &c) const;
+ bool operator!=(const coordinates &c) const;
+ public:
+ double get_latitude() const;
+ double get_longitude() const;
+ };
+
+ /* Area */
+ class area : public object <empty_object::create_empty,
+ maps_area_destroy,
+ maps_area_clone >
+ {
+ public:
+ area();
+
+ /* Rectangular area */
+ area(const coordinates <, const coordinates &rb);
+ area(const double &l, const double &t,
+ const double &r, const double &b);
+
+ /* Circular area */
+ area(const coordinates &c, const double &r);
+ area(const double &x, const double &y, const double &r);
+
+ area(void *h) : object(h)
+ {
+ }
+ area(const area &a);
+ virtual ~area();
+ public:
+ area &operator=(const area &a);
+ bool operator==(const area &a) const;
+ bool operator!=(const area &a) const;
+ public:
+ maps_area_type_e get_type() const;
+ coordinates get_top_left() const;
+ coordinates get_bottom_right() const;
+ coordinates get_center() const;
+ double get_radius() const;
+ };
+
+/*----------------------------------------------------------------------------*/
+ /* Address */
+ typedef object <maps_address_create, maps_address_destroy,
+ maps_address_clone> address;
+
+/*----------------------------------------------------------------------------*/
+ /* Place */
+ typedef object <maps_place_create,
+ maps_place_destroy,
+ maps_place_clone> place;
+
+ typedef object <maps_place_filter_create,
+ maps_place_filter_destroy,
+ maps_place_filter_clone> place_filter;
+
+ typedef object <maps_place_rating_create,
+ maps_place_rating_destroy,
+ maps_place_rating_clone> place_rating;
+
+ typedef object <maps_place_editorial_create,
+ maps_place_editorial_destroy,
+ maps_place_editorial_clone> place_editorial;
+
+ typedef object <maps_place_review_create,
+ maps_place_review_destroy,
+ maps_place_review_clone> place_review;
+
+ typedef object <maps_place_image_create,
+ maps_place_image_destroy,
+ maps_place_image_clone> place_image;
+
+ typedef object <maps_place_media_create,
+ maps_place_media_destroy,
+ maps_place_media_clone> place_media;
+
+ typedef object <maps_place_link_object_create,
+ maps_place_link_object_destroy,
+ maps_place_link_object_clone> place_link_object;
+
+ typedef object <maps_place_contact_create,
+ maps_place_contact_destroy,
+ maps_place_contact_clone> place_contact;
+
+ typedef object <maps_place_category_create,
+ maps_place_category_destroy,
+ maps_place_category_clone> place_category;
+
+/*----------------------------------------------------------------------------*/
+ /* Route */
+ typedef object <maps_route_create,
+ maps_route_destroy,
+ maps_route_clone> route;
+
+ typedef object <maps_route_segment_create,
+ maps_route_segment_destroy,
+ maps_route_segment_clone> route_segment;
+
+ typedef object <maps_route_maneuver_create,
+ maps_route_maneuver_destroy,
+ maps_route_maneuver_clone> route_maneuver;
+
+/*----------------------------------------------------------------------------*/
+ /* String holder with auto-free of memory */
+ class string_holder
+ {
+ public:
+ char *str;
+ public:
+ string_holder(char *string = NULL) : str(string) {
+ }
+ ~string_holder();
+ operator char *() const
+ {
+ return str;
+ }
+ operator char **()
+ {
+ return &str;
+ }
+ };
+};
+
+/*----------------------------------------------------------------------------*/
+
+#endif /* __MAPS_SERVICE_TEST_API_OBJECT_H__ */
+
--- /dev/null
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * 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 "maps_test_utils.h"
+#include <glib.h>
+#include <cstdlib>
+#include <sys/timeb.h>
+
+void __utc_print_error_string(int error)
+{
+ switch (error) {
+ case MAPS_ERROR_NONE:
+ g_print("MAPS_ERROR_NONE\n");
+ break;
+ case MAPS_ERROR_PERMISSION_DENIED:
+ g_print("MAPS_ERROR_PERMISSION_DENIED\n");
+ break;
+ case MAPS_ERROR_OUT_OF_MEMORY:
+ g_print("MAPS_ERROR_OUT_OF_MEMORY\n");
+ break;
+ case MAPS_ERROR_INVALID_PARAMETER:
+ g_print("MAPS_ERROR_INVALID_PARAMETER\n");
+ break;
+ case MAPS_ERROR_NOT_SUPPORTED:
+ g_print("MAPS_ERROR_NOT_SUPPORTED\n");
+ break;
+ case MAPS_ERROR_CONNECTION_TIME_OUT:
+ g_print("MAPS_ERROR_CONNECTION_TIME_OUT\n");
+ break;
+ case MAPS_ERROR_NETWORK_UNREACHABLE:
+ g_print("MAPS_ERROR_NETWORK_UNREACHABLE\n");
+ break;
+ case MAPS_ERROR_SERVICE_NOT_AVAILABLE:
+ g_print("MAPS_ERROR_SERVICE_NOT_AVAILABLE\n");
+ break;
+ case MAPS_ERROR_INVALID_OPERATION:
+ g_print("MAPS_ERROR_INVALID_OPERATION\n");
+ break;
+ case MAPS_ERROR_NOT_FOUND:
+ g_print("MAPS_ERROR_NOT_FOUND\n");
+ break;
+ case MAPS_ERROR_KEY_NOT_AVAILABLE:
+ g_print("MAPS_ERROR_KEY_NOT_AVAILABLE\n");
+ break;
+ case MAPS_ERROR_RESOURCE_BUSY:
+ g_print("MAPS_ERROR_RESOURCE_BUSY\n");
+ break;
+ case MAPS_ERROR_CANCELED:
+ g_print("MAPS_ERROR_CANCELED\n");
+ break;
+ case MAPS_ERROR_UNKNOWN:
+ g_print("MAPS_ERROR_UNKNOWN\n");
+ break;
+ default:
+ g_print("Unknown Error Code\n");
+ break;
+ }
+}
+
+int __get_milli_count()
+{
+ timeb tb;
+ ftime(&tb);
+ int nCount = tb.millitm + (tb.time & 0xfffff)* 1000;
+ return nCount;
+}
+
+int __get_milli_span(int start_t)
+{
+ int nSpan = __get_milli_count() - start_t;
+ if (nSpan < 0)
+ nSpan += 0x100000* 1000;
+ return nSpan;
+}
+
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __MAPS_SERVICE_TEST_UTILS_H__
+#define __MAPS_SERVICE_TEST_UTILS_H__
+
+#include <maps_service.h>
+
+/*----------------------------------------------------------------------------*/
+/* Utils */
+/* */
+
+void __utc_print_error_string(int error);
+
+int __get_milli_count();
+
+int __get_milli_span(int start_t);
+
+#endif /*__MAPS_SERVICE_TEST_UTILS_H__*/
+