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