upload tizen1.0 source
[pkgs/o/oma-ds-service.git] / include / ServiceEngine / SE_Storage.h
1 /*
2  * oma-ds-service
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: JuHak Park <juhaki.park@samsung.com>,
7  *          JuneHyuk Lee <junhyuk7.lee@samsung.com>,
8  *          SunBong Ha <sunbong.ha@samsung.com>
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License");
11  * you may not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  *
22  */
23
24
25
26
27
28 /*
29  * For any sort of issue you concern as to this software,
30  * you may use following point of contact.
31  * All resources contributed on this software
32  * are orinigally written by S-Core Inc., a member of Samsung Group.
33  *
34  * SeongWon Shim <seongwon.shim@samsung.com>
35  */
36
37 /**
38  *   @SE_Storage.h
39  *   @version                                                                   0.1
40  *   @brief                                                                             This file is the header file of interface which saves and gets sync results
41  */
42
43 #ifndef SE_STORAGE_H_
44 #define SE_STORAGE_H_
45
46
47 #include "Common/Common_Define.h"
48 #include "ServiceEngine/SE_Error.h"
49
50 /**
51  * @par Description: API to save sync type, sync result , last sync time(each datastore)
52  * This API can be used to save sync type, sync result , last sync time at the end of synchronization process
53  *
54  * @par Purpose:
55  * @par Typical use case:
56  * @par Method of function operation:
57  * @par Important notes:
58  * @param[in]           int type, account id
59  * @param[in]           enum type, AlertType
60  * @param[in]           enum type, SyncSessionResult
61  * @param[in]           int time, last sync time
62  *
63  * @return                              SE_INTERNAL_OK on success
64  *                                                      SE_INTERNAL_DA_ERROR on error
65  *
66  * @par Errors:
67  *
68  * @pre None.
69  * @post
70  * @see
71  * @remarks None.
72  *
73  * @par Sample Code:
74  * @code
75  * @endcode
76  */
77 SE_ErrorType write_profile_data(int accountId, AlertType alertType, SyncSessionResult syncSessionResult, int lastSessionTime);
78
79
80 /**
81  * @par Description: API to save sync statistics(each datastore)
82  * This API can be used to save statistics at the end of synchronization process
83  *
84  * @par Purpose:
85  * @par Typical use case:
86  * @par Method of function operation:
87  * @par Important notes:
88  * @param[in]           int type, account id
89  * @param[in]           int type, content type(TYPE_CONTACT,  TYPE_CALENDAR, TYPE_MEMO)
90  * @param[in]           bool type whether from server or from client
91  * @param[in]           SyncResult structure
92  *
93  * @return                              SE_INTERNAL_OK on success
94  *                                                      SE_INTERNAL_DA_ERROR on error
95  *
96  * @par Errors:
97  *
98  * @pre None.
99  * @post
100  * @see
101  * @remarks None.
102  *
103  * @par Sample Code:
104  * @code
105  * @endcode
106  */
107 SE_ErrorType write_sync_statistics(int accountId, int content_type, bool isFromServer, SyncResult *pSyncResult);
108
109
110 /**
111  * @par Description: API to save sync result(each datastore)
112  * This API can be used to save sync result at the end of synchronization process
113  *
114  * @par Purpose:
115  * @par Typical use case:
116  * @par Method of function operation:
117  * @par Important notes:
118  * @param[in]           int type, account id
119  * @param[in]           enum type, AlertType
120  * @param[in]           int type, content type(TYPE_CONTACT,  TYPE_CALENDAR, TYPE_MEMO)
121  * @param[in]           int type, last sync time
122  * @param[in]           SyncResult structure, client
123  * @param[in]           SyncResult structure, server
124  *
125  * @return                              SE_INTERNAL_OK on success
126  *                                                      SE_INTERNAL_DA_ERROR on error
127  *
128  * @par Errors:
129  *
130  * @pre None.
131  * @post
132  * @see
133  * @remarks None.
134  *
135  * @par Sample Code:
136  * @code
137  * @endcode
138  */
139 SE_ErrorType write_sync_resource_info(int accountId, AlertType alertType,
140                 int content_type , int lastSessionTime, SyncResult *clientSyncResult, SyncResult *serverSyncResult);
141
142
143 /**
144  * @par Description: API to get profile name from config_tbl
145  * This API can be used to get profile name
146  * This API is part of API for UI
147  *
148  * @par Purpose:
149  * @par Typical use case:
150  * @par Method of function operation:
151  * @par Important notes:
152  * @param[in]           int type, account id
153  * @param[out]          string type, profile name
154  *
155  * @return                              true on success
156  *                                                      false on error
157  *
158  * @par Errors:
159  *
160  * @pre None.
161  * @post
162  * @see
163  * @remarks None.
164  *
165  * @par Sample Code:
166  * @code
167  * @endcode
168  */
169 bool get_profile_name(int accountId, char **profileName);
170
171 /**
172  * @par Description: API to get profile server information(server ip, id, password) from config_tbl
173  * This API can be used to get server ip, id, password
174  * This API is part of API for UI
175  *
176  * @par Purpose:
177  * @par Typical use case:
178  * @par Method of function operation:
179  * @par Important notes:
180  * @param[in]           int type, account id
181  * @param[out]          string type, server ip
182  * @param[out]          string type, id
183  * @param[out]          string type, password
184  *
185  * @return                              true on success
186  *                                                      false on error
187  *
188  * @par Errors:
189  *
190  * @pre None.
191  * @post
192  * @see
193  * @remarks None.
194  *
195  * @par Sample Code:
196  * @code
197  * @endcode
198  */
199 bool get_profile_server_info(int accountId, char **addr, char **id, char **password);
200
201 /**
202  * @par Description: API to get profile sync mode, type, interval from config_tbl
203  * This API can be used to get sync mode, sync type, interval
204  * This API is part of API for UI
205  *
206  * @par Purpose:
207  * @par Typical use case:
208  * @par Method of function operation:
209  * @par Important notes:
210  * @param[in]           int type, account id
211  * @param[out]          string type, sync mode
212  * @param[out]          string type, sync type
213  * @param[out]          string type, interval
214  *
215  * @return                              true on success
216  *                                                      false on error
217  *
218  * @par Errors:
219  *
220  * @pre None.
221  * @post
222  * @see
223  * @remarks None.
224  *
225  * @par Sample Code:
226  * @code
227  * @endcode
228  */
229 bool get_profile_sync_mode(int accountId, char **syncMode, char **syncType, char **interval);
230
231 /**
232  * @par Description: API to get profile datastore information(enable, source uri, target uri, id, password) from config_tbl
233  * This API can be used to get enable, source uri, target uri, id, password
234  * This API is part of API for UI
235  *
236  * @par Purpose:
237  * @par Typical use case:
238  * @par Method of function operation:
239  * @par Important notes:
240  * @param[in]           int type, account id
241  * @param[in]           int type, content type(TYPE_CONTACT,  TYPE_CALENDAR, TYPE_MEMO)
242  * @param[out]          string type, enabled
243  * @param[out]          string type, source uri
244  * @param[out]          string type, target uri
245  * @param[out]          string type, id
246  * @param[out]          string type, password
247  *
248  * @return                              true on success
249  *                                                      false on error
250  *
251  * @par Errors:
252  *
253  * @pre None.
254  * @post
255  * @see
256  * @remarks None.
257  *
258  * @par Sample Code:
259  * @code
260  * @endcode
261  */
262 bool get_profile_sync_category(int accountId, int contentType,
263                 int *enabled, char **srcURI, char **tgtURI, char **id, char **password);
264
265 /**
266  * @par Description: API to get profile sync results(sync status, sync time) from config_tbl
267  * This API can be used to get profile sync results(sync status, sync time)
268  * This API is part of API for UI
269  *
270  * @par Purpose:
271  * @par Typical use case:
272  * @par Method of function operation:
273  * @par Important notes:
274  * @param[in]           int type, account id
275  * @param[out]          int type, lastSessionStatus
276  * @param[out]          int type, lastSessionTime
277  *
278  * @return                              true on success
279  *                                                      false on error
280  *
281  * @par Errors:
282  *
283  * @pre None.
284  * @post
285  * @see
286  * @remarks None.
287  *
288  * @par Sample Code:
289  * @code
290  * @endcode
291  */
292 bool get_last_session_info(int accountId, int *lastSessionStatus, int *lastSessionTime);
293
294
295 /**
296  * @par Description: API to get profile sync statistics for each content type from config_tbl
297  * This API can be used to get profile sync statistics for each content type
298  * This API is part of API for UI
299  *
300  * @par Purpose:
301  * @par Typical use case:
302  * @par Method of function operation:
303  * @par Important notes:
304  * @param[in]           int type, account id
305  * @param[in]           int type, content type(TYPE_CONTACT,  TYPE_CALENDAR, TYPE_MEMO)
306  * @param[out]          string type, sync result(success, fail, stop)
307  * @param[out]          int type, sync time
308  * @param[out]          int type, total items(server to client)
309  * @param[out]          int type, add items(server to client)
310  * @param[out]          int type, delete items(server to client)
311  * @param[out]          int type, replace items(server to client)
312  * @param[out]          int type, total items(client to server)
313  * @param[out]          int type, add items(client to server)
314  * @param[out]          int type, delete items(client to server)
315  * @param[out]          int type, replace items(client to server)
316  *
317  * @return                              true on success
318  *                                                      false on error
319  *
320  * @par Errors:
321  *
322  * @pre None.
323  * @post
324  * @see
325  * @remarks None.
326  *
327  * @par Sample Code:
328  * @code
329  * @endcode
330  */
331 bool get_profile_statistics(int accountId, int contentType, char **dbSynced, int *lastSessionTime,
332                 int *server2Client_Total, int *server2Client_NrOfAdd, int *server2Client_NrOfDelete, int *server2Client_NrOfReplace,
333                 int *client2Server_Total, int *client2Server_NrOfAdd, int *client2Server_NrOfDelete, int *client2Server_NrOfReplace);
334
335
336 #endif /* SE_STORAGE_H_ */