2 * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef __MAPS_PLACE_H__
18 #define __MAPS_PLACE_H__
20 #include <tizen_type.h>
21 #include <maps_address.h>
22 #include <maps_place_category.h>
23 #include <maps_place_attribute.h>
24 #include <maps_place_contact.h>
25 #include <maps_place_editorial.h>
26 #include <maps_place_link_object.h>
27 #include <maps_place_image.h>
28 #include <maps_place_review.h>
29 #include <maps_place_rating.h>
30 #include <maps_coordinates.h>
33 * @ingroup CAPI_MAPS_PLACE_MODULE
34 * @defgroup CAPI_MAPS_PLACE_DATA_MODULE Place
37 * @brief This file contains the functions related to Place information.
39 * @addtogroup CAPI_MAPS_PLACE_DATA_MODULE
41 * @brief This provides APIs related to Place information, used in Place
42 * Discovery and Search.
50 * @brief The Place handle
51 * @details The handle of Place instance.
52 * @remarks To release the handle use maps_place_destroy().
53 * \n To clone the handle use maps_place_clone().
56 * @see maps_place_destroy()
57 * @see maps_place_clone()
59 typedef void *maps_place_h;
61 /*----------------------------------------------------------------------------*/
64 * @brief Called when requesting the list of Place Properties.
65 * @details This callback is invoked while iterating through the list of Place
68 * @remarks @a key and @a value must be released using free() and corresponding
69 * release method for property value correspondingly.
71 * @param[in] index The current index of property
72 * @param[in] total The total amount of properties
73 * @param[in] key The key of property
74 * @param[in] value The value of property
75 * @param[in] uesr_data The user data passed from
76 * maps_place_foreach_property()
77 * @return @c true to continue with the next iteration of the loop, \n @c
78 * false to break out of the loop
80 * @pre maps_place_foreach_property() will invoke this callback.
82 * @see maps_place_foreach_property()
84 typedef bool(*maps_place_properties_cb) (int index, int total, char *key,
85 void *value, void *user_data);
88 * @brief Called when requesting the list of Place Categories.
89 * @details This callback is invoked while iterating through the list of Place
92 * @remarks @a category is valid only in this function and must be released
93 * using maps_place_category_destroy().
94 * \n To use @a category outside this function, clone it with
95 * maps_place_category_clone().
97 * @param[in] index The current index of category
98 * @param[in] total The total amount of categories
99 * @param[in] category The place category handle
100 * @param[in] uesr_data The user data passed from
101 * maps_place_foreach_category()
102 * @return @c true to continue with the next iteration of the loop, \n @c
103 * false to break out of the loop
105 * @pre maps_place_foreach_category() will invoke this callback.
107 * @see maps_place_foreach_category()
108 * @see #maps_place_category_h
110 typedef bool(*maps_place_categories_cb) (int index, int total,
111 maps_place_category_h category,
115 * @brief Called when requesting the list of Place Attributes.
116 * @details This callback is invoked while iterating through the list of Place
119 * @remarks @a attribute is valid only in this function and must be released
120 * using maps_place_attribute_destroy().
121 * \n To use @a attribute outside this function, clone it with
122 * maps_place_attribute_clone().
124 * @param[in] index The current index of attribute
125 * @param[in] total The total amount of attributes
126 * @param[in] attribute The place attribute handle
127 * @param[in] uesr_data The user data passed from the
128 * maps_place_foreach_attribute()
129 * @return @c true to continue with the next iteration of the loop, \n @c
130 * false to break out of the loop
132 * @pre maps_place_foreach_attribute() will invoke this callback.
134 * @see maps_place_foreach_attribute()
135 * @see #maps_place_attribute_h
137 typedef bool(*maps_place_attributes_cb) (int index, int total,
138 maps_place_attribute_h attribute,
142 * @brief Called when requesting the list of Place Contacts.
143 * @details This callback is invoked while iterating through the list of Place
146 * @remarks @a contact is valid only in this function and must be released using
147 * maps_place_contact_destroy().
148 * \n To use @a contact outside this function, clone it with
149 * maps_place_contact_clone().
151 * @param[in] index The current index of contact
152 * @param[in] total The total amount of contacts
153 * @param[in] contact The place contact handle
154 * @param[in] uesr_data The user data passed from the
155 * maps_place_foreach_contact()
156 * @return @c true to continue with the next iteration of the loop, \n @c
157 * false to break out of the loop
159 * @pre maps_place_foreach_contact() will invoke this callback.
161 * @see maps_place_foreach_contact()
162 * @see #maps_place_contact_h
164 typedef bool(*maps_place_contacts_cb) (int index, int total,
165 maps_place_contact_h contact,
169 * @brief Called when requesting the list of Place Editorial.
170 * @details This callback is invoked while iterating through the list of Place
173 * @remarks @a editorial is valid only in this function and must be released
174 * using maps_place_editorial_destroy().
175 * \n To use @a editorial outside this function, clone it with
176 * maps_place_editorial_clone().
178 * @param[in] index The current index of editorial
179 * @param[in] total The total amount of editorials
180 * @param[in] editorial The place editorial handle
181 * @param[in] uesr_data The user data passed from the
182 * maps_place_foreach_editorial()
183 * @return @c true to continue with the next iteration of the loop, \n @c
184 * false to break out of the loop
186 * @pre maps_place_foreach_editorial() will invoke this callback.
188 * @see maps_place_foreach_editorial()
189 * @see #maps_place_editorial_h
192 typedef bool(*maps_place_editorials_cb) (int index, int total,
193 maps_place_editorial_h editorial,
196 * @brief Called when requesting the list of Place Image.
197 * @details This callback is invoked while iterating through the list of Place
200 * @remarks @a image is valid only in this function and must be released using
201 * maps_place_image_destroy().
202 * \n To use @a image outside this function, clone it with
203 * maps_place_image_clone().
205 * @param[in] index The current index of image
206 * @param[in] total The total amount of images
207 * @param[in] image The place image handle
208 * @param[in] uesr_data The user data passed from the
209 * maps_place_foreach_image()
210 * @return @c true to continue with the next iteration of the loop, \n @c
211 * false to break out of the loop
213 * @pre maps_place_foreach_image() will invoke this callback.
215 * @see maps_place_foreach_image()
216 * @see #maps_place_image_h
218 typedef bool(*maps_place_images_cb) (int index, int total,
219 maps_place_image_h image,
223 * @brief Called when requesting the list of Place Review.
224 * @details This callback is invoked while iterating through the list of Place
227 * @remarks @a review is valid only in this function and must be released using
228 * maps_place_review_destroy().
229 * \n To use @a review outside this function, clone it with
230 * maps_place_review_clone().
232 * @param[in] index The current index of review
233 * @param[in] total The total amount of reviews
234 * @param[in] review The place review handle
235 * @param[in] uesr_data The user data passed from the
236 * maps_place_foreach_review()
237 * @return @c true to continue with the next iteration of the loop, \n @c
238 * false to break out of the loop
240 * @pre maps_place_foreach_review() will invoke this callback.
242 * @see maps_place_foreach_review()
243 * @see #maps_place_image_h
245 typedef bool(*maps_place_reviews_cb) (int index, int total,
246 maps_place_review_h review,
249 /*----------------------------------------------------------------------------*/
252 * @brief Destroys the place handle and releases all its resources.
253 * @details This function destroys the place handle and releases all its
257 * @param[in] place The place handle to destroy
258 * @return 0 on success, otherwise a negative error value
259 * @retval #MAPS_ERROR_NONE Successful
260 * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
262 * @see maps_place_clone()
264 int maps_place_destroy(maps_place_h place);
267 * @brief Clones the place handle.
268 * @details This function clones the place handle @a origin and all its
271 * @remarks @a cloned must be released using maps_place_destroy().
273 * @param[in] origin The original place handle
274 * @param[out] cloned A cloned place handle
275 * @return 0 on success, otherwise a negative error value
276 * @retval #MAPS_ERROR_NONE Successful
277 * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
278 * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
280 * @see maps_place_destroy()
282 int maps_place_clone(const maps_place_h origin, maps_place_h *cloned);
284 /*----------------------------------------------------------------------------*/
287 * @brief Gets the place id.
288 * @details This function gets the place id.
290 * @remarks @a id must be released using free().
292 * @param[in] place The place handle
293 * @param[out] id The place id
294 * @return 0 on success, otherwise a negative error value
295 * @retval #MAPS_ERROR_NONE Successful
296 * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
298 int maps_place_get_id(const maps_place_h place, char **id);
301 * @brief Gets the place name.
302 * @details This function gets the place name.
304 * @remarks @a name must be released using free().
306 * @param[in] place The place handle
307 * @param[out] name The place name
308 * @return 0 on success, otherwise a negative error value
309 * @retval #MAPS_ERROR_NONE Successful
310 * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
312 int maps_place_get_name(const maps_place_h place, char **name);
315 * @brief Gets the place view URI.
316 * @details This function gets the place view URI.
318 * @remarks @a uri must be released using free().
320 * @param[in] place The place handle
321 * @param[out] uri The place view URI
322 * @return 0 on success, otherwise a negative error value
323 * @retval #MAPS_ERROR_NONE Successful
324 * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
326 int maps_place_get_uri(const maps_place_h place, char **uri);
329 * @brief Gets the place location.
330 * @details This function gets the place location.
332 * @remarks @a location must be released using maps_coordinates_destroy().
334 * @param[in] place The place handle
335 * @param[out] location The place location
336 * @return 0 on success, otherwise a negative error value
337 * @retval #MAPS_ERROR_NONE Successful
338 * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
340 int maps_place_get_location(const maps_place_h place,
341 maps_coordinates_h *location);
344 * @brief Gets the place distance from the center of the location.
345 * @details This function gets the place distance from the center of the
349 * @param[in] place The place handle
350 * @param[out] distance The place distance in meters
351 * @return 0 on success, otherwise a negative error value
352 * @retval #MAPS_ERROR_NONE Successful
353 * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
355 int maps_place_get_distance(const maps_place_h place, int *distance);
358 * @brief Gets the place address.
359 * @details This function gets the place address.
361 * @remarks @a address must be released using maps_address_destroy().
363 * @param[in] place The place handle
364 * @param[out] address The place address
365 * @return 0 on success, otherwise a negative error value
366 * @retval #MAPS_ERROR_NONE Successful
367 * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
368 * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
370 int maps_place_get_address(const maps_place_h place,
371 maps_address_h *address);
374 * @brief Gets the place rating.
375 * @details This function gets the place rating.
377 * @remarks @a rating must be released using maps_place_rating_destroy().
379 * @param[in] place The place handle
380 * @param[out] rating The place rating handle
381 * @return 0 on success, otherwise a negative error value
382 * @retval #MAPS_ERROR_NONE Successful
383 * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
384 * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
386 int maps_place_get_rating(const maps_place_h place,
387 maps_place_rating_h *rating);
390 * @brief Retrieves all properties.
391 * @details This function retrieves all place properties.
393 * @remarks The properties will be delivered via maps_place_properties_cb().
395 * @param[in] place The place handle
396 * @param[in] callback The callback function to invoke
397 * @param[in] user_data The user data to be passed to the callback
399 * @return 0 on success, otherwise a negative error value
400 * @retval #MAPS_ERROR_NONE Successful
401 * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
402 * @retval #MAPS_ERROR_NOT_FOUND Result not found
404 * @post This function invokes maps_place_properties_cb() repeatedly to retrieve
407 * @see maps_place_properties_cb()
409 int maps_place_foreach_property(const maps_place_h place,
410 maps_place_properties_cb callback,
414 * @brief Retrieves all categories
415 * @details This function retrieves all place categories.
417 * @remarks The categories will be delivered via maps_place_categories_cb().
419 * @param[in] place The place handle
420 * @param[in] callback The callback function to invoke
421 * @param[in] user_data The user data to be passed to the callback
423 * @return 0 on success, otherwise a negative error value
424 * @retval #MAPS_ERROR_NONE Successful
425 * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
426 * @retval #MAPS_ERROR_NOT_FOUND Result not found
427 * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
429 * @post This function invokes maps_place_categories_cb() repeatedly to retrieve
432 * @see maps_place_categories_cb()
434 int maps_place_foreach_category(const maps_place_h place,
435 maps_place_categories_cb callback,
439 * @brief Retrieves all attributes.
440 * @details This function retrieves all place attributes.
442 * @remarks The attributes will be delivered via maps_place_attributes_cb().
444 * @param[in] place The place handle
445 * @param[in] callback The callback function to invoke
446 * @param[in] user_data The user data to be passed to the callback
448 * @return 0 on success, otherwise a negative error value
449 * @retval #MAPS_ERROR_NONE Successful
450 * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
451 * @retval #MAPS_ERROR_NOT_FOUND Result not found
452 * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
454 * @post This function invokes maps_place_attributes_cb() repeatedly to retrieve
457 * @see maps_place_attributes_cb()
459 int maps_place_foreach_attribute(const maps_place_h place,
460 maps_place_attributes_cb callback,
464 * @brief Retrieves all contacts.
465 * @details This function retrieves all place contacts.
467 * @remarks The contacts will be delivered via maps_place_contacts_cb().
469 * @param[in] place The place handle
470 * @param[in] callback The callback function to invoke
471 * @param[in] user_data The user data to be passed to the callback
473 * @return 0 on success, otherwise a negative error value
474 * @retval #MAPS_ERROR_NONE Successful
475 * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
476 * @retval #MAPS_ERROR_NOT_FOUND Result not found
477 * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
479 * @post This function invokes maps_place_contacts_cb() repeatedly to retrieve
482 * @see maps_place_contacts_cb()
484 int maps_place_foreach_contact(const maps_place_h place,
485 maps_place_contacts_cb callback,
489 * @brief Retrieves all editorials.
490 * @details This function retrieves all place editorials.
492 * @remarks The editorials will be delivered via maps_place_editorials_cb().
494 * @param[in] place The place handle
495 * @param[in] callback The callback function to invoke
496 * @param[in] user_data The user data to be passed to the callback
498 * @return 0 on success, otherwise a negative error value
499 * @retval #MAPS_ERROR_NONE Successful
500 * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
501 * @retval #MAPS_ERROR_NOT_FOUND Result not found
502 * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
504 * @post This function invokes maps_place_editorials_cb() repeatedly to retrieve
507 * @see maps_place_editorials_cb()
509 int maps_place_foreach_editorial(const maps_place_h place,
510 maps_place_editorials_cb callback,
514 * @brief Retrieves all images.
515 * @details This function retrieves all place images.
517 * @remarks The images will be delivered via maps_place_images_cb().
519 * @param[in] place The place handle
520 * @param[in] callback The callback function to invoke
521 * @param[in] user_data The user data to be passed to the callback
523 * @return 0 on success, otherwise a negative error value
524 * @retval #MAPS_ERROR_NONE Successful
525 * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
526 * @retval #MAPS_ERROR_NOT_FOUND Result not found
527 * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
529 * @post This function invokes maps_place_images_cb() repeatedly to retrieve
532 * @see maps_place_images_cb()
534 int maps_place_foreach_image(const maps_place_h place,
535 maps_place_images_cb callback, void *user_data);
538 * @brief Retrieves all reviews.
539 * @details This function retrieves all place reviews.
541 * @remarks The reviews will be delivered via maps_place_reviews_cb().
543 * @param[in] place The place handle
544 * @param[in] callback The callback function to invoke
545 * @param[in] user_data The user data to be passed to the callback
547 * @return 0 on success, otherwise a negative error value
548 * @retval #MAPS_ERROR_NONE Successful
549 * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
550 * @retval #MAPS_ERROR_NOT_FOUND Result not found
551 * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
553 * @post This function invokes maps_place_reviews_cb() repeatedly to retrieve
556 * @see maps_place_reviews_cb()
558 int maps_place_foreach_review(const maps_place_h place,
559 maps_place_reviews_cb callback,
563 * @brief Gets the place supplier link.
564 * @details This function gets the place supplier link.
566 * @remarks @a supplier must be released using maps_place_link_object_destroy().
568 * @param[in] place The place handle image
569 * @param[out] supplier The place supplier link
570 * @return 0 on success, otherwise a negative error value
571 * @retval #MAPS_ERROR_NONE Successful
572 * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
573 * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
575 int maps_place_get_supplier_link(const maps_place_image_h place,
576 maps_place_link_object_h *supplier);
579 * @brief Gets the place related link.
580 * @details This function gets the place related link.
582 * @remarks @a related must be released using maps_place_link_object_destroy().
584 * @param[in] place The place handle image
585 * @param[out] related The place related link
586 * @return 0 on success, otherwise a negative error value
587 * @retval #MAPS_ERROR_NONE Successful
588 * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
589 * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
591 int maps_place_get_related_link(const maps_place_image_h place,
592 maps_place_link_object_h *related);
600 #endif /* __MAPS_PLACE_H__ */