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.
18 #ifndef __TIZEN_APPFW_APP_CONTROL_H__
19 #define __TIZEN_APPFW_APP_CONTROL_H__
32 * @addtogroup CAPI_APP_CONTROL_MODULE
37 typedef struct _bundle_t bundle;
41 * @brief App Control handle.
44 typedef struct app_control_s* app_control_h;
48 * @brief Enumeration for App Control Error.
53 APP_CONTROL_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
54 APP_CONTROL_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
55 APP_CONTROL_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
56 APP_CONTROL_ERROR_APP_NOT_FOUND = TIZEN_ERROR_APPLICATION | 0x21, /**< The application is not found */
57 APP_CONTROL_ERROR_KEY_NOT_FOUND = TIZEN_ERROR_KEY_NOT_AVAILABLE, /**< Specified key is not found */
58 APP_CONTROL_ERROR_KEY_REJECTED = TIZEN_ERROR_KEY_REJECTED, /**< Key is not available */
59 APP_CONTROL_ERROR_INVALID_DATA_TYPE = TIZEN_ERROR_APPLICATION | 0x22, /**< Invalid data type */
60 APP_CONTROL_ERROR_LAUNCH_REJECTED = TIZEN_ERROR_APPLICATION | 0x23, /**< The application cannot be launched now*/
61 APP_CONTROL_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
62 APP_CONTROL_ERROR_LAUNCH_FAILED = TIZEN_ERROR_APPLICATION | 0x24, /**< Internal launch error */
63 APP_CONTROL_ERROR_TIMED_OUT = TIZEN_ERROR_TIMED_OUT /**< Time out */
64 } app_control_error_e;
68 * @brief Enumeration for App Control Result.
73 APP_CONTROL_RESULT_SUCCEEDED = 0, /**< Operation succeeded */
74 APP_CONTROL_RESULT_FAILED = -1, /**< Operation failed by the callee */
75 APP_CONTROL_RESULT_CANCELED = -2, /**< Operation canceled by the framework */
76 } app_control_result_e;
80 * @brief Definition for the app_control operation: main operation for an explicit launch.
83 #define APP_CONTROL_OPERATION_MAIN "http://tizen.org/appcontrol/operation/main"
87 * @brief Definition for the app_control operation: default operation for an explicit launch.
90 #define APP_CONTROL_OPERATION_DEFAULT "http://tizen.org/appcontrol/operation/default"
94 * @brief Definition for the app_control operation: provides an explicit editable access to the given data.
97 #define APP_CONTROL_OPERATION_EDIT "http://tizen.org/appcontrol/operation/edit"
101 * @brief Definition for the app_control operation: displays the data.
104 #define APP_CONTROL_OPERATION_VIEW "http://tizen.org/appcontrol/operation/view"
108 * @brief Definition for the app_control operation: picks an item from the data, returning what is selected.
111 #define APP_CONTROL_OPERATION_PICK "http://tizen.org/appcontrol/operation/pick"
115 * @brief Definition for the app_control operation: creates content, returning what is created.
118 #define APP_CONTROL_OPERATION_CREATE_CONTENT "http://tizen.org/appcontrol/operation/create_content"
122 * @brief Definition for the app_control operation: performs a call to someone specified by the data.
125 * @privilege %http://tizen.org/privilege/call
126 * @remarks When you request this operation, you must declare this privilege.
128 #define APP_CONTROL_OPERATION_CALL "http://tizen.org/appcontrol/operation/call"
132 * @brief Definition for the app_control operation: delivers some data to someone else.
135 #define APP_CONTROL_OPERATION_SEND "http://tizen.org/appcontrol/operation/send"
139 * @brief Definition for the app_control operation: delivers text data to someone else.
142 #define APP_CONTROL_OPERATION_SEND_TEXT "http://tizen.org/appcontrol/operation/send_text"
146 * @brief Definition for the app_control operation: shares an item with someone else.
149 #define APP_CONTROL_OPERATION_SHARE "http://tizen.org/appcontrol/operation/share"
153 * @brief Definition for the app_control operation: shares multiple items with someone else.
156 #define APP_CONTROL_OPERATION_MULTI_SHARE "http://tizen.org/appcontrol/operation/multi_share"
160 * @brief Definition for the app_control operation: shares text data with someone else.
163 #define APP_CONTROL_OPERATION_SHARE_TEXT "http://tizen.org/appcontrol/operation/share_text"
167 * @brief Definition for the app_control operation: dials a number as specified by the data.
170 #define APP_CONTROL_OPERATION_DIAL "http://tizen.org/appcontrol/operation/dial"
174 * @brief Definition for the app_control operation: performs a search.
177 #define APP_CONTROL_OPERATION_SEARCH "http://tizen.org/appcontrol/operation/search"
181 * @brief Definition for the app_control operation: downloads an item.
184 #define APP_CONTROL_OPERATION_DOWNLOAD "http://tizen.org/appcontrol/operation/download"
188 * @brief Definition for the app_control operation: prints content.
191 #define APP_CONTROL_OPERATION_PRINT "http://tizen.org/appcontrol/operation/print"
194 * @brief Definition for the app_control operation: composes.
197 #define APP_CONTROL_OPERATION_COMPOSE "http://tizen.org/appcontrol/operation/compose"
200 * @brief Definition for app_control optional data: the subject of a message.
203 #define APP_CONTROL_DATA_SUBJECT "http://tizen.org/appcontrol/data/subject"
207 * @brief Definition for app_control optional data: e-mail addresses.
210 #define APP_CONTROL_DATA_TO "http://tizen.org/appcontrol/data/to"
214 * @brief Definition for app_control optional data: e-mail addresses that should be carbon copied.
217 #define APP_CONTROL_DATA_CC "http://tizen.org/appcontrol/data/cc"
221 * @brief Definition for app_control optional data: e-mail addresses that should be blind carbon copied.
224 #define APP_CONTROL_DATA_BCC "http://tizen.org/appcontrol/data/bcc"
228 * @brief Definition for app_control optional data: the content of the data is associated with #APP_CONTROL_OPERATION_SEND.
231 #define APP_CONTROL_DATA_TEXT "http://tizen.org/appcontrol/data/text"
235 * @brief Definition for app_control optional data: the title of the data.
238 #define APP_CONTROL_DATA_TITLE "http://tizen.org/appcontrol/data/title"
242 * @brief Definition for app_control optional data: the path of a selected item.
245 #define APP_CONTROL_DATA_SELECTED "http://tizen.org/appcontrol/data/selected"
249 * @brief Definition for app_control optional data: multiple item path to deliver.
252 #define APP_CONTROL_DATA_PATH "http://tizen.org/appcontrol/data/path"
256 * @brief Definition for app_control optional data: the selection type.
259 #define APP_CONTROL_DATA_SELECTION_MODE "http://tizen.org/appcontrol/data/selection_mode"
263 * @brief Called when the reply of the launch request is delivered.
267 * @remarks The @a request and @a reply must not be deallocated by the application.
269 * @param[in] request The app_control handle of the launch request that has been sent
270 * @param[in] reply The app_control handle in which the results of the callee are contained
271 * @param[in] result The result code of the launch request
272 * @param[in] user_data The user data passed from the callback registration function
273 * @pre When the callee replies to the launch request, this callback will be invoked.
274 * @see app_control_send_launch_request()
275 * @see app_control_reply_to_launch_request()
277 typedef void (*app_control_reply_cb) (app_control_h request, app_control_h reply, app_control_result_e result, void *user_data);
281 * @brief Called to retrieve the extra data contained in the app_control.
285 * @remarks The @a key must not be deallocated by the application.
287 * @param[in] app_control The app_control handle
288 * @param[in] key The key of the value contained in the app_control
289 * @param[in] user_data The user data passed from the foreach function
290 * @return @c true to continue with the next iteration of the loop,
291 * otherwise @c false to break out of the loop
292 * @pre app_control_foreach_extra_data() will invoke this callback.
293 * @see app_control_foreach_extra_data()
295 typedef bool (*app_control_extra_data_cb)(app_control_h app_control, const char *key, void *user_data);
299 * @brief Called once for each matched application that can be launched to handle the given app_control request.
302 * @param[in] app_control The app_control handle
303 * @param[in] package The package name of the application that can handle the launch request of the given app_control
304 * @param[in] user_data The user data passed from the foreach function
305 * @return @c true to continue with the next iteration of the loop,
306 * otherwise @c false to break out of the loop
307 * @pre app_control_foreach_app_matched() will invoke this callback.
308 * @see app_control_foreach_app_matched()
310 typedef bool (*app_control_app_matched_cb)(app_control_h app_control, const char *appid, void *user_data);
313 typedef int (*app_control_host_res_fn)(void *data);
316 * @brief Creates an app_control handle.
319 * @remarks The @a app_control must be released using app_control_destroy().
320 * @param[out] app_control The app_control handle to be newly created on success
321 * @return @c 0 on success,
322 * otherwise a negative error value
323 * @retval #APP_CONTROL_ERROR_NONE Successful
324 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
325 * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
326 * @see app_control_destroy()
328 int app_control_create(app_control_h *app_control);
332 * @brief Destroys the app_control handle and releases all its resources.
335 * @param[in] app_control The app_control handle
336 * @return @c 0 on success,
337 * otherwise a negative error value
338 * @retval #APP_CONTROL_ERROR_NONE Successful
339 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
340 * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
341 * @see app_control_create()
343 int app_control_destroy(app_control_h app_control);
348 * @brief Converts the app_control handle to bundle data.
351 * @param[in] app_control The app_control handle
352 * @param[out] data The bundle data on success
353 * @return @c 0 on success,
354 * otherwise a negative error value
355 * @retval #APP_CONTROL_ERROR_NONE Successful
356 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
358 int app_control_to_bundle(app_control_h app_control, bundle **data);
361 * @brief Sets the operation to be performed.
363 * @details The @a operation is the mandatory information for the launch request.
364 * If the operation is not specified, #APP_CONTROL_OPERATION_DEFAULT is used for the launch request.
365 * If the operation is #APP_CONTROL_OPERATION_DEFAULT, the package information is mandatory to explicitly launch the application.
367 * @param[in] app_control The app_control handle
368 * @param[in] operation The operation to be performed (if the @a operation is @c NULL, it clears the previous value)
369 * @return @c 0 on success,
370 * otherwise a negative error value
371 * @retval #APP_CONTROL_ERROR_NONE Successful
372 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
373 * @see app_control_get_operation()
374 * @see APP_CONTROL_OPERATION_DEFAULT
375 * @see APP_CONTROL_OPERATION_EDIT
376 * @see APP_CONTROL_OPERATION_VIEW
377 * @see APP_CONTROL_OPERATION_PICK
378 * @see APP_CONTROL_OPERATION_CREATE_CONTENT
379 * @see APP_CONTROL_OPERATION_CALL
380 * @see APP_CONTROL_OPERATION_SEND
381 * @see APP_CONTROL_OPERATION_SEND_TEXT
382 * @see APP_CONTROL_OPERATION_DIAL
383 * @see APP_CONTROL_OPERATION_SEARCH
385 int app_control_set_operation(app_control_h app_control, const char *operation);
389 * @brief Gets the operation to be performed.
392 * @remarks The @a operation must be released using free().
393 * @param[in] app_control The app_control handle
394 * @param[out] operation The operation to be performed
395 * @return @c 0 on success,
396 * otherwise a negative error value
397 * @retval #APP_CONTROL_ERROR_NONE Successful
398 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
399 * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
400 * @see app_control_set_operation()
402 int app_control_get_operation(app_control_h app_control, char **operation);
406 * @brief Sets the URI of the data.
409 * @param[in] app_control The app_control handle
410 * @param[in] uri The URI of the data this app_control is operating on (if the @a uri is @c NULL, it clears the previous value)
411 * @return @c 0 on success,
412 * otherwise a negative error value
413 * @retval #APP_CONTROL_ERROR_NONE Successful
414 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
415 * @see app_control_get_uri()
417 int app_control_set_uri(app_control_h app_control, const char *uri);
421 * @brief Gets the URI of the data.
424 * @remarks The @a uri must be released using free().
425 * @param[in] app_control The app_control handle
426 * @param[out] uri The URI of the data this app_control is operating on
427 * @return @c 0 on success,
428 * otherwise a negative error value
429 * @retval #APP_CONTROL_ERROR_NONE Successful
430 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
431 * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
432 * @see app_control_set_uri()
434 int app_control_get_uri(app_control_h app_control, char **uri);
438 * @brief Sets the explicit MIME type of the data.
441 * @param[in] app_control The app_control handle
442 * @param[in] mime The explicit MIME type of the data this app_control is operating on (if the @a mime is @c NULL, it clears the previous value)
443 * @return @c 0 on success,
444 * otherwise a negative error value
445 * @retval #APP_CONTROL_ERROR_NONE Successful
446 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
447 * @see app_control_get_mime()
449 int app_control_set_mime(app_control_h app_control, const char *mime);
453 * @brief Gets the explicit MIME type of the data.
456 * @remarks The @a uri must be released using free().
457 * @param[in] app_control The app_control handle
458 * @param[out] mime The explicit MIME type of the data this app_control is operating on
459 * @return @c 0 on success,
460 * otherwise a negative error value
461 * @retval #APP_CONTROL_ERROR_NONE Successful
462 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
463 * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
464 * @see app_control_set_mime()
466 int app_control_get_mime(app_control_h app_control, char **mime);
470 * @brief Sets the explicit category.
473 * @param[in] app_control The app_control handle
474 * @param[in] category The explicit category (if the @a category is @c NULL, it clears the previous value)
475 * @return @c 0 on success,
476 * otherwise a negative error value
477 * @retval #APP_CONTROL_ERROR_NONE Successful
478 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
479 * @see app_control_get_category()
481 int app_control_set_category(app_control_h app_control, const char *category);
485 * @brief Gets the explicit category.
488 * @remarks The @a category must be released using free().
489 * @param[in] app_control The app_control handle
490 * @param[out] category The explicit category
491 * @return @c 0 on success,
492 * otherwise a negative error value
493 * @retval #APP_CONTROL_ERROR_NONE Successful
494 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
495 * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
496 * @see app_control_set_category()
498 int app_control_get_category(app_control_h app_control, char **category);
502 * @brief Sets the ID of the application to explicitly launch.
505 * @param[in] app_control The app_control handle
506 * @param[in] app_id The ID of the application to explicitly launch (if the @a app_id is @c NULL, it clears the previous value)
507 * @return @c 0 on success,
508 * otherwise a negative error value
509 * @retval #APP_CONTROL_ERROR_NONE Successful
510 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
511 * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
512 * @see app_control_get_app_id()
514 int app_control_set_app_id(app_control_h app_control, const char *app_id);
518 * @brief Gets the ID of the application to explicitly launch.
521 * @remarks The @a app_id must be released with free().
522 * @param[in] app_control The app_control handle
523 * @param[out] app_id The ID of the application to explicitly launch
524 * @return @c 0 on success,
525 * otherwise a negative error value
526 * @retval #APP_CONTROL_ERROR_NONE Successful
527 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
528 * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
529 * @see app_control_set_app_id()
531 int app_control_get_app_id(app_control_h app_control, char **app_id);
535 * @brief Sets the window ID of the application.
538 * @param[in] app_control The app_control handle
539 * @param[in] id The window ID of the caller application (if the @a id is not positive, it clears the previous value)
540 * @return @c 0 on success,
541 * otherwise a negative error value
542 * @retval #APP_CONTROL_ERROR_NONE Successful
543 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
544 * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
545 * @see app_control_get_window()
547 int app_control_set_window(app_control_h app_control, unsigned int id);
552 * @brief Gets the window ID of the application.
555 * @param[in] app_control The app_control handle
556 * @param[out] id The window ID of the caller application
557 * @return @c 0 on success,
558 * otherwise a negative error value
559 * @retval #APP_CONTROL_ERROR_NONE Successful
560 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
561 * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
562 * @see app_control_set_app_id()
564 int app_control_get_window(app_control_h app_control, unsigned int *id);
568 * @brief Adds extra data to the app_control.
571 * @remarks The function replaces any existing value for the given key.
572 * @remarks The function returns #APP_CONTROL_ERROR_INVALID_PARAMETER if @a key or @a value is a zero-length string.
573 * @remarks The function returns #APP_CONTROL_ERROR_KEY_REJECTED if the application tries to use the same key with system-defined key.
574 * @param[in] app_control The app_control handle
575 * @param[in] key The name of the extra data
576 * @param[in] value The value associated with the given key
577 * @return @c 0 on success,
578 * otherwise a negative error value
579 * @retval #APP_CONTROL_ERROR_NONE Successful
580 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
581 * @retval #APP_CONTROL_ERROR_KEY_REJECTED Key not available
582 * @see app_control_add_extra_data_array()
583 * @see app_control_remove_extra_data()
584 * @see app_control_get_extra_data()
586 int app_control_add_extra_data(app_control_h app_control, const char *key, const char *value);
590 * @brief Adds the extra data array to the app_control.
593 * @remarks The function replaces any existing value for the given key.
594 * @remarks The function returns #APP_CONTROL_ERROR_INVALID_PARAMETER if @a key is a zero-length string.
595 * @remarks The function returns #APP_CONTROL_ERROR_KEY_REJECTED if the application tries to use the same key with system-defined key.
596 * @param[in] app_control The app_control handle
597 * @param[in] key The name of the extra data
598 * @param[in] value The array value associated with the given key
599 * @param[in] length The length of the array
600 * @return @c 0 on success,
601 * otherwise a negative error value
602 * @retval #APP_CONTROL_ERROR_NONE Successful
603 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
604 * @retval #APP_CONTROL_ERROR_KEY_REJECTED Key not available
605 * @see app_control_add_extra_data()
606 * @see app_control_remove_extra_data()
607 * @see app_control_get_extra_data()
609 int app_control_add_extra_data_array(app_control_h app_control, const char *key, const char* value[], int length);
613 * @brief Removes the extra data from the app_control.
616 * @param[in] app_control The app_control handle
617 * @param[in] key The name of the extra data
618 * @return @c 0 on success,
619 * otherwise a negative error value
620 * @retval #APP_CONTROL_ERROR_NONE Successful
621 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
622 * @retval #APP_CONTROL_ERROR_KEY_NOT_FOUND Specified key not found
623 * @see app_control_add_extra_data()
624 * @see app_control_add_extra_data_array()
625 * @see app_control_get_extra_data()
627 int app_control_remove_extra_data(app_control_h app_control, const char *key);
631 * @brief Gets the extra data from the app_control.
634 * @remarks The @a value must be released using free().
635 * @remarks The function returns #APP_CONTROL_ERROR_INVALID_DATA_TYPE if @a value is of array data type.
636 * @param[in] app_control The app_control handle
637 * @param[in] key The name of the extra data
638 * @param[out] value The value associated with the given key
639 * @return @c 0 on success,
640 * otherwise a negative error value
641 * @retval #APP_CONTROL_ERROR_NONE Successful
642 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
643 * @retval #APP_CONTROL_ERROR_KEY_NOT_FOUND Specified key not found
644 * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
645 * @retval #APP_CONTROL_ERROR_INVALID_DATA_TYPE Invalid data type
646 * @see app_control_add_extra_data()
647 * @see app_control_add_extra_data_array()
648 * @see app_control_get_extra_data()
649 * @see app_control_remove_extra_data()
650 * @see app_control_foreach_extra_data()
652 int app_control_get_extra_data(app_control_h app_control, const char *key, char **value);
656 * @brief Gets the extra data array from the app_control.
659 * @remarks The @a value must be released using free().
660 * @remarks The function returns #APP_CONTROL_ERROR_INVALID_DATA_TYPE if @a value is not of array data type.
661 * @param[in] app_control The app_control handle
662 * @param[in] key The name of the extra data
663 * @param[out] value The array value associated with the given key
664 * @param[out] length The length of the array
665 * @return @c 0 on success,
666 * otherwise a negative error value
667 * @retval #APP_CONTROL_ERROR_NONE Successful
668 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
669 * @retval #APP_CONTROL_ERROR_KEY_NOT_FOUND Specified key not found
670 * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
671 * @retval #APP_CONTROL_ERROR_INVALID_DATA_TYPE Invalid data type
672 * @see app_control_add_extra_data()
673 * @see app_control_add_extra_data_array()
674 * @see app_control_remove_extra_data()
675 * @see app_control_foreach_extra_data()
677 int app_control_get_extra_data_array(app_control_h app_control, const char *key, char ***value, int *length);
681 * @brief Checks whether the extra data associated with the given @a key is of array data type.
684 * @param[in] app_control The app_control handle
685 * @param[in] key The name of the extra data
686 * @param[out] array If @c true the extra data is of array data type,
688 * @return @c 0 on success,
689 * otherwise a negative error value
690 * @retval #APP_CONTROL_ERROR_NONE Successful
691 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
692 * @see app_control_add_extra_data()
693 * @see app_control_add_extra_data_array()
694 * @see app_control_remove_extra_data()
695 * @see app_control_foreach_extra_data()
697 int app_control_is_extra_data_array(app_control_h app_control, const char *key, bool *array);
701 * @brief Retrieves all extra data contained in app_control.
702 * @details This function calls app_control_extra_data_cb() once for each key-value pair for extra data contained in app_control. \n
703 * If the app_control_extra_data_cb() callback function returns @c false, then iteration will be finished.
706 * @param[in] app_control The app_control handle
707 * @param[in] callback The iteration callback function
708 * @param[in] user_data The user data to be passed to the callback function
709 * @return @c 0 on success,
710 * otherwise a negative error value
711 * @retval #APP_CONTROL_ERROR_NONE Successful
712 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
713 * @post This function invokes app_control_extra_data_cb().
714 * @see app_control_extra_data_cb()
716 int app_control_foreach_extra_data(app_control_h app_control, app_control_extra_data_cb callback, void *user_data);
720 * @brief Retrieves all applications that can be launched to handle the given app_control request.
723 * @param[in] app_control The app_control handle
724 * @param[in] callback The iteration callback function
725 * @param[in] user_data The user data to be passed to the callback function
726 * @return @c 0 on success,
727 * otherwise a negative error value
728 * @retval #APP_CONTROL_ERROR_NONE Success
729 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
730 * @post This function invokes app_control_app_matched_cb().
731 * @see app_control_app_matched_cb()
733 int app_control_foreach_app_matched(app_control_h app_control, app_control_app_matched_cb callback, void *user_data);
737 * @brief Sends the launch request.
739 * @details The operation is mandatory information for the launch request. \n
740 * If the operation is not specified, #APP_CONTROL_OPERATION_DEFAULT is used by default.
741 * If the operation is #APP_CONTROL_OPERATION_DEFAULT, the application ID is mandatory to explicitly launch the application.
744 * @privilege %http://tizen.org/privilege/appmanager.launch
745 * @param[in] app_control The app_control handle
746 * @param[in] callback The callback function to be called when the reply is delivered
747 * @param[in] user_data The user data to be passed to the callback function
748 * @return @c 0 on success,
749 * otherwise a negative error value
750 * @retval #APP_CONTROL_ERROR_NONE Successful
751 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
752 * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
753 * @retval #APP_CONTROL_ERROR_APP_NOT_FOUND The application to run the given launch request is not found
754 * @retval #APP_CONTROL_ERROR_LAUNCH_REJECTED The application cannot be launched in current context
755 * @retval #APP_CONTROL_ERROR_LAUNCH_FAILED Failed to launch the application
756 * @retval #APP_CONTROL_ERROR_TIMED_OUT Failed due to timeout. The application that handles @a app_control may be busy
757 * @retval #APP_CONTROL_ERROR_PERMISSION_DENIED Permission denied
758 * @post If the launch request is sent for the result, the result will come back through app_control_reply_cb() from the callee application.
759 * @see app_control_reply_to_launch_request()
760 * @see app_control_reply_cb()
762 int app_control_send_launch_request(app_control_h app_control, app_control_reply_cb callback, void *user_data);
766 * @brief Sends the terminate request to the application that is launched by app_control. This API is only effective for some applications that are provided by default for handling platform default app_controls. You are not allowed to terminate other general applications using this API.
769 * @param[in] app_control The app_control handle
770 * @return @c 0 on success,
771 * otherwise a negative error value
772 * @retval #APP_CONTROL_ERROR_NONE Successful
773 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
774 * @retval #APP_CONTROL_ERROR_PERMISSION_DENIED Permission denied
775 * @see app_control_send_launch_request()
777 int app_control_send_terminate_request(app_control_h app_control);
781 * @brief Replies to the launch request sent by the caller.
782 * @details If the caller application sent the launch request to receive the result, the callee application can return the result back to the caller.
785 * @param[in] reply The app_control handle in which the results of the callee are contained
786 * @param[in] request The app_control handle sent by the caller
787 * @param[in] result The result code of the launch request
788 * @return @c 0 on success,
789 * otherwise a negative error value
790 * @retval #APP_CONTROL_ERROR_NONE Successful
791 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
792 * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
793 * @see app_control_send_launch_request()
795 int app_control_reply_to_launch_request(app_control_h reply, app_control_h request, app_control_result_e result);
799 * @brief Creates and returns a copy of the given app_control handle.
802 * @remarks A newly created app_control should be destroyed by calling app_control_destroy() if it is no longer needed.
804 * @param[out] clone If successful, a newly created app_control handle will be returned
805 * @param[in] app_control The app_control handle
806 * @return @c 0 on success,
807 * otherwise a negative error value
808 * @retval #APP_CONTROL_ERROR_NONE Successful
809 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
810 * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
811 * @see app_control_destroy()
813 int app_control_clone(app_control_h *clone, app_control_h app_control);
817 * @brief Gets the application ID of the caller from the launch request.
820 * @remarks The @a app_control must be the launch request from app_control_cb().
821 * @remarks This function returns #APP_CONTROL_ERROR_INVALID_PARAMETER if the given app_control is not the launch request.
822 * @remarks The @a id must be released using free().
823 * @param[in] app_control The app_control handle from app_control_cb()
824 * @param[out] id The application ID of the caller
825 * @return @a 0 on success,
826 * otherwise a negative error value
827 * @retval #APP_CONTROL_ERROR_NONE Successful
828 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
829 * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
831 int app_control_get_caller(app_control_h app_control, char **id);
835 * @brief Checks whether the caller is requesting a reply from the launch request.
838 * @remarks The @a app_control must be the launch request from app_control_cb().
839 * @remarks This function returns #APP_CONTROL_ERROR_INVALID_PARAMETER if the given app_control is not the launch request.
840 * @param[in] app_control The app_control handle from app_control_cb()
841 * @param[out] requested If @c true a reply is requested by the caller,
843 * @return @c 0 on success,
844 * otherwise a negative error value
845 * @retval #APP_CONTROL_ERROR_NONE Successful
846 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
847 * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
849 int app_control_is_reply_requested(app_control_h app_control, bool *requested);
853 * @brief Requests the specified callee window to be transient for the caller window.
856 * @remarks The @a callee_id window is transient for the top-level caller window and should be handled accordingly.
857 * @param[in] app_control The app_control handle
858 * @param[in] callee_id The callee window ID
859 * @param[in] cbfunc The callback function to be called when the transient is requested
860 * @param[in] data A data pointer to pass to the callback function
861 * @return @c 0 on success,
862 * otherwise a negative error value.
863 * @retval #APP_CONTROL_ERROR_NONE Successful
864 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
866 int app_control_request_transient_app(app_control_h app_control, unsigned int callee_id, app_control_host_res_fn cbfunc, void *data);
876 #endif /* __TIZEN_APPFW_APP_CONTROL_H__ */