Sync to the latest code
[platform/core/appfw/ail.git] / include / ail.h
1 /*
2  * ail
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
25 #ifndef __AIL_H__
26 #define __AIL_H__
27
28 #include <stdbool.h>
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif /* __cplusplus */
33
34
35
36 /**
37  * @open
38  * @ingroup APPLICATION_FRAMEWORK
39  * @defgroup ail Application Information Library
40  */
41
42 /**
43  * @file       ail.h
44  * @brief      Application Information Library header
45  * @author     Sunghyuk Lee (sunghyuk.lee@samsung.com), Jin Yoon (jinny.yoon@samsung.com)
46  * @date       2011-07-30
47  * @version    0.1
48  */
49
50 /**
51  * @addtogroup ail
52  * @{
53  */
54
55 /**
56  * @brief string type properties
57  */
58 #define AIL_PROP_PACKAGE_STR                    "AIL_PROP_PACKAGE_STR"
59 #define AIL_PROP_EXEC_STR                       "AIL_PROP_EXEC_STR"
60 #define AIL_PROP_NAME_STR                       "AIL_PROP_NAME_STR"
61 #define AIL_PROP_TYPE_STR                       "AIL_PROP_TYPE_STR"
62 #define AIL_PROP_ICON_STR                       "AIL_PROP_ICON_STR"
63 #define AIL_PROP_CATEGORIES_STR                 "AIL_PROP_CATEGORIES_STR"
64 #define AIL_PROP_VERSION_STR                    "AIL_PROP_VERSION_STR"
65 #define AIL_PROP_MIMETYPE_STR                   "AIL_PROP_MIMETYPE_STR"
66 #define AIL_PROP_X_SLP_SERVICE_STR              "AIL_PROP_X_SLP_SERVICE_STR"
67 #define AIL_PROP_X_SLP_PACKAGETYPE_STR          "AIL_PROP_X_SLP_PACKAGETYPE_STR"
68 #define AIL_PROP_X_SLP_PACKAGECATEGORIES_STR    "AIL_PROP_X_SLP_PACKAGECATEGORIES_STR"
69 #define AIL_PROP_X_SLP_PACKAGEID_STR            "AIL_PROP_X_SLP_PACKAGEID_STR"
70 #define AIL_PROP_X_SLP_SVC_STR                  "AIL_PROP_X_SLP_SVC_STR"
71 #define AIL_PROP_X_SLP_EXE_PATH                 "AIL_PROP_X_SLP_EXE_PATH"
72 #define AIL_PROP_X_SLP_APPID_STR                "AIL_PROP_X_SLP_APPID_STR"
73 #define AIL_PROP_X_SLP_PKGID_STR                "AIL_PROP_X_SLP_PKGID_STR"
74 #define AIL_PROP_X_SLP_DOMAIN_STR               "AIL_PROP_X_SLP_DOMAIN_STR"
75 #define AIL_PROP_X_SLP_SUBMODEMAINID_STR                "AIL_PROP_X_SLP_SUBMODEMAINID_STR"
76 #define AIL_PROP_X_SLP_INSTALLEDSTORAGE_STR             "AIL_PROP_X_SLP_INSTALLEDSTORAGE_STR"
77
78 /**
79  * @brief integer type properties
80  */
81 #define AIL_PROP_X_SLP_TEMP_INT                 "AIL_PROP_X_SLP_TEMP_INT"
82 #define AIL_PROP_X_SLP_INSTALLEDTIME_INT        "AIL_PROP_X_SLP_INSTALLEDTIME_INT"
83
84 /**
85  * @brief boolean type properties
86  */
87 #define AIL_PROP_NODISPLAY_BOOL                 "AIL_PROP_NODISPLAY_BOOL"
88 #define AIL_PROP_X_SLP_TASKMANAGE_BOOL          "AIL_PROP_X_SLP_TASKMANAGE_BOOL"
89 #define AIL_PROP_X_SLP_MULTIPLE_BOOL            "AIL_PROP_X_SLP_MULTIPLE_BOOL"
90 #define AIL_PROP_X_SLP_REMOVABLE_BOOL           "AIL_PROP_X_SLP_REMOVABLE_BOOL"
91 #define AIL_PROP_X_SLP_ISHORIZONTALSCALE_BOOL   "AIL_PROP_X_SLP_ISHORIZONTALSCALE_BOOL"
92 #define AIL_PROP_X_SLP_ENABLED_BOOL             "AIL_PROP_X_SLP_ENABLED_BOOL"
93 #define AIL_PROP_X_SLP_SUBMODE_BOOL             "AIL_PROP_X_SLP_SUBMODE_BOOL"
94
95 /**
96  * @brief A handle for filters
97  */
98 typedef struct ail_filter *ail_filter_h;
99
100 /**
101  * @brief A handle for appinfos
102  */
103 typedef struct ail_appinfo *ail_appinfo_h;
104
105 /**
106  * @brief return values 
107  */
108 typedef enum {
109         AIL_ERROR_OK = 0,                                               /**< General success */
110         AIL_ERROR_FAIL = -1,                                    /**< General error */
111         AIL_ERROR_DB_FAILED = -2,                               /**< Database error */
112         AIL_ERROR_OUT_OF_MEMORY = -3,                   /**< Out of memory */
113         AIL_ERROR_INVALID_PARAMETER = -4,               /**< Invalid parameter */
114         AIL_ERROR_NO_DATA = -5,                                 /**< Success, but no data */
115 } ail_error_e;
116
117 /**
118  * @fn ail_error_e ail_filter_new(ail_filter_h *filter)
119  *
120  * @brief  Create a new filter handle which is used to filter records from Application Information Database. You can add filtering conditions to filter with ail_filter_add_xxx functions. All conditions are ANDed.
121  *
122  * @par Sync (or) Async : Synchronous API.
123  *
124  * @param[out] filter a pointer to a filter which is newly created
125  *
126  * @return 0 if success, negative value(<0) if fail\n
127  * @retval      AIL_ERROR_OK                                    success
128  * @retval      AIL_ERROR_INVALID_PARAMETER             invalid parameter
129  * @retval      AIL_ERROR_OUT_OF_MEMORY                 out of memory
130  *
131  * @pre None
132  * @post If the filter is no longer used, it should be freed with ail_filter_destroy()
133  *
134  * @see  ail_filter_destroy()
135  *
136  * @par Prospective Clients:
137  * External Apps.
138  *
139  * @code
140 int count_apps()
141 {
142         ail_filter_h filter;
143         ail_error_e ret;
144         int n;
145
146         ret = ail_filter_new(&filter);
147         if (ret != AIL_ERROR_OK) {
148                 return -1;
149         }
150
151         ret = ail_filter_add_bool(filter, AIL_PROP_NODISPLAY_BOOL, false);
152         if (ret != AIL_ERROR_OK) {
153                 return -1;
154         }
155
156         ret = ail_filter_add_str(filter, AIL_PROP_MIMETYPE_STR, "audio/wav");
157         if (ret != AIL_ERROR_OK) {
158                 return -1;
159         }
160
161         ret = ail_filter_count_appinfo(filter, &n);
162         if (ret != AIL_ERROR_OK) {
163                 return -1;
164         }
165         ret = ail_filter_destroy(filter);
166
167         printf("N of apps not to be displayed and supporting 'audo/wav' mime type = %d\n", n);
168
169         return n;
170 }
171  * @endcode
172  */
173 ail_error_e ail_filter_new(ail_filter_h *filter);
174
175
176
177 /**
178  * @fn ail_error_e ail_error_e ail_filter_add_int(ail_filter_h filter, const char *property, const int value)
179  *
180  * @brief Add integer condition to filter
181  *
182  * @par Sync (or) Async : Synchronous API
183  *
184  * @param[in] filter    a filter handle which can be create with ail_filter_new()
185  * @param[in] property          a property type of integer
186  * @param[in] value             the value to filter by
187  *
188  * @return 0 if success, negative value(<0) if fail\n
189  * @retval      AIL_ERROR_OK                                    success
190  * @retval      AIL_ERROR_INVALID_PARAMETER             invalid parameter
191  * @retval      AIL_ERROR_OUT_OF_MEMORY                 out of memory
192  *
193  * @pre The filter should be valid handle which was created by ail_filter_new()
194  *
195  * @see  ail_filter_new()
196  *
197  * @par Prospective Clients:
198  * External Apps.
199  *
200  * @code
201 int count_apps()
202 {
203         ail_filter_h filter;
204         ail_error_e ret;
205         int n;
206
207         ret = ail_filter_new(&filter);
208         if (ret != AIL_ERROR_OK) {
209                 return -1;
210         }
211
212         ret = ail_filter_add_int(filter, AIL_PROP_X_SLP_BASELAYOUTWIDTH_INT, 480);
213         if (ret != AIL_ERROR_OK) {
214                 return -1;
215         }
216
217         ret = ail_filter_count_appinfo(filter, &n);
218         if (ret != AIL_ERROR_OK) {
219                 return -1;
220         }
221
222         printf("N of apps = %d\n", n);
223
224         return n;
225 }
226  * @endcode
227  */
228 ail_error_e ail_filter_add_int(ail_filter_h filter, const char *property, const int value);
229
230
231 /**
232  * @fn ail_error_e ail_error_e ail_filter_add_bool(ail_filter_h filter, const char *property, const bool value)
233  *
234  * @brief Add boolean condition to filter by. The value can be true/false only
235  *
236  * @par Sync (or) Async : Synchronous API
237  *
238  * @param[in] filter     a filter handle which can be create with ail_filter_new()
239  * @param[in] property   a property type of boolean
240  * @param[in] value      the value to filter by
241  *
242  * @return 0 if success, negative value(<0) if fail\n
243  * @retval      AIL_ERROR_OK                                    success
244  * @retval      AIL_ERROR_INVALID_PARAMETER             invalid parameter
245  * @retval      AIL_ERROR_OUT_OF_MEMORY                 out of memory
246  *
247  * @pre The filter should be valid handle which was created by ail_filter_new()
248  *
249  * @see  ail_filter_new()
250  *
251  * @par Prospective Clients:
252  * External Apps.
253  *
254  * @code
255 int count_apps()
256 {
257         ail_filter_h filter;
258         ail_error_e ret;
259         int n;
260
261         ret = ail_filter_new(&filter);
262         if (ret != AIL_ERROR_OK) {
263                 return -1;
264         }
265
266         ret = ail_filter_add_bool(filter, AIL_PROP_X_SLP_REMOVABLE_BOOL, true);
267         if (ret != AIL_ERROR_OK) {
268                 return -1;
269         }
270
271         ret = ail_filter_count_appinfo(filter, &n);
272         if (ret != AIL_ERROR_OK) {
273                 return -1;
274         }
275
276         fprintf(stderr, "N of apps = %d\n", n);
277
278         return n;
279 }
280  * @endcode
281  */
282 ail_error_e ail_filter_add_bool(ail_filter_h filter, const char *property, bool value);
283
284
285
286 /**
287  * @fn ail_error_e ail_error_e ail_filter_add_str(ail_filter_h filter, const char *property, const char *value)
288  *
289  * @brief Add string condition to filter by. The string is case-sensitive.
290  *
291  * @par Sync (or) Async : Synchronous API
292  *
293  * @param[in] filter     a filter handle which can be create with ail_filter_new()
294  * @param[in] property   a property type of string
295  * @param[in] value      the value to filter by
296  *
297  * @return 0 if success, negative value(<0) if fail\n
298  * @retval      AIL_ERROR_OK                                    success
299  * @retval      AIL_ERROR_INVALID_PARAMETER             invalid parameter
300  * @retval      AIL_ERROR_OUT_OF_MEMORY                 out of memory
301  *
302  * @pre The filter should be valid handle which was created by ail_filter_new()
303  *
304  * @see  ail_filter_new()
305  *
306  * @par Prospective Clients:
307  * External Apps.
308  *
309  * @code
310 int count_apps()
311 {
312         ail_filter_h filter;
313         ail_error_e ret;
314         int n;
315
316         ret = ail_filter_new(&filter);
317         if (ret != AIL_ERROR_OK) {
318                 return -1;
319         }
320
321         ret = ail_filter_add_str(filter, AIL_PROP_PACKAGE_STR, "com.samsung.memo");
322         if (ret != AIL_ERROR_OK) {
323                 return -1;
324         }
325
326         ret = ail_filter_count_appinfo(filter, &n);
327         if (ret != AIL_ERROR_OK) {
328                 return -1;
329         }
330
331         fprintf(stderr, "N of apps = %d\n", n);
332
333         return n;
334 }
335  * @endcode
336  */
337 ail_error_e ail_filter_add_str(ail_filter_h filter, const char *property, const char *value);
338
339
340
341 /**
342  * @fn ail_error_e ail_filter_destroy(ail_filter_h filter)
343  *
344  * @brief Destroy a filter which is not used any longer.
345  *
346  * @par Sync (or) Async : Synchronous API
347  *
348  * @param[in] filter    filter handle
349  *
350  * @return 0 if success, negative value(<0) if fail\n
351  * @retval      AIL_ERROR_OK    success
352  * @retval      AIL_ERROR_INVALID_PARAMETER             invalid parameter
353  *
354  * @post If the filter is no longer used, it should be freed with ail_filter_destroy()
355  *
356  * @see  ail_filter_new()
357  *
358  * @par Prospective Clients:
359  * External Apps.
360  *
361  * @code
362 int count_apps()
363 {
364         ail_filter_h filter;
365         ail_error_e ret;
366         int n;
367
368         ret = ail_filter_new(&filter);
369         if (ret != AIL_ERROR_OK) {
370                 return -1;
371         }
372
373         ret = ail_filter_add_bool(filter, AIL_PROP_X_SLP_REMOVABLE_BOOL, true);
374         if (ret != AIL_ERROR_OK) {
375                 return -1;
376         }
377
378         ret = ail_filter_count_appinfo(filter, &n);
379         if (ret != AIL_ERROR_OK) {
380                 return -1;
381         }
382
383         printf("N of removable apps = %d\n", n);
384
385         ret = ail_filter_add_str(filter, AIL_PROP_MIMETYPE_STR, "audio/wav");
386         if (ret != AIL_ERROR_OK) {
387                 return -1;
388         }
389
390         ret = ail_filter_count_appinfo(filter, &n);
391         if (ret != AIL_ERROR_OK) {
392                 return -1;
393         }
394
395         printf("N of apps removable and supporting 'audo/wav' mime type = %d\n", n);
396
397         ret = ail_filter_destroy(filter);
398
399         return n;
400 }
401  * @endcode
402  */
403 ail_error_e ail_filter_destroy(ail_filter_h filter);
404
405
406
407 /**
408  * @brief return value type of ail_list_appinfo_cb
409  */
410 typedef enum {
411         AIL_CB_RET_CONTINUE = 1,                /**< continue */
412         AIL_CB_RET_CANCEL = 0,                  /**< cancel */
413 } ail_cb_ret_e;
414
415 /**
416  * @fn ail_cb_ret_e (*ail_list_appinfo_cb) (const ail_appinfo_h appinfo_h, void *user_data)
417  *
418  * @breif Specifies the type of functions passed to ail_filter_list_appinfo_foreach().
419  *
420  * @param[in] appinfo_h the appinfo's handle
421  * @param[in] user_data user data passed to ail_filtet_list_appinfo_foreach()
422  *
423  * @return 0 if success, negative value(<0) if fail\n
424  * @retval      AIL_CB_RET_CONTINUE                             return if you continue iteration
425  * @retval      AIL_CB_RET_CANCEL                               return if you cancel iteration
426  *
427  * @see  ail_filter_list_appinfo_foreach()
428  */
429 typedef ail_cb_ret_e (*ail_list_appinfo_cb) (const ail_appinfo_h appinfo_h, void *user_data);
430
431 /**
432  * @fn ail_error_e ail_error_e ail_filter_list_appinfo_foreach(ail_filter_h filter, ail_list_appinfo_cb func, void *user_data)
433  *
434  * @brief Calls the callback function for each app filtered by given filter. If the filter is not given (i.e filter handle is NULL), it is invoked for all apps.
435  *
436  * @par Sync (or) Async : Synchronous API
437  *
438  * @param[in] filter            a filter handle
439  * @param[in] func                      the function to call with each app's appinfo
440  * @param[in] user_data         user_data to pass to the function
441  *
442  * @return  0 if success, negative value(<0) if fail\n
443  * @retval AIL_ERROR_OK                                 success
444  * @retval AIL_ERROR_DB_FAILED                          database error
445  * @retval AIL_ERROR_INVALID_PARAMETER          invalid parameter
446  *
447  * @see  ail_list_appinfo_cb
448  * @see ail_filter_add_bool()
449  * @see ail_filter_add_int()
450  * @see ail_filter_add_str()
451  *
452  * @par Prospective Clients:
453  * External Apps.
454  *
455  * @code
456
457 ail_cb_ret_e appinfo_func(const ail_appinfo_h appinfo, void *user_data)
458 {
459         int *i = (int *)user_data;
460         char *appid;
461
462         ail_appinfo_get_str(appinfo, AIL_PROP_PACKAGE_STR, &appid);
463         printf("i=%d %s\n", (*i)++, appid);
464
465         if (*i > 30)
466                 return AIL_CB_RET_CANCEL;
467
468         return AIL_CB_RET_CONTINUE;
469 }
470
471 int list_apps()
472 {
473         ail_filter_h filter;
474         ail_error_e ret;
475         int i=0;
476
477         ret = ail_filter_new(&filter);
478         if (ret != AIL_ERROR_OK) {
479                 return -1;
480         }
481
482         ret = ail_filter_add_bool(filter, AIL_PROP_X_SLP_REMOVABLE_BOOL, true);
483         if (ret != AIL_ERROR_OK) {
484                 return -1;
485         }
486
487         ret = ail_filter_add_str(filter, AIL_PROP_TYPE_STR, "Application");
488         if (ret != AIL_ERROR_OK) {
489                 return -1;
490         }
491
492         printf("List apps which are removable and 'Application' typed\n");
493         ail_filter_list_appinfo_foreach(filter, appinfo_func, (void *)&i);
494
495         ail_filter_destroy(filter);
496         
497         return 0;
498 }
499  * @endcode
500  */
501 ail_error_e ail_filter_list_appinfo_foreach(ail_filter_h filter,
502                                             ail_list_appinfo_cb appinfo_func,
503                                             void *user_data);
504
505
506
507 /**
508  * @fn ail_error_e ail_error_e ail_filter_count_appinfo(ail_filter_h filter, int *count)
509  *
510  * @brief Gets the number of app which is filtered by the given filter. If the filter is not given (i.e filter handle is NULL), all app are counted.
511  *
512  * @par Sync (or) Async : Synchronous API
513  *
514  * @param[in] filter    a filter handle
515  * @param[in] count             the number of appinfo which is filtered
516  *
517  * @return 0 if success, negative value(<0) if fail\n
518  * @retval      AIL_ERROR_OK                                    success
519  * @retval      AIL_ERROR_INVALID_PARAMETER             invalid parameter
520  * @retval      AIL_ERROR_OUT_OF_MEMORY                 out of memory
521  *
522  * @pre None
523  * @post None
524  *
525  * @see ail_filter_new()
526  * @see ail_filter_add_bool()
527  * @see ail_filter_add_int()
528  * @see ail_filter_add_str()
529  *
530  * @par Prospective Clients:
531  * External Apps.
532  *
533  * @code
534 int count_apps()
535 {
536         ail_filter_h filter;
537         ail_error_e ret;
538         int n;
539
540         ret = ail_filter_new(&filter);
541         if (ret != AIL_ERROR_OK) {
542                 return -1;
543         }
544
545         ret = ail_filter_add_bool(filter, AIL_PROP_NODISPLAY_BOOL, true);
546         if (ret != AIL_ERROR_OK) {
547                 return -1;
548         }
549
550         ret = ail_filter_count_appinfo(filter, &n);
551         if (ret != AIL_ERROR_OK) {
552                 return -1;
553         }
554
555         printf("N of app not to be displayed = %d", n);
556
557         ret = ail_filter_count_appinfo(NULL, &n);
558         if (ret != AIL_ERROR_OK) {
559                 return -1;
560         }
561
562         printf("N of all app = %d\n", n);
563
564         return n;
565 }
566  * @endcode
567  */
568 ail_error_e ail_filter_count_appinfo(ail_filter_h filter, int *count);
569
570
571
572 /**
573  * @fn ail_error_e ail_package_get_appinfo(const char *package, ail_appinfo_h *handle)
574  *
575  * @brief get an application information related to a package. 
576         This API just retrieves all the information of the package from Application Information Database.
577         All data related to the package are loaded in the memory after calling this function. 
578         If you want to read a value from the retrieving data, you have to use the functions of ail_appinfo_get_xxx.
579
580  * @par Sync (or) Async : Synchronous API.
581  *
582  * @param[in] package package name what you want to know about.
583  * @param[out] handle handle will be used with the functions of ail_appinfo_get_xxx. If no data, it will be NULL.
584  *
585  * @return 0 if success, negative value(<0) if fail\n
586  * @retval      AIL_ERROR_OK                                    success
587  * @retval      AIL_ERROR_FAIL                                  internal error
588  * @retval      AIL_ERROR_DB_FAILED                             database error
589  * @retval      AIL_ERROR_INVALID_PARAMETER             invalid parameter
590  * @retval      AIL_ERROR_NO_DATA                               no data. cannot find the package.
591  *
592  * @pre declare a handle before calling this function. The handle is used as a second argument of this API.
593  * @post destroy the handle with the function of ail_package_destroy_appinfo after using it all.
594  *
595  * @see  ail_package_destroy_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_int(), ail_appinfo_get_str()
596  *
597  * @par Prospective Clients:
598  * External Apps.
599  *
600  * @code
601 static ail_error_e _get_name(const char *package)
602 {
603         ail_appinfo_h handle;
604         ail_error_e ret;
605         char *str;
606
607         ret = ail_package_get_appinfo(package, &handle);
608         if (ret != AIL_ERROR_OK) {
609                 return AIL_ERROR_FAIL;
610         }
611
612         ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &str);
613         if (ret != AIL_ERROR_OK) {
614                 return AIL_ERROR_FAIL;
615         }
616         fprintf(stderr, "Package[%s], Property[%s] : %s\n", package, property, str);
617
618         ret = ail_package_destroy_appinfo(handle);
619         if (ret != AIL_ERROR_OK) {
620                 return AIL_ERROR_FAIL;
621         }
622
623         return AIL_ERROR_OK;
624 }
625  * @endcode
626  */
627 ail_error_e ail_package_get_appinfo(const char *package, ail_appinfo_h *handle) __attribute__((deprecated));
628
629
630 /**
631  * @fn ail_error_e ail_get_appinfo(const char *appid, ail_appinfo_h *handle)
632  *
633  * @brief get an application information related to a appid.
634         This API just retrieves all the information of the application from Application Information Database.
635         All data related to the appid are loaded in the memory after calling this function.
636         If you want to read a value from the retrieving data, you have to use the functions of ail_appinfo_get_xxx.
637
638  * @par Sync (or) Async : Synchronous API.
639  *
640  * @param[in] appid appid what you want to know about.
641  * @param[out] handle handle will be used with the functions of ail_appinfo_get_xxx. If no data, it will be NULL.
642  *
643  * @return 0 if success, negative value(<0) if fail\n
644  * @retval      AIL_ERROR_OK                                    success
645  * @retval      AIL_ERROR_FAIL                                  internal error
646  * @retval      AIL_ERROR_DB_FAILED                             database error
647  * @retval      AIL_ERROR_INVALID_PARAMETER             invalid parameter
648  * @retval      AIL_ERROR_NO_DATA                               no data. cannot find the app.
649  *
650  * @pre declare a handle before calling this function. The handle is used as a second argument of this API.
651  * @post destroy the handle with the function of ail_get_appinfo after using it all.
652  *
653  * @see  ail_get_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_int(), ail_appinfo_get_str()
654  *
655  * @par Prospective Clients:
656  * External Apps.
657  *
658  * @code
659 static ail_error_e _get_name(const char *appid)
660 {
661         ail_appinfo_h handle;
662         ail_error_e ret;
663         char *str;
664
665         ret = ail_get_appinfo(appid, &handle);
666         if (ret != AIL_ERROR_OK) {
667                 return AIL_ERROR_FAIL;
668         }
669
670         ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &str);
671         if (ret != AIL_ERROR_OK) {
672                 return AIL_ERROR_FAIL;
673         }
674         fprintf(stderr, "Package[%s], Property[%s] : %s\n", appid, property, str);
675
676         ret = ail_destroy_appinfo(handle);
677         if (ret != AIL_ERROR_OK) {
678                 return AIL_ERROR_FAIL;
679         }
680
681         return AIL_ERROR_OK;
682 }
683  * @endcode
684  */
685 ail_error_e ail_get_appinfo(const char *appid, ail_appinfo_h *handle);
686
687
688 /**
689  * @fn ail_error_e ail_appinfo_get_bool(const ail_appinfo_h handle, const char *property, bool *value)
690  *
691  * @brief get a boolean value related to the property. 
692         Before using this API, the handle is defined by calling ail_get_appinfo.
693         This function needs a out-parameter for the value.
694  *
695  * @par Sync (or) Async : Synchronous API.
696  *
697  * @param[in] handle    the handle is defined by calling ail_get_appinfo.
698  * @param[in] property   a property type of boolean
699  * @param[out] value    a out-parameter value that is mapped with the property.
700  *
701  * @return 0 if success, negative value(<0) if fail\n
702  * @retval      AIL_ERROR_OK                                    success
703  * @retval      AIL_ERROR_DB_FAILED                             database error
704  * @retval      AIL_ERROR_INVALID_PARAMETER             invalid parameter
705  *
706  * @pre define a handle using ail_get_appinfo. The handle is used as a first argument of this API.
707  * @post destroy the handle with the function of ail_destroy_appinfo after using it all.
708  *
709  * @see  ail_get_appinfo(), ail_destroy_appinfo(), ail_appinfo_get_int(), ail_appinfo_get_str()
710  *
711  * @par Prospective Clients:
712  * External Apps.
713  *
714  * @code
715 static ail_error_e _get_nodisplay(const char *appid)
716 {
717         ail_appinfo_h handle;
718         ail_error_e ret;
719         bool value;
720
721         ret = ail_get_appinfo(appid, &handle);
722         if (ret != AIL_ERROR_OK) {
723                 return AIL_ERROR_FAIL;
724         }
725
726         ret = ail_appinfo_get_bool(handle, AIL_PROP_NODISPLAY_BOOL, &value);
727         if (ret != AIL_ERROR_OK) {
728                 return AIL_ERROR_FAIL;
729         }
730         fprintf(stderr, "appid[%s] : %d\n", appid, value);
731
732         ret = ail_destroy_appinfo(handle);
733         if (ret != AIL_ERROR_OK) {
734                 return AIL_ERROR_FAIL;
735         }
736
737         return AIL_ERROR_OK;
738 }
739  * @endcode
740  */
741 ail_error_e ail_appinfo_get_bool(const ail_appinfo_h handle, const char *property, bool *value);
742
743
744
745 /**
746  * @fn ail_error_e ail_appinfo_get_int(const ail_appinfo_h handle, const char *property, int *value)
747  *
748  * @brief get a integer value related to the property. 
749         Before using this API, the handle is defined by calling ail_get_appinfo.
750         This function needs a out-parameter for the value.
751  *
752  * @par Sync (or) Async : Synchronous API.
753  *
754  * @param[in] handle    the handle is defined by calling ail_get_appinfo.
755  * @param[in] property  a property type of integer.
756  * @param[out] value    a out-parameter value that is mapped with the property.
757  *
758  * @return 0 if success, negative value(<0) if fail\n
759  * @retval      AIL_ERROR_OK                                    success
760  * @retval      AIL_ERROR_DB_FAILED                             database error
761  * @retval      AIL_ERROR_INVALID_PARAMETER             invalid parameter
762  *
763  * @pre define a handle using ail_get_appinfo. The handle is used as a first argument of this API.
764  * @post destroy the handle with the function of ail_destroy_appinfo after using it all.
765  *
766  * @see  ail_get_appinfo(), ail_destroy_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_str()
767  *
768  * @par Prospective Clients:
769  * External Apps.
770  *
771  * @code
772 static ail_error_e _get_x_slp_baselayoutwidth(const char *appid)
773 {
774         ail_appinfo_h handle;
775         ail_error_e ret;
776         int value;
777
778         ret = ail_get_appinfo(appid, &handle);
779         if (ret != AIL_ERROR_OK) {
780                 return AIL_ERROR_FAIL;
781         }
782
783         ret = ail_appinfo_get_int(handle, AIL_PROP_X_SLP_BASELAYOUTWIDTH_INT, &value);
784         if (ret != AIL_ERROR_OK) {
785                 return AIL_ERROR_FAIL;
786         }
787         fprintf(stderr, "Package[%s] : %d\n", appid, value);
788
789         ret = ail_destroy_appinfo(handle);
790         if (ret != AIL_ERROR_OK) {
791                 return AIL_ERROR_FAIL;
792         }
793
794         return AIL_ERROR_OK;
795 }
796  * @endcode
797  */
798 ail_error_e ail_appinfo_get_int(const ail_appinfo_h handle, const char *property, int *value);
799
800
801
802 /**
803  * @fn ail_error_e ail_appinfo_get_str(const ail_appinfo_h handle, const char *property, char **str)
804  *
805  * @brief get a string related to the property. 
806         Before using this API, the handle is defined by calling ail_get_appinfo.
807         This function needs a out-parameter for the value.
808  *
809  * @par Sync (or) Async : Synchronous API.
810  *
811  * @param[in] handle    the handle is defined by calling ail_get_appinfo.
812  * @param[in] property  a property type of string.
813  * @param[out] str              a out-parameter string that is mapped with the property. The icon property contains the absolute file path. If there is no data, the value of str is NULL.
814  *
815  * @return 0 if success, negative value(<0) if fail\n
816  * @retval      AIL_ERROR_OK                                    success
817  * @retval      AIL_ERROR_DB_FAILED                             database error
818  * @retval      AIL_ERROR_INVALID_PARAMETER             invalid parameter
819  *
820  * @pre define a handle using ail_get_appinfo. The handle is used as a first argument of this API.
821  * @post str doesn't need to be freed. It will be freed by calling ail_destroy_appinfo.
822  *
823  * @see  ail_get_appinfo(), ail_destroy_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_int()
824  *
825  * @par Prospective Clients:
826  * External Apps.
827  *
828  * @code
829 static ail_error_e _get_nodisplay(const char *appid)
830 {
831         ail_appinfo_h handle;
832         ail_error_e ret;
833         char* value;
834
835         ret = ail_get_appinfo(appid, &handle);
836         if (ret != AIL_ERROR_OK) {
837                 return AIL_ERROR_FAIL;
838         }
839
840         ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &value);
841         if (ret != AIL_ERROR_OK) {
842                 return AIL_ERROR_FAIL;
843         }
844         fprintf(stderr, "Package[%s] : %d\n", appid, value);
845
846         ret = ail_destroy_appinfo(handle);
847         if (ret != AIL_ERROR_OK) {
848                 return AIL_ERROR_FAIL;
849         }
850
851         return AIL_ERROR_OK;
852 }
853  * @endcode
854  */
855 ail_error_e ail_appinfo_get_str(const ail_appinfo_h handle, const char *property, char **str);
856
857
858
859 /**
860  * @fn ail_error_e ail_package_destroy_appinfo(const ail_appinfo_h handle)
861  *
862  * @brief destroy a handle what you get with the function of ail_package_get_appinfo.
863  *
864  * @par Sync (or) Async : Synchronous API.
865  *
866  * @param[in] handle destroy all resources related to the handle.
867  *
868  * @return 0 if success, negative value(<0) if fail\n
869  * @retval      AIL_ERROR_OK                                    success
870  * @retval      AIL_ERROR_DB_FAILED                             database error
871  * @retval      AIL_ERROR_INVALID_PARAMETER             invalid parameter
872  *
873  * @pre need a handle that you don't need anymore.
874  * @post cannot use the handle after destroying.
875  *
876  * @see  ail_package_get_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_int(), ail_appinfo_get_str()
877  *
878  * @par Prospective Clients:
879  * External Apps.
880  *
881  * @code
882 static ail_error_e _get_name(const char *package)
883 {
884         ail_appinfo_h handle;
885         ail_error_e ret;
886         char *str;
887
888         ret = ail_package_get_appinfo(package, &handle);
889         if (ret != AIL_ERROR_OK) {
890                 return AIL_ERROR_FAIL;
891         }
892
893         ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &str);
894         if (ret != AIL_ERROR_OK) {
895                 return AIL_ERROR_FAIL;
896         }
897         fprintf(stderr, "Package[%s], Property[%s] : %s\n", package, property, str);
898
899         ret = ail_package_destroy_appinfo(handle);
900         if (ret != AIL_ERROR_OK) {
901                 return AIL_ERROR_FAIL;
902         }
903
904         return AIL_ERROR_OK;
905 }
906  * @endcode
907  */
908 ail_error_e ail_package_destroy_appinfo(const ail_appinfo_h handle) __attribute__((deprecated));
909
910
911 /**
912  * @fn ail_error_e ail_destroy_appinfo(const ail_appinfo_h handle)
913  *
914  * @brief destroy a handle what you get with the function of ail_get_appinfo.
915  *
916  * @par Sync (or) Async : Synchronous API.
917  *
918  * @param[in] handle destroy all resources related to the handle.
919  *
920  * @return 0 if success, negative value(<0) if fail\n
921  * @retval      AIL_ERROR_OK                                    success
922  * @retval      AIL_ERROR_DB_FAILED                             database error
923  * @retval      AIL_ERROR_INVALID_PARAMETER             invalid parameter
924  *
925  * @pre need a handle that you don't need anymore.
926  * @post cannot use the handle after destroying.
927  *
928  * @see  ail_get_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_int(), ail_appinfo_get_str()
929  *
930  * @par Prospective Clients:
931  * External Apps.
932  *
933  * @code
934 static ail_error_e _get_name(const char *appid)
935 {
936         ail_appinfo_h handle;
937         ail_error_e ret;
938         char *str;
939
940         ret = ail_get_appinfo(appid, &handle);
941         if (ret != AIL_ERROR_OK) {
942                 return AIL_ERROR_FAIL;
943         }
944
945         ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &str);
946         if (ret != AIL_ERROR_OK) {
947                 return AIL_ERROR_FAIL;
948         }
949         fprintf(stderr, "Package[%s], Property[%s] : %s\n", appid, property, str);
950
951         ret = ail_destroy_appinfo(handle);
952         if (ret != AIL_ERROR_OK) {
953                 return AIL_ERROR_FAIL;
954         }
955
956         return AIL_ERROR_OK;
957 }
958  * @endcode
959  */
960 ail_error_e ail_destroy_appinfo(const ail_appinfo_h handle);
961
962 /**
963  * @fn ail_error_e ail_close_appinfo_db(void)
964  *
965  * @brief close appinfo db.
966  *
967  * @par Sync (or) Async : Synchronous API.
968  *
969  * @return 0 if success, negative value(<0) if fail\n
970  * @retval      AIL_ERROR_OK                                    success
971  * @retval      AIL_ERROR_DB_FAILED                             database error
972  * @retval      AIL_ERROR_INVALID_PARAMETER             invalid parameter
973  *
974  * @pre need a handle that you don't need anymore.
975  * @post cannot use the handle after destroying.
976  *
977  * @see  ail_get_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_int(), ail_appinfo_get_str()
978  *
979  * @par Prospective Clients:
980  * External Apps.
981  *
982  * @code
983 static ail_error_e _get_name(const char *appid)
984 {
985         ail_appinfo_h handle;
986         ail_error_e ret;
987         char *str;
988
989         ret = ail_get_appinfo(appid, &handle);
990         if (ret != AIL_ERROR_OK) {
991                 return AIL_ERROR_FAIL;
992         }
993
994         ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &str);
995         if (ret != AIL_ERROR_OK) {
996                 return AIL_ERROR_FAIL;
997         }
998         fprintf(stderr, "Package[%s], Property[%s] : %s\n", appid, property, str);
999
1000         ret = ail_destroy_appinfo(handle);
1001         if (ret != AIL_ERROR_OK) {
1002                 return AIL_ERROR_FAIL;
1003         }
1004
1005         ret = ail_close_appinfo_db();
1006         if (ret != AIL_ERROR_OK) {
1007                 return AIL_ERROR_FAIL;
1008         }
1009
1010         return AIL_ERROR_OK;
1011 }
1012  * @endcode
1013  */
1014 ail_error_e ail_close_appinfo_db(void);
1015
1016
1017 /**
1018  * @fn ail_error_e ail_desktop_add(const char *appid)
1019  *
1020  * @brief add a app information into Application Information Database.
1021         A desktop file for this app has to be installed in the desktop directory before using this API.
1022         If there is no database for Application Information Database, this API will create the DB.
1023         If there is a DB, this function adds information for the app into the DB.
1024         And a notification is published to the applications who want to know about changing DB. 
1025  *
1026  * @par Sync (or) Async : Synchronous API.
1027  *
1028  * @param[in] appid
1029  *
1030  * @return 0 if success, negative value(<0) if fail\n
1031  * @retval      AIL_ERROR_OK                                    success
1032  * @retval      AIL_ERROR_FAIL                                  internal error
1033  * @retval      AIL_ERROR_INVALID_PARAMETER             invalid parameter
1034  *
1035  * @pre a desktop file for the app has to be installed in the desktop directory before using this API.
1036  * @post app information is added into the Application Information Database.
1037  *
1038  * @see  ail_desktop_update(), ail_desktop_remove()
1039  *
1040  * @par Prospective Clients:
1041  * External Apps.
1042  *
1043  * @code
1044 static ail_error_e _add_desktop(const char *appid)
1045 {
1046         ail_error_e ret;
1047
1048         if (!appid) {
1049                 return AIL_ERROR_FAIL;
1050         }
1051
1052         ret = ail_desktop_add(appid);
1053         if (ret != AIL_ERROR_OK) {
1054                 return AIL_ERROR_FAIL;
1055         }
1056
1057         return AIL_ERROR_OK;
1058 }
1059  * @endcode
1060  */
1061 ail_error_e ail_desktop_add(const char *appid);
1062
1063
1064
1065 /**
1066  * @fn ail_error_e ail_desktop_update(const char *appid)
1067  *
1068  * @brief update a app information in the Application Information Database.
1069         A desktop file for this app has to be installed in the desktop directory before using this API.
1070         And a notification is published to the applications who want to know about changing DB. 
1071  *
1072  * @par Sync (or) Async : Synchronous API.
1073  *
1074  * @param[in] appid
1075  *
1076  * @return 0 if success, negative value(<0) if fail\n
1077  * @retval      AIL_ERROR_OK                                    success
1078  * @retval      AIL_ERROR_FAIL                                  internal error
1079  * @retval      AIL_ERROR_INVALID_PARAMETER             invalid parameter
1080  *
1081  * @pre a desktop file for the app has to be installed in the desktop directory before using this API.
1082  * @post update a app information in the Application Information Database.
1083  *
1084  * @see  ail_desktop_add(), ail_desktop_remove()
1085  *
1086  * @par Prospective Clients:
1087  * External Apps.
1088  *
1089  * @code
1090 static ail_error_e _update_desktop(const char *appid)
1091 {
1092         ail_error_e ret;
1093
1094         if (!appid) {
1095                 return AIL_ERROR_FAIL;
1096         }
1097
1098         ret = ail_desktop_update(appid);
1099         if (ret != AIL_ERROR_OK) {
1100                 return AIL_ERROR_FAIL;
1101         }
1102
1103         return AIL_ERROR_OK;
1104 }
1105  * @endcode
1106  */
1107 ail_error_e ail_desktop_update(const char *appid);
1108
1109
1110
1111 /**
1112  * @fn ail_error_e ail_desktop_remove(const char *appid)
1113  *
1114  * @brief remove a app information in the Application Information Database.
1115         And a notification is published to the applications who want to know about changing DB. 
1116  *
1117  * @par Sync (or) Async : Synchronous API.
1118  *
1119  * @param[in] appid
1120  *
1121  * @return 0 if success, negative value(<0) if fail\n
1122  * @retval      AIL_ERROR_OK                                    success
1123  * @retval      AIL_ERROR_FAIL                                  internal error
1124  * @retval      AIL_ERROR_INVALID_PARAMETER             invalid parameter
1125  *
1126  * @pre no pre-condition.
1127  * @post app information is removed in the Application Information Database.
1128  *
1129  * @see  ail_desktop_add(), ail_desktop_update()
1130  *
1131  * @par Prospective Clients:
1132  * External Apps.
1133  *
1134  * @code
1135 static ail_error_e _remove_desktop(const char *appid)
1136 {
1137         ail_error_e ret;
1138
1139         if (!appid) {
1140                 return AIL_ERROR_FAIL;
1141         }
1142
1143         ret = ail_desktop_remove(appid);
1144         if (ret != AIL_ERROR_OK) {
1145                 return AIL_ERROR_FAIL;
1146         }
1147
1148         return AIL_ERROR_OK;
1149 }
1150  * @endcode
1151  */
1152 ail_error_e ail_desktop_remove(const char *appid);
1153
1154 /**
1155  * @fn ail_error_e ail_desktop_clean(const char *pkgid)
1156  *
1157  * @brief clean a pkg information in the Application Information Database.
1158  *
1159  * @par Sync (or) Async : Synchronous API.
1160  *
1161  * @param[in] pkgid
1162  *
1163  * @return 0 if success, negative value(<0) if fail\n
1164  * @retval      AIL_ERROR_OK                                    success
1165  * @retval      AIL_ERROR_FAIL                                  internal error
1166  * @retval      AIL_ERROR_INVALID_PARAMETER             invalid parameter
1167  *
1168  * @pre no pre-condition.
1169  * @post app information is removed in the Application Information Database.
1170  *
1171  * @see  ail_desktop_add(), ail_desktop_update()
1172  *
1173  * @par Prospective Clients:
1174  * External Apps.
1175  *
1176  * @code
1177 static ail_error_e _clean_desktop(const char *pkgid)
1178 {
1179         ail_error_e ret;
1180
1181         if (!appid) {
1182                 return AIL_ERROR_FAIL;
1183         }
1184
1185         ret = ail_desktop_clean(pkgid);
1186         if (ret != AIL_ERROR_OK) {
1187                 return AIL_ERROR_FAIL;
1188         }
1189
1190         return AIL_ERROR_OK;
1191 }
1192  * @endcode
1193  */
1194 ail_error_e ail_desktop_clean(const char *pkgid);
1195
1196
1197 /**
1198  * @fn ail_error_e ail_desktop_fota(const char *appid)
1199  *
1200  * @brief add a app information into Application Information Database.
1201         A desktop file for this app has to be installed in the desktop directory before using this API.
1202         If there is no database for Application Information Database, this API will create the DB.
1203         If there is a DB, this function adds information for the app into the DB.
1204         And a notification is not published to the applications who want to know about changing DB.
1205  *
1206  * @par Sync (or) Async : Synchronous API.
1207  *
1208  * @param[in] appid
1209  *
1210  * @return 0 if success, negative value(<0) if fail\n
1211  * @retval      AIL_ERROR_OK                                    success
1212  * @retval      AIL_ERROR_FAIL                                  internal error
1213  * @retval      AIL_ERROR_INVALID_PARAMETER             invalid parameter
1214  *
1215  * @pre a desktop file for the app has to be installed in the desktop directory before using this API.
1216  * @post app information is added into the Application Information Database.
1217  *
1218  * @see  ail_desktop_update(), ail_desktop_remove()
1219  *
1220  * @par Prospective Clients:
1221  * External Apps.
1222  *
1223  * @code
1224 static ail_error_e _add_desktop_fota(const char *appid)
1225 {
1226         ail_error_e ret;
1227
1228         if (!appid) {
1229                 return AIL_ERROR_FAIL;
1230         }
1231
1232         ret = ail_desktop_fota(appid);
1233         if (ret != AIL_ERROR_OK) {
1234                 return AIL_ERROR_FAIL;
1235         }
1236
1237         return AIL_ERROR_OK;
1238 }
1239  * @endcode
1240  */
1241 ail_error_e ail_desktop_fota(const char *appid);
1242
1243 /**
1244  * @fn ail_error_e ail_desktop_appinfo_modify_str(const char *appid, const char *property, const char *value, bool broadcast)
1245  *
1246  * @brief update a app information db.
1247         And a notification is published to the applications who want to know about changing DB.
1248  *
1249  * @par Sync (or) Async : Synchronous API.
1250  *
1251  * @param[in] appid
1252  *
1253  * @return 0 if success, negative value(<0) if fail\n
1254  * @retval      AIL_ERROR_OK                                    success
1255  * @retval      AIL_ERROR_FAIL                                  internal error
1256  * @retval      AIL_ERROR_INVALID_PARAMETER             invalid parameter
1257  *
1258  * @pre no pre-condition.
1259  * @post app information is removed in the Application Information Database.
1260  *
1261  *
1262  * @par Prospective Clients:
1263  * External Apps.
1264  *
1265  * @code
1266 static ail_error_e _appinfo_modify_str(const char *appid, const char *property, const char *value, bool broadcast)
1267 {
1268         ail_error_e ret;
1269
1270         if (!appid) {
1271                 return AIL_ERROR_FAIL;
1272         }
1273         if (!property) {
1274                 return AIL_ERROR_FAIL;
1275         }
1276         if (!value) {
1277                 return AIL_ERROR_FAIL;
1278         }
1279
1280         ret = ail_desktop_appinfo_modify_str(appid, property, value, broadcast);
1281         if (ret != AIL_ERROR_OK) {
1282                 return AIL_ERROR_FAIL;
1283         }
1284
1285         return AIL_ERROR_OK;
1286 }
1287  * @endcode
1288  */
1289
1290 ail_error_e ail_desktop_appinfo_modify_str(const char *appid, const char *property, const char *value, bool broadcast);
1291
1292 /** @} */
1293
1294
1295 #ifdef __cplusplus
1296 }
1297 #endif /* __cplusplus */
1298
1299 #endif /* __AIL_H__ */
1300 // End of a file