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