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"
78 * @brief integer type properties
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"
84 * @brief boolean type properties
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_INACTIVATED_BOOL "AIL_PROP_X_SLP_INACTIVATED_BOOL"
94 * @brief A handle for filters
96 typedef struct ail_filter *ail_filter_h;
99 * @brief A handle for appinfos
101 typedef struct ail_appinfo *ail_appinfo_h;
104 * @brief return values
107 AIL_ERROR_OK = 0, /**< General success */
108 AIL_ERROR_FAIL = -1, /**< General error */
109 AIL_ERROR_DB_FAILED = -2, /**< Database error */
110 AIL_ERROR_OUT_OF_MEMORY = -3, /**< Out of memory */
111 AIL_ERROR_INVALID_PARAMETER = -4, /**< Invalid parameter */
112 AIL_ERROR_NO_DATA = -5, /**< Success, but no data */
116 * @fn ail_error_e ail_filter_new(ail_filter_h *filter)
118 * @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 * @par Sync (or) Async : Synchronous API.
122 * @param[out] filter a pointer to a filter which is newly created
124 * @return 0 if success, negative value(<0) if fail\n
125 * @retval AIL_ERROR_OK success
126 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
127 * @retval AIL_ERROR_OUT_OF_MEMORY out of memory
130 * @post If the filter is no longer used, it should be freed with ail_filter_destroy()
132 * @see ail_filter_destroy()
134 * @par Prospective Clients:
144 ret = ail_filter_new(&filter);
145 if (ret != AIL_ERROR_OK) {
149 ret = ail_filter_add_bool(filter, AIL_PROP_NODISPLAY_BOOL, false);
150 if (ret != AIL_ERROR_OK) {
154 ret = ail_filter_add_str(filter, AIL_PROP_MIMETYPE_STR, "audio/wav");
155 if (ret != AIL_ERROR_OK) {
159 ret = ail_filter_count_appinfo(filter, &n);
160 if (ret != AIL_ERROR_OK) {
163 ret = ail_filter_destroy(filter);
165 printf("N of apps not to be displayed and supporting 'audo/wav' mime type = %d\n", n);
171 ail_error_e ail_filter_new(ail_filter_h *filter);
176 * @fn ail_error_e ail_error_e ail_filter_add_int(ail_filter_h filter, const char *property, const int value)
178 * @brief Add integer condition to filter
180 * @par Sync (or) Async : Synchronous API
182 * @param[in] filter a filter handle which can be create with ail_filter_new()
183 * @param[in] property a property type of integer
184 * @param[in] value the value to filter by
186 * @return 0 if success, negative value(<0) if fail\n
187 * @retval AIL_ERROR_OK success
188 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
189 * @retval AIL_ERROR_OUT_OF_MEMORY out of memory
191 * @pre The filter should be valid handle which was created by ail_filter_new()
193 * @see ail_filter_new()
195 * @par Prospective Clients:
205 ret = ail_filter_new(&filter);
206 if (ret != AIL_ERROR_OK) {
210 ret = ail_filter_add_int(filter, AIL_PROP_X_SLP_BASELAYOUTWIDTH_INT, 480);
211 if (ret != AIL_ERROR_OK) {
215 ret = ail_filter_count_appinfo(filter, &n);
216 if (ret != AIL_ERROR_OK) {
220 printf("N of apps = %d\n", n);
226 ail_error_e ail_filter_add_int(ail_filter_h filter, const char *property, const int value);
230 * @fn ail_error_e ail_error_e ail_filter_add_bool(ail_filter_h filter, const char *property, const bool value)
232 * @brief Add boolean condition to filter by. The value can be true/false only
234 * @par Sync (or) Async : Synchronous API
236 * @param[in] filter a filter handle which can be create with ail_filter_new()
237 * @param[in] property a property type of boolean
238 * @param[in] value the value to filter by
240 * @return 0 if success, negative value(<0) if fail\n
241 * @retval AIL_ERROR_OK success
242 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
243 * @retval AIL_ERROR_OUT_OF_MEMORY out of memory
245 * @pre The filter should be valid handle which was created by ail_filter_new()
247 * @see ail_filter_new()
249 * @par Prospective Clients:
259 ret = ail_filter_new(&filter);
260 if (ret != AIL_ERROR_OK) {
264 ret = ail_filter_add_bool(filter, AIL_PROP_X_SLP_REMOVABLE_BOOL, true);
265 if (ret != AIL_ERROR_OK) {
269 ret = ail_filter_count_appinfo(filter, &n);
270 if (ret != AIL_ERROR_OK) {
274 fprintf(stderr, "N of apps = %d\n", n);
280 ail_error_e ail_filter_add_bool(ail_filter_h filter, const char *property, bool value);
285 * @fn ail_error_e ail_error_e ail_filter_add_str(ail_filter_h filter, const char *property, const char *value)
287 * @brief Add string condition to filter by. The string is case-sensitive.
289 * @par Sync (or) Async : Synchronous API
291 * @param[in] filter a filter handle which can be create with ail_filter_new()
292 * @param[in] property a property type of string
293 * @param[in] value the value to filter by
295 * @return 0 if success, negative value(<0) if fail\n
296 * @retval AIL_ERROR_OK success
297 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
298 * @retval AIL_ERROR_OUT_OF_MEMORY out of memory
300 * @pre The filter should be valid handle which was created by ail_filter_new()
302 * @see ail_filter_new()
304 * @par Prospective Clients:
314 ret = ail_filter_new(&filter);
315 if (ret != AIL_ERROR_OK) {
319 ret = ail_filter_add_str(filter, AIL_PROP_PACKAGE_STR, "com.samsung.memo");
320 if (ret != AIL_ERROR_OK) {
324 ret = ail_filter_count_appinfo(filter, &n);
325 if (ret != AIL_ERROR_OK) {
329 fprintf(stderr, "N of apps = %d\n", n);
335 ail_error_e ail_filter_add_str(ail_filter_h filter, const char *property, const char *value);
340 * @fn ail_error_e ail_filter_destroy(ail_filter_h filter)
342 * @brief Destroy a filter which is not used any longer.
344 * @par Sync (or) Async : Synchronous API
346 * @param[in] filter filter handle
348 * @return 0 if success, negative value(<0) if fail\n
349 * @retval AIL_ERROR_OK success
350 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
352 * @post If the filter is no longer used, it should be freed with ail_filter_destroy()
354 * @see ail_filter_new()
356 * @par Prospective Clients:
366 ret = ail_filter_new(&filter);
367 if (ret != AIL_ERROR_OK) {
371 ret = ail_filter_add_bool(filter, AIL_PROP_X_SLP_REMOVABLE_BOOL, true);
372 if (ret != AIL_ERROR_OK) {
376 ret = ail_filter_count_appinfo(filter, &n);
377 if (ret != AIL_ERROR_OK) {
381 printf("N of removable apps = %d\n", n);
383 ret = ail_filter_add_str(filter, AIL_PROP_MIMETYPE_STR, "audio/wav");
384 if (ret != AIL_ERROR_OK) {
388 ret = ail_filter_count_appinfo(filter, &n);
389 if (ret != AIL_ERROR_OK) {
393 printf("N of apps removable and supporting 'audo/wav' mime type = %d\n", n);
395 ret = ail_filter_destroy(filter);
401 ail_error_e ail_filter_destroy(ail_filter_h filter);
406 * @brief return value type of ail_list_appinfo_cb
409 AIL_CB_RET_CONTINUE = 1, /**< continue */
410 AIL_CB_RET_CANCEL = 0, /**< cancel */
414 * @fn ail_cb_ret_e (*ail_list_appinfo_cb) (const ail_appinfo_h appinfo_h, void *user_data)
416 * @breif Specifies the type of functions passed to ail_filter_list_appinfo_foreach().
418 * @param[in] appinfo_h the appinfo's handle
419 * @param[in] user_data user data passed to ail_filtet_list_appinfo_foreach()
421 * @return 0 if success, negative value(<0) if fail\n
422 * @retval AIL_CB_RET_CONTINUE return if you continue iteration
423 * @retval AIL_CB_RET_CANCEL return if you cancel iteration
425 * @see ail_filter_list_appinfo_foreach()
427 typedef ail_cb_ret_e (*ail_list_appinfo_cb) (const ail_appinfo_h appinfo_h, void *user_data);
430 * @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 * @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 * @par Sync (or) Async : Synchronous API
436 * @param[in] filter a filter handle
437 * @param[in] func the function to call with each app's appinfo
438 * @param[in] user_data user_data to pass to the function
440 * @return 0 if success, negative value(<0) if fail\n
441 * @retval AIL_ERROR_OK success
442 * @retval AIL_ERROR_DB_FAILED database error
443 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
445 * @see ail_list_appinfo_cb
446 * @see ail_filter_add_bool()
447 * @see ail_filter_add_int()
448 * @see ail_filter_add_str()
450 * @par Prospective Clients:
455 ail_cb_ret_e appinfo_func(const ail_appinfo_h appinfo, void *user_data)
457 int *i = (int *)user_data;
460 ail_appinfo_get_str(appinfo, AIL_PROP_PACKAGE_STR, &appid);
461 printf("i=%d %s\n", (*i)++, appid);
464 return AIL_CB_RET_CANCEL;
466 return AIL_CB_RET_CONTINUE;
475 ret = ail_filter_new(&filter);
476 if (ret != AIL_ERROR_OK) {
480 ret = ail_filter_add_bool(filter, AIL_PROP_X_SLP_REMOVABLE_BOOL, true);
481 if (ret != AIL_ERROR_OK) {
485 ret = ail_filter_add_str(filter, AIL_PROP_TYPE_STR, "Application");
486 if (ret != AIL_ERROR_OK) {
490 printf("List apps which are removable and 'Application' typed\n");
491 ail_filter_list_appinfo_foreach(filter, appinfo_func, (void *)&i);
493 ail_filter_destroy(filter);
499 ail_error_e ail_filter_list_appinfo_foreach(ail_filter_h filter,
500 ail_list_appinfo_cb appinfo_func,
506 * @fn ail_error_e ail_error_e ail_filter_count_appinfo(ail_filter_h filter, int *count)
508 * @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 * @par Sync (or) Async : Synchronous API
512 * @param[in] filter a filter handle
513 * @param[in] count the number of appinfo which is filtered
515 * @return 0 if success, negative value(<0) if fail\n
516 * @retval AIL_ERROR_OK success
517 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
518 * @retval AIL_ERROR_OUT_OF_MEMORY out of memory
523 * @see ail_filter_new()
524 * @see ail_filter_add_bool()
525 * @see ail_filter_add_int()
526 * @see ail_filter_add_str()
528 * @par Prospective Clients:
538 ret = ail_filter_new(&filter);
539 if (ret != AIL_ERROR_OK) {
543 ret = ail_filter_add_bool(filter, AIL_PROP_NODISPLAY_BOOL, true);
544 if (ret != AIL_ERROR_OK) {
548 ret = ail_filter_count_appinfo(filter, &n);
549 if (ret != AIL_ERROR_OK) {
553 printf("N of app not to be displayed = %d", n);
555 ret = ail_filter_count_appinfo(NULL, &n);
556 if (ret != AIL_ERROR_OK) {
560 printf("N of all app = %d\n", n);
566 ail_error_e ail_filter_count_appinfo(ail_filter_h filter, int *count);
571 * @fn ail_error_e ail_package_get_appinfo(const char *package, ail_appinfo_h *handle)
573 * @brief get an application information related to a package.
574 This API just retrieves all the information of the package from Application Information Database.
575 All data related to the package are loaded in the memory after calling this function.
576 If you want to read a value from the retrieving data, you have to use the functions of ail_appinfo_get_xxx.
578 * @par Sync (or) Async : Synchronous API.
580 * @param[in] package package name what you want to know about.
581 * @param[out] handle handle will be used with the functions of ail_appinfo_get_xxx. If no data, it will be NULL.
583 * @return 0 if success, negative value(<0) if fail\n
584 * @retval AIL_ERROR_OK success
585 * @retval AIL_ERROR_FAIL internal error
586 * @retval AIL_ERROR_DB_FAILED database error
587 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
588 * @retval AIL_ERROR_NO_DATA no data. cannot find the package.
590 * @pre declare a handle before calling this function. The handle is used as a second argument of this API.
591 * @post destroy the handle with the function of ail_package_destroy_appinfo after using it all.
593 * @see ail_package_destroy_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_int(), ail_appinfo_get_str()
595 * @par Prospective Clients:
599 static ail_error_e _get_name(const char *package)
601 ail_appinfo_h handle;
605 ret = ail_package_get_appinfo(package, &handle);
606 if (ret != AIL_ERROR_OK) {
607 return AIL_ERROR_FAIL;
610 ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &str);
611 if (ret != AIL_ERROR_OK) {
612 return AIL_ERROR_FAIL;
614 fprintf(stderr, "Package[%s], Property[%s] : %s\n", package, property, str);
616 ret = ail_package_destroy_appinfo(handle);
617 if (ret != AIL_ERROR_OK) {
618 return AIL_ERROR_FAIL;
625 ail_error_e ail_package_get_appinfo(const char *package, ail_appinfo_h *handle) __attribute__((deprecated));
629 * @fn ail_error_e ail_get_appinfo(const char *appid, ail_appinfo_h *handle)
631 * @brief get an application information related to a appid.
632 This API just retrieves all the information of the application from Application Information Database.
633 All data related to the appid are loaded in the memory after calling this function.
634 If you want to read a value from the retrieving data, you have to use the functions of ail_appinfo_get_xxx.
636 * @par Sync (or) Async : Synchronous API.
638 * @param[in] appid appid what you want to know about.
639 * @param[out] handle handle will be used with the functions of ail_appinfo_get_xxx. If no data, it will be NULL.
641 * @return 0 if success, negative value(<0) if fail\n
642 * @retval AIL_ERROR_OK success
643 * @retval AIL_ERROR_FAIL internal error
644 * @retval AIL_ERROR_DB_FAILED database error
645 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
646 * @retval AIL_ERROR_NO_DATA no data. cannot find the app.
648 * @pre declare a handle before calling this function. The handle is used as a second argument of this API.
649 * @post destroy the handle with the function of ail_get_appinfo after using it all.
651 * @see ail_get_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_int(), ail_appinfo_get_str()
653 * @par Prospective Clients:
657 static ail_error_e _get_name(const char *appid)
659 ail_appinfo_h handle;
663 ret = ail_get_appinfo(appid, &handle);
664 if (ret != AIL_ERROR_OK) {
665 return AIL_ERROR_FAIL;
668 ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &str);
669 if (ret != AIL_ERROR_OK) {
670 return AIL_ERROR_FAIL;
672 fprintf(stderr, "Package[%s], Property[%s] : %s\n", appid, property, str);
674 ret = ail_destroy_appinfo(handle);
675 if (ret != AIL_ERROR_OK) {
676 return AIL_ERROR_FAIL;
683 ail_error_e ail_get_appinfo(const char *appid, ail_appinfo_h *handle);
687 * @fn ail_error_e ail_appinfo_get_bool(const ail_appinfo_h handle, const char *property, bool *value)
689 * @brief get a boolean value related to the property.
690 Before using this API, the handle is defined by calling ail_get_appinfo.
691 This function needs a out-parameter for the value.
693 * @par Sync (or) Async : Synchronous API.
695 * @param[in] handle the handle is defined by calling ail_get_appinfo.
696 * @param[in] property a property type of boolean
697 * @param[out] value a out-parameter value that is mapped with the property.
699 * @return 0 if success, negative value(<0) if fail\n
700 * @retval AIL_ERROR_OK success
701 * @retval AIL_ERROR_DB_FAILED database error
702 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
704 * @pre define a handle using ail_get_appinfo. The handle is used as a first argument of this API.
705 * @post destroy the handle with the function of ail_destroy_appinfo after using it all.
707 * @see ail_get_appinfo(), ail_destroy_appinfo(), ail_appinfo_get_int(), ail_appinfo_get_str()
709 * @par Prospective Clients:
713 static ail_error_e _get_nodisplay(const char *appid)
715 ail_appinfo_h handle;
719 ret = ail_get_appinfo(appid, &handle);
720 if (ret != AIL_ERROR_OK) {
721 return AIL_ERROR_FAIL;
724 ret = ail_appinfo_get_bool(handle, AIL_PROP_NODISPLAY_BOOL, &value);
725 if (ret != AIL_ERROR_OK) {
726 return AIL_ERROR_FAIL;
728 fprintf(stderr, "appid[%s] : %d\n", appid, value);
730 ret = ail_destroy_appinfo(handle);
731 if (ret != AIL_ERROR_OK) {
732 return AIL_ERROR_FAIL;
739 ail_error_e ail_appinfo_get_bool(const ail_appinfo_h handle, const char *property, bool *value);
744 * @fn ail_error_e ail_appinfo_get_int(const ail_appinfo_h handle, const char *property, int *value)
746 * @brief get a integer value related to the property.
747 Before using this API, the handle is defined by calling ail_get_appinfo.
748 This function needs a out-parameter for the value.
750 * @par Sync (or) Async : Synchronous API.
752 * @param[in] handle the handle is defined by calling ail_get_appinfo.
753 * @param[in] property a property type of integer.
754 * @param[out] value a out-parameter value that is mapped with the property.
756 * @return 0 if success, negative value(<0) if fail\n
757 * @retval AIL_ERROR_OK success
758 * @retval AIL_ERROR_DB_FAILED database error
759 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
761 * @pre define a handle using ail_get_appinfo. The handle is used as a first argument of this API.
762 * @post destroy the handle with the function of ail_destroy_appinfo after using it all.
764 * @see ail_get_appinfo(), ail_destroy_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_str()
766 * @par Prospective Clients:
770 static ail_error_e _get_x_slp_baselayoutwidth(const char *appid)
772 ail_appinfo_h handle;
776 ret = ail_get_appinfo(appid, &handle);
777 if (ret != AIL_ERROR_OK) {
778 return AIL_ERROR_FAIL;
781 ret = ail_appinfo_get_int(handle, AIL_PROP_X_SLP_BASELAYOUTWIDTH_INT, &value);
782 if (ret != AIL_ERROR_OK) {
783 return AIL_ERROR_FAIL;
785 fprintf(stderr, "Package[%s] : %d\n", appid, value);
787 ret = ail_destroy_appinfo(handle);
788 if (ret != AIL_ERROR_OK) {
789 return AIL_ERROR_FAIL;
796 ail_error_e ail_appinfo_get_int(const ail_appinfo_h handle, const char *property, int *value);
801 * @fn ail_error_e ail_appinfo_get_str(const ail_appinfo_h handle, const char *property, char **str)
803 * @brief get a string related to the property.
804 Before using this API, the handle is defined by calling ail_get_appinfo.
805 This function needs a out-parameter for the value.
807 * @par Sync (or) Async : Synchronous API.
809 * @param[in] handle the handle is defined by calling ail_get_appinfo.
810 * @param[in] property a property type of string.
811 * @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 * @return 0 if success, negative value(<0) if fail\n
814 * @retval AIL_ERROR_OK success
815 * @retval AIL_ERROR_DB_FAILED database error
816 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
818 * @pre define a handle using ail_get_appinfo. The handle is used as a first argument of this API.
819 * @post str doesn't need to be freed. It will be freed by calling ail_destroy_appinfo.
821 * @see ail_get_appinfo(), ail_destroy_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_int()
823 * @par Prospective Clients:
827 static ail_error_e _get_nodisplay(const char *appid)
829 ail_appinfo_h handle;
833 ret = ail_get_appinfo(appid, &handle);
834 if (ret != AIL_ERROR_OK) {
835 return AIL_ERROR_FAIL;
838 ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &value);
839 if (ret != AIL_ERROR_OK) {
840 return AIL_ERROR_FAIL;
842 fprintf(stderr, "Package[%s] : %d\n", appid, value);
844 ret = ail_destroy_appinfo(handle);
845 if (ret != AIL_ERROR_OK) {
846 return AIL_ERROR_FAIL;
853 ail_error_e ail_appinfo_get_str(const ail_appinfo_h handle, const char *property, char **str);
858 * @fn ail_error_e ail_package_destroy_appinfo(const ail_appinfo_h handle)
860 * @brief destroy a handle what you get with the function of ail_package_get_appinfo.
862 * @par Sync (or) Async : Synchronous API.
864 * @param[in] handle destroy all resources related to the handle.
866 * @return 0 if success, negative value(<0) if fail\n
867 * @retval AIL_ERROR_OK success
868 * @retval AIL_ERROR_DB_FAILED database error
869 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
871 * @pre need a handle that you don't need anymore.
872 * @post cannot use the handle after destroying.
874 * @see ail_package_get_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_int(), ail_appinfo_get_str()
876 * @par Prospective Clients:
880 static ail_error_e _get_name(const char *package)
882 ail_appinfo_h handle;
886 ret = ail_package_get_appinfo(package, &handle);
887 if (ret != AIL_ERROR_OK) {
888 return AIL_ERROR_FAIL;
891 ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &str);
892 if (ret != AIL_ERROR_OK) {
893 return AIL_ERROR_FAIL;
895 fprintf(stderr, "Package[%s], Property[%s] : %s\n", package, property, str);
897 ret = ail_package_destroy_appinfo(handle);
898 if (ret != AIL_ERROR_OK) {
899 return AIL_ERROR_FAIL;
906 ail_error_e ail_package_destroy_appinfo(const ail_appinfo_h handle) __attribute__((deprecated));
910 * @fn ail_error_e ail_destroy_appinfo(const ail_appinfo_h handle)
912 * @brief destroy a handle what you get with the function of ail_get_appinfo.
914 * @par Sync (or) Async : Synchronous API.
916 * @param[in] handle destroy all resources related to the handle.
918 * @return 0 if success, negative value(<0) if fail\n
919 * @retval AIL_ERROR_OK success
920 * @retval AIL_ERROR_DB_FAILED database error
921 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
923 * @pre need a handle that you don't need anymore.
924 * @post cannot use the handle after destroying.
926 * @see ail_get_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_int(), ail_appinfo_get_str()
928 * @par Prospective Clients:
932 static ail_error_e _get_name(const char *appid)
934 ail_appinfo_h handle;
938 ret = ail_get_appinfo(appid, &handle);
939 if (ret != AIL_ERROR_OK) {
940 return AIL_ERROR_FAIL;
943 ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &str);
944 if (ret != AIL_ERROR_OK) {
945 return AIL_ERROR_FAIL;
947 fprintf(stderr, "Package[%s], Property[%s] : %s\n", appid, property, str);
949 ret = ail_destroy_appinfo(handle);
950 if (ret != AIL_ERROR_OK) {
951 return AIL_ERROR_FAIL;
958 ail_error_e ail_destroy_appinfo(const ail_appinfo_h handle);
962 * @fn ail_error_e ail_desktop_add(const char *appid)
964 * @brief add a app information into Application Information Database.
965 A desktop file for this app has to be installed in the desktop directory before using this API.
966 If there is no database for Application Information Database, this API will create the DB.
967 If there is a DB, this function adds information for the app into the DB.
968 And a notification is published to the applications who want to know about changing DB.
970 * @par Sync (or) Async : Synchronous API.
974 * @return 0 if success, negative value(<0) if fail\n
975 * @retval AIL_ERROR_OK success
976 * @retval AIL_ERROR_FAIL internal error
977 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
979 * @pre a desktop file for the app has to be installed in the desktop directory before using this API.
980 * @post app information is added into the Application Information Database.
982 * @see ail_desktop_update(), ail_desktop_remove()
984 * @par Prospective Clients:
988 static ail_error_e _add_desktop(const char *appid)
993 return AIL_ERROR_FAIL;
996 ret = ail_desktop_add(appid);
997 if (ret != AIL_ERROR_OK) {
998 return AIL_ERROR_FAIL;
1001 return AIL_ERROR_OK;
1005 ail_error_e ail_desktop_add(const char *appid);
1010 * @fn ail_error_e ail_desktop_update(const char *appid)
1012 * @brief update a app information in the Application Information Database.
1013 A desktop file for this app has to be installed in the desktop directory before using this API.
1014 And a notification is published to the applications who want to know about changing DB.
1016 * @par Sync (or) Async : Synchronous API.
1020 * @return 0 if success, negative value(<0) if fail\n
1021 * @retval AIL_ERROR_OK success
1022 * @retval AIL_ERROR_FAIL internal error
1023 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
1025 * @pre a desktop file for the app has to be installed in the desktop directory before using this API.
1026 * @post update a app information in the Application Information Database.
1028 * @see ail_desktop_add(), ail_desktop_remove()
1030 * @par Prospective Clients:
1034 static ail_error_e _update_desktop(const char *appid)
1039 return AIL_ERROR_FAIL;
1042 ret = ail_desktop_update(appid);
1043 if (ret != AIL_ERROR_OK) {
1044 return AIL_ERROR_FAIL;
1047 return AIL_ERROR_OK;
1051 ail_error_e ail_desktop_update(const char *appid);
1056 * @fn ail_error_e ail_desktop_remove(const char *appid)
1058 * @brief remove a app information in the Application Information Database.
1059 And a notification is published to the applications who want to know about changing DB.
1061 * @par Sync (or) Async : Synchronous API.
1065 * @return 0 if success, negative value(<0) if fail\n
1066 * @retval AIL_ERROR_OK success
1067 * @retval AIL_ERROR_FAIL internal error
1068 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
1070 * @pre no pre-condition.
1071 * @post app information is removed in the Application Information Database.
1073 * @see ail_desktop_add(), ail_desktop_update()
1075 * @par Prospective Clients:
1079 static ail_error_e _remove_desktop(const char *appid)
1084 return AIL_ERROR_FAIL;
1087 ret = ail_desktop_remove(appid);
1088 if (ret != AIL_ERROR_OK) {
1089 return AIL_ERROR_FAIL;
1092 return AIL_ERROR_OK;
1096 ail_error_e ail_desktop_remove(const char *appid);
1103 #endif /* __cplusplus */
1105 #endif /* __AIL_H__ */