Add new api for subscribing db update callback
[platform/core/appfw/librua.git] / include / rua_stat_internal.h
1 /*
2  * Copyright (c) 2016 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 /**
18  * @file        rua_stat_internal.h
19  * @brief       RUA STATUS INTERNAL API declaration header file.
20  * @author      Hyunho Kang (hhstark.kang@samsung.com)
21  * @version     0.1
22  * @history     0.1: RUA STAT INTERNAL API Declarations, structure declaration
23  */
24
25 #ifndef __RUA_STAT_INTERNAL_H__
26 #define __RUA_STAT_INTERNAL_H__
27
28 #include <sqlite3.h>
29 #include <dlog.h>
30
31 #ifndef API
32 #define API __attribute__ ((visibility("default")))
33 #endif
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39 #ifdef LOG_TAG
40 #undef LOG_TAG
41 #endif
42
43 #define LOG_TAG "RUA"
44
45 #define RUA_STAT_DB_NAME        ".rua_stat.db"
46 #define QUERY_MAXLEN    4096
47 #define WIN_SCORE 100
48 #define LOSE_SCORE_RATE 0.7f
49
50 int _rua_stat_init(sqlite3 **db, char *db_name, int flags, uid_t uid);
51
52 /**
53  * @brief       Add application launch status.
54  * @param[in]   caller, rua_stat_tag
55  * @return      0 on success, otherwise a nagative error value
56  * @retval      0 on successful
57  * @retval      -1 on failed
58  */
59 API int rua_stat_db_update(char *caller, char *rua_stat_tag);
60 API int rua_stat_usr_db_update(char *caller, char *rua_stat_tab, uid_t uid);
61
62 #ifdef __cplusplus
63 }
64 #endif
65 #endif /*__RUA_STAT_INTERNAL_H__*/