--- /dev/null
+Seungkeun Lee <sngn.lee@samsung.com>
+Kangho Hur <kanho.hur@samsung.com>
--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+SET(fw_name "capi-location-poi")
+
+PROJECT(${fw_name})
+
+SET(CMAKE_INSTALL_PREFIX /usr)
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+
+SET(INC_DIR include)
+INCLUDE_DIRECTORIES(${INC_DIR})
+
+SET(dependents "dlog location capi-base-common capi-location-manager")
+SET(pc_dependents "capi-base-common capi-location-manager")
+
+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")
+SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
+
+IF("${ARCH}" STREQUAL "arm")
+ ADD_DEFINITIONS("-DTARGET")
+ENDIF("${ARCH}" STREQUAL "arm")
+
+ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+ADD_DEFINITIONS("-DTIZEN_DEBUG")
+
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib")
+
+aux_source_directory(src SOURCES)
+ADD_LIBRARY(${fw_name} SHARED ${SOURCES})
+
+SET_TARGET_PROPERTIES(${fw_name}
+ PROPERTIES
+ VERSION ${FULLVER}
+ SOVERSION ${MAJORVER}
+ CLEAN_DIRECT_OUTPUT 1
+)
+
+TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS})
+
+INSTALL(TARGETS ${fw_name} DESTINATION lib)
+INSTALL(
+ DIRECTORY ${INC_DIR}/ DESTINATION include/location
+ FILES_MATCHING
+ PATTERN "*_private.h" EXCLUDE
+ PATTERN "${INC_DIR}/*.h"
+ )
+
+SET(PC_NAME ${fw_name})
+SET(PC_REQUIRED ${pc_dependents})
+SET(PC_LDFLAGS -l${fw_name})
+
+CONFIGURE_FILE(
+ ${fw_name}.pc.in
+ ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc
+ @ONLY
+)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION lib/pkgconfig)
+
+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 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+\r
+ Apache License\r
+ Version 2.0, January 2004\r
+ http://www.apache.org/licenses/\r
+\r
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\r
+\r
+ 1. Definitions.\r
+\r
+ "License" shall mean the terms and conditions for use, reproduction,\r
+ and distribution as defined by Sections 1 through 9 of this document.\r
+\r
+ "Licensor" shall mean the copyright owner or entity authorized by\r
+ the copyright owner that is granting the License.\r
+\r
+ "Legal Entity" shall mean the union of the acting entity and all\r
+ other entities that control, are controlled by, or are under common\r
+ control with that entity. For the purposes of this definition,\r
+ "control" means (i) the power, direct or indirect, to cause the\r
+ direction or management of such entity, whether by contract or\r
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the\r
+ outstanding shares, or (iii) beneficial ownership of such entity.\r
+\r
+ "You" (or "Your") shall mean an individual or Legal Entity\r
+ exercising permissions granted by this License.\r
+\r
+ "Source" form shall mean the preferred form for making modifications,\r
+ including but not limited to software source code, documentation\r
+ source, and configuration files.\r
+\r
+ "Object" form shall mean any form resulting from mechanical\r
+ transformation or translation of a Source form, including but\r
+ not limited to compiled object code, generated documentation,\r
+ and conversions to other media types.\r
+\r
+ "Work" shall mean the work of authorship, whether in Source or\r
+ Object form, made available under the License, as indicated by a\r
+ copyright notice that is included in or attached to the work\r
+ (an example is provided in the Appendix below).\r
+\r
+ "Derivative Works" shall mean any work, whether in Source or Object\r
+ form, that is based on (or derived from) the Work and for which the\r
+ editorial revisions, annotations, elaborations, or other modifications\r
+ represent, as a whole, an original work of authorship. For the purposes\r
+ of this License, Derivative Works shall not include works that remain\r
+ separable from, or merely link (or bind by name) to the interfaces of,\r
+ the Work and Derivative Works thereof.\r
+\r
+ "Contribution" shall mean any work of authorship, including\r
+ the original version of the Work and any modifications or additions\r
+ to that Work or Derivative Works thereof, that is intentionally\r
+ submitted to Licensor for inclusion in the Work by the copyright owner\r
+ or by an individual or Legal Entity authorized to submit on behalf of\r
+ the copyright owner. For the purposes of this definition, "submitted"\r
+ means any form of electronic, verbal, or written communication sent\r
+ to the Licensor or its representatives, including but not limited to\r
+ communication on electronic mailing lists, source code control systems,\r
+ and issue tracking systems that are managed by, or on behalf of, the\r
+ Licensor for the purpose of discussing and improving the Work, but\r
+ excluding communication that is conspicuously marked or otherwise\r
+ designated in writing by the copyright owner as "Not a Contribution."\r
+\r
+ "Contributor" shall mean Licensor and any individual or Legal Entity\r
+ on behalf of whom a Contribution has been received by Licensor and\r
+ subsequently incorporated within the Work.\r
+\r
+ 2. Grant of Copyright License. Subject to the terms and conditions of\r
+ this License, each Contributor hereby grants to You a perpetual,\r
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
+ copyright license to reproduce, prepare Derivative Works of,\r
+ publicly display, publicly perform, sublicense, and distribute the\r
+ Work and such Derivative Works in Source or Object form.\r
+\r
+ 3. Grant of Patent License. Subject to the terms and conditions of\r
+ this License, each Contributor hereby grants to You a perpetual,\r
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
+ (except as stated in this section) patent license to make, have made,\r
+ use, offer to sell, sell, import, and otherwise transfer the Work,\r
+ where such license applies only to those patent claims licensable\r
+ by such Contributor that are necessarily infringed by their\r
+ Contribution(s) alone or by combination of their Contribution(s)\r
+ with the Work to which such Contribution(s) was submitted. If You\r
+ institute patent litigation against any entity (including a\r
+ cross-claim or counterclaim in a lawsuit) alleging that the Work\r
+ or a Contribution incorporated within the Work constitutes direct\r
+ or contributory patent infringement, then any patent licenses\r
+ granted to You under this License for that Work shall terminate\r
+ as of the date such litigation is filed.\r
+\r
+ 4. Redistribution. You may reproduce and distribute copies of the\r
+ Work or Derivative Works thereof in any medium, with or without\r
+ modifications, and in Source or Object form, provided that You\r
+ meet the following conditions:\r
+\r
+ (a) You must give any other recipients of the Work or\r
+ Derivative Works a copy of this License; and\r
+\r
+ (b) You must cause any modified files to carry prominent notices\r
+ stating that You changed the files; and\r
+\r
+ (c) You must retain, in the Source form of any Derivative Works\r
+ that You distribute, all copyright, patent, trademark, and\r
+ attribution notices from the Source form of the Work,\r
+ excluding those notices that do not pertain to any part of\r
+ the Derivative Works; and\r
+\r
+ (d) If the Work includes a "NOTICE" text file as part of its\r
+ distribution, then any Derivative Works that You distribute must\r
+ include a readable copy of the attribution notices contained\r
+ within such NOTICE file, excluding those notices that do not\r
+ pertain to any part of the Derivative Works, in at least one\r
+ of the following places: within a NOTICE text file distributed\r
+ as part of the Derivative Works; within the Source form or\r
+ documentation, if provided along with the Derivative Works; or,\r
+ within a display generated by the Derivative Works, if and\r
+ wherever such third-party notices normally appear. The contents\r
+ of the NOTICE file are for informational purposes only and\r
+ do not modify the License. You may add Your own attribution\r
+ notices within Derivative Works that You distribute, alongside\r
+ or as an addendum to the NOTICE text from the Work, provided\r
+ that such additional attribution notices cannot be construed\r
+ as modifying the License.\r
+\r
+ You may add Your own copyright statement to Your modifications and\r
+ may provide additional or different license terms and conditions\r
+ for use, reproduction, or distribution of Your modifications, or\r
+ for any such Derivative Works as a whole, provided Your use,\r
+ reproduction, and distribution of the Work otherwise complies with\r
+ the conditions stated in this License.\r
+\r
+ 5. Submission of Contributions. Unless You explicitly state otherwise,\r
+ any Contribution intentionally submitted for inclusion in the Work\r
+ by You to the Licensor shall be under the terms and conditions of\r
+ this License, without any additional terms or conditions.\r
+ Notwithstanding the above, nothing herein shall supersede or modify\r
+ the terms of any separate license agreement you may have executed\r
+ with Licensor regarding such Contributions.\r
+\r
+ 6. Trademarks. This License does not grant permission to use the trade\r
+ names, trademarks, service marks, or product names of the Licensor,\r
+ except as required for reasonable and customary use in describing the\r
+ origin of the Work and reproducing the content of the NOTICE file.\r
+\r
+ 7. Disclaimer of Warranty. Unless required by applicable law or\r
+ agreed to in writing, Licensor provides the Work (and each\r
+ Contributor provides its Contributions) on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\r
+ implied, including, without limitation, any warranties or conditions\r
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\r
+ PARTICULAR PURPOSE. You are solely responsible for determining the\r
+ appropriateness of using or redistributing the Work and assume any\r
+ risks associated with Your exercise of permissions under this License.\r
+\r
+ 8. Limitation of Liability. In no event and under no legal theory,\r
+ whether in tort (including negligence), contract, or otherwise,\r
+ unless required by applicable law (such as deliberate and grossly\r
+ negligent acts) or agreed to in writing, shall any Contributor be\r
+ liable to You for damages, including any direct, indirect, special,\r
+ incidental, or consequential damages of any character arising as a\r
+ result of this License or out of the use or inability to use the\r
+ Work (including but not limited to damages for loss of goodwill,\r
+ work stoppage, computer failure or malfunction, or any and all\r
+ other commercial damages or losses), even if such Contributor\r
+ has been advised of the possibility of such damages.\r
+\r
+ 9. Accepting Warranty or Additional Liability. While redistributing\r
+ the Work or Derivative Works thereof, You may choose to offer,\r
+ and charge a fee for, acceptance of support, warranty, indemnity,\r
+ or other liability obligations and/or rights consistent with this\r
+ License. However, in accepting such obligations, You may act only\r
+ on Your own behalf and on Your sole responsibility, not on behalf\r
+ of any other Contributor, and only if You agree to indemnify,\r
+ defend, and hold each Contributor harmless for any liability\r
+ incurred by, or claims asserted against, such Contributor by reason\r
+ of your accepting any such warranty or additional liability.\r
+\r
+ END OF TERMS AND CONDITIONS\r
+\r
+ APPENDIX: How to apply the Apache License to your work.\r
+\r
+ To apply the Apache License to your work, attach the following\r
+ boilerplate notice, with the fields enclosed by brackets "[]"\r
+ replaced with your own identifying information. (Don't include\r
+ the brackets!) The text should be enclosed in the appropriate\r
+ comment syntax for the file format. We also recommend that a\r
+ file or class name and description of purpose be included on the\r
+ same "printed page" as the copyright notice for easier\r
+ identification within third-party archives.\r
+\r
+ Copyright [yyyy] [name of copyright owner]\r
+\r
+ Licensed under the Apache License, Version 2.0 (the "License");\r
+ you may not use this file except in compliance with the License.\r
+ You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+ Unless required by applicable law or agreed to in writing, software\r
+ distributed under the License is distributed on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ See the License for the specific language governing permissions and\r
+ limitations under the License.\r
+\r
+\r
+\r
--- /dev/null
+<manifest>
+ <request>
+ <domain name="_"/>
+ </request>
+</manifest>
--- /dev/null
+
+# Package Information for pkg-config
+
+prefix=@PREFIX@
+exec_prefix=/usr
+libdir=/usr/lib
+includedir=/usr/include/location
+
+Name: @PC_NAME@
+Description: @PACKAGE_DESCRIPTION@
+Version: @VERSION@
+Requires: @PC_REQUIRED@
+Libs: -L${libdir} @PC_LDFLAGS@
+Cflags: -I${includedir}
+
--- /dev/null
+/*
+ * Copyright (c) 2011-2013 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 __TIZEN_LOCATOIN_POI_H__
+#define __TIZEN_LOCATOIN_POI_H__
+
+#include <tizen.h>
+#include <time.h>
+#include <location_bounds.h>
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#define POI_ERROR_CLASS TIZEN_ERROR_LOCATION_CLASS | 0x50
+
+/**
+ * @brief The POI service handle
+ * @ingroup CAPI_LOCATION_POI_MODULE
+ */
+typedef void * poi_service_h;
+
+/**
+ * @brief The POI preference handle
+ * @ingroup CAPI_LOCATION_POI_PREFERENCE_MODULE
+ */
+typedef void * poi_preference_h;
+
+/**
+ * @brief The POI filter handle
+ * @ingroup CAPI_LOCATION_POI_FILTER_MODULE
+ */
+typedef void * poi_filter_h;
+
+/**
+ * @brief The POI handle
+ * @ingroup CAPI_LOCATION_POI_POI_MODULE
+ */
+typedef void * poi_h;
+
+
+/**
+ * @brief Enumerations of sort order
+ * @ingroup CAPI_LOCATION_POI_PREFERENCE_MODULE
+ */
+typedef enum {
+ POI_SORTORDER_NONE, /**< None of sorting the results in order.*/
+ POI_SORTORDER_ASC, /**< A constant for sorting the results in ascending order */
+ POI_SORTORDER_DESC /**< A constant for sorting the results in descending order */
+} poi_sort_order_e;
+
+
+
+/**
+ * @brief Enumerations of error code for POI
+ * @ingroup CAPI_LOCATION_POI_MODULE
+ */
+typedef enum
+{
+ POI_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
+ POI_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
+ POI_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
+ POI_ERROR_NETWORK_FAILED = POI_ERROR_CLASS | 0x02, /**< Network unavailable*/
+ POI_ERROR_SERVICE_NOT_AVAILABLE = POI_ERROR_CLASS | 0x03, /**< Service unavailable */
+ POI_ERROR_INVALID_KEY = POI_ERROR_CLASS | 0x04, /**< Invalid key */
+ POI_ERROR_RESULT_NOT_FOUND = POI_ERROR_CLASS | 0x05, /**< Result not found */
+} poi_error_e;
+
+
+/**
+ * @brief The result of POI search
+ * @ingroup CAPI_LOCATION_POI_MODULE
+ * @remarks @a poi is valid only in this function. To use the @a poi outside this function, copy the handle with poi_clone() function.\nIf failed to search, lenght is 0 and poi is NULL
+ * @param [in] error The result of request
+ * @param [in] request_id The request id
+ * @param [in] index The index of POI data in result set, start from 0
+ * @param [in] length The number of result
+ * @param [in] poi The result data
+ * @param [in] uesr_data The user data passed from the request function
+ * @return @c true to continue with the next iteration of the loop, \n @c false to break outsp of the loop.
+ * @see poi_service_search_by_position()
+ * @see poi_service_search_by_area()
+ * @see poi_service_search_by_address()
+ */
+typedef bool (*poi_service_search_cb)(poi_error_e error, int request_id , int index, int length , poi_h poi , void * user_data);
+
+/**
+ * @brief Called once for each properties
+ * @ingroup CAPI_LOCATION_POI_PREFERENCE_MODULE
+ * @remarks @a key and value are valid only in this function.
+ * @param [in] key The key string
+ * @param [in] value The value string
+ * @param [in] uesr_data The user data passed from the foreach function
+ * @return @c true to continue with the next iteration of the loop, \n @c false to break outsp of the loop.
+ * @see poi_preference_foreach_properties()
+ */
+typedef bool (*poi_preference_properties_cb)(const char *key , const char *value, void *user_data);
+
+/**
+ * @brief Called once for each available keys
+ * @ingroup CAPI_LOCATION_POI_PREFERENCE_MODULE
+ * @remarks @a key is valid only in this function.
+ * @param [in] key The key string
+ * @param [in] uesr_data The user data passed from the foreach function
+ * @return @c true to continue with the next iteration of the loop, \n @c false to break outsp of the loop.
+ * @see poi_preference_foreach_available_keys()
+ */
+typedef bool (*poi_preference_available_key_cb)(const char *key , void *user_data);
+
+/**
+ * @brief Called once for each available values
+ * @ingroup CAPI_LOCATION_POI_PREFERENCE_MODULE
+ * @remarks @a value is valid only in this function.
+ * @param [in] value The value string
+ * @param [in] uesr_data The user data passed from the foreach function
+ * @return @c true to continue with the next iteration of the loop, \n @c false to break outsp of the loop.
+ * @see poi_preference_foreach_available_values()
+ */
+typedef bool (*poi_preference_available_value_cb)(const char *value , void *user_data);
+
+
+/**
+ * @brief Called once for each sortable field
+ * @ingroup CAPI_LOCATION_POI_PREFERENCE_MODULE
+ * @remarks @a field is valid only in this function.
+ * @param [in] field The field string
+ * @param [in] uesr_data The user data passed from the foreach function
+ * @return @c true to continue with the next iteration of the loop, \n @c false to break outsp of the loop.
+ * @see poi_preference_foreach_sortable_field()
+ */
+typedef bool (*poi_preference_sortable_field_cb)(const char *field , void *user_data);
+
+/**
+ * @brief Called once for each properties
+ * @ingroup CAPI_LOCATION_POI_FILTER_MODULE
+ * @remarks @a key and value are valid only in this function.
+ * @param [in] key The key string
+ * @param [in] value The value string
+ * @param [in] uesr_data The user data passed from the foreach function
+ * @return @c true to continue with the next iteration of the loop, \n @c false to break outsp of the loop.
+ * @see poi_filter_foreach_available_keys()
+ */
+typedef bool (*poi_filter_properties_cb)(const char *key , const char *value , void *user_data);
+
+
+/**
+ * @brief Called once for each available keys
+ * @ingroup CAPI_LOCATION_POI_FILTER_MODULE
+ * @remarks @a key is valid only in this function.
+ * @param [in] key The key string
+ * @param [in] uesr_data The user data passed from the foreach function
+ * @return @c true to continue with the next iteration of the loop, \n @c false to break outsp of the loop.
+ * @see poi_filter_foreach_available_keys()
+ */
+typedef bool (*poi_filter_available_key_cb)(const char *key , void *user_data);
+
+/**
+ * @brief Called once for each available values
+ * @ingroup CAPI_LOCATION_POI_FILTER_MODULE
+ * @remarks @a value is valid only in this function.
+ * @param [in] value The value string
+ * @param [in] uesr_data The user data passed from the foreach function
+ * @return @c true to continue with the next iteration of the loop, \n @c false to break outsp of the loop.
+ * @see poi_filter_foreach_available_values()
+ */
+typedef bool (*poi_filter_available_value_cb)(const char *value , void *user_data);
+
+
+/**
+ * @brief Called once for each urls
+ * @ingroup CAPI_LOCATION_POI_POI_MODULE
+ * @remarks @a url and description are valid only in this function.
+ * @param [in] url The url
+ * @param [in] description The description
+ * @param [in] uesr_data The user data passed from the foreach function
+ * @return @c true to continue with the next iteration of the loop, \n @c false to break outsp of the loop.
+ * @see poi_foreach_urls()
+ */
+typedef bool (*poi_urls_cb)(const char *url , const char *description, void *user_data);
+
+/**
+ * @brief Called once for each properties
+ * @ingroup CAPI_LOCATION_POI_POI_MODULE
+ * @remarks @a key and value are valid only in this function.
+ * @param [in] key The key of property
+ * @param [in] value The value of property
+ * @param [in] uesr_data The user data passed from the foreach function
+ * @return @c true to continue with the next iteration of the loop, \n @c false to break outsp of the loop.
+ * @see poi_foreach_properties()
+ */
+typedef bool (*poi_properties_cb)(const char *key, const char* value, void *user_data);
+
+/**
+ * @brief Called once for each categories
+ * @ingroup CAPI_LOCATION_POI_POI_MODULE
+ * @remarks @a category is valid only in this function.
+ * @param [in] category The category
+ * @param [in] uesr_data The user data passed from the foreach function
+ * @return @c true to continue with the next iteration of the loop, \n @c false to break outsp of the loop.
+ * @see poi_foreach_categories()
+ */
+typedef bool (*poi_categories_cb)(const char *category, void *user_data);
+
+
+
+/**
+ * @brief Creates a new POI service handle.
+ * @ingroup CAPI_LOCATION_POI_MODULE
+ * @remarks @a service must be released poi_service_destroy() by you.
+ * @param [out] service A handle of a new POI service handle on success
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #POI_ERROR_NONE Successful
+ * @retval #POI_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #POI_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #POI_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ * @see poi_service_destroy()
+ */
+int poi_service_create(poi_service_h *service);
+
+
+/**
+ * @brief Destroys the POI service handle and releases all its resources.
+ * @ingroup CAPI_LOCATION_POI_MODULE
+ * @param [in] service The POI service handle to destroy
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #POI_ERROR_NONE Successful
+ * @retval #POI_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see poi_service_create()
+ */
+int poi_service_destroy(poi_service_h service);
+
+/**
+ * @brief Gets POI preference
+ * @ingroup CAPI_LOCATION_POI_MODULE
+ * @remarks @a preference must be released poi_preference_destroy() by you.
+ * @param [in] service The POI service handle
+ * @param [out] preference The POI preference handle
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #POI_ERROR_NONE Successful
+ * @retval #POI_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see poi_service_set_preference()
+ */
+int poi_service_get_preference(poi_service_h service , poi_preference_h *preference);
+
+/**
+ * @brief Sets POI preference
+ * @ingroup CAPI_LOCATION_POI_MODULE
+ * @remarks @a preference handle is copied by frameworks
+ * @param [in] service The POI service handle
+ * @param [in] preference The POI preference handle
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #POI_ERROR_NONE Successful
+ * @retval #POI_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see poi_service_set_preference()
+ */
+int poi_service_set_preference(poi_service_h service , poi_preference_h preference);
+
+
+
+/**
+ * @brief Request a search
+ * @ingroup CAPI_LOCATION_POI_MODULE
+ * @param [in] service The POI service handle
+ * @param [in] position The interested position
+ * @param [in] distance The search area distance
+ * @param [in] filter The filter 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 #POI_ERROR_NONE Successful
+ * @retval #POI_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #POI_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #POI_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ * @see poi_service_search_by_area()
+ * @see poi_service_search_by_address()
+ * @see poi_service_search_cancel()
+ * @see poi_service_search_cb()
+ */
+int poi_service_search (poi_service_h service, location_coords_s position, int distance , poi_filter_h filter, poi_service_search_cb callback, void * user_data, int * request_id);
+
+/**
+ * @brief Request a search by area
+ * @ingroup CAPI_LOCATION_POI_MODULE
+ * @remarks boundary is supporting only circle type bounds for search.
+ * @param [in] service The POI service handle
+ * @param [in] boundary The interested area
+ * @param [in] filter The filter 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 #POI_ERROR_NONE Successful
+ * @retval #POI_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #POI_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #POI_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ * @see poi_service_search_by_position()
+ * @see poi_service_search_by_address()
+ * @see poi_service_search_cancel()
+ * @see poi_service_search_cb()
+ */
+int poi_service_search_by_area (poi_service_h service, location_bounds_h boundary , poi_filter_h filter, poi_service_search_cb callback, void * user_data, int * request_id);
+
+/**
+ * @brief Request a search by area
+ * @ingroup CAPI_LOCATION_POI_MODULE
+ * @param [in] service The POI service handle
+ * @param [in] address The interested address
+ * @param [in] distance The search area distance
+ * @param [in] filter The filter 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 #POI_ERROR_NONE Successful
+ * @retval #POI_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #POI_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #POI_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ * @see poi_service_search_by_area()
+ * @see poi_service_search_by_position()
+ * @see poi_service_search_cancel()
+ * @see poi_service_search_cb()
+ */
+int poi_service_search_by_address(poi_service_h service, const char* address, int distance, poi_filter_h filter, poi_service_search_cb callback, void * user_data, int * request_id);
+
+/**
+ * @brief Cancel the search request
+ * @ingroup CAPI_LOCATION_POI_MODULE
+ * @param [in] service The POI service handle
+ * @param [in] request_id The request id to cancel
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #POI_ERROR_NONE Successful
+ * @retval #POI_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre poi_service_search_by_area() or poi_service_search_by_position() or poi_service_search_by_address() should be called before.
+ * @see poi_service_search_by_area()
+ * @see poi_service_search_by_position()
+ * @see poi_service_search_by_address()
+ */
+int poi_service_cancel(poi_service_h service, int request_id);
+
+
+
+/**
+ * @brief Creates a new POI preference handle.
+ * @ingroup CAPI_LOCATION_POI_PREFERENCE_MODULE
+ * @remarks @a preference must be released poi_preference_destroy() by you.
+ * @param [out] preference A handle of a new POI preference handle on success
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #POI_ERROR_NONE Successful
+ * @retval #POI_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #POI_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see poi_preference_destroy()
+ */
+int poi_preference_create(poi_preference_h *preference );
+
+/**
+ * @brief Destroys the POI preference handle and releases all its resources.
+ * @ingroup CAPI_LOCATION_POI_PREFERENCE_MODULE
+ * @param [in] preference The POI preference handle to destroy
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #POI_ERROR_NONE Successful
+ * @retval #POI_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see poi_service_create()
+ */
+int poi_preference_destroy(poi_preference_h preference );
+
+/**
+ * @brief Gets the preference value
+ * @ingroup CAPI_LOCATION_POI_PREFERENCE_MODULE
+ *
+ * @param[in] preference The handle to the POI preference
+ * @param[in] key The key of preference
+ * @param[out] value The preference value
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #POI_ERROR_NONE Successful
+ * @retval #POI_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #POI_ERROR_INVALID_KEY Invalid key
+ *
+ * @see poi_preference_set()
+ */
+int poi_preference_get(poi_preference_h preference, const char *key, char **value);
+
+/**
+ * @brief Sets the preference value
+ * @ingroup CAPI_LOCATION_POI_PREFERENCE_MODULE
+ *
+ * @param[in] preference The handle to the POI preference
+ * @param[in] key The key of preference
+ * @param[in] value The preference value to set , could be NULL if want remove value
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #POI_ERROR_NONE Successful
+ * @retval #POI_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #POI_ERROR_INVALID_KEY Invalid key
+ *
+ * @see poi_preference_get()
+ */
+int poi_preference_set(poi_preference_h preference, const char *key, const char *value);
+
+/**
+ * @brief Sets the number of maximum result
+ * @ingroup CAPI_LOCATION_POI_PREFERENCE_MODULE
+ *
+ * @param[in] preference The handle to the POI preference
+ * @param[in] max_result The number of maximum result
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #POI_ERROR_NONE Successful
+ * @retval #POI_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see poi_preference_get_max_result()
+ */
+int poi_preference_set_max_result(poi_preference_h preference, int max_result);
+
+/**
+ * @brief Gets the number of maximum result
+ * @ingroup CAPI_LOCATION_POI_PREFERENCE_MODULE
+ *
+ * @param[in] preference The handle to the POI preference
+ * @param[out] max_result The number of maximum result
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #POI_ERROR_NONE Successful
+ * @retval #POI_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see poi_preference_set_max_result()
+ */
+int poi_preference_get_max_result(poi_preference_h preference, int* max_result);
+
+/**
+ * @brief Sets the sort option
+ * @ingroup CAPI_LOCATION_POI_PREFERENCE_MODULE
+ *
+ * @param[in] preference The handle to the POI preference
+ * @param[in] field The field name for sorting
+ * @param[in] order The sort order
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #POI_ERROR_NONE Successful
+ * @retval #POI_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see poi_preference_get_sort()
+ */
+int poi_preference_set_sort(poi_preference_h preference , const char* field , poi_sort_order_e order);
+
+/**
+ * @brief Gets the sort option
+ * @ingroup CAPI_LOCATION_POI_PREFERENCE_MODULE
+ *
+ * @remarks @a field must be released @c free() by you.
+ * @param[in] preference The handle to the POI preference
+ * @param[out] field The field name for sorting
+ * @param[out] order The sort order
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #POI_ERROR_NONE Successful
+ * @retval #POI_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see poi_preference_set_sort()
+ */
+int poi_preference_get_sort(poi_preference_h preference , char** field, poi_sort_order_e *order);
+
+/**
+ * @brief Retrieves all properties in preference
+ * @ingroup CAPI_LOCATION_POI_PREFERENCE_MODULE
+ *
+ * @param[in] preference The handle to the POI preference
+ * @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 #POI_ERROR_NONE Successful
+ * @retval #POI_ERROR_INVALID_PARAMETER Invalid parameter
+ * @post This function invokes poi_preference_properties_cb() repeatdly to retrieve each preference properties.
+ *
+ * @see poi_preference_properties_cb()
+ */
+int poi_preference_foreach_properties( poi_preference_h preference, poi_preference_properties_cb callback , void * user_data);
+
+/**
+ * @brief Retrieves all available preference keys
+ * @ingroup CAPI_LOCATION_POI_PREFERENCE_MODULE
+ *
+ * @param[in] service The POI service 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 #POI_ERROR_NONE Successful
+ * @retval #POI_ERROR_INVALID_PARAMETER Invalid parameter
+ * @post This function invokes poi_preference_available_key_cb() repeatdly to retrieve each available preference keys.
+ *
+ * @see poi_preference_available_key_cb()
+ */
+int poi_preference_foreach_available_keys( poi_service_h service, poi_preference_available_key_cb callback , void * user_data);
+
+/**
+ * @brief Retrieves all available preference values
+ * @ingroup CAPI_LOCATION_POI_PREFERENCE_MODULE
+ *
+ * @param[in] service The POI service handle
+ * @param[in] key The key string
+ * @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 #POI_ERROR_NONE Successful
+ * @retval #POI_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #POI_ERROR_INVALID_KEY Invalid key
+ * @post This function invokes poi_preference_available_value_cb() repeatdly to retrieve each available preference values.
+ *
+ * @see poi_preference_available_value_cb()
+ */
+int poi_preference_foreach_available_values( poi_service_h service, const char *key, poi_preference_available_value_cb callback , void * user_data);
+
+/**
+ * @brief Retrieves all sortable fields
+ * @ingroup CAPI_LOCATION_POI_PREFERENCE_MODULE
+ *
+ * @param[in] service The POI service 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 #POI_ERROR_NONE Successful
+ * @retval #POI_ERROR_INVALID_PARAMETER Invalid parameter
+ * @post This function invokes poi_preference_sortable_field_cb() repeatdly to retrieve each sortable fields.
+ *
+ * @see poi_preference_sortable_field_cb()
+ * @see poi_preference_set_sort()
+ * @see poi_preference_get_sort()
+ */
+int poi_preference_foreach_sortable_field( poi_service_h service , poi_preference_sortable_field_cb callback , void * user_data);
+
+
+/**
+ * @brief Creates a new POI filter handle.
+ * @ingroup CAPI_LOCATION_POI_FILTER_MODULE
+ * @remarks @a filter must be released poi_filter_destroy() by you.
+ * @param [out] filter A handle of a new POI filter handle on success
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #POI_ERROR_NONE Successful
+ * @retval #POI_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #POI_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see poi_filter_destroy()
+ */
+int poi_filter_create(poi_filter_h *filter);
+
+
+/**
+ * @brief Destroys the POI filter handle and releases all its resources.
+ * @ingroup CAPI_LOCATION_POI_FILTER_MODULE
+ * @param [in] filter The POI filter handle to destroy
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #POI_ERROR_NONE Successful
+ * @retval #POI_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see poi_filter_create()
+ */
+int poi_filter_destroy(poi_filter_h filter);
+
+/**
+ * @brief Sets the filter value
+ * @ingroup CAPI_LOCATION_POI_FILTER_MODULE
+ * @param [in] filter The handle to the POI 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 #POI_ERROR_NONE Successful
+ * @retval #POI_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see poi_filter_get()
+ * @see poi_filter_foreach_available_keys()
+ */
+int poi_filter_set(poi_filter_h filter, const char* key, const char* value);
+
+/**
+ * @brief Gets the filter value
+ * @ingroup CAPI_LOCATION_POI_FILTER_MODULE
+ * @remarks @a value must be released @c free() by you.
+ * @param [in] filter The handle to the POI filter
+ * @param [in] key The key of filter
+ * @param [out] value The filter value
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #POI_ERROR_NONE Successful
+ * @retval #POI_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see poi_filter_set()
+ * @see poi_filter_foreach_available_keys()
+ */
+int poi_filter_get(poi_filter_h filter, const char* key, char** value);
+
+/**
+ * @brief Retrieves all filter properties
+ * @ingroup CAPI_LOCATION_POI_FILTER_MODULE
+ *
+ * @param[in] filter The handle to the POI 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 #POI_ERROR_NONE Successful
+ * @retval #POI_ERROR_INVALID_PARAMETER Invalid parameter
+ * @post This function invokes poi_filter_available_key_cb() repeatdly to retrieve each available filter keys.
+ *
+ * @see poi_filter_properties_cb()
+ * @see poi_filter_get()
+ * @see poi_filter_set()
+ */
+int poi_filter_foreach_properties(poi_filter_h filter, poi_filter_properties_cb callback , void * user_data);
+
+/**
+ * @brief Retrieves all available filter keys
+ * @ingroup CAPI_LOCATION_POI_FILTER_MODULE
+ *
+ * @param[in] service The POI service 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 #POI_ERROR_NONE Successful
+ * @retval #POI_ERROR_INVALID_PARAMETER Invalid parameter
+ * @post This function invokes poi_filter_available_key_cb() repeatdly to retrieve each available filter keys.
+ *
+ * @see poi_preference_available_key_cb()
+ * @see poi_filter_get()
+ * @see poi_filter_set()
+ */
+int poi_filter_foreach_available_keys( poi_service_h service, poi_filter_available_key_cb callback , void * user_data);
+
+/**
+ * @brief Retrieves all available filter values
+ * @ingroup CAPI_LOCATION_POI_FILTER_MODULE
+ *
+ * @param[in] service The POI service handle
+ * @param[in] key The key string
+ * @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 #POI_ERROR_NONE Successful
+ * @retval #POI_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #POI_ERROR_INVALID_KEY Invalid key
+ * @post This function invokes poi_filter_available_value_cb() repeatdly to retrieve each available filter values.
+ *
+ * @see poi_filter_available_value_cb()
+ * @see poi_filter_get()
+ * @see poi_filter_set()
+ */
+int poi_filter_foreach_available_values( poi_service_h service, const char *key, poi_filter_available_value_cb callback , void * user_data);
+
+
+/**
+ * @brief Creates a new POI handle.
+ * @ingroup CAPI_LOCATION_POI_POI_MODULE
+ * @remarks @a poi must be released poi_destroy() by you.
+ * @param [out] poi A handle of a new POI handle on success
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #POI_ERROR_NONE Successful
+ * @retval #POI_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #POI_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see poi_destroy()
+ * @see poi_clone()
+ */
+int poi_create(poi_h *poi);
+
+/**
+ * @brief Destroys the POI handle and releases all its resources.
+ * @ingroup CAPI_LOCATION_POI_POI_MODULE
+ * @param [in] poi The POI handle to destroy
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #POI_ERROR_NONE Successful
+ * @retval #POI_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see poi_create()
+ * @see poi_clone()
+ */
+int poi_destroy(poi_h poi);
+
+/**
+ * @brief Clones the POI handle
+ * @ingroup CAPI_LOCATION_POI_POI_MODULE
+ * @remarks @a cloned must be released poi_destroy() by you.
+ * @param [out] cloned A cloned POI handle
+ * @param [in] origin The original POI handle
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #POI_ERROR_NONE Successful
+ * @retval #POI_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #POI_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see poi_create()
+ * @see poi_destroy()
+ */
+int poi_clone(poi_h* cloned, poi_h origin);
+
+/**
+ * @brief Gets the POI id
+ * @ingroup CAPI_LOCATION_POI_POI_MODULE
+ * @param [in] poi The handle to POI
+ * @param [out] id The POI id
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #POI_ERROR_NONE Successful
+ * @retval #POI_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int poi_get_id(poi_h poi, int *id);
+
+/**
+ * @brief Gets the POI name
+ * @ingroup CAPI_LOCATION_POI_POI_MODULE
+ * @remarks @a name must be released with @c free() by you.
+ * @param [in] poi The handle to POI
+ * @param [out] name The POI name
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #POI_ERROR_NONE Successful
+ * @retval #POI_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int poi_get_name(poi_h poi, char **name);
+
+/**
+ * @brief Gets the POI position
+ * @ingroup CAPI_LOCATION_POI_POI_MODULE
+ * @param [in] poi The handle to POI
+ * @param [out] position The POI position
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #POI_ERROR_NONE Successful
+ * @retval #POI_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int poi_get_position(poi_h poi, location_coords_s *position);
+
+/**
+ * @brief Gets the POI address
+ * @ingroup CAPI_LOCATION_POI_POI_MODULE
+ * @remarks All output values must be released with @c free() by you.
+ * @param [in] poi The handle to POI
+ * @param [out] building_number The building number
+ * @param [out] postal_code The postal delivery code
+ * @param [out] street The full street name
+ * @param [out] city The city name
+ * @param [out] district The municipal district name
+ * @param [out] state The state or province region of a nation
+ * @param [out] country_code The country code
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #POI_ERROR_NONE Successful
+ * @retval #POI_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int poi_get_address(poi_h poi, char **building_number, char **postal_code, char **street, char **city, char **district, char **state, char **country_code);
+
+/**
+ * @brief Gets the POI description
+ * @ingroup CAPI_LOCATION_POI_POI_MODULE
+ * @remarks @a description must be released with @c free() by you.
+ * @param [in] poi The handle to POI
+ * @param [out] description The POI description
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #POI_ERROR_NONE Successful
+ * @retval #POI_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int poi_get_description(poi_h poi, char** description);
+
+/**
+ * @brief Gets the POI timestamp
+ * @ingroup CAPI_LOCATION_POI_POI_MODULE
+ * @param [in] poi The handle to POI
+ * @param [out] timestamp The POI timestamp
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #POI_ERROR_NONE Successful
+ * @retval #POI_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int poi_get_timestamp(poi_h poi , time_t *timestamp);
+
+/**
+ * @brief Gets the POI bounding rect
+ * @ingroup CAPI_LOCATION_POI_POI_MODULE
+ * @param [in] poi The handle to POI
+ * @param [out] top_left The top left position
+ * @param [out] bottom_right The bottom right position
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #POI_ERROR_NONE Successful
+ * @retval #POI_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int poi_get_bounding_rect(poi_h poi , location_coords_s *top_left, location_coords_s *bottom_right);
+
+/**
+ * @brief Gets the POI author
+ * @ingroup CAPI_LOCATION_POI_POI_MODULE
+ * @remarks @a author must be released with @c free() by you.
+ * @param [in] poi The handle to POI
+ * @param [out] author The POI author
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #POI_ERROR_NONE Successful
+ * @retval #POI_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int poi_get_author(poi_h poi , char** author);
+
+/**
+ * @brief Gets the POI phone number
+ * @ingroup CAPI_LOCATION_POI_POI_MODULE
+ * @remarks @a phone_number must be released with @c free() by you.
+ * @param [in] poi The handle to POI
+ * @param [out] phone_number The POI phone number
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #POI_ERROR_NONE Successful
+ * @retval #POI_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int poi_get_phone_number(poi_h poi , char **phone_number);
+
+/**
+ * @brief Retrieves all urls
+ * @ingroup CAPI_LOCATION_POI_POI_MODULE
+ * @param [in] poi The handle to POI
+ * @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 #POI_ERROR_NONE Successful
+ * @retval #POI_ERROR_INVALID_PARAMETER Invalid parameter
+ * @post This function invokes poi_urls_cb() repeatdly to retrieve each urls.
+ * @see poi_urls_cb()
+ */
+int poi_foreach_urls(poi_h poi, poi_urls_cb callback , void * user_data);
+
+/**
+ * @brief Retrieves all properties
+ * @ingroup CAPI_LOCATION_POI_POI_MODULE
+ * @param [in] poi The handle to POI
+ * @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 #POI_ERROR_NONE Successful
+ * @retval #POI_ERROR_INVALID_PARAMETER Invalid parameter
+ * @post This function invokes poi_properties_cb() repeatdly to retrieve each properties.
+ * @see poi_properties_cb()
+ */
+int poi_foreach_properties(poi_h poi, poi_properties_cb callback, void * user_data);
+
+/**
+ * @brief Retrieves all categories
+ * @ingroup CAPI_LOCATION_POI_POI_MODULE
+ * @param [in] poi The handle to POI
+ * @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 #POI_ERROR_NONE Successful
+ * @retval #POI_ERROR_INVALID_PARAMETER Invalid parameter
+ * @post This function invokes poi_categories_cb() repeatdly to retrieve each categories.
+ * @see poi_categories_cb()
+ */
+int poi_foreach_categories(poi_h poi , poi_categories_cb callback , void * user_data);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIZEN_LOCATION_POI_H__ */
+
--- /dev/null
+/*
+ * Copyright (c) 2011-2013 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 __TIZEN_LOCATION_POI_PRIVATE_H__
+#define __TIZEN_LOCATION_POI_PRIVATE_H__
+
+#include <location/location.h>
+#include <poi.h>
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "CAPI_LOCATION_POI"
+
+#define POI_LOGD(fmt,args...) LOGD(fmt, ##args)
+#define POI_LOGW(fmt,args...) LOGW(fmt, ##args)
+#define POI_LOGI(fmt,args...) LOGI(fmt, ##args)
+#define POI_LOGE(fmt,args...) LOGE(fmt, ##args)
+
+#define POI_CHECK_CONDITION(condition, error, msg) \
+ do { \
+ if( !(condition) ){ \
+ POI_LOGE("%s(0x%08x)", msg, error); \
+ return error; \
+ } \
+ } while (0)
+
+#define POI_PRINT_ERROR_CODE_RETURN(code) \
+ do{ \
+ POI_LOGE("%s(0x%08x)", #code, code); \
+ return code; \
+ } while (0)
+
+
+#define POI_NULL_ARG_CHECK(arg) \
+ POI_CHECK_CONDITION( (arg !=NULL),POI_ERROR_INVALID_PARAMETER,"POI_ERROR_INVALID_PARAMETER")
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+typedef struct _poi_service_s{
+ LocationMapObject* object;
+ poi_preference_h preference;
+
+} poi_service_s;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //__TIZEN_LOCATION_POI_PRIVATE_H__
+
--- /dev/null
+Name: capi-location-poi
+Summary: A Location POI library in Tizen Native API
+Version: 0.1.3
+Release: 1
+Group: System/Libraries
+License: Apache Licensc, Version 2.0
+Source0: %{name}-%{version}.tar.gz
+BuildRequires: cmake
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(location)
+BuildRequires: pkgconfig(capi-base-common)
+BuildRequires: pkgconfig(capi-location-manager)
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
+
+%description
+
+
+%package devel
+Summary: A Location POI library in Tizen Native API (Development)
+Group: TO_BE/FILLED_IN
+Requires: %{name} = %{version}-%{release}
+
+%description devel
+
+
+
+%prep
+%setup -q
+
+
+%build
+MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
+cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
+
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+
+%files
+%manifest capi-location-poi.manifest
+%{_libdir}/libcapi-location-poi.so.*
+
+%files devel
+%{_includedir}/location/*.h
+%{_libdir}/pkgconfig/*.pc
+%{_libdir}/libcapi-location-poi.so
+
--- /dev/null
+/*
+ * Copyright (c) 2011-2013 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 <location/location.h>
+#include <location/location-map-service.h>
+#include <poi.h>
+#include <poi_private.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+typedef struct {
+ void *data;
+ poi_service_search_cb callback;
+}__callback_data;
+
+/*
+* Internal Implementation
+*/
+static int _convert_error_code(int code)
+{
+ int ret;
+ char* msg = "POI_ERROR_NONE";
+ switch(code)
+ {
+ case LOCATION_ERROR_NONE:
+ ret = POI_ERROR_NONE;
+ msg = "POI_ERROR_NONE";
+ break;
+ case LOCATION_ERROR_NETWORK_FAILED:
+ case LOCATION_ERROR_NETWORK_NOT_CONNECTED:
+ ret = POI_ERROR_NETWORK_FAILED;
+ msg = "POI_ERROR_NETWORK_FAILED";
+ break;
+ case LOCATION_ERROR_PARAMETER:
+ ret = POI_ERROR_INVALID_PARAMETER;
+ msg = "POI_ERROR_INVALID_PARAMETER";
+ break;
+ case LOCATION_ERROR_NOT_FOUND:
+ ret = POI_ERROR_RESULT_NOT_FOUND;
+ msg = "POI_ERROR_RESULT_NOT_FOUND";
+ break;
+ case LOCATION_ERROR_NOT_ALLOWED:
+ case LOCATION_ERROR_NOT_AVAILABLE:
+ case LOCATION_ERROR_CONFIGURATION:
+ case LOCATION_ERROR_UNKNOWN:
+ default:
+ msg = "POI_ERROR_SERVICE_NOT_AVAILABLE";
+ ret = POI_ERROR_SERVICE_NOT_AVAILABLE;
+ }
+ POI_LOGE("%s(0x%08x) : core fw error(0x%x)", msg, ret, code);
+ return ret;
+}
+
+static void __LocationPOICB(LocationError error, guint req_id, GList * landmark_list, gchar * error_code, gchar * error_msg, gpointer userdata)
+{
+ __callback_data * callback = (__callback_data*)userdata;
+ if( callback == NULL || callback->callback == NULL)
+ return ;
+
+ int ret = _convert_error_code(error);
+ GList *mark_list = landmark_list;
+ int length = 0;
+ int index = 0;
+
+ if( mark_list == NULL || ret != 0){
+ callback->callback(ret , req_id, index, length, NULL, callback->data);
+ free(callback);
+ return;
+ }
+
+ length = g_list_length(mark_list);
+ while( mark_list) {
+ LocationLandmark *mark = mark_list->data;
+ if( callback->callback(ret, req_id, index++, length, mark, callback->data) == false )
+ break;
+ mark_list = mark_list->next;
+ }
+
+ free(callback);
+
+}
+
+
+
+int poi_service_create( poi_service_h *poi)
+{
+ if( poi == NULL)
+ POI_PRINT_ERROR_CODE_RETURN(POI_ERROR_INVALID_PARAMETER);
+
+ if( location_init() != LOCATION_ERROR_NONE )
+ {
+ POI_LOGE("POI_ERROR_SERVICE_NOT_AVAILABLE(0x%08x) : fail to location_init", POI_ERROR_SERVICE_NOT_AVAILABLE);
+ return POI_ERROR_SERVICE_NOT_AVAILABLE;
+ }
+
+ poi_service_s *handle = (poi_service_s*)malloc(sizeof(poi_service_s));
+ if( handle == NULL)
+ POI_PRINT_ERROR_CODE_RETURN(POI_ERROR_OUT_OF_MEMORY);
+
+ memset(handle, 0 , sizeof(poi_service_s));
+
+ if( POI_ERROR_NONE != poi_preference_create(&handle->preference ) ){
+ free(handle);
+ POI_PRINT_ERROR_CODE_RETURN(POI_ERROR_OUT_OF_MEMORY);
+ }
+
+ handle->object = location_map_new(NULL);
+ if(handle->object == NULL)
+ {
+ free(handle);
+ POI_LOGE("POI_ERROR_SERVICE_NOT_AVAILABLE(0x%08x) : fail to location_map_new", POI_ERROR_SERVICE_NOT_AVAILABLE);
+ return POI_ERROR_SERVICE_NOT_AVAILABLE;
+ }
+
+ *poi = (poi_service_h)handle;
+ return POI_ERROR_NONE;
+}
+
+
+int poi_service_destroy(poi_service_h poi)
+{
+ if( poi == NULL)
+ POI_PRINT_ERROR_CODE_RETURN(POI_ERROR_INVALID_PARAMETER);
+
+ poi_service_s *handle = (poi_service_s*)poi;
+
+ if( handle->preference ){
+ poi_preference_destroy(handle->preference);
+ handle->preference = NULL;
+ }
+
+ int ret = location_map_free(handle->object);
+ if(ret!= POI_ERROR_NONE)
+ {
+ return _convert_error_code(ret);
+ }
+ free(handle);
+ return POI_ERROR_NONE;
+
+}
+
+int poi_service_set_preference(poi_service_h poi , poi_preference_h preference)
+{
+ POI_NULL_ARG_CHECK(poi);
+ POI_NULL_ARG_CHECK(preference);
+
+ poi_service_s *handle = (poi_service_s*)poi;
+
+ if( handle->preference ){
+ poi_preference_destroy(handle->preference);
+ handle->preference = (poi_preference_h)location_poi_pref_copy((LocationPOIPreference*)preference);
+ }
+ return POI_ERROR_NONE;
+}
+
+int poi_service_get_preference(poi_service_h poi , poi_preference_h *preference)
+{
+ POI_NULL_ARG_CHECK(poi);
+ POI_NULL_ARG_CHECK(preference);
+ poi_service_s *handle = (poi_service_s*)poi;
+
+ if( handle->preference == NULL ){
+ poi_preference_create(&handle->preference );
+ }
+ *preference = (poi_preference_h)location_poi_pref_copy((LocationPOIPreference*)handle->preference);
+ return POI_ERROR_NONE;
+}
+
+int poi_service_search(poi_service_h poi, location_coords_s position, int distance , poi_filter_h filter, poi_service_search_cb callback, void * user_data, int * request_id)
+{
+ POI_NULL_ARG_CHECK(poi);
+ POI_NULL_ARG_CHECK(callback);
+ POI_CHECK_CONDITION(distance >= 0 , POI_ERROR_INVALID_PARAMETER, "distance value is negative");
+ POI_CHECK_CONDITION(position.latitude>=-90 && position.latitude<=90 ,POI_ERROR_INVALID_PARAMETER,"latitude should be -90 <= latitude <= 90");
+ POI_CHECK_CONDITION(position.longitude>=-180 && position.longitude<=180,POI_ERROR_INVALID_PARAMETER,"longitude should be -180 <= latitude <= 180");
+
+
+ LocationPosition pos;
+ unsigned int reqid;
+ int ret;
+
+ poi_service_s *handle = (poi_service_s*)poi;
+ pos.latitude = position.latitude;
+ pos.longitude = position.longitude;
+ pos.altitude = 0;
+ pos.status = LOCATION_STATUS_2D_FIX;
+
+
+ __callback_data * calldata = (__callback_data *)malloc(sizeof(__callback_data));
+ if( calldata == NULL)
+ POI_PRINT_ERROR_CODE_RETURN(POI_ERROR_OUT_OF_MEMORY);
+
+ calldata->callback = callback;
+ calldata->data = user_data;
+
+ if( distance != 0 ){
+ char distance_str[255];
+ snprintf(distance_str, 255, "%d", distance);
+ poi_preference_set(handle->preference, "Distance", distance_str);
+ }else{
+ poi_preference_set(handle->preference, "Distance", NULL);
+ }
+
+
+ ret = location_map_search_poi (handle->object , (LocationPOIFilter*)filter , &pos, (LocationPOIPreference *)handle->preference, __LocationPOICB, calldata, &reqid);
+ if( ret != 0 ){
+ free(calldata);
+ return _convert_error_code(ret);
+ }
+
+ if( request_id )
+ *request_id = reqid;
+ return POI_ERROR_NONE;
+
+}
+
+
+int poi_service_search_by_area (poi_service_h poi, location_bounds_h boundary , poi_filter_h filter, poi_service_search_cb callback, void * user_data, int * request_id)
+{
+ POI_NULL_ARG_CHECK(poi);
+ POI_NULL_ARG_CHECK(callback);
+ POI_NULL_ARG_CHECK(boundary);
+
+ unsigned int reqid;
+ int ret;
+ poi_service_s *handle = (poi_service_s*)poi;
+ location_bounds_type_e bound_type;
+ location_bounds_get_type(boundary, &bound_type);
+
+ if( bound_type == LOCATION_BOUNDS_RECT ){
+ if( !location_map_is_supported_provider_capability(handle->object , MAP_SERVICE_POI_SEARCH_BY_RECT_BOUNDARY) )
+ return POI_ERROR_SERVICE_NOT_AVAILABLE;
+ }else if(bound_type == LOCATION_BOUNDS_CIRCLE){
+ if( !location_map_is_supported_provider_capability(handle->object , MAP_SERVICE_POI_SEARCH_BY_CIRCLE_BOUNDARY) )
+ return POI_ERROR_SERVICE_NOT_AVAILABLE;
+ }else if(bound_type == LOCATION_BOUNDS_POLYGON){
+ if( !location_map_is_supported_provider_capability(handle->object , MAP_SERVICE_POI_SEARCH_BY_POLYGON_BOUNDARY) )
+ return POI_ERROR_SERVICE_NOT_AVAILABLE;
+ }
+
+ __callback_data * calldata = (__callback_data *)malloc(sizeof(__callback_data));
+ if( calldata == NULL)
+ POI_PRINT_ERROR_CODE_RETURN(POI_ERROR_OUT_OF_MEMORY);
+
+ calldata->callback = callback;
+ calldata->data = user_data;
+
+ poi_preference_set(handle->preference, "Distance", NULL);
+
+ ret = location_map_search_poi_by_area (handle->object , (LocationPOIFilter*)filter , (LocationBoundary *)boundary, (LocationPOIPreference *)handle->preference, __LocationPOICB, calldata, &reqid);
+ if( ret != 0 ){
+ free(calldata);
+ return _convert_error_code(ret);
+ }
+
+ if( request_id )
+ *request_id = reqid;
+ return POI_ERROR_NONE;
+
+}
+
+int poi_service_search_by_address(poi_service_h poi, const char* address, int distance, poi_filter_h filter, poi_service_search_cb callback, void * user_data, int * request_id)
+{
+ POI_NULL_ARG_CHECK(poi);
+ POI_NULL_ARG_CHECK(callback);
+ POI_CHECK_CONDITION(distance >= 0 , POI_ERROR_INVALID_PARAMETER, "distance value is negative");
+
+
+ unsigned int reqid;
+ int ret;
+ poi_service_s *handle = (poi_service_s*)poi;
+
+ __callback_data * calldata = (__callback_data *)malloc(sizeof(__callback_data));
+ if( calldata == NULL)
+ POI_PRINT_ERROR_CODE_RETURN(POI_ERROR_OUT_OF_MEMORY);
+
+ calldata->callback = callback;
+ calldata->data = user_data;
+
+ if( distance != 0 ){
+ char distance_str[255];
+ snprintf(distance_str, 255, "%d", distance);
+ poi_preference_set(handle->preference, "Distance", distance_str);
+ }else{
+ poi_preference_set(handle->preference, "Distance", NULL);
+ }
+
+ ret = location_map_search_poi_by_freeformed_address (handle->object , (LocationPOIFilter*)filter , address, (LocationPOIPreference *)handle->preference, __LocationPOICB, calldata, &reqid);
+
+ if( ret != 0 ){
+ free(calldata);
+ return _convert_error_code(ret);
+ }
+
+ if( request_id )
+ *request_id = reqid;
+ return POI_ERROR_NONE;
+
+}
+
+int poi_service_cancel(poi_service_h service, int request_id)
+{
+ POI_NULL_ARG_CHECK(service);
+
+ poi_service_s *handle = (poi_service_s*)service;
+ return _convert_error_code(location_map_cancel_poi_request(handle->object, request_id));
+}
+
+int poi_filter_create(poi_filter_h *filter)
+{
+ POI_NULL_ARG_CHECK(filter);
+
+ LocationPOIFilter *native_filter = location_poi_filter_new();
+ POI_CHECK_CONDITION( (native_filter != NULL) , POI_ERROR_OUT_OF_MEMORY, "POI_ERROR_OUT_OF_MEMORY");
+ *filter = (void*)native_filter;
+ return POI_ERROR_NONE;
+}
+int poi_filter_destroy(poi_filter_h filter)
+{
+ POI_NULL_ARG_CHECK(filter);
+ location_poi_filter_free((LocationPOIFilter*)filter);
+ return POI_ERROR_NONE;
+}
+int poi_filter_set(poi_filter_h filter, const char* key, const char* value)
+{
+ POI_NULL_ARG_CHECK(filter);
+ POI_NULL_ARG_CHECK(key);
+ int ret = location_poi_filter_set((LocationPOIFilter*)filter , key, value);
+ if( !ret )
+ return POI_ERROR_INVALID_KEY;
+ return POI_ERROR_NONE;
+}
+int poi_filter_get(poi_filter_h filter, const char* key, char** value)
+{
+ POI_NULL_ARG_CHECK(filter);
+ POI_NULL_ARG_CHECK(key);
+ POI_NULL_ARG_CHECK(value);
+ char *v = (char*)location_poi_filter_get((LocationPOIFilter*)filter, key);
+ if ( v == NULL )
+ POI_PRINT_ERROR_CODE_RETURN(POI_ERROR_INVALID_KEY);
+
+ *value = strdup(v);
+ return POI_ERROR_NONE;
+}
+
+int poi_filter_foreach_properties(poi_filter_h filter, poi_filter_properties_cb callback , void * user_data)
+{
+ POI_NULL_ARG_CHECK(filter);
+ POI_NULL_ARG_CHECK(callback);
+
+ GList *keys = location_poi_filter_get_key((LocationPOIFilter*)filter);
+ while(keys){
+ char *key = keys->data;
+ char *value = location_poi_filter_get((LocationPOIFilter*)filter, key);
+ if(!callback(key,value, user_data))
+ break;
+ keys = keys->next;
+ }
+ g_list_free(keys);
+ return POI_ERROR_NONE;
+}
+
+int poi_filter_foreach_available_keys( poi_service_h poi, poi_filter_available_key_cb callback , void * user_data)
+{
+ POI_NULL_ARG_CHECK(poi);
+ POI_NULL_ARG_CHECK(callback);
+
+ poi_service_s *handle = (poi_service_s*)poi;
+
+ GList *keys=NULL;
+ location_map_get_provider_capability_key(handle->object, MAP_SERVICE_POI_FILTER, &keys);
+ if( keys == NULL )
+ return POI_ERROR_RESULT_NOT_FOUND;
+
+ while(keys){
+ char *key = keys->data;
+ if( !callback(key,user_data) )
+ break;
+ keys = keys->next;
+ }
+ g_list_free_full (keys, g_free);
+ return POI_ERROR_NONE;
+}
+
+int poi_filter_foreach_available_values( poi_service_h poi, const char *key, poi_filter_available_value_cb callback , void * user_data)
+{
+ //TODO.
+ // Available category
+ return POI_ERROR_RESULT_NOT_FOUND;
+}
+
+int poi_preference_create(poi_preference_h *preference )
+{
+ POI_NULL_ARG_CHECK(preference);
+ LocationPOIPreference *pref;
+ pref = location_poi_pref_new();
+ if( pref == NULL)
+ POI_PRINT_ERROR_CODE_RETURN(POI_ERROR_OUT_OF_MEMORY);
+ *preference = pref;
+
+ return POI_ERROR_NONE;
+}
+
+int poi_preference_destroy(poi_preference_h preference )
+{
+ POI_NULL_ARG_CHECK(preference);
+ location_poi_pref_free((LocationPOIPreference*)preference);
+ return POI_ERROR_NONE;
+}
+
+int poi_preference_foreach_properties( poi_preference_h preference, poi_preference_properties_cb callback , void * user_data)
+{
+ POI_NULL_ARG_CHECK(preference);
+ POI_NULL_ARG_CHECK(callback);
+
+ GList *keys = location_poi_pref_get_property_key((LocationPOIPreference*)preference);
+ while(keys){
+ char *key = keys->data;
+ char *value = location_poi_pref_get_property((LocationPOIPreference*)preference, key);
+ if(!callback(key,value, user_data))
+ break;
+ keys = keys->next;
+ }
+ g_list_free(keys);
+ return POI_ERROR_NONE;
+}
+
+int poi_preference_foreach_available_keys( poi_service_h poi, poi_preference_available_key_cb callback , void * user_data)
+{
+ POI_NULL_ARG_CHECK(poi);
+ POI_NULL_ARG_CHECK(callback);
+
+ poi_service_s *handle = (poi_service_s*)poi;
+
+ GList *keys=NULL;
+ location_map_get_provider_capability_key(handle->object, MAP_SERVICE_POI_PREF_PROPERTY, &keys);
+ if( keys == NULL )
+ return POI_ERROR_RESULT_NOT_FOUND;
+
+ while(keys){
+ char *key = keys->data;
+ if( !callback(key,user_data) )
+ break;
+ keys = keys->next;
+ }
+ g_list_free_full (keys, g_free);
+ return POI_ERROR_NONE;
+}
+
+int poi_preference_foreach_available_values( poi_service_h poi, const char *key, poi_preference_available_value_cb callback , void * user_data)
+{
+ //TODO. impl..
+ // Availiable LandmarkType
+ // Availiable LandmarkName
+ return POI_ERROR_RESULT_NOT_FOUND;
+}
+
+int poi_preference_get(poi_preference_h preference, const char *key, char **value)
+{
+ POI_NULL_ARG_CHECK(preference);
+ POI_NULL_ARG_CHECK(key);
+ POI_NULL_ARG_CHECK(value);
+ char *v = (char*)location_poi_pref_get_property((LocationPOIPreference*)preference, key);
+ if( v == NULL )
+ POI_PRINT_ERROR_CODE_RETURN(POI_ERROR_INVALID_KEY);
+ *value = strdup(v);
+ return POI_ERROR_NONE;
+}
+
+int poi_preference_set(poi_preference_h preference, const char *key, const char *value)
+{
+ POI_NULL_ARG_CHECK(preference);
+ POI_NULL_ARG_CHECK(key);
+
+ int ret = location_poi_pref_set_property((LocationPOIPreference*)preference,key, value);
+ if( !ret )
+ POI_PRINT_ERROR_CODE_RETURN(POI_ERROR_INVALID_KEY);
+ return POI_ERROR_NONE;
+}
+
+int poi_preference_set_max_result(poi_preference_h preference, int max_result)
+{
+ POI_NULL_ARG_CHECK(preference);
+ int ret = location_poi_pref_set_max_result((LocationPOIPreference*)preference, max_result);
+ if( !ret )
+ POI_PRINT_ERROR_CODE_RETURN(POI_ERROR_INVALID_PARAMETER);
+ return POI_ERROR_NONE;
+}
+
+int poi_preference_get_max_result(poi_preference_h preference, int* max_result)
+{
+ POI_NULL_ARG_CHECK(preference);
+ POI_NULL_ARG_CHECK(max_result);
+ int ret = location_poi_pref_get_max_result((LocationPOIPreference*)preference );
+ if( ret == 0 )
+ POI_PRINT_ERROR_CODE_RETURN(POI_ERROR_INVALID_PARAMETER);
+ *max_result = ret;
+ return POI_ERROR_NONE;
+}
+
+
+int poi_preference_foreach_sortable_field( poi_service_h poi, poi_preference_sortable_field_cb callback , void * user_data)
+{
+ POI_NULL_ARG_CHECK(poi);
+ POI_NULL_ARG_CHECK(callback);
+
+ poi_service_s *handle = (poi_service_s*)poi;
+
+ GList *keys=NULL;
+ location_map_get_provider_capability_key(handle->object, MAP_SERVICE_POI_PREF_SORT_BY, &keys);
+ if( keys == NULL )
+ return POI_ERROR_RESULT_NOT_FOUND;
+
+ while(keys){
+ char *key = keys->data;
+ if( !callback(key,user_data) )
+ break;
+ keys = keys->next;
+ }
+ g_list_free_full (keys, g_free);
+ return POI_ERROR_NONE;
+}
+
+int poi_preference_set_sort(poi_preference_h preference , const char* field , poi_sort_order_e order)
+{
+ POI_NULL_ARG_CHECK(preference);
+ POI_NULL_ARG_CHECK(field);
+ int ret = location_poi_pref_set_sort_by((LocationPOIPreference*)preference, field);
+ if( !ret )
+ POI_PRINT_ERROR_CODE_RETURN(POI_ERROR_INVALID_PARAMETER);
+ ret = location_poi_pref_set_sort_order ((LocationPOIPreference*)preference , order);
+ if( !ret )
+ POI_PRINT_ERROR_CODE_RETURN(POI_ERROR_INVALID_PARAMETER);
+
+ return POI_ERROR_NONE;
+}
+
+int poi_preference_get_sort(poi_preference_h preference , char** field, poi_sort_order_e *order)
+{
+ POI_NULL_ARG_CHECK(preference);
+ POI_NULL_ARG_CHECK(field);
+ POI_NULL_ARG_CHECK(order);
+ char *sort_by = (char*)location_poi_pref_get_sort_by((LocationPOIPreference*)preference);
+ if( sort_by )
+ *field = strdup(sort_by);
+ else
+ *field = NULL;
+
+ *order = location_poi_pref_get_sort_order((LocationPOIPreference*)preference);
+ return POI_ERROR_NONE;
+}
+
+int poi_create(poi_h *poi)
+{
+ POI_NULL_ARG_CHECK(poi);
+ LocationLandmark* landmark = location_landmark_new();
+ if( landmark == NULL)
+ POI_PRINT_ERROR_CODE_RETURN(POI_ERROR_OUT_OF_MEMORY);
+
+ *poi = landmark;
+ return POI_ERROR_NONE;
+}
+
+int poi_destroy(poi_h poi)
+{
+ POI_NULL_ARG_CHECK(poi);
+ location_landmark_free((LocationLandmark*)poi);
+ return POI_ERROR_NONE;
+}
+
+int poi_clone(poi_h* cloned, poi_h origin)
+{
+ POI_NULL_ARG_CHECK(cloned);
+ POI_NULL_ARG_CHECK(origin);
+
+ LocationLandmark * landmark = location_landmark_copy ((LocationLandmark*)origin);
+ if( landmark == NULL)
+ POI_PRINT_ERROR_CODE_RETURN(POI_ERROR_OUT_OF_MEMORY);
+ *cloned = landmark;
+ return POI_ERROR_NONE;
+}
+
+int poi_get_id(poi_h poi, int *id)
+{
+ POI_NULL_ARG_CHECK(poi);
+ POI_NULL_ARG_CHECK(id);
+ *id = location_landmark_get_id((LocationLandmark*)poi);
+ return POI_ERROR_NONE;
+}
+
+int poi_get_name(poi_h poi, char **name)
+{
+ POI_NULL_ARG_CHECK(poi);
+ POI_NULL_ARG_CHECK(name);
+ char *poi_name = (char*)location_landmark_get_name((LocationLandmark*)poi);
+ if( poi_name == NULL)
+ *name = NULL;
+ else
+ *name = strdup(poi_name);
+ return POI_ERROR_NONE;
+}
+
+int poi_get_position(poi_h poi, location_coords_s *position)
+{
+ POI_NULL_ARG_CHECK(poi);
+ POI_NULL_ARG_CHECK(position);
+ const LocationPosition *pos = location_landmark_get_position((LocationLandmark*)poi);
+ if( pos == NULL)
+ POI_PRINT_ERROR_CODE_RETURN(POI_ERROR_INVALID_PARAMETER);
+
+ position->latitude = pos->latitude;
+ position->longitude = pos->longitude;
+ return POI_ERROR_NONE;
+}
+
+int poi_get_address(poi_h poi, char **building_number, char **postal_code, char **street, char **city, char **district, char **state, char **country_code)
+{
+ POI_NULL_ARG_CHECK(poi);
+ const LocationAddress * addr = location_landmark_get_address((LocationLandmark*)poi);
+ if( addr == NULL )
+ return POI_ERROR_RESULT_NOT_FOUND;
+ if( building_number && addr->building_number)
+ *building_number = strdup(addr->building_number);
+
+ if( postal_code && addr->postal_code)
+ *postal_code = strdup(addr->postal_code);
+
+ if( street && addr->street)
+ *street = strdup(addr->street);
+
+ if( city && addr->city)
+ *city = strdup(addr->city);
+
+ if( district && addr->district)
+ *district = strdup(addr->district);
+
+ if( state && addr->state)
+ *state = strdup(addr->state);
+
+ if( country_code && addr->country_code)
+ *country_code = strdup(addr->country_code);
+
+ return POI_ERROR_NONE;
+
+}
+
+int poi_get_description(poi_h poi, char** description)
+{
+ POI_NULL_ARG_CHECK(poi);
+ POI_NULL_ARG_CHECK(description);
+
+ char * desc = (char*)location_landmark_get_description((LocationLandmark*)poi);
+ if( desc == NULL)
+ *description = NULL;
+ else
+ *description = strdup(desc);
+ return POI_ERROR_NONE;
+}
+
+int poi_get_timestamp(poi_h poi , time_t *timestamp)
+{
+ POI_NULL_ARG_CHECK(poi);
+ POI_NULL_ARG_CHECK(timestamp);
+ *timestamp = location_landmark_get_timestamp((LocationLandmark*)poi);
+ return POI_ERROR_NONE;
+}
+
+int poi_get_bounding_rect(poi_h poi , location_coords_s *top_left, location_coords_s *bottom_right)
+{
+ POI_NULL_ARG_CHECK(poi);
+ POI_NULL_ARG_CHECK(top_left);
+ POI_NULL_ARG_CHECK(bottom_right);
+
+ const LocationBoundary *bound = location_landmark_get_bounding_box((LocationLandmark*)poi);
+ if( bound == NULL )
+ return POI_ERROR_RESULT_NOT_FOUND;
+ top_left->latitude = bound->rect.left_top->latitude;
+ top_left->longitude = bound->rect.left_top->longitude;
+ bottom_right->latitude = bound->rect.right_bottom->latitude;
+ bottom_right->longitude = bound->rect.right_bottom->longitude;
+
+ return POI_ERROR_NONE;
+}
+
+int poi_get_author(poi_h poi , char** author)
+{
+ POI_NULL_ARG_CHECK(poi);
+ POI_NULL_ARG_CHECK(author);
+ char *auth = (char*)location_landmark_get_author((LocationLandmark*)poi);
+ if( auth == NULL )
+ *author = NULL;
+ else
+ *author = strdup(auth);
+ return POI_ERROR_NONE;
+}
+
+int poi_get_phone_number(poi_h poi , char** phone_number)
+{
+ POI_NULL_ARG_CHECK(poi);
+ POI_NULL_ARG_CHECK(phone_number);
+ char *number = (char*)location_landmark_get_phone_number((LocationLandmark*)poi);
+ if( number == NULL )
+ *phone_number = NULL;
+ else
+ *phone_number = strdup(number);
+ return POI_ERROR_NONE;
+}
+
+int poi_foreach_urls(poi_h poi, poi_urls_cb callback , void * user_data)
+{
+ POI_NULL_ARG_CHECK(poi);
+ POI_NULL_ARG_CHECK(callback);
+
+ GList *url_list = (GList*)location_landmark_get_url((LocationLandmark*)poi);
+
+ while( url_list ){
+ LocationLandmarkUrl *url = url_list->data;
+ if(url != NULL && !callback(location_landmark_url_get_url_path(url), location_landmark_url_get_description(url), user_data) )
+ break;
+ url_list = url_list->next;
+ }
+ return POI_ERROR_NONE;
+}
+
+int poi_foreach_properties(poi_h poi, poi_properties_cb callback, void * user_data)
+{
+ POI_NULL_ARG_CHECK(poi);
+ POI_NULL_ARG_CHECK(callback);
+ GList *key_list = (GList*)location_landmark_get_property_key((LocationLandmark*)poi);
+
+ while( key_list ){
+ char *key = key_list->data;
+ char *value = NULL;
+ if( key != NULL && (value = (char*)location_landmark_get_property((LocationLandmark*)poi, key)) != NULL){
+ if( callback(key, value, user_data) == false)
+ break;
+ }
+ key_list = key_list->next;
+ }
+ return POI_ERROR_NONE;
+}
+
+int poi_foreach_categories(poi_h poi , poi_categories_cb callback , void * user_data)
+{
+ POI_NULL_ARG_CHECK(poi);
+ POI_NULL_ARG_CHECK(callback);
+ GList *category_list = (GList*)location_landmark_get_category((LocationLandmark*)poi);
+
+ while( category_list ){
+ char *category = category_list->data;
+ if( false == callback(category, user_data) )
+ break;
+ category_list = category_list->next;
+ }
+ return POI_ERROR_NONE;
+}
--- /dev/null
+SET(fw_test "${fw_name}-test")
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(${fw_test} REQUIRED glib-2.0 )
+FOREACH(flag ${${fw_test}_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ MESSAGE(${flag})
+ENDFOREACH()
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall")
+
+aux_source_directory(. sources)
+FOREACH(src ${sources})
+ GET_FILENAME_COMPONENT(src_name ${src} NAME_WE)
+ MESSAGE("${src_name}")
+ ADD_EXECUTABLE(${src_name} ${src})
+ TARGET_LINK_LIBRARIES(${src_name} ${fw_name} ${${fw_test}_LDFLAGS})
+ENDFOREACH()
--- /dev/null
+/*
+ * Copyright (c) 2011-2013 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 <stdio.h>
+#include <unistd.h>
+#include <glib.h>
+#include <poi.h>
+#include <location_bounds.h>
+
+static GMainLoop *g_mainloop = NULL;
+
+static gpointer GmainThread(gpointer data)
+{
+ g_mainloop = g_main_loop_new (NULL, FALSE);
+ printf("\n...Entering GMain Loop to Receive Notifications....\n");
+ g_main_loop_run (g_mainloop);
+ g_main_loop_unref (g_mainloop);
+ g_mainloop = NULL;
+ return NULL;
+}
+
+bool _service_search_cb(poi_error_e error, int request_id , int index, int length , poi_h poi , void * user_data)
+{
+ printf("error %d %d)-------------\n",error, index);
+ char * name=NULL ;
+ char *description=NULL;
+ poi_get_name(poi , &name);
+ int ret = poi_get_description(poi, &description);
+ printf("get description ret = %d\n", ret);
+ printf("%s / %s\n", name , description);
+
+
+ return true;
+}
+
+
+int poi_test(){
+ poi_service_h poi_manager ;
+ poi_filter_h filter;
+ poi_preference_h pref;
+ poi_service_create(&poi_manager);
+
+ location_bounds_h bound;
+
+ location_coords_s pos = {37.336723, -121.889555};
+ location_bounds_create_circle(pos, 400, &bound);
+
+ char * addr = "N SAN PEDRO ST CA SANTA CLARA SAN JOSE 95110";
+
+ poi_filter_create(&filter);
+ //poi_filter_set(filter, "KEYWORD", "pizza");
+ poi_filter_set(filter, "CATEGORY", "restaurant");
+ poi_preference_create(&pref);
+ poi_preference_set_max_result(pref, 5);
+ poi_preference_set_sort(pref, "Distance", POI_SORTORDER_ASC);
+ poi_service_set_preference(poi_manager, pref);
+
+ int ret;
+ //printf("request search!!!\n");
+ ret = poi_service_search(poi_manager,pos , 100, filter, _service_search_cb , NULL, NULL);
+ printf("ret = category, poi_service_search : %d\n", ret);
+
+ sleep(3);
+
+ poi_filter_create(&filter);
+ poi_filter_set(filter, "KEYWORD", "pizza");
+ poi_preference_create(&pref);
+ poi_preference_set_max_result(pref, 5);
+ poi_preference_set_sort(pref, "Distance", POI_SORTORDER_DESC);
+ poi_service_set_preference(poi_manager, pref);
+
+ ret = poi_service_search(poi_manager,pos , 100, filter, _service_search_cb , NULL, NULL);
+ printf("ret = keyword, poi_service_search : %d\n", ret);
+
+
+ sleep(3);
+
+ poi_filter_create(&filter);
+ poi_filter_set(filter, "POIName", "pizza");
+ poi_preference_create(&pref);
+ poi_preference_set_max_result(pref, 5);
+ poi_preference_set_sort(pref, "Distance", POI_SORTORDER_DESC);
+ poi_service_set_preference(poi_manager, pref);
+
+ ret = poi_service_search(poi_manager,pos , 100, filter, _service_search_cb , NULL, NULL);
+ printf("ret = POIName, poi_service_search : %d\n", ret);
+
+ sleep(3);
+
+ poi_filter_create(&filter);
+ poi_filter_set(filter, "CATEGORY", "restaurant");
+ poi_preference_create(&pref);
+ poi_preference_set_max_result(pref, 5);
+ poi_preference_set_sort(pref, "Distance", POI_SORTORDER_DESC);
+ poi_service_set_preference(poi_manager, pref);
+
+ ret = poi_service_search_by_area(poi_manager, bound, filter, _service_search_cb , NULL, NULL);
+ printf("ret = category, poi_service_search_by_area : %d\n", ret);
+
+
+ sleep(3);
+
+ poi_filter_create(&filter);
+ poi_filter_set(filter, "KEYWORD", "pizza");
+ poi_preference_create(&pref);
+ poi_preference_set_max_result(pref, 5);
+ poi_preference_set_sort(pref, "Distance", POI_SORTORDER_DESC);
+ poi_service_set_preference(poi_manager, pref);
+
+ ret = poi_service_search_by_area(poi_manager, bound, filter, _service_search_cb , NULL, NULL);
+ printf("ret = keyword, poi_service_search_by_area : %d\n", ret);
+
+ sleep(3);
+
+ poi_filter_create(&filter);
+ poi_preference_create(&pref);
+ poi_filter_set(filter, "POIName", "pizza");
+ poi_preference_set_max_result(pref, 5);
+ poi_preference_set_sort(pref, "Distance", POI_SORTORDER_DESC);
+ poi_service_set_preference(poi_manager, pref);
+
+ ret = poi_service_search_by_area(poi_manager, bound, filter, _service_search_cb , NULL, NULL);
+ printf("ret = poi name, poi_service_search_by_area : %d\n", ret);
+
+ sleep(3);
+
+ poi_filter_create(&filter);
+ poi_filter_set(filter, "CATEGORY", "restaurant");
+ poi_preference_create(&pref);
+ poi_preference_set_max_result(pref, 5);
+ poi_preference_set_sort(pref, "Distance", POI_SORTORDER_DESC);
+ poi_service_set_preference(poi_manager, pref);
+
+ ret = poi_service_search_by_address(poi_manager, addr, 100, filter, _service_search_cb , NULL, NULL);
+ printf("ret = category, poi_service_search_by_address : %d\n", ret);
+
+
+ sleep(10);
+
+ poi_filter_create(&filter);
+ poi_filter_set(filter, "KEYWORD", "cafe");
+ poi_preference_create(&pref);
+ poi_preference_set_max_result(pref, 5);
+ poi_preference_set_sort(pref, "Distance", POI_SORTORDER_DESC);
+ poi_service_set_preference(poi_manager, pref);
+
+ ret = poi_service_search_by_address(poi_manager, addr, 400, filter, _service_search_cb , NULL, NULL);
+ printf("ret = keyword, poi_service_search_by_address : %d\n", ret);
+
+ sleep(10);
+
+ poi_filter_create(&filter);
+ poi_filter_set(filter, "POIName", "cafe");
+ poi_preference_create(&pref);
+ poi_preference_set_max_result(pref, 5);
+ poi_preference_set_sort(pref, "Distance", POI_SORTORDER_DESC);
+ poi_service_set_preference(poi_manager, pref);
+
+ ret = poi_service_search_by_address(poi_manager, addr, 400, filter, _service_search_cb , NULL, NULL);
+ printf("ret = POIName, poi_service_search_by_address : %d\n", ret);
+ if (poi_manager) {
+ poi_service_destroy(poi_manager);
+ }
+ sleep(10);
+ return 0;
+}
+
+int main(){
+ GError *gerr = NULL;
+ gint c = 0;
+ // If application is executed by AUL, this is not needed.
+ g_setenv("PKG_NAME", "com.samsung.location-api-test", 1);
+
+#if !GLIB_CHECK_VERSION (2, 31, 0)
+ if( !g_thread_supported() )
+ {
+ g_thread_init(NULL);
+ }
+#endif
+
+ GThread *g_main;
+ g_main = g_thread_create(GmainThread, NULL, TRUE, &gerr);
+ if (!g_main) {
+ g_debug("Error create gmain thread: Err domain[%d] Err code[%d] Err msg[%s]",
+ gerr->domain, gerr->code, gerr->message);
+ g_error_free(gerr);
+ return 0;
+ }
+
+ poi_test();
+ if ((c = getchar()) == EOF) {
+ printf("getchar return EOF \n");
+ }
+
+ return 0;
+
+
+}
+