2 * Copyright (c) 2000 - 2016 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.
19 * @brief RUA API declaration header file.
20 * @author Jinwoo Nam (jwoo.nam@samsung.com)
22 * @history 0.1: RUA API Declarations, structure declaration
32 #include <sys/types.h>
43 #define API __attribute__ ((visibility("default")))
66 * @brief RUA record info structure
69 int id; /**< primary key */
70 char *pkg_name; /**< package name */
71 char *app_path; /**< application path */
72 char *arg; /**< application launching argument */
73 time_t launch_time; /**< application launching time */
74 char *instance_id; /**< Instance ID */
75 char *instance_name; /**< Instance Name */
76 char *icon; /**< Icon path */
77 char *uri; /**< URI */
82 * @param[in] pkg_name package name to delete history
83 * @return 0 on success, otherwise a nagative error value
84 * @retval 0 on successful
85 * @retval -1 on failed
87 API int rua_add_history_for_uid(char *pkg_name, char *app_path, char *arg, uid_t uid);
90 * @brief Delete history with pkg_name
91 * @param[in] pkg_name package name to delete history
92 * @return 0 on success, otherwise a nagative error value
93 * @retval 0 on successful
94 * @retval -1 on failed
96 API int rua_delete_history_with_pkgname(char *pkg_name);
97 API int rua_delete_history_with_pkgname_for_uid(char *pkg_name, uid_t uid);
100 * @brief Delete history with app_path
101 * @param[in] app_path package name to delete history
102 * @return 0 on success, otherwise a nagative error value
103 * @retval 0 on successful
104 * @retval -1 on failed
106 API int rua_delete_history_with_apppath(char *app_path);
107 API int rua_delete_history_with_apppath_for_uid(char *app_path, uid_t uid);
110 * @brief Clear history
111 * @return 0 on success, otherwise a nagative error value
112 * @retval 0 on successful
113 * @retval -1 on failed
115 API int rua_clear_history(void);
116 API int rua_clear_history_for_uid(uid_t uid);
119 * @brief Load recently used application history db.
120 * @param[out] table db table pointer
121 * @param[out] nrows the number of record
122 * @param[out] ncols the number of field
123 * @return 0 on success, otherwise a nagative error value
124 * @retval 0 on successful
125 * @retval -1 on failed
127 API int rua_history_load_db(char ***table, int *nrows, int *ncols);
128 API int rua_history_load_db_for_uid(char ***table, int *nrows, int *ncols, uid_t uid);
131 * @brief Unload recently used application history db.
132 * @param[in] table db table pointer to unload
133 * @return 0 on success, otherwise a nagative error value
134 * @retval 0 on successful
135 * @retval -1 on failed
137 API int rua_history_unload_db(char ***table);
140 * @brief Load recently used application record.
141 * @param[out] rec record to load
142 * @param[in] table db table pointer
143 * @param[in] nrows the number of record
144 * @param[in] ncols the number of field
145 * @param[in] row record index to load
146 * @return 0 on success, otherwise a nagative error value
147 * @retval 0 on successful
148 * @retval -1 on failed
150 API int rua_history_get_rec(struct rua_rec *rec, char **table,
151 int nrows, int ncols, int row);
154 * @brief Check some package is latest or not with package name
155 * @param[in] pkg_name package name
156 * @return 0 on success, otherwise a nagative error value
157 * @retval 0 if given pkg_name is lastest application
158 * @retval -1 if not lastest applicaton or on failed
160 API int rua_is_latest_app(const char *pkg_name);
161 API int rua_is_latest_app_for_uid(const char *pkg_name, uid_t uid);
164 * @brief Delete rua history with instance id
165 * @param[in] app_id The application ID
166 * @param[in] instance_id The instance ID
167 * @return 0 on success, otherwise a negative error value
169 API int rua_delete_history_with_instance_id(const char *app_id,
170 const char *instance_id);
173 * @brief Initialize rua
174 * @return 0 on success, otherwise a nagative error value
175 * @retval 0 on successful
176 * @retval -1 on failed
178 API int rua_init(void);
181 * @brief Finalize rua
182 * @return 0 on success, otherwise a nagative error value
183 * @retval 0 on successful
184 * @retval -1 on failed
186 API int rua_fini(void);