2 * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef __AUL_RESOURCE_MANAGER_H__
18 #define __AUL_RESOURCE_MANAGER_H__
29 * @brief Enumeration for Resource Types
33 AUL_RESOURCE_TYPE_IMAGE = 0, /**<Image*/
34 AUL_RESOURCE_TYPE_LAYOUT, /**<Edje*/
35 AUL_RESOURCE_TYPE_SOUND, /**<Sound*/
36 AUL_RESOURCE_TYPE_BIN, /**<Bin*/
37 AUL_RESOURCE_TYPE_MIN = AUL_RESOURCE_TYPE_IMAGE,
38 AUL_RESOURCE_TYPE_MAX = AUL_RESOURCE_TYPE_BIN,
39 /*add values between AUL_RESOURCE_TYPE_MIN and AUL_RESOURCE_TYPE_MAX*/
43 * @brief Enumeration for Aul Resource Manager Error.
47 AUL_RESOURCE_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
48 AUL_RESOURCE_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
49 AUL_RESOURCE_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
50 AUL_RESOURCE_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< I/O error */
51 } aul_resource_error_e;
54 * @brief Creates resource manager and get from db.
57 * @remarks If resource manager is already exist,
58 * It will just return APP_RESOURCE_ERROR_NONE
59 * @return @c 0 on success,
60 * otherwise a negative error value
61 * @retval #AUL_RESOURCE_ERROR_NONE Successful
62 * @retval #AUL_RESOURCE_ERROR_IO_ERROR IO Internal I/O Error
63 * @retval #AUL_RESOURCE_ERROR_OUT_OF_MEMORY Out of memeory
64 * @see aul_resource_manager_release()
66 int aul_resource_manager_init(void);
69 * @brief Creates resource manager and make valid filelist from given attributes.
72 * @remarks If resource manager is already exist,
73 * It will just return APP_RESOURCE_ERROR_NONE
74 * This function should called from resource slice tool only.
75 * @param[in] rsc_folder_path path of resource.
76 * @param[in] b bundle which contain attributes about target device.
77 * @return @c 0 on success,
78 * otherwise a negative error value
79 * @retval #AUL_RESOURCE_ERROR_NONE Successful
80 * @retval #AUL_RESOURCE_ERROR_IO_ERROR IO Internal I/O Error
81 * @retval #AUL_RESOURCE_ERROR_OUT_OF_MEMORY Out of memeory
82 * @see aul_resource_manager_release()
84 int aul_resource_manager_init_slice(const char *rsc_folder_path, bundle *b);
87 * @brief Convert resource ID to path name
90 * @remarks If resource manager is not created yet,
91 * aul_resource_manager_init() will be invoked automatically.
92 * Caller should free the returned pointer.
93 * @param[in] type Resource type @see aul_resource_e
94 * @param[in] id Resource ID
95 * @param[out] path The name of requested resource on success, otherwise NULL
96 * @return @c 0 on success,
97 * otherwise a negative error value
98 * @retval #AUL_RESOURCE_ERROR_NONE Successful
99 * @retval #AUL_RESOURCE_ERROR_INVALID_PARAMETER Invalid Parameter
100 * @retval #AUL_RESOURCE_ERROR_IO_ERROR Internal I/O Error
101 * @see aul_resource_manager_init()
103 int aul_resource_manager_get(aul_resource_e type, const char *id, char **path);
106 * @brief Destroys resource manager.
109 * @remarks Please make sure that the instance of resource manager should be released when the application is closing only.
110 * It is highly recommended way to improve run-time performance.
111 * @return @c 0 on success,
112 * otherwise a negative error value
113 * @retval #AUL_RESOURCE_ERROR_NONE Successful
114 * @see aul_resource_manager_init()
116 int aul_resource_manager_release(void);
119 * @brief Get valid file path list.
122 * @remarks Please make sure that the instance of resource manager should be released when the application is closing only.
123 * It is highly recommended way to improve run-time performance.
124 * @return @c 0 on success,
125 * otherwise a negative error value
126 * @retval #AUL_RESOURCE_ERROR_NONE Successful
127 * @see aul_resource_manager_init()
129 int aul_resource_manager_get_path_list(GHashTable **list);
139 #endif /* __AUL_RESOURCE_MANAGER_H__ */