4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>, Jaeho Lee <jaeho81.lee@samsung.com>
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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.
36 * This is new version of Application Utility Library
38 * Almost function's input param is application package name(APN).\n
39 * APN is application package name which is set by developer.\n
40 * In case of in-house application, prefix is org.tizen.\n
41 * It is different from debian package name.\n
43 * - Debian Package Name : Name which is managed by package manager
44 * - Application Package Name : Name which is used by AUL
45 * - Execution Path : real program executable path
50 * @ingroup APPLICATION_FRAMEWORK
51 * @defgroup aul Application Utility Library
58 * @brief Application Utility Library header
60 * Patched by Knhoon Baik <knhoon.baik@samsung.com>
61 * Patched by Youmin Ha <youmin.ha@samsung.com>
70 * @brief Return values in AUL.
72 typedef enum _aul_return_val {
73 AUL_R_LOCAL = -7, /**< Launch by himself */
74 AUL_R_ETIMEOUT = -6, /**< Timeout */
75 AUL_R_ECANCELED = -5, /**< Operation canceled */
76 AUL_R_EINVAL = -4, /**< Invalid argument */
77 AUL_R_ECOMM = -3, /**< Comunication Error */
78 AUL_R_ENOINIT = -2, /**< AUL handler NOT initialized */
79 AUL_R_ERROR = -1, /**< General error */
80 AUL_R_OK = 0 /**< General success */
86 * @defgroup aul_launch Primitive APIs to launch/resume/terminate application
89 * APIs to launch/resume/terminate application
90 * - Launch application based on application package name
91 * - Resume application based on application package name
92 * - Resume application based on pid (required root or inhouse permisssion)
93 * - Terminate application base on pid (required root or inhouse permission)
95 * AUL internal information
96 * - AUL grant pid, gid to launched application for security
97 * - AUL send RESET/RESUME/TERM event for running application in case of single instance
98 * - AUL set application enviroment based on desktop entry
99 * - AUL support single instance / multi instance
100 * - AUL support application data exchange format (bundle)
104 * @addtogroup aul_launch
108 typedef enum _aul_type{
114 /** AUL internal private key */
115 #define AUL_K_PKG_NAME "__AUL_PKG_NAME__"
116 /** AUL internal private key */
117 #define AUL_K_WAIT_RESULT "__AUL_WAIT_RESULT__"
118 /** AUL internal private key */
119 #define AUL_K_SEND_RESULT "__AUL_SEND_RESULT__"
120 /** AUL internal private key */
121 #define AUL_K_TASK_MANAGE "__AUL_TASK_MANAGE__"
122 /** AUL internal private key */
123 #define AUL_K_APP_TYPE "__AUL_APP_TYPE__"
124 /** AUL internal private key - To check original caller's identity */
125 #define AUL_K_ORG_CALLER_PID "__AUL_ORG_CALLER_PID__"
126 /** AUL internal private key - To check forwarded callee app's pid */
127 #define AUL_K_FWD_CALLEE_PID "__AUL_FWD_CALLEE_PID__"
129 /** AUL public key - To check caller's secuirty */
130 #define AUL_K_CALLER_PID "__AUL_CALLER_PID__"
131 /** AUL public key - To check callee's secuirty */
132 #define AUL_K_CALLEE_PID "__AUL_CALLEE_PID__"
134 /** AUL public key - To find argv0 */
135 #define AUL_K_ARGV0 "__AUL_ARGV0__"
136 /** AUL public key - To measure launching time */
137 #define AUL_K_STARTTIME "__AUL_STARTTIME__"
139 /** AUL public key - To support launching based on mime type */
140 #define AUL_K_MIME_TYPE "__AUL_MIME_TYPE__"
141 /** AUL public key - To support launching based on mime type */
142 #define AUL_K_UNALIASED_MIME_TYPE "__AUL_UNALIASED_MIME_TYPE__"
143 /** AUL public key - To support launching based on mime type */
144 #define AUL_K_MIME_CONTENT "__AUL_MIME_CONTENT__"
146 /** AUL public key - To support launching based on service */
147 #define AUL_K_SERVICE_NAME "__AUL_SERVICE_NAME__"
149 /** AUL public key - To force launch app selector instead of lauchingn default app */
150 #define AUL_K_FORCE_LAUNCH_APP_SELECTOR "__AUL_FORCE_LAUNCH_APP_SELECTOR__"
152 /** AUL public key - To support SDK */
153 #define AUL_K_SDK "__AUL_SDK__"
156 * @brief This is callback function for aul_launch_init
157 * @param[in] type event's type received from system
158 * @param[in] b In case of RESET events, bundle which is received from peer
159 * @param[in] data user-supplied data
161 typedef int (*aul_handler_fn) (aul_type type, bundle * b, void *data);
165 * This API install your AUL handler and setup AUL internal connection.
167 * AUL receive START(RESET), RESUME, TERMINATE events from system.\n
168 * This API use to handle the events. \n
169 * @par Typical use case:
170 * In general, you need not use this API.
171 * If you use AppCore, you should NOT use this API.
172 * AppCore will set default aul_handler.
174 * @param[in] handler aul main callback handler function
175 * @param[in] data user-supplied data for start_handler
176 * @return 0 if success, negative value(<0) if fail\n
177 * @retval AUL_R_OK - success
178 * @retval AUL_R_ECANCELD - aul handler was installed already by others
179 * @retval AUL_R_ECOMM - error to create internal ipc
180 * @retval AUL_R_ERROR - error to attach glib main loop or ecore main loop
182 * @warning If you use AppCore, you should NOT use this API.\n
183 * You need glib main loop or ecore main loop.\n
185 * you must have aul handler to use this API.
186 * aul_luanch_init register aul handler.
193 * #include <bundle.h>
195 * static int aul_handler(aul_type type, bundle *kb,void *data)
200 * // process RESET event
203 * // process RESUME event
205 * case AUL_TERMINATE:
206 * // preocess TERMINATE event
212 * int main(int argc, char **argv)
215 * aul_launch_init(aul_handler,NULL);
216 * aul_launch_argv_handler(argc, argv);
217 * ecore_main_loop_begin();
224 int aul_launch_init(aul_handler_fn handler, void *data);
228 * This API create internal RESET events with given argc, argv \n
230 * This API's purpose is to generate reset event.
231 * If you want to generate local RESET events with argument vector format, use this API
232 * @par Typical use case:
233 * In general, you need not use this API.
234 * AppCore use this API to create internal reset event.
236 * @param[in] argc # of args
237 * @param[in] argv list of arg strings
238 * @return 0 if success, negative value(<0) if fail
239 * @retval AUL_R_OK - success
240 * @retval AUL_R_ENOINIT - aul handler was NOT yet installed
241 * @retval AUL_R_ECANCLED - error to create internal bundle with given argc,argv.
242 * @retval AUL_R_ERROR - general error
245 * you must have aul handler to use this API.
246 * aul_luanch_init register aul handler.
253 * #include <bundle.h>
255 * int send_local_reset_event()
259 * argv[0] = "local.app";
260 * argv[1] = "event_type";
261 * argv[2] = "my_reset";
263 * aul_launch_argv_handler(argc,argv);
268 * If you use AppCore, you NEED NOT use this API.
270 int aul_launch_argv_handler(int argc, char **argv);
274 * This API creates internal RESET events with given bundle \n
276 * This API's purpose is to generate reset event.
277 * If you want to generate local RESET events with argument vector format, first use
278 * bundle_import_from_argv to create a bundle from the argument vector and then use this API
279 * Eventually, this API will replace aul_launch_argv_handler().
280 * @par Typical use case:
281 * In general, you need not use this API.
282 * AppCore use this API to create internal reset event.
284 * @param[in] b bundle
285 * @return 0 if success, negative value(<0) if fail
286 * @retval AUL_R_OK - success
287 * @retval AUL_R_ENOINIT - aul handler was NOT yet installed
288 * @retval AUL_R_ERROR - general error
291 * you must have aul handler to use this API.
292 * aul_luanch_init register aul handler.
296 * aul_launch_init, bundle_import_from_argv
299 * #include <bundle.h>
301 * int send_local_reset_event()
306 * argv[0] = "local.app";
307 * argv[1] = "event_type";
308 * argv[2] = "my_reset";
311 * b = bundle_import_from_argv(argc,argv);
312 * aul_launch_local(b);
317 * If you use AppCore, you NEED NOT to use this API.
319 int aul_launch_local(bundle *b);
323 * This API launches application with the given bundle.
324 * If the application is not running or a multiple-instance one, this API launches with the given bundle.
325 * If the application is running, this API sends a RESET event to the App.
326 * While the application is running, if the application cannot receive the RESET event,
327 * this API returns a general error(AUL_R_ERROR).\n
329 * This API is for caller.
330 * This API's purpose is to launch/reset application with given bundle.
331 * @par Typical use case:
332 * If you know the target application's pkgname and bundle types,
333 * you can use this API to launch/reset the application.
335 * @param[in] pkgname package name to be run as callee
336 * @param[in] kb bundle to be passed to callee
337 * @return callee's pid if success, negative value(<0) if fail
338 * @retval AUL_R_OK - success
339 * @retval AUL_R_EINVAL - invaild package name
340 * @retval AUL_R_ECOM - internal AUL IPC error
341 * @retval AUL_R_ERROR - general error
351 * #include <bundle.h>
353 * int launch_inhouse_contact_app()
356 * b = bundle_create();
357 * bundle_add(b,"type","SIM");
358 * aul_launch_app("org.tizen.contact",b);
365 int aul_launch_app(const char *pkgname, bundle *kb);
369 * This API launches application, as menu screen launches the app.
370 * Thus, if the applocation is running, this API sends a RESUME event to the app.
371 * If the application is not running, this API launches the app.
372 * While the application is running, if the application cannot receive the RESUME event,
373 * AUL tries to raise the application's default window.
376 * This API is for caller.
377 * This API's purpose is to resume/launch application
378 * @par Typical use case:
379 * If you only want to show application with previous state or default state, Use this API.
381 * @param[in] pkgname package name to be resume as callee
382 * @return callee's pid if success, negative value(<0) if fail
383 * @retval AUL_R_OK - success
384 * @retval AUL_R_EINVAL - invaild package name
385 * @retval AUL_R_ECOM - internal AUL IPC error
386 * @retval AUL_R_ERROR - general error
393 * aul_launch_app, aul_app_is_running, aul_resume_pid
396 * #include <bundle.h>
398 * int open_inhouse_contact_app()
400 * if(aul_app_is_running("org.tizen.contact"))
401 * aul_open_app("org.tizen.contact");
406 * If you don't want to launch the app,
407 * you should check app's running state with aul_app_is_running.
408 * This API will launch the application if the application is not running.
410 int aul_open_app(const char *pkgname);
414 * This API trigger to resume application
415 * If the application is running, this API send a resume event to the App.
416 * If the application is not running or multiple instance, this API launch App. with bundle.
417 * Although the application is running, if the application cannot receive resume event,
418 * AUL try to raise the application's default windows.
420 * This API is for caller.
421 * This API's purpose is to send resume event or to launch application
422 * @par Typical use case:
423 * If you only want to show application with previous state or default state, Use this API.
425 * @param[in] pkgname package name to be resume as callee
426 * @param[in] kb bundle to be passed to callee in case of launching app
427 * @return callee's pid if success, negative value(<0) if fail
428 * @retval AUL_R_OK - success
429 * @retval AUL_R_EINVAL - invaild package name
430 * @retval AUL_R_ECOM - internal AUL IPC error
431 * @retval AUL_R_ERROR - general error
438 * aul_launch_app, aul_app_is_running, aul_resume_pid
440 * This function will be deprecated. Use aul_open_add() instead.
443 * #include <bundle.h>
445 * int resume_inhouse_contact_app()
447 * if(aul_app_is_running("org.tizen.contact"))
448 * aul_resume_app("org.tizen.contact",NULL);
453 * If you don't want to launch the app,
454 * you should check app's running state with aul_app_is_running.
455 * This API will launch the application if the application is not running.
456 * If you want to only resume without launching in multiple instance application model,
457 * you should use aul_resume_pid.
459 int aul_resume_app(const char *pkgname, bundle *kb)
460 __attribute__ ((__deprecated__));
464 * This API trigger to resume application
465 * If the application is running, this API send a resume event to the App.
466 * If the application is not running, this API return AUL_R_ERROR.
467 * Although the application is running, if the application cannot receive resume event,
468 * AUL try to raise the application's default windows.
470 * This API is for caller.
471 * This API's purpose is to send resume event.
472 * @par Typical use case:
473 * In multiple application model, If you want to only resume specific application, Use this API
475 * @param[in] pid application's pid to be resumed
476 * @return 0 if success, negative value(<0) if fail
477 * @retval AUL_R_OK - success
478 * @retval AUL_R_EINVAL - invaild pid
479 * @retval AUL_R_ECOM - internal AUL IPC error
480 * @retval AUL_R_ERROR - general error (include application is not running)
481 * @warning This API need to require root or inhouse permisssion \n
482 * If you have not the permission, this API return AUL_R_ERROR. \n
491 * #include <bundle.h>
493 * int iterfunc(const aul_app_info *info, void *data)
495 * if(strcmp(info->pkg_name,"org.tizen.contact")==0)
496 * aul_resume_pid(info->pid);
499 * int iterate_running_apps()
501 * return aul_app_get_running_app_info(iterfunc,NULL);
508 int aul_resume_pid(int pid);
512 * This API trigger to terminate application
514 * If the application is running, this API send a terminate event to the App. \n
515 * If the app cannot receive the event, AUL kill forcely the application.\n
517 * This API's purpose is to kill application
518 * @par Typical use case:
519 * In general, Application like Task Manager use this API.
521 * This API need to require root or inhouse permisssion. \n
523 * @param[in] pid application's pid to be terminated
524 * @return 0 if success, negative value(<0) if fail
525 * @retval AUL_R_OK - success
526 * @retval AUL_R_EINVAL - invaild pid
527 * @retval AUL_R_ECOM - internal AUL IPC error
528 * @retval AUL_R_ERROR - general error
529 * @warning This API need to require root or inhouse permisssion. \n
539 * #include <bundle.h>
541 * int iterfunc(const aul_app_info *info, void *data)
543 * if(strcmp(info->pkg_name,"org.tizen.contact")==0)
544 * aul_terminate_pid(info->pid);
547 * int iterate_running_apps()
549 * return aul_app_get_running_app_info(iterfunc,NULL);
554 * If you have not the permission, this API return AUL_R_ERROR. \n
556 int aul_terminate_pid(int pid);
561 * @defgroup aul_info Helper APIs to get running application information
564 * API to get running application information (state, executable path, ..)
565 * - get application package name from pid
566 * - get application running state
567 * - get application list of runnning applications
571 * @addtogroup aul_info
576 *@brief Running application's information structure retrieved by AUL
578 typedef struct _aul_app_info {
579 int pid; /**< app's pid if running*/
580 char* pkg_name; /**< APN (application package name) */
581 char* app_path; /**< application excutable path */
585 * @brief iterator function running with aul_app_get_running_app_info
586 * @param[out] ainfo aul_app_info retreived by aul_app_get_running_app_info
587 * @param[out] data user-supplied data
589 typedef int (*aul_app_info_iter_fn)(const aul_app_info *ainfo, void *data);
593 * This API ask a application is running by application package name.
595 * To know whether some application is running or not, use this API
596 * @par Typical use case:
597 * For example, If you want to know browser application running,
598 * you can check it by using this API.
600 * @param[in] pkgname application package name
601 * @return true / false
602 * @retval 1 app_name is running now.
603 * @retval 0 app_name is NOT running now.
614 * int is_running_browser_app()
616 * return aul_app_is_running("org.tizen.browser");
624 int aul_app_is_running(const char *pkgname);
628 * This API use to get running application list.
629 * This API call iter_fn with each aul_app_info of running apps when running application is found.
631 * If you want to get running application list, use this API
632 * This API give you running applications which has SLP desktop file.
633 * @par Typical use case:
634 * In general, this API is used by task manager appllication. (running application list viewer)
636 * @param[in] iter_fn iterator function
637 * @param[in] data user-supplied data for iter_fn
638 * @return 0 if success, negative value(<0) if fail
639 * @retval AUL_R_OK - success
640 * @retval AUL_R_ERROR - internal error
651 * int iterfunc(const aul_app_info* info, void* data)
653 * printf("\t==========================\n");
654 * printf("\t pkg_name: %s\n", info->pkg_name);
655 * printf("\t app_path: %s\n", info->app_path);
656 * printf("\t running pid: %d\n", info->pid);
657 * printf("\t==========================\n");
661 * int iterate_running_apps()
663 * return aul_app_get_running_app_info(iterfunc,NULL);
668 * This API should use if you want to know running application which has desktop files.
669 * If you want to get all process list, you must iterate process information by using proc filesystem
670 * Or, If you want to get all window list, you must iterate XWindows by using XWindow APIs
672 int aul_app_get_running_app_info(aul_app_info_iter_fn iter_fn, void *data);
676 * This API get application package name by pid
678 * If you want to get package name of running application, use this API
679 * @par Typical use case:
680 * In general, You can use this API when you want to know caller's information.
682 * @param[in] pid given pid
683 * @param[out] pkgname pkgname to be get
684 * @param[in] len length of pkgname
685 * @return 0 if success, negative value(<0) if fail
686 * @retval AUL_R_OK - success
687 * @retval AUL_R_ERROR - no such a package name
696 * #include <bundle.h>
698 * static int app_reset(bundle *b, void *data)
703 * pid = atoi(bundle_get_val(b,AUL_K_CALLER_PID));
704 * aul_app_get_pkgname_bypid(pid, appname, sizeof(appname));
711 int aul_app_get_pkgname_bypid(int pid, char *pkgname, int len);
716 * @defgroup aul_mime High-level APIs to launch default application based on mime type
719 * AUL High-level APIs based on mime type
721 * These APIs provide two functionality\n
723 * -# To launch default application to open a file based on its MIME type \n
724 * For example, you can launch the default video player to open .mp4 files
725 * or launch the default browser to open HTML files \n
726 * -# To launch default application to process given content \n
727 * For example, you can launch the default e-mail application to process
728 * "nice@samsung.com" e-mail address.
732 * @addtogroup aul_mime
738 * This API launch application associated with given filename
740 * This API is for caller.
741 * This API launch application based on mime type.
742 * This API find mime_type associated with file name,
743 * and then find default app associated with found mime_type
744 * and then launch the app with filename argument.
745 * @par Typical use case:
746 * You can launch application to process given filename.
747 * That is, Even if you don't know the specific application's pkgname,
748 * you can launch the applicaiton processing given filename .
749 * For example, If you want to process image file, you can simply launch image viewer.
750 * At that time, you can use this APIs like aul_open_file("myimage.jpg");
752 * @param[in] filename filename
753 * @return callee's pid or 0 if success, negative value if fail\n
754 * (when no found default app, return 0)
755 * @retval AUL_R_OK - success
756 * @retval AUL_R_EINVAL - invalid argument(filename)
757 * @retval AUL_R_ECOM - internal AUL IPC error
758 * @retval AUL_R_ERROR - general error
769 * int view_image_file(char *filename)
771 * aul_open_file(filename);
779 int aul_open_file(const char* filename) __attribute__((deprecated));
783 * This API launch application associated with given specific mimetype
785 * This API is for caller.
786 * This API launch application based on mime type like aul_open_file API.
787 * But, This API don't find mime_type associated with file name.
788 * This API use mimetype given by user. By using given mimetype, find default application.
789 * and then launch the app with filename argument.
790 * @par Typical use case:
791 * Some files cannot extract exact mimetype automatically.
792 * For example, To know mime type of files with DRM lock, first we should unlock DRM file.
793 * In this case, You can use this API.
794 * First, unlock DRM file, and extract mimetype from unlock file by using aul_get_mime_from_file,
795 * and then, use this API with DRM file and extracted mime type.
797 * @param[in] filename filename
798 * @param[in] mimetype specific mimetype
799 * @return callee's pid or 0 if success, negative value if fail\n
800 * (when no found default app, return 0)
801 * @retval AUL_R_OK - success
802 * @retval AUL_R_EINVAL - invalid argument(filename,mimetype)
803 * @retval AUL_R_ECOM - internal AUL IPC error
804 * @retval AUL_R_ERROR - general error
811 * aul_open_file, aul_get_mime_from_file
815 * int view_drm_image_file(char *drm_filename)
818 * // you must implement this function
819 * mimetype = get_mimetype_from_drmfile(drm_filename);
821 * aul_open_file_with_mimetype(drm_filename,mimetype);
828 int aul_open_file_with_mimetype(const char *filename, const char *mimetype) __attribute__((deprecated));
832 * This API launch application associated with content like "http://www.samsung.com"
834 * This API is for caller.
835 * This API launch application based on mime type.
836 * This API find mime_type associated with content,
837 * and then find default app associated with found mime_type,
838 * and then launch the app with content argument.
839 * @par Typical use case:
840 * You can launch application to process given content.
841 * That is, Even if you don't know the specific application's pkgname,
842 * you can launch the applicaiton processing given content.
843 * For example, If you want to process URL "http://www.samsung.com",
844 * you can simply launch browser.
845 * At that time, you can use this APIs like aul_open_content("http://www.samsung.com");
847 * @param[in] content content
848 * @return callee's pid or 0 if success, negative value if fail\n
849 * (when no found default app, return 0)
850 * @retval AUL_R_OK - success
851 * @retval AUL_R_EINVAL - invalid argument(content)
852 * @retval AUL_R_ECOM - internal AUL IPC error
853 * @retval AUL_R_ERROR - general error or no found mimetype
864 * int view_url(char *url)
866 * aul_open_content(url);
874 int aul_open_content(const char* content) __attribute__((deprecated));
878 * This API get the default application(package name) associated with MIME type
880 * This API use to get default application associteted with mimetype
881 * In general, Setting Application need this API.
882 * @par Typical use case:
883 * Setting Application show mapping of default application / mimetype
885 * @param[in] mimetype a mime type
886 * @param[out] defapp a application package name of the app
887 * @param[in] len length of defapp
888 * @return 0 if success, negative value if fail
889 * @retval AUL_R_OK - success
890 * @retval AUL_R_EINVAL - invalid argument(mimetype)
891 * @retval AUL_R_ERROR - general error or no found mimetype
898 * aul_set_defapp_with_mime
902 * void get_text_html_defapp()
905 * aul_get_defapp_from_mime("text/html",appname,sizeof(appname));
913 int aul_get_defapp_from_mime(const char *mimetype, char *defapp, int len) __attribute__((deprecated));
917 * This API set the default application(package name) associated with MIME type
919 * This API use to change default application associteted with mimetype
920 * In general, Setting Application or Installer need this API.
921 * @par Typical use case:
922 * Default Application associated with mimetype can be changed by Setting Application or installer
923 * So, application to process specific mimetype can be substituted.
925 * @param[in] mimetype a mime type
926 * @param[in] defapp a application package name of the app to be set
927 * @return 0 if success, negative value if fail
928 * @retval AUL_R_OK - success
929 * @retval AUL_R_EINVAL - invalid argument(mimetype)
930 * @retval AUL_R_ERROR - general error
937 * aul_get_defapp_from_mime
941 * void set_text_html_defapp()
943 * aul_set_defapp_with_mime("text/html","org.tizen.browser");
950 int aul_set_defapp_with_mime(const char *mimetype, const char *defapp) __attribute__((deprecated));
954 * This API get the mimetype associated with filename
956 * This API use to get mimetype associteted with given filename
957 * In general, This API use when you want to know only mimetype given filename.
958 * @par Typical use case:
959 * For example, In trasfering data through bluetooth,
960 * additional information like mimetype should be added.
961 * In such situation, You can get mimetype by using this API.
963 * @param[in] filename file name
964 * @param[out] mimetype a mime type
965 * @param[in] len length of mimetype
966 * @return 0 if success, negative value if fail
967 * @retval AUL_R_OK - success
968 * @retval AUL_R_EINVAL - invalid argument(filename)
969 * @retval AUL_R_ERROR - general error
980 * void get_mimetype()
982 * char mimetype[255];
983 * aul_get_mime_from_file("image.jpg",mimetype,sizeof(mimetype));
990 int aul_get_mime_from_file(const char *filename, char *mimetype, int len);
994 * This API get the mimetype associated with given content
996 * This API use to get mimetype associteted with given content
997 * In general, This API use when you want to know only mimetype given content
998 * @par Typical use case:
999 * For example, In trasfering data through bluetooth,
1000 * additional information like mimetype should be added.
1001 * In such situation, You can get mimetype by using this API.
1003 * @param[in] content content string like "011-0000-0000"
1004 * @param[out] mimetype a mime type
1005 * @param[in] len length of mimetype
1006 * @return 0 if success, negative value if fail
1007 * @retval AUL_R_OK - success
1008 * @retval AUL_R_EINVAL - invalid argument(content)
1009 * @retval AUL_R_ERROR - general error
1020 * void get_mimetype()
1022 * char mimetype[255];
1023 * aul_get_mime_from_content("http://www.samsung.com",mimetype,sizeof(mimetype));
1030 int aul_get_mime_from_content(const char *content, char *mimetype, int len);
1034 * This API get the icon's name associated with given mimetype
1036 * This API use to get icon's name associteted with given mimetype
1037 * @par Typical use case:
1038 * If you want to show mimetype's icon, use this API.
1040 * @param[in] mimetype a mime type
1041 * @param[out] iconname icon's name
1042 * @param[in] len length of iconname
1043 * @return 0 if success, negative value if fail
1044 * @retval AUL_R_OK - success
1045 * @retval AUL_R_EINVAL - invalid argument(content)
1046 * @retval AUL_R_ERROR - general error (no such mime type)
1057 * void get_mime_icon()
1060 * aul_get_mime_icon("text/html",icon,sizeof(icon));
1067 int aul_get_mime_icon(const char *mimetype, char *iconname, int len);
1071 * This API get the extensions associated with given mimetype
1073 * This API use to get extensions associteted with given mimetype
1074 * @par Typical use case:
1075 * In general, user is not familiar with mimetype(text/html),
1076 * user is familiar with extenstions(*.html, *.htm)
1077 * So, To show mimetype information to user, use this API
1079 * @param[in] mimetype a mime type
1080 * @param[out] extlist extentions (ex> mpeg,mpg,mpe)
1081 * @param[in] len length of extlist
1082 * @return 0 if success, negative value if fail
1083 * @retval AUL_R_OK - success
1084 * @retval AUL_R_EINVAL - invalid argument(mimetype)
1085 * @retval AUL_R_ERROR - general error (no mimetype or no extenstion)
1092 * aul_get_mime_description
1096 * void get_extension()
1098 * char extlist[255];
1099 * aul_get_mime_extension("text/html",extlist,sizeof(extlist));
1104 * Some mimetype don't have extension.
1105 * In that case, You can use aul_get_mime_description.
1108 int aul_get_mime_extension(const char *mimetype, char *extlist, int len);
1112 * This API get the description associated with given mimetype
1114 * This API use to get description associteted with given mimetype
1115 * @par Typical use case:
1116 * In general, user is not familiar with mimetype(text/html),
1117 * user is familiar with well-knowing information like extenstions(*.html, *.htm)
1118 * But, some mimetype don't have extenstion.
1119 * At that time,to show mimetype information to user, use this API
1121 * @param[in] mimetype a mime type
1122 * @param[out] desc description (ex> Call client)
1123 * @param[in] len length of desc
1124 * @return 0 if success, negative value if fail
1125 * @retval AUL_R_OK - success
1126 * @retval AUL_R_EINVAL - invalid argument(mimetype)
1127 * @retval AUL_R_ERROR - general error (no mimetype or no descrition)
1134 * aul_get_mime_extension
1138 * void get_information_from_mime()
1141 * if(aul_get_mime_extension("text/html",info,sizeof(info))<0){
1142 * aul_get_mime_description("text/html",info,sizeof(info));
1150 int aul_get_mime_description(const char *mimetype, char *desc, int len);
1152 /************************************************************************************************/
1153 /* Example of aul_open_content or aul_open_file */
1154 /* voice call , browser , docview , image viewer , audio player, video player */
1156 /* voice call - aul_open_content("callto://011-1111-1111"); */
1157 /* browser - aul_open_content("http://www.naver.com"); */
1158 /* - aul_open_file("/opt/share/index.html"); */
1159 /* docview - aul_open_file("/opt/share/word.pdf"); */
1160 /* image view - aul_open_file("/opt/share/image.jpg"); */
1161 /* audio play - aul_open_file("/opt/share/audio.mp3"); */
1162 /* video play - aul_open_file("/opt/share/video.mpg"); */
1163 /************************************************************************************************/
1168 * @defgroup aul_service High-level APIs to launch applications based on service.
1171 * AUL High-level APIs based on service
1173 * This is Request/Response mechanism based on AUL like DBUS service call with auto-activation.\n
1174 * We recommend this APIs for requesting application service like camera application service (take_picture)
1175 * But, You can use other mechanism like DBUS service or your own internal IPC
1178 * Launch application based on service \n
1179 * If application is not running, AUL requests to reset the event.\n
1180 * Application can wait result with callback function.
1183 * After callee performs the requested operation, callee sends the result back, if necessary.\n
1188 * @addtogroup aul_service
1193 * @brief aul_service_res_fn is service result function
1194 * @param[out] b result bundle
1195 * @param[out] data user-supplied data
1197 typedef void (*aul_service_res_fn)(bundle *b, int reserved, void *user_data);
1201 * This API launch application based on service.
1203 * This API is for caller.
1204 * This API launch application based on service name.
1205 * This API find default application associated with service name.
1206 * and then launch the application with given bundle.
1207 * @par Typical use case:
1208 * You can launch application provided the service if you know service name.
1209 * That is, even if you don't know the specific application's pkgname,
1210 * you can launch the applicaiton by requesting the service.
1211 * For example, If you want to take a picture in your app, you can simply launch camera application.
1212 * At that time, you can use this API like aul_open_service(TAKE_PICTURE_SVC,..);
1215 * @param[in] svcname service name to launch as callee
1216 * @param[in] b bundle to be passed to callee
1217 * @param[in] cbfunc result callback function
1218 * @param[in] data user-supplied data passed to callback function
1219 * @return callee's pid if success, negative value(<0) if fail
1220 * @retval AUL_R_OK - success
1221 * @retval AUL_R_EINVAL - invaild service name
1222 * @retval AUL_R_ENOINIT - you must initilize aul library with aul_launch_init
1223 * @retval AUL_R_ECOM - internal AUL IPC error
1224 * @retval AUL_R_ERROR - general error
1234 * #include <aul_service.h>
1235 * #include <bundle.h>
1237 * void res_func(bundle *b, int reserved, void *user_data)
1239 * // process result bundle
1242 * int create_camera_view()
1244 * aul_open_service(TAKE_PICTURE_SVC, NULL, res_func, NULL);
1249 * This API can wait result (asynchronous).
1250 * To see kinds of default service provided by platform, see "aul_service.h" header file
1253 int aul_open_service(const char *svcname, bundle *b, aul_service_res_fn cbfunc, void *data) __attribute__((deprecated));
1257 * This API create service result bundle based on bundle received in reset event.
1259 * This API use to create result bundle to send it to caller.
1260 * @par Typical use case:
1261 * This API is for callee which provide application service.\n
1262 * To send result to caller, You must create result bundle. \n
1263 * Callee(application providing the service) can send result by using this API and aul_send_service_result.
1265 * @param[in] inb bundle received in reset event
1266 * @param[out] outb bundle to use for returning result
1267 * @return 0 if success, negative value(<0) if fail
1268 * @retval AUL_R_OK - success
1269 * @retval AUL_R_EINVAL - inb is not bundle created by aul_open_service
1270 * @retval AUL_R_ERROR - general error
1273 * To create result bundle, You need received original bundle.
1274 * The original bundle can get from app_reset handler.
1278 * aul_send_service_result
1281 * #include <bundle.h>
1283 * int app_reset(bundle *b, void *data)
1285 * ad->recved_bundle = bundle_dup(b);
1290 * bundle* res_bundle;
1291 * aul_create_result_bundle(ad->recved_bundle,&res_bundle);
1292 * bundle_add(res_bundle, "result", "1");
1293 * aul_send_service_result(res_bundle);
1300 int aul_create_result_bundle(bundle *inb, bundle **outb);
1304 * This API send service result to caller with bundle
1306 * This API is used to send result bundle to caller.
1307 * @par Typical use case:
1308 * This API is for callee which provide application service.\n
1309 * To send result to caller, You can use this API after creating result bundle. \n
1310 * Callee(application to provide service) can send result by using this API and aul_create_result_bundle.
1312 * @param[in] b Result data in bundle format
1313 * @return 0 if success, negative value(<0) if fail
1314 * @retval AUL_R_OK - success
1315 * @retval AUL_R_EINVAL - invalid result bundle
1316 * @retval AUL_R_ECOMM - internal AUL IPC error
1317 * @retval AUL_R_ERROR - general error
1320 * To send result bundle, You must create result bundle.
1321 * see aul_create_result_bundle
1325 * aul_create_result_bundle
1328 * #include <bundle.h>
1330 * int app_reset(bundle *b, void *data)
1332 * ad->recved_bundle = bundle_dup(b);
1337 * bundle* res_bundle;
1338 * aul_create_result_bundle(ad->recved_bundle,&res_bundle);
1339 * bundle_add(res_bundle, "result", "1");
1340 * aul_send_service_result(res_bundle);
1347 int aul_send_service_result(bundle *b);
1351 * This API set the default application(package name) associated with service name
1353 * This API use to change default application associteted with service name
1354 * In general, Setting Application needs this API.
1355 * @par Typical use case:
1356 * Default Application associated with service name can be changed by Setting Application
1357 * So, Inhouse service application can be substituted by 3rd party service application
1359 * @param[in] svcname service string like "create_contact"
1360 * @param[in] defapp default application like "org.tizen.contact"
1361 * @return 0 if success, negative value if fail
1362 * @retval AUL_R_OK - success
1363 * @retval AUL_R_EINVAL - invalid argument(content)
1364 * @retval AUL_R_ERROR - general error
1371 * aul_get_defapp_for_service
1374 * #include <aul_service.h>
1376 * void set_camera_service_defapp()
1378 * aul_set_defapp_for_service(TAKE_PICTURE_SVC,"org.tizen.camera");
1386 int aul_set_defapp_for_service(const char *svcname, const char *defapp) __attribute__((deprecated));
1390 * This API get the application package name associated with given service name
1392 * This API use to get default application associteted with service name
1393 * In general, Setting Application need this API.
1394 * @par Typical use case:
1395 * Setting Application show mapping of default application/ service
1397 * @param[in] svcname service string like "create_contact"
1398 * @param[out] defapp default application
1399 * @param[in] len length of defapp
1400 * @return 0 if success, negative value if fail
1401 * @retval AUL_R_OK - success
1402 * @retval AUL_R_EINVAL - invalid argument(content)
1403 * @retval AUL_R_ERROR - general error
1410 * aul_set_defapp_for_service
1413 * #include <aul_service.h>
1415 * void get_camera_service_defapp()
1417 * char appname[255];
1418 * aul_get_defapp_for_service(TAKE_PICTURE_SVC,appname,sizeof(appname));
1426 int aul_get_defapp_for_service(const char *svcname, char *defapp, int len) __attribute__((deprecated));
1438 #endif /* __AUL_H__ */
1440 /* vi: set ts=8 sts=8 sw=8: */