support async launch result callback
[platform/core/appfw/app-svc.git] / include / appsvc.h
1 /*
2  *  app-svc
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>, Jaeho Lee <jaeho81.lee@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21
22
23
24 #ifndef __APP_SVC_H__
25 #define __APP_SVC_H__
26
27 /**
28  * @file    appsvc.h
29  * @version 1.1
30  * @brief   This file contains APIs of the appsvc library
31  */
32
33 /**
34  * @addtogroup APPLICATION_FRAMEWORK
35  * @{
36  *
37  * @defgroup appsvc Application Service
38  * @version  1.1
39  * @brief    Application Service library
40  *
41  */
42
43 /**
44  * @addtogroup appsvc
45  * @{
46  */
47
48
49 #include <bundle.h>
50 #include <sys/types.h>
51
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55
56
57 /** APP_SVC OPERATION TYPE*/
58 #define APPSVC_OPERATION_DEFAULT                "http://tizen.org/appcontrol/operation/default"
59 /** APP_SVC OPERATION TYPE*/
60 #define APPSVC_OPERATION_EDIT                   "http://tizen.org/appcontrol/operation/edit"
61 /** APP_SVC OPERATION TYPE*/
62 #define APPSVC_OPERATION_VIEW                   "http://tizen.org/appcontrol/operation/view"
63 /** APP_SVC OPERATION TYPE*/
64 #define APPSVC_OPERATION_PICK                   "http://tizen.org/appcontrol/operation/pick"
65 /** APP_SVC OPERATION TYPE*/
66 #define APPSVC_OPERATION_CREATE_CONTENT         "http://tizen.org/appcontrol/operation/create_content"
67 /** APP_SVC OPERATION TYPE*/
68 #define APPSVC_OPERATION_CALL                   "http://tizen.org/appcontrol/operation/call"
69 /** APP_SVC OPERATION TYPE*/
70 #define APPSVC_OPERATION_SEND                   "http://tizen.org/appcontrol/operation/send"
71 /** APP_SVC OPERATION TYPE*/
72 #define APPSVC_OPERATION_SEND_TEXT              "http://tizen.org/appcontrol/operation/send_text"
73 /** APP_SVC OPERATION TYPE*/
74 #define APPSVC_OPERATION_DIAL                   "http://tizen.org/appcontrol/operation/dial"
75 /** APP_SVC OPERATION TYPE*/
76 #define APPSVC_OPERATION_SEARCH                 "http://tizen.org/appcontrol/operation/search"
77 /** APP_SVC OPERATION TYPE*/
78 #define APPSVC_OPERATION_DOWNLOAD               "http://tizen.org/appcontrol/operation/download"
79 /** APP_SVC OPERATION TYPE*/
80 #define APPSVC_OPERATION_SHARE                  "http://tizen.org/appcontrol/operation/share"
81 /** APP_SVC OPERATION TYPE*/
82 #define APPSVC_OPERATION_MULTI_SHARE    "http://tizen.org/appcontrol/operation/multi_share"
83 /** APP_SVC OPERATION TYPE*/
84 #define APPSVC_OPERATION_COMPOSE                "http://tizen.org/appcontrol/opeation/compose"
85 /** APP_SVC OPERATION TYPE*/
86 #define APPSVC_OPERATION_LOCATION               "http://tizen.org/appcontrol/operation/configure/location"
87 /** APP_SVC OPERATION TYPE*/
88 #define APPSVC_OPERATION_FONT_TYPE              "http://tizen.org/appcontrol/operation/configure/font/type"
89 /** APP_SVC OPERATION TYPE*/
90 #define APPSVC_OPERATION_FONT_SIZE              "http://tizen.org/appcontrol/operation/configure/font/size"
91 /** APP_SVC OPERATION TYPE*/
92 #define APPSVC_OPERATION_LAUNCH_ON_EVENT       "http://tizen.org/appcontrol/operation/launch_on_event"
93
94
95
96
97 /** APP_SVC DATA SUBJECT*/
98 #define APPSVC_DATA_SUBJECT             "http://tizen.org/appcontrol/data/subject"
99 /** APP_SVC DATA TYPE*/
100 #define APPSVC_DATA_TO                  "http://tizen.org/appcontrol/data/to"
101 /** APP_SVC DATA TYPE*/
102 #define APPSVC_DATA_CC                  "http://tizen.org/appcontrol/data/cc"
103 /** APP_SVC DATA TYPE*/
104 #define APPSVC_DATA_BCC                 "http://tizen.org/appcontrol/data/bcc"
105 /** APP_SVC DATA TYPE*/
106 #define APPSVC_DATA_TEXT                "http://tizen.org/appcontrol/data/text"
107 /** APP_SVC DATA TYPE*/
108 #define APPSVC_DATA_TITLE               "http://tizen.org/appcontrol/data/title"
109 /** APP_SVC DATA TYPE*/
110 #define APPSVC_DATA_SELECTED            "http://tizen.org/appcontrol/data/selected"
111 /** APP_SVC DATA TYPE*/
112 #define APPSVC_DATA_KEYWORD             "http://tizen.org/appcontrol/data/keyword"
113 /** APP_SVC DATA TYPE*/
114 #define APPSVC_DATA_PATH                "http://tizen.org/appcontrol/data/path"
115 /** APP_SVC DATA TYPE*/
116 #define APPSVC_DATA_SELECTION_MODE      "http://tizen.org/appcontrol/data/selection_mode"
117 /** APP_SVC DATA TYPE*/
118 #define APPSVC_DATA_RETURN_RESULT       "http://tizen.org/appcontrol/data/return_result"
119
120
121 /** APP SVC internal private key */
122 #define APP_SVC_K_URI_R_INFO            "__APP_SVC_URI_R_INFO__"
123
124 #define APP_SELECTOR "org.tizen.app-selector"
125
126 #define APPSVC_K_LAUNCH_RESULT_APP_STARTED "__K_LAUNCH_RESULT_APP_STARTED__"
127
128 /**
129  * @brief Return values in appsvc. 
130  */
131 typedef enum _appsvc_return_val {
132         APPSVC_RET_EILLACC = -5,                /**< Illegal Access */
133         APPSVC_RET_ELAUNCH = -4,                /**< Failure on launching the app */
134         APPSVC_RET_ENOMATCH = -3,               /**< No matching result Error */
135         APPSVC_RET_EINVAL = -2,                 /**< Invalid argument */
136         APPSVC_RET_ERROR = -1,                  /**< General error */
137         APPSVC_RET_OK = 0                       /**< General success */
138 }appsvc_return_val;
139
140
141 /**
142  * @brief result values in appsvc. 
143  */
144 typedef enum _appsvc_result_val {
145         APPSVC_RES_CANCEL = -2,         /**< Cancel by system */
146         APPSVC_RES_NOT_OK = -1,         /**< Fail by user */
147         APPSVC_RES_OK = 0               /**< Success by user */
148 }appsvc_result_val;
149
150
151 /** 
152  * @brief appsvc_res_fn is appsvc result function
153  * @param[out]  b               result bundle   
154  * @param[out]  request_code    request code
155  * @param[out]  result                  result value
156  * @param[out]  data            user-supplied data      
157 */
158 typedef void (*appsvc_res_fn)(bundle *b, int request_code, appsvc_result_val result, void *data);
159
160
161 /** 
162  * @brief iterator function running with appsvc_get_list 
163  * @param[out]  pkg_name        package name retreived by appsvc_get_list
164  * @param[out]  data            user-supplied data      
165 */
166 typedef int (*appsvc_info_iter_fn)(const char *appid, void *data);
167
168 typedef int (*appsvc_host_res_fn)(void *data);
169
170 /**
171  * @par Description:
172  * This function sets an operation to launch application based on appsvc.
173  *
174  * @param[in] b bundle object 
175  * @param[in] operation operation 
176  *
177  * @return 0 if success, negative value(<0) if fail
178  * @retval APPSVC_RET_OK - success
179  * @retval APPSVC_RET_ERROR - general error 
180  * @retval APPSVC_RET_EINVAL - invalid argument(content)
181  *
182  * @pre None.
183  * @post None.
184  * @see None.
185  * @remarks An application must call this function before using appsvc_run_service API. 
186  *
187  * @par Sample code:
188  * @code
189 #include <appsvc.h>
190
191 ...
192 {
193         bundle *b = NULL;
194
195         b = bundle_create();
196         
197         appsvc_set_operation(b, APPSVC_OPERATION_VIEW);
198 }
199  * @endcode
200  *
201  */
202 int appsvc_set_operation(bundle *b, const char *operation);
203
204 /**
205  * @par Description:
206  * This function sets an uri to launch application based on appsvc.
207  *
208  * @param[in] b bundle object 
209  * @param[in] uri uri 
210  *
211  * @return 0 if success, negative value(<0) if fail
212  * @retval APPSVC_RET_OK - success
213  * @retval APPSVC_RET_ERROR - general error 
214  * @retval APPSVC_RET_EINVAL - invalid argument(content)
215  *
216  * @pre None.
217  * @post None.
218  * @see None.
219  * @remarks None. 
220  *
221  * @par Sample code:
222  * @code
223 #include <appsvc.h>
224
225 ...
226 {
227         bundle *b = NULL;
228
229         b = bundle_create();
230         
231         appsvc_set_operation(b, APPSVC_OPERATION_VIEW);
232         appsvc_set_uri(b,"http://www.samsung.com");
233 }
234  * @endcode
235  *
236  */
237 int appsvc_set_uri(bundle *b, const char *uri);
238
239 /**
240  * @par Description:
241  * This function sets a mime-type to launch application based on appsvc.
242  *
243  * @param[in] b bundle object 
244  * @param[in] mime mime-type 
245  *
246  * @return 0 if success, negative value(<0) if fail
247  * @retval APPSVC_RET_OK - success
248  * @retval APPSVC_RET_ERROR - general error 
249  * @retval APPSVC_RET_EINVAL - invalid argument(content)
250  *
251  * @pre None.
252  * @post None.
253  * @see None.
254  * @remarks None. 
255  *
256  * @par Sample code:
257  * @code
258 #include <appsvc.h>
259
260 ...
261 {
262         bundle *b = NULL;
263
264         b = bundle_create();
265         
266         appsvc_set_operation(b, APPSVC_OPERATION_PICK);
267         appsvc_set_mime(b,"image/jpg");
268 }
269  * @endcode
270  *
271  */
272 int appsvc_set_mime(bundle *b, const char *mime);
273
274 /**
275  * @par Description:
276  * This function sets an extra data to launch application based on appsvc.
277  *
278  * @param[in] b bundle object 
279  * @param[in] key key of extra data 
280  * @param[in] val data 
281  *
282  * @return 0 if success, negative value(<0) if fail
283  *
284  * @pre None.
285  * @post None.
286  * @see None.
287  * @remarks None. 
288  *
289  * @par Sample code:
290  * @code
291 #include <appsvc.h>
292
293 ...
294 {
295         bundle *b = NULL;
296
297         b = bundle_create();
298         
299         appsvc_set_operation(b, APPSVC_OPERATION_SEND);
300         appsvc_set_uri(b,"mailto:xxx1@xxx");
301         appsvc_add_data(b,APPSVC_DATA_CC,"xxx2@xxx");
302 }
303  * @endcode
304  *
305  */
306 int appsvc_add_data(bundle *b, const char *key, const char *val);
307
308 /**
309  * @par Description:
310  * This function sets an extra array data to launch application based on appsvc.
311  *
312  * @param[in] b bundle object 
313  * @param[in] key key of extra data 
314  * @param[in] val_array data 
315  * @param[in] len Length of array
316  *
317  * @return 0 if success, negative value(<0) if fail
318  *
319  * @pre None.
320  * @post None.
321  * @see None.
322  * @remarks None. 
323  *
324  * @par Sample code:
325  * @code
326 #include <appsvc.h>
327
328 ...
329 {
330         bundle *b = NULL;
331         char *images[] = {"/opt/media/a.jpg", "/opt/media/b.jpg", "/opt/media/c.jpg"};
332
333         b = bundle_create();
334
335         appsvc_add_data_array(b, APPSVC_DATA_SELECTED, images, 3);
336 }
337  * @endcode
338  *
339  */
340 int appsvc_add_data_array(bundle *b, const char *key, const char **val_array, int len);
341
342
343 /**
344  * @par Description:
345  * This function sets a package name to launch application based on appsvc.
346  *
347  * @param[in] b bundle object 
348  * @param[in] pkg_name package name for explict launch
349  *
350  * @return 0 if success, negative value(<0) if fail
351  * @retval APPSVC_RET_OK - success
352  * @retval APPSVC_RET_ERROR - general error 
353  * @retval APPSVC_RET_EINVAL - invalid argument(content)
354  *
355  * @pre None.
356  * @post None.
357  * @see None.
358  * @remarks None. 
359  *
360  * @par Sample code:
361  * @code
362 #include <appsvc.h>
363
364 ...
365 {
366         bundle *b = NULL;
367
368         b = bundle_create();
369         
370         appsvc_set_operation(b, APPSVC_OPERATION_PICK);
371         appsvc_set_mime(b,"image/jpg");
372         appsvc_set_pkgname(b, "org.tizen.mygallery");
373 }
374  * @endcode
375  *
376  */
377 /* Deprecated API */
378 int appsvc_set_pkgname(bundle *b, const char *pkg_name); // __attribute__((deprecated));
379
380
381 /**
382  * @par Description:
383  * This function sets a appid to launch application based on appsvc.
384  *
385  * @param[in] b bundle object
386  * @param[in] appid application id for explict launch
387  *
388  * @return 0 if success, negative value(<0) if fail
389  * @retval APPSVC_RET_OK - success
390  * @retval APPSVC_RET_ERROR - general error
391  * @retval APPSVC_RET_EINVAL - invalid argument(content)
392  *
393  * @pre None.
394  * @post None.
395  * @see None.
396  * @remarks None.
397  *
398  * @par Sample code:
399  * @code
400 #include <appsvc.h>
401
402 ...
403 {
404         bundle *b = NULL;
405
406         b = bundle_create();
407
408         appsvc_set_operation(b, APPSVC_OPERATION_PICK);
409         appsvc_set_mime(b,"image/jpg");
410         appsvc_set_appid(b, "org.tizen.mygallery");
411 }
412  * @endcode
413  *
414  */
415 int appsvc_set_appid(bundle *b, const char *appid);
416
417
418 /**
419  * @par Description:
420  * This function sets a appid to launch application based on appsvc.
421  *
422  * @param[in] b bundle object
423  * @param[in] application category
424  *
425  * @return 0 if success, negative value(<0) if fail
426  * @retval APPSVC_RET_OK - success
427  * @retval APPSVC_RET_ERROR - general error
428  * @retval APPSVC_RET_EINVAL - invalid argument(content)
429  *
430  * @pre None.
431  * @post None.
432  * @see None.
433  * @remarks None.
434  *
435  * @par Sample code:
436  * @code
437 #include <appsvc.h>
438
439 ...
440 {
441         bundle *b = NULL;
442
443         b = bundle_create();
444
445         appsvc_set_operation(b, APPSVC_OPERATION_VIEW);
446         appsvc_set_category(b, "http://tizen.org/category/app/browser");
447 }
448  * @endcode
449  *
450  */
451 int appsvc_set_category(bundle *b, const char *category);
452
453 /**
454  * @par Description:
455  * This API launch application based on appsvc.
456  *
457  * @param[in] b bundle to be passed to callee
458  * @param[in] request_code request code
459  * @param[in] cbfunc result callback function
460  * @param[in] data user-supplied data passed to callback function
461  *
462  * @return callee's pid if success, negative value(<0) if fail
463  * @retval callee's pid - success
464  * @retval APPSVC_RET_ERROR - general error 
465  * @retval APPSVC_RET_EINVAL - invalid argument(content)
466  * @retval APPSVC_RET_ENOMATCH - no matching result Error 
467  * @retval APPSVC_RET_ELAUNCH - failure on launching the app
468  *
469  * @pre None.
470  * @post None.
471  * @see None.
472  * @remarks None. 
473  *
474  * @par Sample code:
475  * @code
476 #include <appsvc.h>
477
478 ...
479 {
480         bundle *b = NULL;
481         static int num = 0;
482
483         b = bundle_create();
484         
485         appsvc_set_operation(b, APPSVC_OPERATION_PICK);
486         appsvc_set_mime(b,"image/jpg");
487
488         return appsvc_run_service(b, 0, cb_func, (void*)NULL);
489 }
490  * @endcode
491  *
492  */
493 int appsvc_run_service(bundle *b, int request_code, appsvc_res_fn cbfunc, void *data);
494 int appsvc_usr_run_service(bundle *b, int request_code, appsvc_res_fn cbfunc, void *data, uid_t uid);
495
496 /**
497  * @par Description:
498  * This API use to get application list that is matched with given bundle.
499  *
500  * @param[in] b bundle to resolve application
501  * @param[in] iter_fn iterator function
502  * @param[in] data user-supplied data for iter_fn
503  *
504  * @return 0 if success, negative value(<0) if fail
505  * @retval APPSVC_RET_OK - success
506  * @retval APPSVC_RET_EINVAL - invalid argument(content)
507  * @retval APPSVC_RET_ENOMATCH - no matching result Error 
508  *
509  * @pre None.
510  * @post None.
511  * @see None.
512  * @remarks None. 
513  *
514  * @par Sample code:
515  * @code
516 #include <appsvc.h>
517
518 static int iter_fn(const char* pkg_name, void *data)
519 {
520         printf("\t==========================\n");
521         printf("\t pkg_name: %s\n", pkg_name);
522         printf("\t==========================\n");
523         return 0;
524 }
525
526 ...
527 {
528         bundle *b = NULL;
529         static int num = 0;
530
531         b = bundle_create();
532         
533         appsvc_set_operation(b, APPSVC_OPERATION_PICK);
534         appsvc_set_mime(b,"image/jpg");
535
536         return appsvc_get_list(b, iter_fn, (void*)NULL);
537 }
538  * @endcode
539  *
540  */
541 int appsvc_get_list(bundle *b, appsvc_info_iter_fn iter_fn, void *data);
542 int appsvc_usr_get_list(bundle *b, appsvc_info_iter_fn iter_fn, void *data, uid_t uid);
543
544 /**
545  * @par Description:
546  * This function gets a operation from bundle.
547  *
548  * @param[in] b bundle object 
549  *
550  * @return Pointer for operation string if success, NULL if fail
551  *
552  * @pre None.
553  * @post None.
554  * @see None.
555  * @remarks None. 
556  *
557  * @par Sample code:
558  * @code
559 #include <appsvc.h>
560
561 ...
562 {
563         char *val;      
564         val = appsvc_get_operation(b);
565 }
566  * @endcode
567  *
568  */
569 const char *appsvc_get_operation(bundle *b);
570
571 /**
572  * @par Description:
573  * This function gets a uri from bundle.
574  *
575  * @param[in] b bundle object 
576  *
577  * @return Pointer for uri string if success, NULL if fail
578  *
579  * @pre None.
580  * @post None.
581  * @see None.
582  * @remarks None. 
583  *
584  * @par Sample code:
585  * @code
586 #include <appsvc.h>
587
588 ...
589 {
590         char *val;      
591         val = appsvc_get_uri(b);
592 }
593  * @endcode
594  *
595  */
596 const char *appsvc_get_uri(bundle *b);
597
598 /**
599  * @par Description:
600  * This function gets a mime-type from bundle.
601  *
602  * @param[in] b bundle object 
603  *
604  * @return Pointer for mime-type string if success, NULL if fail
605  *
606  * @pre None.
607  * @post None.
608  * @see None.
609  * @remarks None. 
610  *
611  * @par Sample code:
612  * @code
613 #include <appsvc.h>
614
615 ...
616 {
617         char *val;      
618         val = appsvc_get_mime(b);
619 }
620  * @endcode
621  *
622  */
623 const char *appsvc_get_mime(bundle *b);
624
625 /**
626  * @par Description:
627  * This function gets a package name from bundle.
628  *
629  * @param[in] b bundle object 
630  *
631  * @return Pointer for package name string if success, NULL if fail
632  *
633  * @pre None.
634  * @post None.
635  * @see None.
636  * @remarks None. 
637  *
638  * @par Sample code:
639  * @code
640 #include <appsvc.h>
641
642 ...
643 {
644         char *val;      
645         val = appsvc_get_pkgname(b);
646 }
647  * @endcode
648  *
649  */
650 /* Deprecated API */
651 const char *appsvc_get_pkgname(bundle *b); // __attribute__((deprecated));
652
653 /**
654  * @par Description:
655  * This function gets a application id from bundle.
656  *
657  * @param[in] b bundle object
658  *
659  * @return Pointer for application id string if success, NULL if fail
660  *
661  * @pre None.
662  * @post None.
663  * @see None.
664  * @remarks None.
665  *
666  * @par Sample code:
667  * @code
668 #include <appsvc.h>
669
670 ...
671 {
672         char *val;
673         val = appsvc_get_appid(b);
674 }
675  * @endcode
676  *
677  */
678 const char *appsvc_get_appid(bundle *b);
679
680 /**
681  * @par Description:
682  * This function gets a application category from bundle.
683  *
684  * @param[in] b bundle object
685  *
686  * @return Pointer for application category string if success, NULL if fail
687  *
688  * @pre None.
689  * @post None.
690  * @see None.
691  * @remarks None.
692  *
693  * @par Sample code:
694  * @code
695 #include <appsvc.h>
696
697 ...
698 {
699         char *val;
700         val = appsvc_get_category(b);
701 }
702  * @endcode
703  *
704  */
705 const char *appsvc_get_category(bundle *b);
706
707 /**
708  * @par Description:
709  * This function gets value from key.
710  *
711  * @param[in] b bundle object 
712  * @param[in] key key
713  *
714  * @return Pointer for value string if success, NULL if fail
715  *
716  * @pre None.
717  * @post None.
718  * @see None.
719  * @remarks None. 
720  *
721  * @par Sample code:
722  * @code
723 #include <appsvc.h>
724
725 ...
726 {
727         char *val;      
728         val = appsvc_get_data(b, APPSVC_DATA_CC);
729 }
730  * @endcode
731  *
732  */
733 const char *appsvc_get_data(bundle *b, const char *key);
734
735 /**
736  * @par Description:
737  * This function gets value from key.
738  *
739  * @param[in] b bundle object 
740  * @param[in] key key
741  * @param[out] len length of array
742  *
743  * @return Pointer for value string array if success, NULL if fail
744  *
745  * @pre None.
746  * @post None.
747  * @see None.
748  * @remarks None. 
749  *
750  * @par Sample code:
751  * @code
752 #include <appsvc.h>
753
754 ...
755 {
756         char **val_array;       
757         int len;
758         char *val;
759
760         if(appsvc_data_is_array(b, APPSVC_DATA_SELECTED))
761                 val_array = appsvc_get_data_array(b, APPSVC_DATA_SELECTED, &len);
762         else 
763                 val = appsvc_get_data(b, APPSVC_DATA_SELECTED);
764 }
765  * @endcode
766  *
767  */
768 const char **appsvc_get_data_array(bundle *b, const char *key, int *len);
769
770 /**
771  * @par Description:
772  * This API create appsvc result bundle based on bundle received in reset event.
773  *
774  * @param[in] inb bundle received in reset event 
775  * @param[in] outb bundle to use for returning result 
776  *
777  * @retval APPSVC_RET_OK - success
778  * @retval APPSVC_RET_ERROR - general error 
779  * @retval APPSVC_RET_EINVAL - invalid argument(content)
780  *
781  * @pre None.
782  * @post None.
783  * @see appsvc_send_result.
784  * @remarks None. 
785  *
786  * @par Sample code:
787  * @code
788 #include <appsvc.h>
789
790 ...
791 {
792         struct appdata *ad = data;
793         bundle* res_bundle;
794         
795         appsvc_create_result_bundle(ad->b,&res_bundle);
796         bundle_add(res_bundle, "result", "1");
797         appsvc_send_result(res_bundle, 0);
798 }
799  * @endcode
800  *
801  */
802 int appsvc_create_result_bundle(bundle *inb, bundle **outb);
803
804 /**
805  * @par Description:
806  * This API send appsvc result to caller with bundle.
807  *
808  * @param[in] b Result data in bundle format
809  * @param[in] result result value
810  *
811  * @retval APPSVC_RET_OK - success
812  * @retval APPSVC_RET_ERROR - general error 
813  * @retval APPSVC_RET_EINVAL - invalid argument(content)
814  *
815  * @pre appsvc_create_result_bundle.
816  * @post None.
817  * @see appsvc_send_result.
818  * @remarks None. 
819  *
820  * @par Sample code:
821  * @code
822 #include <appsvc.h>
823
824 ...
825 {
826         struct appdata *ad = data;
827         bundle* res_bundle;
828         
829         appsvc_create_result_bundle(ad->b,&res_bundle);
830         bundle_add(res_bundle, "result", "1");
831         appsvc_send_result(res_bundle, 0);
832 }
833  * @endcode
834  *
835  */
836 int appsvc_send_result(bundle *b, appsvc_result_val result);
837
838 /**
839  * @par Description:
840  * This API set the default application(package name) associated with op, uri and mime-type.
841  *
842  * @param[in] op                operation
843  * @param[in] mime_type mime-type
844  * @param[in] scheme    scheme of uri
845  * @param[in] defapp    default application
846  *
847  * @retval APPSVC_RET_OK - success
848  * @retval APPSVC_RET_ERROR - general error 
849  * @retval APPSVC_RET_EINVAL - invalid argument(content)
850  *
851  * @pre None.
852  * @post None.
853  * @see None.
854  * @remarks None. 
855  *
856  * @par Sample code:
857  * @code
858 #include <appsvc.h>
859
860 ...
861 {
862         appsvc_set_defapp(APPSVC_OPERATION_VIEW, NULL,"http", "org.tizen.mybrowser");
863 }
864  * @endcode
865  *
866  */
867 int appsvc_set_defapp(const char *op, const char *mime_type, const char *uri,
868                                 const char *defapp, uid_t uid);
869
870 /**
871  * @par Description:
872  * This API unset the default application(package name) associated with op, uri and mime-type.
873  *
874  * @param[in] defapp    default application
875  *
876  * @retval APPSVC_RET_OK - success
877  * @retval APPSVC_RET_ERROR - general error 
878  *
879  * @pre None.
880  * @post None.
881  * @see None.
882  * @remarks None. 
883  *
884  * @par Sample code:
885  * @code
886 #include <appsvc.h>
887
888 ...
889 {
890         appsvc_unset_defapp("org.tizen.test");
891 }
892  * @endcode
893  *
894  */
895 int appsvc_unset_defapp(const char *defapp, uid_t uid);
896
897 /**
898  * @par Description:
899  *      This API ask a application is default application or not.
900  *
901  * @param[in]   pkg_name        application package name
902  * @return      true / false
903  * @retval      1       app_name is default application in appsvc.
904  * @retval      0       app_name is NOT default application in appsvc.
905  *
906   * @pre None.
907   * @post None.
908   * @see None.
909   * @remarks None. 
910   *
911   * @par Sample code:
912   * @code
913 #include <appsvc.h>
914  
915  ...
916
917  * int is_defapp_browser_app()
918  * { 
919  *      return appsvc_is_defapp("org.tizen.browser");
920  * }
921  *
922  * @endcode
923  * @remark
924  *      None
925
926 */
927 int appsvc_is_defapp(const char *appid, uid_t uid);
928
929 /**
930  * @par Description:
931  *      This API ask a extra data is array or not.
932  *
933  * @param[in] b bundle object 
934  * @param[in] key key of extra data 
935  * @return      true / false
936  * @retval      1       a extra data is array.
937  * @retval      0       a extra data is not array.
938  *
939   * @pre None.
940   * @post None.
941   * @see None.
942   * @remarks None. 
943   *
944   * @par Sample code:
945   * @code
946 #include <appsvc.h>
947  
948  ...
949
950  * int appsvc_data_is_array(bundle *b, char *key)
951  * {
952  *      return appsvc_data_is_array(b, key);
953  * }
954  *
955  * @endcode
956  * @remark
957  *      None
958
959 */
960 int appsvc_data_is_array(bundle *b, const char *key);
961
962 int appsvc_subapp_terminate_request_pid(int pid);
963
964 /**
965  * @par Description:
966  * This function sets an uri to launch application based on appsvc.
967  *
968  * @param[in] b bundle object
969  * @param[in] char *mode
970  *
971  * @return 0 if success, negative value(<0) if fail
972  * @retval APPSVC_RET_OK - success
973  * @retval APPSVC_RET_ERROR - general error
974  * @retval APPSVC_RET_EINVAL - invalid argument(content)
975  *
976  * @pre None.
977  * @post None.
978  * @see None.
979  * @remarks None.
980  *
981  * @par Sample code:
982  * @code
983 #include <appsvc.h>
984
985 ...
986 {
987         appsvc_set_launch_mode(app_control->data, mode);
988 }
989  * @endcode
990  *
991  */
992 int appsvc_set_launch_mode(bundle *b, const char *mode);
993
994 /**
995  * @par Description:
996  * This function sets an uri to launch application based on appsvc.
997  *
998  * @param[in] b bundle object
999  *
1000  * @return Pointer for launch mode string if success, NULL if fail
1001  *
1002  * @pre None.
1003  * @post None.
1004  * @see None.
1005  * @remarks None.
1006  *
1007  * @par Sample code:
1008  * @code
1009 #include <appsvc.h>
1010
1011 ...
1012 {
1013         appsvc_get_launch_mode(app_control->data);
1014 }
1015  * @endcode
1016  *
1017  */
1018 const char *appsvc_get_launch_mode(bundle *b);
1019
1020 int aul_svc_subscribe_launch_result(bundle *b, const char *event);
1021 #ifdef __cplusplus
1022         }
1023 #endif
1024
1025 /**
1026  * @}
1027  */
1028 /**
1029  * @}
1030  */
1031
1032
1033 #endif          /* __APP_SVC_H__ */
1034
1035 /* vi: set ts=8 sts=8 sw=8: */