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