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_ISHORIZONTALSCALE_BOOL "AIL_PROP_X_SLP_ISHORIZONTALSCALE_BOOL"
91 #define AIL_PROP_X_SLP_ENABLED_BOOL "AIL_PROP_X_SLP_ENABLED_BOOL"
95 * @brief A handle for filters
97 typedef struct ail_filter *ail_filter_h;
100 * @brief A handle for appinfos
102 typedef struct ail_appinfo *ail_appinfo_h;
105 * @brief return values
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 */
117 * @fn ail_error_e ail_filter_new(ail_filter_h *filter)
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.
121 * @par Sync (or) Async : Synchronous API.
123 * @param[out] filter a pointer to a filter which is newly created
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
131 * @post If the filter is no longer used, it should be freed with ail_filter_destroy()
133 * @see ail_filter_destroy()
135 * @par Prospective Clients:
145 ret = ail_filter_new(&filter);
146 if (ret != AIL_ERROR_OK) {
150 ret = ail_filter_add_bool(filter, AIL_PROP_NODISPLAY_BOOL, false);
151 if (ret != AIL_ERROR_OK) {
155 ret = ail_filter_add_str(filter, AIL_PROP_MIMETYPE_STR, "audio/wav");
156 if (ret != AIL_ERROR_OK) {
160 ret = ail_filter_count_appinfo(filter, &n);
161 if (ret != AIL_ERROR_OK) {
164 ret = ail_filter_destroy(filter);
166 printf("N of apps not to be displayed and supporting 'audo/wav' mime type = %d\n", n);
172 ail_error_e ail_filter_new(ail_filter_h *filter);
177 * @fn ail_error_e ail_error_e ail_filter_add_int(ail_filter_h filter, const char *property, const int value)
179 * @brief Add integer condition to filter
181 * @par Sync (or) Async : Synchronous API
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
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
192 * @pre The filter should be valid handle which was created by ail_filter_new()
194 * @see ail_filter_new()
196 * @par Prospective Clients:
206 ret = ail_filter_new(&filter);
207 if (ret != AIL_ERROR_OK) {
211 ret = ail_filter_add_int(filter, AIL_PROP_X_SLP_BASELAYOUTWIDTH_INT, 480);
212 if (ret != AIL_ERROR_OK) {
216 ret = ail_filter_count_appinfo(filter, &n);
217 if (ret != AIL_ERROR_OK) {
221 printf("N of apps = %d\n", n);
227 ail_error_e ail_filter_add_int(ail_filter_h filter, const char *property, const int value);
231 * @fn ail_error_e ail_error_e ail_filter_add_bool(ail_filter_h filter, const char *property, const bool value)
233 * @brief Add boolean condition to filter by. The value can be true/false only
235 * @par Sync (or) Async : Synchronous API
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
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
246 * @pre The filter should be valid handle which was created by ail_filter_new()
248 * @see ail_filter_new()
250 * @par Prospective Clients:
260 ret = ail_filter_new(&filter);
261 if (ret != AIL_ERROR_OK) {
265 ret = ail_filter_add_bool(filter, AIL_PROP_X_SLP_REMOVABLE_BOOL, true);
266 if (ret != AIL_ERROR_OK) {
270 ret = ail_filter_count_appinfo(filter, &n);
271 if (ret != AIL_ERROR_OK) {
275 fprintf(stderr, "N of apps = %d\n", n);
281 ail_error_e ail_filter_add_bool(ail_filter_h filter, const char *property, bool value);
286 * @fn ail_error_e ail_error_e ail_filter_add_str(ail_filter_h filter, const char *property, const char *value)
288 * @brief Add string condition to filter by. The string is case-sensitive.
290 * @par Sync (or) Async : Synchronous API
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
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
301 * @pre The filter should be valid handle which was created by ail_filter_new()
303 * @see ail_filter_new()
305 * @par Prospective Clients:
315 ret = ail_filter_new(&filter);
316 if (ret != AIL_ERROR_OK) {
320 ret = ail_filter_add_str(filter, AIL_PROP_PACKAGE_STR, "com.samsung.memo");
321 if (ret != AIL_ERROR_OK) {
325 ret = ail_filter_count_appinfo(filter, &n);
326 if (ret != AIL_ERROR_OK) {
330 fprintf(stderr, "N of apps = %d\n", n);
336 ail_error_e ail_filter_add_str(ail_filter_h filter, const char *property, const char *value);
341 * @fn ail_error_e ail_filter_destroy(ail_filter_h filter)
343 * @brief Destroy a filter which is not used any longer.
345 * @par Sync (or) Async : Synchronous API
347 * @param[in] filter filter handle
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
353 * @post If the filter is no longer used, it should be freed with ail_filter_destroy()
355 * @see ail_filter_new()
357 * @par Prospective Clients:
367 ret = ail_filter_new(&filter);
368 if (ret != AIL_ERROR_OK) {
372 ret = ail_filter_add_bool(filter, AIL_PROP_X_SLP_REMOVABLE_BOOL, true);
373 if (ret != AIL_ERROR_OK) {
377 ret = ail_filter_count_appinfo(filter, &n);
378 if (ret != AIL_ERROR_OK) {
382 printf("N of removable apps = %d\n", n);
384 ret = ail_filter_add_str(filter, AIL_PROP_MIMETYPE_STR, "audio/wav");
385 if (ret != AIL_ERROR_OK) {
389 ret = ail_filter_count_appinfo(filter, &n);
390 if (ret != AIL_ERROR_OK) {
394 printf("N of apps removable and supporting 'audo/wav' mime type = %d\n", n);
396 ret = ail_filter_destroy(filter);
402 ail_error_e ail_filter_destroy(ail_filter_h filter);
407 * @brief return value type of ail_list_appinfo_cb
410 AIL_CB_RET_CONTINUE = 1, /**< continue */
411 AIL_CB_RET_CANCEL = 0, /**< cancel */
415 * @fn ail_cb_ret_e (*ail_list_appinfo_cb) (const ail_appinfo_h appinfo_h, void *user_data)
417 * @breif Specifies the type of functions passed to ail_filter_list_appinfo_foreach().
419 * @param[in] appinfo_h the appinfo's handle
420 * @param[in] user_data user data passed to ail_filtet_list_appinfo_foreach()
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
426 * @see ail_filter_list_appinfo_foreach()
428 typedef ail_cb_ret_e (*ail_list_appinfo_cb) (const ail_appinfo_h appinfo_h, void *user_data);
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)
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.
435 * @par Sync (or) Async : Synchronous API
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
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
446 * @see ail_list_appinfo_cb
447 * @see ail_filter_add_bool()
448 * @see ail_filter_add_int()
449 * @see ail_filter_add_str()
451 * @par Prospective Clients:
456 ail_cb_ret_e appinfo_func(const ail_appinfo_h appinfo, void *user_data)
458 int *i = (int *)user_data;
461 ail_appinfo_get_str(appinfo, AIL_PROP_PACKAGE_STR, &appid);
462 printf("i=%d %s\n", (*i)++, appid);
465 return AIL_CB_RET_CANCEL;
467 return AIL_CB_RET_CONTINUE;
476 ret = ail_filter_new(&filter);
477 if (ret != AIL_ERROR_OK) {
481 ret = ail_filter_add_bool(filter, AIL_PROP_X_SLP_REMOVABLE_BOOL, true);
482 if (ret != AIL_ERROR_OK) {
486 ret = ail_filter_add_str(filter, AIL_PROP_TYPE_STR, "Application");
487 if (ret != AIL_ERROR_OK) {
491 printf("List apps which are removable and 'Application' typed\n");
492 ail_filter_list_appinfo_foreach(filter, appinfo_func, (void *)&i);
494 ail_filter_destroy(filter);
500 ail_error_e ail_filter_list_appinfo_foreach(ail_filter_h filter,
501 ail_list_appinfo_cb appinfo_func,
507 * @fn ail_error_e ail_error_e ail_filter_count_appinfo(ail_filter_h filter, int *count)
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.
511 * @par Sync (or) Async : Synchronous API
513 * @param[in] filter a filter handle
514 * @param[in] count the number of appinfo which is filtered
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
524 * @see ail_filter_new()
525 * @see ail_filter_add_bool()
526 * @see ail_filter_add_int()
527 * @see ail_filter_add_str()
529 * @par Prospective Clients:
539 ret = ail_filter_new(&filter);
540 if (ret != AIL_ERROR_OK) {
544 ret = ail_filter_add_bool(filter, AIL_PROP_NODISPLAY_BOOL, true);
545 if (ret != AIL_ERROR_OK) {
549 ret = ail_filter_count_appinfo(filter, &n);
550 if (ret != AIL_ERROR_OK) {
554 printf("N of app not to be displayed = %d", n);
556 ret = ail_filter_count_appinfo(NULL, &n);
557 if (ret != AIL_ERROR_OK) {
561 printf("N of all app = %d\n", n);
567 ail_error_e ail_filter_count_appinfo(ail_filter_h filter, int *count);
572 * @fn ail_error_e ail_package_get_appinfo(const char *package, ail_appinfo_h *handle)
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.
579 * @par Sync (or) Async : Synchronous API.
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.
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.
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.
594 * @see ail_package_destroy_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_int(), ail_appinfo_get_str()
596 * @par Prospective Clients:
600 static ail_error_e _get_name(const char *package)
602 ail_appinfo_h handle;
606 ret = ail_package_get_appinfo(package, &handle);
607 if (ret != AIL_ERROR_OK) {
608 return AIL_ERROR_FAIL;
611 ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &str);
612 if (ret != AIL_ERROR_OK) {
613 return AIL_ERROR_FAIL;
615 fprintf(stderr, "Package[%s], Property[%s] : %s\n", package, property, str);
617 ret = ail_package_destroy_appinfo(handle);
618 if (ret != AIL_ERROR_OK) {
619 return AIL_ERROR_FAIL;
626 ail_error_e ail_package_get_appinfo(const char *package, ail_appinfo_h *handle) __attribute__((deprecated));
630 * @fn ail_error_e ail_get_appinfo(const char *appid, ail_appinfo_h *handle)
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.
637 * @par Sync (or) Async : Synchronous API.
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.
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.
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.
652 * @see ail_get_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_int(), ail_appinfo_get_str()
654 * @par Prospective Clients:
658 static ail_error_e _get_name(const char *appid)
660 ail_appinfo_h handle;
664 ret = ail_get_appinfo(appid, &handle);
665 if (ret != AIL_ERROR_OK) {
666 return AIL_ERROR_FAIL;
669 ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &str);
670 if (ret != AIL_ERROR_OK) {
671 return AIL_ERROR_FAIL;
673 fprintf(stderr, "Package[%s], Property[%s] : %s\n", appid, property, str);
675 ret = ail_destroy_appinfo(handle);
676 if (ret != AIL_ERROR_OK) {
677 return AIL_ERROR_FAIL;
684 ail_error_e ail_get_appinfo(const char *appid, ail_appinfo_h *handle);
688 * @fn ail_error_e ail_appinfo_get_bool(const ail_appinfo_h handle, const char *property, bool *value)
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.
694 * @par Sync (or) Async : Synchronous API.
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.
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
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.
708 * @see ail_get_appinfo(), ail_destroy_appinfo(), ail_appinfo_get_int(), ail_appinfo_get_str()
710 * @par Prospective Clients:
714 static ail_error_e _get_nodisplay(const char *appid)
716 ail_appinfo_h handle;
720 ret = ail_get_appinfo(appid, &handle);
721 if (ret != AIL_ERROR_OK) {
722 return AIL_ERROR_FAIL;
725 ret = ail_appinfo_get_bool(handle, AIL_PROP_NODISPLAY_BOOL, &value);
726 if (ret != AIL_ERROR_OK) {
727 return AIL_ERROR_FAIL;
729 fprintf(stderr, "appid[%s] : %d\n", appid, value);
731 ret = ail_destroy_appinfo(handle);
732 if (ret != AIL_ERROR_OK) {
733 return AIL_ERROR_FAIL;
740 ail_error_e ail_appinfo_get_bool(const ail_appinfo_h handle, const char *property, bool *value);
745 * @fn ail_error_e ail_appinfo_get_int(const ail_appinfo_h handle, const char *property, int *value)
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.
751 * @par Sync (or) Async : Synchronous API.
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.
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
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.
765 * @see ail_get_appinfo(), ail_destroy_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_str()
767 * @par Prospective Clients:
771 static ail_error_e _get_x_slp_baselayoutwidth(const char *appid)
773 ail_appinfo_h handle;
777 ret = ail_get_appinfo(appid, &handle);
778 if (ret != AIL_ERROR_OK) {
779 return AIL_ERROR_FAIL;
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;
786 fprintf(stderr, "Package[%s] : %d\n", appid, value);
788 ret = ail_destroy_appinfo(handle);
789 if (ret != AIL_ERROR_OK) {
790 return AIL_ERROR_FAIL;
797 ail_error_e ail_appinfo_get_int(const ail_appinfo_h handle, const char *property, int *value);
802 * @fn ail_error_e ail_appinfo_get_str(const ail_appinfo_h handle, const char *property, char **str)
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.
808 * @par Sync (or) Async : Synchronous API.
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.
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
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.
822 * @see ail_get_appinfo(), ail_destroy_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_int()
824 * @par Prospective Clients:
828 static ail_error_e _get_nodisplay(const char *appid)
830 ail_appinfo_h handle;
834 ret = ail_get_appinfo(appid, &handle);
835 if (ret != AIL_ERROR_OK) {
836 return AIL_ERROR_FAIL;
839 ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &value);
840 if (ret != AIL_ERROR_OK) {
841 return AIL_ERROR_FAIL;
843 fprintf(stderr, "Package[%s] : %d\n", appid, value);
845 ret = ail_destroy_appinfo(handle);
846 if (ret != AIL_ERROR_OK) {
847 return AIL_ERROR_FAIL;
854 ail_error_e ail_appinfo_get_str(const ail_appinfo_h handle, const char *property, char **str);
859 * @fn ail_error_e ail_package_destroy_appinfo(const ail_appinfo_h handle)
861 * @brief destroy a handle what you get with the function of ail_package_get_appinfo.
863 * @par Sync (or) Async : Synchronous API.
865 * @param[in] handle destroy all resources related to the handle.
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
872 * @pre need a handle that you don't need anymore.
873 * @post cannot use the handle after destroying.
875 * @see ail_package_get_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_int(), ail_appinfo_get_str()
877 * @par Prospective Clients:
881 static ail_error_e _get_name(const char *package)
883 ail_appinfo_h handle;
887 ret = ail_package_get_appinfo(package, &handle);
888 if (ret != AIL_ERROR_OK) {
889 return AIL_ERROR_FAIL;
892 ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &str);
893 if (ret != AIL_ERROR_OK) {
894 return AIL_ERROR_FAIL;
896 fprintf(stderr, "Package[%s], Property[%s] : %s\n", package, property, str);
898 ret = ail_package_destroy_appinfo(handle);
899 if (ret != AIL_ERROR_OK) {
900 return AIL_ERROR_FAIL;
907 ail_error_e ail_package_destroy_appinfo(const ail_appinfo_h handle) __attribute__((deprecated));
911 * @fn ail_error_e ail_destroy_appinfo(const ail_appinfo_h handle)
913 * @brief destroy a handle what you get with the function of ail_get_appinfo.
915 * @par Sync (or) Async : Synchronous API.
917 * @param[in] handle destroy all resources related to the handle.
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
924 * @pre need a handle that you don't need anymore.
925 * @post cannot use the handle after destroying.
927 * @see ail_get_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_int(), ail_appinfo_get_str()
929 * @par Prospective Clients:
933 static ail_error_e _get_name(const char *appid)
935 ail_appinfo_h handle;
939 ret = ail_get_appinfo(appid, &handle);
940 if (ret != AIL_ERROR_OK) {
941 return AIL_ERROR_FAIL;
944 ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &str);
945 if (ret != AIL_ERROR_OK) {
946 return AIL_ERROR_FAIL;
948 fprintf(stderr, "Package[%s], Property[%s] : %s\n", appid, property, str);
950 ret = ail_destroy_appinfo(handle);
951 if (ret != AIL_ERROR_OK) {
952 return AIL_ERROR_FAIL;
959 ail_error_e ail_destroy_appinfo(const ail_appinfo_h handle);
962 * @fn ail_error_e ail_close_appinfo_db(void)
964 * @brief close appinfo db.
966 * @par Sync (or) Async : Synchronous API.
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
973 * @pre need a handle that you don't need anymore.
974 * @post cannot use the handle after destroying.
976 * @see ail_get_appinfo(), ail_appinfo_get_bool(), ail_appinfo_get_int(), ail_appinfo_get_str()
978 * @par Prospective Clients:
982 static ail_error_e _get_name(const char *appid)
984 ail_appinfo_h handle;
988 ret = ail_get_appinfo(appid, &handle);
989 if (ret != AIL_ERROR_OK) {
990 return AIL_ERROR_FAIL;
993 ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &str);
994 if (ret != AIL_ERROR_OK) {
995 return AIL_ERROR_FAIL;
997 fprintf(stderr, "Package[%s], Property[%s] : %s\n", appid, property, str);
999 ret = ail_destroy_appinfo(handle);
1000 if (ret != AIL_ERROR_OK) {
1001 return AIL_ERROR_FAIL;
1004 ret = ail_close_appinfo_db();
1005 if (ret != AIL_ERROR_OK) {
1006 return AIL_ERROR_FAIL;
1009 return AIL_ERROR_OK;
1013 ail_error_e ail_close_appinfo_db(void);
1017 * @fn ail_error_e ail_desktop_add(const char *appid)
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.
1025 * @par Sync (or) Async : Synchronous API.
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
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.
1037 * @see ail_desktop_update(), ail_desktop_remove()
1039 * @par Prospective Clients:
1043 static ail_error_e _add_desktop(const char *appid)
1048 return AIL_ERROR_FAIL;
1051 ret = ail_desktop_add(appid);
1052 if (ret != AIL_ERROR_OK) {
1053 return AIL_ERROR_FAIL;
1056 return AIL_ERROR_OK;
1060 ail_error_e ail_desktop_add(const char *appid);
1065 * @fn ail_error_e ail_desktop_update(const char *appid)
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.
1071 * @par Sync (or) Async : Synchronous API.
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
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.
1083 * @see ail_desktop_add(), ail_desktop_remove()
1085 * @par Prospective Clients:
1089 static ail_error_e _update_desktop(const char *appid)
1094 return AIL_ERROR_FAIL;
1097 ret = ail_desktop_update(appid);
1098 if (ret != AIL_ERROR_OK) {
1099 return AIL_ERROR_FAIL;
1102 return AIL_ERROR_OK;
1106 ail_error_e ail_desktop_update(const char *appid);
1111 * @fn ail_error_e ail_desktop_remove(const char *appid)
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.
1116 * @par Sync (or) Async : Synchronous API.
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
1125 * @pre no pre-condition.
1126 * @post app information is removed in the Application Information Database.
1128 * @see ail_desktop_add(), ail_desktop_update()
1130 * @par Prospective Clients:
1134 static ail_error_e _remove_desktop(const char *appid)
1139 return AIL_ERROR_FAIL;
1142 ret = ail_desktop_remove(appid);
1143 if (ret != AIL_ERROR_OK) {
1144 return AIL_ERROR_FAIL;
1147 return AIL_ERROR_OK;
1151 ail_error_e ail_desktop_remove(const char *appid);
1155 * @fn ail_error_e ail_desktop_appinfo_modify_str(const char *appid, const char *property, const char *value, bool broadcast)
1157 * @brief update a app information db.
1158 And a notification is published to the applications who want to know about changing DB.
1160 * @par Sync (or) Async : Synchronous API.
1164 * @return 0 if success, negative value(<0) if fail\n
1165 * @retval AIL_ERROR_OK success
1166 * @retval AIL_ERROR_FAIL internal error
1167 * @retval AIL_ERROR_INVALID_PARAMETER invalid parameter
1169 * @pre no pre-condition.
1170 * @post app information is removed in the Application Information Database.
1173 * @par Prospective Clients:
1177 static ail_error_e _appinfo_modify_str(const char *appid, const char *property, const char *value, bool broadcast)
1182 return AIL_ERROR_FAIL;
1185 return AIL_ERROR_FAIL;
1188 return AIL_ERROR_FAIL;
1191 ret = ail_desktop_appinfo_modify_str(appid, property, value, broadcast);
1192 if (ret != AIL_ERROR_OK) {
1193 return AIL_ERROR_FAIL;
1196 return AIL_ERROR_OK;
1201 ail_error_e ail_desktop_appinfo_modify_str(const char *appid, const char *property, const char *value, bool broadcast);
1208 #endif /* __cplusplus */
1210 #endif /* __AIL_H__ */