Add rule file in accesses.d folder
[framework/connectivity/bluetooth-share.git] / lib / bluetooth-share-api.h
1 /*
2  * bluetooth-share-api
3  *
4  * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *              http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 #ifndef __DEF_BLUETOOTH_SHARE_API_H_
21 #define __DEF_BLUETOOTH_SHARE_API_H_
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 #include <db-util.h>
28
29 #ifndef EXPORT_API
30 #define EXPORT_API __attribute__((visibility("default")))
31 #endif
32
33 enum {
34         BT_SHARE_ERR_NONE = 0,
35         BT_SHARE_ERR_INTERNAL = -1,
36         BT_SHARE_ERR_INVALID_PARAM = -2,
37         BT_SHARE_ERR_UNKNOWN = -3
38 }bt_share_err_e;
39
40
41 typedef struct {
42         unsigned int id;
43         unsigned int sid;
44         unsigned int tr_status;
45         int timestamp;
46         char *file_path;
47         char *dev_name;
48         char *addr;
49         char *type;
50         char *content;
51 }bt_tr_data_t;
52
53
54 typedef enum {
55         BT_DB_OUTBOUND,
56         BT_DB_INBOUND
57 } bt_tr_db_table_e;
58
59
60 EXPORT_API sqlite3 *bt_share_open_db(void);
61
62 EXPORT_API int bt_share_close_db(sqlite3 *db);
63
64 EXPORT_API int bt_share_add_tr_data(sqlite3 *db, int db_table, bt_tr_data_t *data);
65
66 EXPORT_API int bt_share_update_tr_data(sqlite3 *db, int db_table, int id, bt_tr_data_t *data);
67
68 EXPORT_API bt_tr_data_t *bt_share_get_tr_data(sqlite3 *db, int db_table, int id);
69
70 EXPORT_API GSList *bt_share_get_all_tr_data_list(sqlite3 *db, int db_table);
71
72 EXPORT_API GSList *bt_share_get_completed_tr_data_list(sqlite3 *db, int db_table);
73
74 EXPORT_API GSList *bt_share_get_tr_data_list_by_status(sqlite3 *db, int db_table, int status);
75
76 EXPORT_API unsigned int bt_share_get_last_session_id(sqlite3 *db, int db_table);
77
78 EXPORT_API int bt_share_release_tr_data_list(GSList *list);
79
80 EXPORT_API int bt_share_get_tr_data_count(sqlite3 *db, int db_table);
81
82 EXPORT_API int bt_share_remove_tr_data_by_id(sqlite3 *db, int db_table, int id);
83
84 EXPORT_API int bt_share_remove_tr_data_by_status(sqlite3 *db, int db_table, int status);
85
86 EXPORT_API int bt_share_remove_tr_data_by_notification(sqlite3 *db, int db_table);
87
88 EXPORT_API int bt_share_remove_all_tr_data(sqlite3 *db, int db_table);
89
90
91 #ifdef __cplusplus
92 }
93 #endif
94 #endif                          /* __DEF_BLUETOOTH_SHARE_API_H_ */