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.
32 #endif /* __cplusplus */
38 * @ingroup APPLICATION_FRAMEWORK
39 * @defgroup ail Application Information Library
44 * @brief Application Information Library header
45 * @author Sunghyuk Lee (sunghyuk.lee@samsung.com), Jin Yoon (jinny.yoon@samsung.com)
56 * @brief string type properties
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"
79 * @brief integer type properties
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"
85 * @brief boolean type properties
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"
96 * @brief A handle for filters
98 typedef struct ail_filter *ail_filter_h;
101 * @brief A handle for appinfos
103 typedef struct ail_appinfo *ail_appinfo_h;
106 * @brief return values
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 */
118 * @fn ail_error_e ail_filter_new(ail_filter_h *filter)
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.
122 * @par Sync (or) Async : Synchronous API.
124 * @param[out] filter a pointer to a filter which is newly created
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
132 * @post If the filter is no longer used, it should be freed with ail_filter_destroy()
134 * @see ail_filter_destroy()
136 * @par Prospective Clients:
146 ret = ail_filter_new(&filter);
147 if (ret != AIL_ERROR_OK) {
151 ret = ail_filter_add_bool(filter, AIL_PROP_NODISPLAY_BOOL, false);
152 if (ret != AIL_ERROR_OK) {
156 ret = ail_filter_add_str(filter, AIL_PROP_MIMETYPE_STR, "audio/wav");
157 if (ret != AIL_ERROR_OK) {
161 ret = ail_filter_count_appinfo(filter, &n);
162 if (ret != AIL_ERROR_OK) {
165 ret = ail_filter_destroy(filter);
167 printf("N of apps not to be displayed and supporting 'audo/wav' mime type = %d\n", n);
173 ail_error_e ail_filter_new(ail_filter_h *filter);
178 * @fn ail_error_e ail_error_e ail_filter_add_int(ail_filter_h filter, const char *property, const int value)
180 * @brief Add integer condition to filter
182 * @par Sync (or) Async : Synchronous API
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
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
193 * @pre The filter should be valid handle which was created by ail_filter_new()
195 * @see ail_filter_new()
197 * @par Prospective Clients:
207 ret = ail_filter_new(&filter);
208 if (ret != AIL_ERROR_OK) {
212 ret = ail_filter_add_int(filter, AIL_PROP_X_SLP_BASELAYOUTWIDTH_INT, 480);
213 if (ret != AIL_ERROR_OK) {
217 ret = ail_filter_count_appinfo(filter, &n);
218 if (ret != AIL_ERROR_OK) {
222 printf("N of apps = %d\n", n);
228 ail_error_e ail_filter_add_int(ail_filter_h filter, const char *property, const int value);
232 * @fn ail_error_e ail_error_e ail_filter_add_bool(ail_filter_h filter, const char *property, const bool value)
234 * @brief Add boolean condition to filter by. The value can be true/false only
236 * @par Sync (or) Async : Synchronous API
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
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
247 * @pre The filter should be valid handle which was created by ail_filter_new()
249 * @see ail_filter_new()
251 * @par Prospective Clients:
261 ret = ail_filter_new(&filter);
262 if (ret != AIL_ERROR_OK) {
266 ret = ail_filter_add_bool(filter, AIL_PROP_X_SLP_REMOVABLE_BOOL, true);
267 if (ret != AIL_ERROR_OK) {
271 ret = ail_filter_count_appinfo(filter, &n);
272 if (ret != AIL_ERROR_OK) {
276 fprintf(stderr, "N of apps = %d\n", n);
282 ail_error_e ail_filter_add_bool(ail_filter_h filter, const char *property, bool value);
287 * @fn ail_error_e ail_error_e ail_filter_add_str(ail_filter_h filter, const char *property, const char *value)
289 * @brief Add string condition to filter by. The string is case-sensitive.
291 * @par Sync (or) Async : Synchronous API
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
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
302 * @pre The filter should be valid handle which was created by ail_filter_new()
304 * @see ail_filter_new()
306 * @par Prospective Clients:
316 ret = ail_filter_new(&filter);
317 if (ret != AIL_ERROR_OK) {
321 ret = ail_filter_add_str(filter, AIL_PROP_PACKAGE_STR, "com.samsung.memo");
322 if (ret != AIL_ERROR_OK) {
326 ret = ail_filter_count_appinfo(filter, &n);
327 if (ret != AIL_ERROR_OK) {
331 fprintf(stderr, "N of apps = %d\n", n);
337 ail_error_e ail_filter_add_str(ail_filter_h filter, const char *property, const char *value);
342 * @fn ail_error_e ail_filter_destroy(ail_filter_h filter)
344 * @brief Destroy a filter which is not used any longer.
346 * @par Sync (or) Async : Synchronous API
348 * @param[in] filter filter handle
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
354 * @post If the filter is no longer used, it should be freed with ail_filter_destroy()
356 * @see ail_filter_new()
358 * @par Prospective Clients:
368 ret = ail_filter_new(&filter);
369 if (ret != AIL_ERROR_OK) {
373 ret = ail_filter_add_bool(filter, AIL_PROP_X_SLP_REMOVABLE_BOOL, true);
374 if (ret != AIL_ERROR_OK) {
378 ret = ail_filter_count_appinfo(filter, &n);
379 if (ret != AIL_ERROR_OK) {
383 printf("N of removable apps = %d\n", n);
385 ret = ail_filter_add_str(filter, AIL_PROP_MIMETYPE_STR, "audio/wav");
386 if (ret != AIL_ERROR_OK) {
390 ret = ail_filter_count_appinfo(filter, &n);
391 if (ret != AIL_ERROR_OK) {
395 printf("N of apps removable and supporting 'audo/wav' mime type = %d\n", n);
397 ret = ail_filter_destroy(filter);
403 ail_error_e ail_filter_destroy(ail_filter_h filter);
408 * @brief return value type of ail_list_appinfo_cb
411 AIL_CB_RET_CONTINUE = 1, /**< continue */
412 AIL_CB_RET_CANCEL = 0, /**< cancel */
416 * @fn ail_cb_ret_e (*ail_list_appinfo_cb) (const ail_appinfo_h appinfo_h, void *user_data)
418 * @breif Specifies the type of functions passed to ail_filter_list_appinfo_foreach().
420 * @param[in] appinfo_h the appinfo's handle
421 * @param[in] user_data user data passed to ail_filtet_list_appinfo_foreach()
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
427 * @see ail_filter_list_appinfo_foreach()
429 typedef ail_cb_ret_e (*ail_list_appinfo_cb) (const ail_appinfo_h appinfo_h, void *user_data);
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)
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.
436 * @par Sync (or) Async : Synchronous API
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
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
447 * @see ail_list_appinfo_cb
448 * @see ail_filter_add_bool()
449 * @see ail_filter_add_int()
450 * @see ail_filter_add_str()
452 * @par Prospective Clients:
457 ail_cb_ret_e appinfo_func(const ail_appinfo_h appinfo, void *user_data)
459 int *i = (int *)user_data;
462 ail_appinfo_get_str(appinfo, AIL_PROP_PACKAGE_STR, &appid);
463 printf("i=%d %s\n", (*i)++, appid);
466 return AIL_CB_RET_CANCEL;
468 return AIL_CB_RET_CONTINUE;
477 ret = ail_filter_new(&filter);
478 if (ret != AIL_ERROR_OK) {
482 ret = ail_filter_add_bool(filter, AIL_PROP_X_SLP_REMOVABLE_BOOL, true);
483 if (ret != AIL_ERROR_OK) {
487 ret = ail_filter_add_str(filter, AIL_PROP_TYPE_STR, "Application");
488 if (ret != AIL_ERROR_OK) {
492 printf("List apps which are removable and 'Application' typed\n");
493 ail_filter_list_appinfo_foreach(filter, appinfo_func, (void *)&i);
495 ail_filter_destroy(filter);
501 ail_error_e ail_filter_list_appinfo_foreach(ail_filter_h filter,
502 ail_list_appinfo_cb appinfo_func,
508 * @fn ail_error_e ail_error_e ail_filter_count_appinfo(ail_filter_h filter, int *count)
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.
512 * @par Sync (or) Async : Synchronous API
514 * @param[in] filter a filter handle
515 * @param[in] count the number of appinfo which is filtered
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
525 * @see ail_filter_new()
526 * @see ail_filter_add_bool()
527 * @see ail_filter_add_int()
528 * @see ail_filter_add_str()
530 * @par Prospective Clients:
540 ret = ail_filter_new(&filter);
541 if (ret != AIL_ERROR_OK) {
545 ret = ail_filter_add_bool(filter, AIL_PROP_NODISPLAY_BOOL, true);
546 if (ret != AIL_ERROR_OK) {
550 ret = ail_filter_count_appinfo(filter, &n);
551 if (ret != AIL_ERROR_OK) {
555 printf("N of app not to be displayed = %d", n);
557 ret = ail_filter_count_appinfo(NULL, &n);
558 if (ret != AIL_ERROR_OK) {
562 printf("N of all app = %d\n", n);
568 ail_error_e ail_filter_count_appinfo(ail_filter_h filter, int *count);
573 * @fn ail_error_e ail_package_get_appinfo(const char *package, ail_appinfo_h *handle)
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.
580 * @par Sync (or) Async : Synchronous API.
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.
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.
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.
595 * @see ail_package_destroy_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_int(), ail_appinfo_get_str()
597 * @par Prospective Clients:
601 static ail_error_e _get_name(const char *package)
603 ail_appinfo_h handle;
607 ret = ail_package_get_appinfo(package, &handle);
608 if (ret != AIL_ERROR_OK) {
609 return AIL_ERROR_FAIL;
612 ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &str);
613 if (ret != AIL_ERROR_OK) {
614 return AIL_ERROR_FAIL;
616 fprintf(stderr, "Package[%s], Property[%s] : %s\n", package, property, str);
618 ret = ail_package_destroy_appinfo(handle);
619 if (ret != AIL_ERROR_OK) {
620 return AIL_ERROR_FAIL;
627 ail_error_e ail_package_get_appinfo(const char *package, ail_appinfo_h *handle) __attribute__((deprecated));
631 * @fn ail_error_e ail_get_appinfo(const char *appid, ail_appinfo_h *handle)
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.
638 * @par Sync (or) Async : Synchronous API.
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.
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.
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.
653 * @see ail_get_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_int(), ail_appinfo_get_str()
655 * @par Prospective Clients:
659 static ail_error_e _get_name(const char *appid)
661 ail_appinfo_h handle;
665 ret = ail_get_appinfo(appid, &handle);
666 if (ret != AIL_ERROR_OK) {
667 return AIL_ERROR_FAIL;
670 ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &str);
671 if (ret != AIL_ERROR_OK) {
672 return AIL_ERROR_FAIL;
674 fprintf(stderr, "Package[%s], Property[%s] : %s\n", appid, property, str);
676 ret = ail_destroy_appinfo(handle);
677 if (ret != AIL_ERROR_OK) {
678 return AIL_ERROR_FAIL;
685 ail_error_e ail_get_appinfo(const char *appid, ail_appinfo_h *handle);
689 * @fn ail_error_e ail_appinfo_get_bool(const ail_appinfo_h handle, const char *property, bool *value)
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.
695 * @par Sync (or) Async : Synchronous API.
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.
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
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.
709 * @see ail_get_appinfo(), ail_destroy_appinfo(), ail_appinfo_get_int(), ail_appinfo_get_str()
711 * @par Prospective Clients:
715 static ail_error_e _get_nodisplay(const char *appid)
717 ail_appinfo_h handle;
721 ret = ail_get_appinfo(appid, &handle);
722 if (ret != AIL_ERROR_OK) {
723 return AIL_ERROR_FAIL;
726 ret = ail_appinfo_get_bool(handle, AIL_PROP_NODISPLAY_BOOL, &value);
727 if (ret != AIL_ERROR_OK) {
728 return AIL_ERROR_FAIL;
730 fprintf(stderr, "appid[%s] : %d\n", appid, value);
732 ret = ail_destroy_appinfo(handle);
733 if (ret != AIL_ERROR_OK) {
734 return AIL_ERROR_FAIL;
741 ail_error_e ail_appinfo_get_bool(const ail_appinfo_h handle, const char *property, bool *value);
746 * @fn ail_error_e ail_appinfo_get_int(const ail_appinfo_h handle, const char *property, int *value)
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.
752 * @par Sync (or) Async : Synchronous API.
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.
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
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.
766 * @see ail_get_appinfo(), ail_destroy_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_str()
768 * @par Prospective Clients:
772 static ail_error_e _get_x_slp_baselayoutwidth(const char *appid)
774 ail_appinfo_h handle;
778 ret = ail_get_appinfo(appid, &handle);
779 if (ret != AIL_ERROR_OK) {
780 return AIL_ERROR_FAIL;
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;
787 fprintf(stderr, "Package[%s] : %d\n", appid, value);
789 ret = ail_destroy_appinfo(handle);
790 if (ret != AIL_ERROR_OK) {
791 return AIL_ERROR_FAIL;
798 ail_error_e ail_appinfo_get_int(const ail_appinfo_h handle, const char *property, int *value);
803 * @fn ail_error_e ail_appinfo_get_str(const ail_appinfo_h handle, const char *property, char **str)
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.
809 * @par Sync (or) Async : Synchronous API.
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.
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
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.
823 * @see ail_get_appinfo(), ail_destroy_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_int()
825 * @par Prospective Clients:
829 static ail_error_e _get_nodisplay(const char *appid)
831 ail_appinfo_h handle;
835 ret = ail_get_appinfo(appid, &handle);
836 if (ret != AIL_ERROR_OK) {
837 return AIL_ERROR_FAIL;
840 ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &value);
841 if (ret != AIL_ERROR_OK) {
842 return AIL_ERROR_FAIL;
844 fprintf(stderr, "Package[%s] : %d\n", appid, value);
846 ret = ail_destroy_appinfo(handle);
847 if (ret != AIL_ERROR_OK) {
848 return AIL_ERROR_FAIL;
855 ail_error_e ail_appinfo_get_str(const ail_appinfo_h handle, const char *property, char **str);
860 * @fn ail_error_e ail_package_destroy_appinfo(const ail_appinfo_h handle)
862 * @brief destroy a handle what you get with the function of ail_package_get_appinfo.
864 * @par Sync (or) Async : Synchronous API.
866 * @param[in] handle destroy all resources related to the handle.
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
873 * @pre need a handle that you don't need anymore.
874 * @post cannot use the handle after destroying.
876 * @see ail_package_get_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_int(), ail_appinfo_get_str()
878 * @par Prospective Clients:
882 static ail_error_e _get_name(const char *package)
884 ail_appinfo_h handle;
888 ret = ail_package_get_appinfo(package, &handle);
889 if (ret != AIL_ERROR_OK) {
890 return AIL_ERROR_FAIL;
893 ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &str);
894 if (ret != AIL_ERROR_OK) {
895 return AIL_ERROR_FAIL;
897 fprintf(stderr, "Package[%s], Property[%s] : %s\n", package, property, str);
899 ret = ail_package_destroy_appinfo(handle);
900 if (ret != AIL_ERROR_OK) {
901 return AIL_ERROR_FAIL;
908 ail_error_e ail_package_destroy_appinfo(const ail_appinfo_h handle) __attribute__((deprecated));
912 * @fn ail_error_e ail_destroy_appinfo(const ail_appinfo_h handle)
914 * @brief destroy a handle what you get with the function of ail_get_appinfo.
916 * @par Sync (or) Async : Synchronous API.
918 * @param[in] handle destroy all resources related to the handle.
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
925 * @pre need a handle that you don't need anymore.
926 * @post cannot use the handle after destroying.
928 * @see ail_get_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_int(), ail_appinfo_get_str()
930 * @par Prospective Clients:
934 static ail_error_e _get_name(const char *appid)
936 ail_appinfo_h handle;
940 ret = ail_get_appinfo(appid, &handle);
941 if (ret != AIL_ERROR_OK) {
942 return AIL_ERROR_FAIL;
945 ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &str);
946 if (ret != AIL_ERROR_OK) {
947 return AIL_ERROR_FAIL;
949 fprintf(stderr, "Package[%s], Property[%s] : %s\n", appid, property, str);
951 ret = ail_destroy_appinfo(handle);
952 if (ret != AIL_ERROR_OK) {
953 return AIL_ERROR_FAIL;
960 ail_error_e ail_destroy_appinfo(const ail_appinfo_h handle);
963 * @fn ail_error_e ail_close_appinfo_db(void)
965 * @brief close appinfo db.
967 * @par Sync (or) Async : Synchronous API.
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
974 * @pre need a handle that you don't need anymore.
975 * @post cannot use the handle after destroying.
977 * @see ail_get_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_int(), ail_appinfo_get_str()
979 * @par Prospective Clients:
983 static ail_error_e _get_name(const char *appid)
985 ail_appinfo_h handle;
989 ret = ail_get_appinfo(appid, &handle);
990 if (ret != AIL_ERROR_OK) {
991 return AIL_ERROR_FAIL;
994 ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &str);
995 if (ret != AIL_ERROR_OK) {
996 return AIL_ERROR_FAIL;
998 fprintf(stderr, "Package[%s], Property[%s] : %s\n", appid, property, str);
1000 ret = ail_destroy_appinfo(handle);
1001 if (ret != AIL_ERROR_OK) {
1002 return AIL_ERROR_FAIL;
1005 ret = ail_close_appinfo_db();
1006 if (ret != AIL_ERROR_OK) {
1007 return AIL_ERROR_FAIL;
1010 return AIL_ERROR_OK;
1014 ail_error_e ail_close_appinfo_db(void);
1018 * @fn ail_error_e ail_desktop_add(const char *appid)
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.
1026 * @par Sync (or) Async : Synchronous API.
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
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.
1038 * @see ail_desktop_update(), ail_desktop_remove()
1040 * @par Prospective Clients:
1044 static ail_error_e _add_desktop(const char *appid)
1049 return AIL_ERROR_FAIL;
1052 ret = ail_desktop_add(appid);
1053 if (ret != AIL_ERROR_OK) {
1054 return AIL_ERROR_FAIL;
1057 return AIL_ERROR_OK;
1061 ail_error_e ail_desktop_add(const char *appid);
1066 * @fn ail_error_e ail_desktop_update(const char *appid)
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.
1072 * @par Sync (or) Async : Synchronous API.
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
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.
1084 * @see ail_desktop_add(), ail_desktop_remove()
1086 * @par Prospective Clients:
1090 static ail_error_e _update_desktop(const char *appid)
1095 return AIL_ERROR_FAIL;
1098 ret = ail_desktop_update(appid);
1099 if (ret != AIL_ERROR_OK) {
1100 return AIL_ERROR_FAIL;
1103 return AIL_ERROR_OK;
1107 ail_error_e ail_desktop_update(const char *appid);
1112 * @fn ail_error_e ail_desktop_remove(const char *appid)
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.
1117 * @par Sync (or) Async : Synchronous API.
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
1126 * @pre no pre-condition.
1127 * @post app information is removed in the Application Information Database.
1129 * @see ail_desktop_add(), ail_desktop_update()
1131 * @par Prospective Clients:
1135 static ail_error_e _remove_desktop(const char *appid)
1140 return AIL_ERROR_FAIL;
1143 ret = ail_desktop_remove(appid);
1144 if (ret != AIL_ERROR_OK) {
1145 return AIL_ERROR_FAIL;
1148 return AIL_ERROR_OK;
1152 ail_error_e ail_desktop_remove(const char *appid);
1155 * @fn ail_error_e ail_desktop_clean(const char *pkgid)
1157 * @brief clean a pkg information in the Application Information Database.
1159 * @par Sync (or) Async : Synchronous API.
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
1168 * @pre no pre-condition.
1169 * @post app information is removed in the Application Information Database.
1171 * @see ail_desktop_add(), ail_desktop_update()
1173 * @par Prospective Clients:
1177 static ail_error_e _clean_desktop(const char *pkgid)
1182 return AIL_ERROR_FAIL;
1185 ret = ail_desktop_clean(pkgid);
1186 if (ret != AIL_ERROR_OK) {
1187 return AIL_ERROR_FAIL;
1190 return AIL_ERROR_OK;
1194 ail_error_e ail_desktop_clean(const char *pkgid);
1198 * @fn ail_error_e ail_desktop_fota(const char *appid)
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.
1206 * @par Sync (or) Async : Synchronous API.
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
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.
1218 * @see ail_desktop_update(), ail_desktop_remove()
1220 * @par Prospective Clients:
1224 static ail_error_e _add_desktop_fota(const char *appid)
1229 return AIL_ERROR_FAIL;
1232 ret = ail_desktop_fota(appid);
1233 if (ret != AIL_ERROR_OK) {
1234 return AIL_ERROR_FAIL;
1237 return AIL_ERROR_OK;
1241 ail_error_e ail_desktop_fota(const char *appid);
1244 * @fn ail_error_e ail_desktop_appinfo_modify_str(const char *appid, const char *property, const char *value, bool broadcast)
1246 * @brief update a app information db.
1247 And a notification is published to the applications who want to know about changing DB.
1249 * @par Sync (or) Async : Synchronous API.
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
1258 * @pre no pre-condition.
1259 * @post app information is removed in the Application Information Database.
1262 * @par Prospective Clients:
1266 static ail_error_e _appinfo_modify_str(const char *appid, const char *property, const char *value, bool broadcast)
1271 return AIL_ERROR_FAIL;
1274 return AIL_ERROR_FAIL;
1277 return AIL_ERROR_FAIL;
1280 ret = ail_desktop_appinfo_modify_str(appid, property, value, broadcast);
1281 if (ret != AIL_ERROR_OK) {
1282 return AIL_ERROR_FAIL;
1285 return AIL_ERROR_OK;
1290 ail_error_e ail_desktop_appinfo_modify_str(const char *appid, const char *property, const char *value, bool broadcast);
1297 #endif /* __cplusplus */
1299 #endif /* __AIL_H__ */