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