Add new functions to handling running components
[platform/core/appfw/aul-1.git] / include / aul_rsc_mgr.h
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 #pragma once
18
19 #include <tizen.h>
20 #include <bundle.h>
21 #include <glib.h>
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 /**
28  * @brief Enumeration for Resource Types
29  * @since_tizen 2.4
30  */
31 typedef enum {
32         AUL_RESOURCE_TYPE_IMAGE = 0, /**<Image*/
33         AUL_RESOURCE_TYPE_LAYOUT, /**<Edje*/
34         AUL_RESOURCE_TYPE_SOUND, /**<Sound*/
35         AUL_RESOURCE_TYPE_BIN, /**<Bin*/
36         AUL_RESOURCE_TYPE_MIN = AUL_RESOURCE_TYPE_IMAGE,
37         AUL_RESOURCE_TYPE_MAX = AUL_RESOURCE_TYPE_BIN,
38 /*add values between AUL_RESOURCE_TYPE_MIN and AUL_RESOURCE_TYPE_MAX*/
39 } aul_resource_e;
40
41 /**
42  * @brief Enumeration for Aul Resource Manager Error.
43  * @since_tizen 2.4
44  */
45 typedef enum {
46         AUL_RESOURCE_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
47         AUL_RESOURCE_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
48         AUL_RESOURCE_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
49         AUL_RESOURCE_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< I/O error */
50 } aul_resource_error_e;
51
52 /**
53  * @brief Creates resource manager and get from db.
54  *
55  * @since_tizen 2.4
56  * @remarks If resource manager is already exist,
57  *                      It will just return APP_RESOURCE_ERROR_NONE
58  * @return @c 0 on success,
59  *         otherwise a negative error value
60  * @retval #AUL_RESOURCE_ERROR_NONE Successful
61  * @retval #AUL_RESOURCE_ERROR_IO_ERROR IO Internal I/O Error
62  * @retval #AUL_RESOURCE_ERROR_OUT_OF_MEMORY Out of memeory
63  * @see aul_resource_manager_release()
64  */
65 int aul_resource_manager_init(void);
66
67 /**
68  * @brief Creates resource manager and make valid filelist from given attributes.
69  *
70  * @since_tizen 2.4
71  * @remarks If resource manager is already exist,
72  *                      It will just return APP_RESOURCE_ERROR_NONE
73  *                      This function should called from resource slice tool only.
74  * @param[in] rsc_folder_path path of resource.
75  * @param[in] b bundle which contain attributes about target device.
76  * @return @c 0 on success,
77  *         otherwise a negative error value
78  * @retval #AUL_RESOURCE_ERROR_NONE Successful
79  * @retval #AUL_RESOURCE_ERROR_IO_ERROR IO Internal I/O Error
80  * @retval #AUL_RESOURCE_ERROR_OUT_OF_MEMORY Out of memeory
81  * @see aul_resource_manager_release()
82  */
83 int aul_resource_manager_init_slice(const char *rsc_folder_path, bundle *b);
84
85 /**
86  * @brief Convert resource ID to path name
87  *
88  * @since_tizen 2.4
89  * @remarks If resource manager is not created yet,
90  *                      aul_resource_manager_init() will be invoked automatically.
91  *                      Caller should free the returned pointer.
92  * @param[in] type Resource type @see aul_resource_e
93  * @param[in] id Resource ID
94  * @param[out] path The name of requested resource on success, otherwise NULL
95  * @return @c 0 on success,
96  *         otherwise a negative error value
97  * @retval #AUL_RESOURCE_ERROR_NONE Successful
98  * @retval #AUL_RESOURCE_ERROR_INVALID_PARAMETER Invalid Parameter
99  * @retval #AUL_RESOURCE_ERROR_IO_ERROR Internal I/O Error
100  * @see aul_resource_manager_init()
101  */
102 int aul_resource_manager_get(aul_resource_e type, const char *id, char **path);
103
104 /**
105  * @brief Destroys resource manager.
106  *
107  * @since_tizen 2.4
108  * @remarks Please make sure that the instance of resource manager should be released when the application is closing only.
109  *                      It is highly recommended way to improve run-time performance.
110  * @return @c 0 on success,
111  *         otherwise a negative error value
112  * @retval #AUL_RESOURCE_ERROR_NONE Successful
113  * @see aul_resource_manager_init()
114  */
115 int aul_resource_manager_release(void);
116
117 /**
118  * @brief Get valid file path list.
119  *
120  * @since_tizen 2.4
121  * @remarks Please make sure that the instance of resource manager should be released when the application is closing only.
122  *                      It is highly recommended way to improve run-time performance.
123  * @return @c 0 on success,
124  *         otherwise a negative error value
125  * @retval #AUL_RESOURCE_ERROR_NONE Successful
126  * @see aul_resource_manager_init()
127  */
128 int aul_resource_manager_get_path_list(GHashTable **list);
129
130 /**
131  * @}
132  */
133
134 #ifdef __cplusplus
135 }
136 #endif
137
138