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