Tizen 2.0 Release
[pkgs/o/oma-ds-service.git] / include / service-engine / se_storage.h
1 /*
2  * oma-ds-agent
3  * Copyright (c) 2012 Samsung Electronics Co., Ltd.
4  *
5  * Licensed under the Apache License, Version 2.0 (the License);
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17
18 /**
19  *   @SE_Storage.h
20  *   @version                                                                   0.1
21  *   @brief                                                                             This file is the header file of interface which saves and gets sync results
22  */
23
24 #ifndef SE_STORAGE_H_
25 #define SE_STORAGE_H_
26
27 #include "common/common_define.h"
28 #include "service-engine/se_error.h"
29
30 /**
31  * @par Description: API to save sync type, sync result , last sync time(each datastore)
32  * This API can be used to save sync type, sync result , last sync time at the end of synchronization process
33  *
34  * @par Purpose:
35  * @par Typical use case:
36  * @par Method of function operation:
37  * @par Important notes:
38  * @param[in]           int type, account id
39  * @param[in]           enum type, AlertType
40  * @param[in]           enum type, sync_session_result_e
41  * @param[in]           int type, last sync time
42  * @param[in]           int type, whether or not tn end in pkg4
43  *
44  * @return                              SE_INTERNAL_OK on success
45  *                                                      SE_INTERNAL_DA_ERROR on error
46  *
47  * @par Errors:
48  *
49  * @pre None.
50  * @post
51  * @see
52  * @remarks None.
53  *
54  * @par Sample Code:
55  * @code
56  * @endcode
57  */
58 se_error_type_e write_profile_data(int account_id, alert_type_e alert_type, sync_session_result_e sync_session_result, int last_session_time, int only_from_client);
59
60 /**
61  * @par Description: API to save sync statistics(each datastore)
62  * This API can be used to save statistics at the end of synchronization process
63  *
64  * @par Purpose:
65  * @par Typical use case:
66  * @par Method of function operation:
67  * @par Important notes:
68  * @param[in]           int type, account id
69  * @param[in]           int type, content type(TYPE_CONTACT,  TYPE_CALENDAR, TYPE_MEMO)
70  * @param[in]           bool type whether from server or from client
71  * @param[in]           sync_result_s structure
72  *
73  * @return                              SE_INTERNAL_OK on success
74  *                                                      SE_INTERNAL_DA_ERROR on error
75  *
76  * @par Errors:
77  *
78  * @pre None.
79  * @post
80  * @see
81  * @remarks None.
82  *
83  * @par Sample Code:
84  * @code
85  * @endcode
86  */
87 se_error_type_e write_sync_statistics(int account_id, int content_type, bool is_from_server, sync_result_s * sync_result);
88
89 /**
90  * @par Description: API to save sync result(each datastore)
91  * This API can be used to save sync result at the end of synchronization process
92  *
93  * @par Purpose:
94  * @par Typical use case:
95  * @par Method of function operation:
96  * @par Important notes:
97  * @param[in]           int type, account id
98  * @param[in]           int type, content type(TYPE_CONTACT,  TYPE_CALENDAR, TYPE_MEMO)
99  * @param[in]           int type, last sync time
100  * @param[in]           int type, whether or not to end in pkg4
101  * @param[in]           sync_result_s structure, client
102  * @param[in]           sync_result_s structure, server
103  *
104  * @return                              SE_INTERNAL_OK on success
105  *                                                      SE_INTERNAL_DA_ERROR on error
106  *
107  * @par Errors:
108  *
109  * @pre None.
110  * @post
111  * @see
112  * @remarks None.
113  *
114  * @par Sample Code:
115  * @code
116  * @endcode
117  */
118 se_error_type_e write_sync_resource_info(int account_id, int content_type, int last_session_time, int only_from_client, sync_result_s * client_sync_result, sync_result_s * server_sync_result);
119
120 /**
121  * @par Description: API to get profile data from config_tbl
122  * This API can be used to get profile data
123  * This API is part of API for UI
124  *
125  * @par Purpose:
126  * @par Typical use case:
127  * @par Method of function operation:
128  * @par Important notes:
129  * @param[in]           int type, account id
130  * @param[out]          string type, profile name
131  * @param[out]          string type, server ip
132  * @param[out]          string type, id
133  * @param[out]          string type, password
134  * @param[out]          string type, sync mode
135  * @param[out]          string type, sync type
136  * @param[out]          string type, interval
137  * @param[out]          int type, last_session_status
138  * @param[out]          int type, last_session_time
139  *
140  *
141  * @return                              true on success
142  *                                                      false on error
143  *
144  * @par Errors:
145  *
146  * @pre None.
147  * @post
148  * @see
149  * @remarks None.
150  *
151  * @par Sample Code:
152  * @code
153  * @endcode
154  */
155 bool get_profile_data(int account_id, char **profile_name, char **addr, char **id, char **password, char **sync_mode, char **sync_type, char **interval, int *last_session_status, int *last_session_time);
156
157 /**
158  * @par Description: API to get profile datastore information(enable, source uri, target uri, id, password) from config_tbl
159  * This API can be used to get enable, source uri, target uri, id, password
160  * This API is part of API for UI
161  *
162  * @par Purpose:
163  * @par Typical use case:
164  * @par Method of function operation:
165  * @par Important notes:
166  * @param[in]           int type, account id
167  * @param[in]           int type, content type(TYPE_CONTACT,  TYPE_CALENDAR, TYPE_MEMO)
168  * @param[out]          string type, enabled
169  * @param[out]          string type, source uri
170  * @param[out]          string type, target uri
171  * @param[out]          string type, id
172  * @param[out]          string type, password
173  *
174  * @return                              true on success
175  *                                                      false on error
176  *
177  * @par Errors:
178  *
179  * @pre None.
180  * @post
181  * @see
182  * @remarks None.
183  *
184  * @par Sample Code:
185  * @code
186  * @endcode
187  */
188 bool get_profile_sync_category(int account_id, int content_type, int *enabled, char **src_uri, char **tgt_uri, char **id, char **password);
189
190 /**
191  * @par Description: API to get profile sync statistics for each content type from config_tbl
192  * This API can be used to get profile sync statistics for each content type
193  * This API is part of API for UI
194  *
195  * @par Purpose:
196  * @par Typical use case:
197  * @par Method of function operation:
198  * @par Important notes:
199  * @param[in]           int type, account id
200  * @param[in]           int type, content type(TYPE_CONTACT,  TYPE_CALENDAR, TYPE_MEMO)
201  * @param[out]          string type, sync result(success, fail, stop)
202  * @param[out]          int type, sync time
203  * @param[out]          int type, total items(server to client)
204  * @param[out]          int type, add items(server to client)
205  * @param[out]          int type, delete items(server to client)
206  * @param[out]          int type, replace items(server to client)
207  * @param[out]          int type, total items(client to server)
208  * @param[out]          int type, add items(client to server)
209  * @param[out]          int type, delete items(client to server)
210  * @param[out]          int type, replace items(client to server)
211  *
212  * @return                              true on success
213  *                                                      false on error
214  *
215  * @par Errors:
216  *
217  * @pre None.
218  * @post
219  * @see
220  * @remarks None.
221  *
222  * @par Sample Code:
223  * @code
224  * @endcode
225  */
226 bool get_profile_statistics(int account_id, int content_type, char **dbSynced, int *last_session_time,
227                             int *server2client_total, int *server2client_nrofadd, int *server2client_nrofdelete, int *server2client_nrofreplace,
228                             int *client2server_total, int *client2server_nrofadd, int *client2server_nrofdelete, int *client2server_nrofreplace);
229
230 /**
231  * @par Description: API to get all profiles data from config_tbl
232  * This API can be used to get all profiles data
233  * This API is part of API for UI
234  *
235  * @par Purpose:
236  * @par Typical use case:
237  * @par Method of function operation:
238  * @par Important notes:
239  * @param[out]          GList, all profiles data
240  *
241  *
242  * @return                              true on success
243  *                                                      false on error
244  *
245  * @par Errors:
246  *
247  * @pre None.
248  * @post
249  * @see
250  * @remarks None.
251  *
252  * @par Sample Code:
253  * @code
254  * @endcode
255  */
256 bool get_all_profiles_data(GList ** list);
257
258 #endif                          /* SE_STORAGE_H_ */