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