upload tizen1.0 source
[pkgs/o/oma-ds-service.git] / include / ServiceEngine / SE_Sync.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_Sync.h
39  *   @version                                                                   0.1
40  *   @brief                                                                             This file is the header file of interface of Service Engine
41  */
42
43 #ifndef SYNCENGINE_H_
44 #define SYNCENGINE_H_
45
46 #include <stdbool.h>
47 #include "Common/Common_Define_Internal.h"
48 #include "ServiceEngine/SE_Common.h"
49 #include "Framework/SAN_parser/PM_SanParser.h"
50 #include "ServiceEngine/SE_Error.h"
51
52 /**
53  * @par Description: API to process synchronization request
54  * This API can be used to process synchronization by predefined profile information
55  * This API uses Notification and Storage API which for notifying synchronization status to UI and saving sync results to Agent DB
56  *
57  * @par Purpose:
58  * @par Typical use case:
59  * @par Method of function operation:
60  * @par Important notes:
61  * @param[in]           int type, account id
62  * @param[in]           string type, sync mode(manual, push(SAN), periodic)
63  * @param[in]           SanPackage structure, only for SAN sync mode
64
65  * @return                              true on success, false on error
66  *
67  * @par Errors:
68  *
69  * @pre None.
70  * @post
71  * @see
72  * @remarks None.
73  *
74  * @par Sample Code:
75  * @code
76 int main()
77 {
78         bool ret = 0;
79         ret = synchronize(accountId, syncMode, pSanPackage);
80         if (ret == true)
81         {
82                 //synchronization success
83         }
84         else
85         {
86                 //synchronization fail
87         }
88
89         return 0;
90 }
91  * @endcode
92  */
93 bool synchronize(int accountId, char *syncMode, SanPackage *pSanPackage);
94
95
96 /**
97  * @par Description: API to convert SyncProgress and SyncError from common error code
98  * This API can be used to convert string to be used to notify to UI for sync results
99  *
100  * @par Purpose:
101  * @par Typical use case:
102  * @par Method of function operation:
103  * @par Important notes:
104  * @param[in]           enum type, Common_ErrorType
105  * @param[out]          enum type, SyncProgress
106  * @param[out]          enum type, SyncError
107  *
108  * @return
109  *
110  * @par Errors:
111  *
112  * @pre None.
113  * @post
114  * @see
115  * @remarks None.
116  *
117  * @par Sample Code:
118  * @code
119  * @endcode
120  */
121 void convert_common_errorcode(Common_ErrorType errorCode, SyncProgress *process, SyncError *error);
122
123
124 /**
125  * @par Description: API to convert SyncProgress and SyncError from engine error code
126  * This API can be used to convert string to be used to notify to UI for sync results
127  *
128  * @par Purpose:
129  * @par Typical use case:
130  * @par Method of function operation:
131  * @par Important notes:
132  * @param[in]           enum type, SE_ErrorType
133  * @param[out]          enum type, SyncProgress
134  * @param[out]          enum type, SyncError
135  *
136  * @return
137  *
138  * @par Errors:
139  *
140  * @pre None.
141  * @post
142  * @see
143  * @remarks None.
144  *
145  * @par Sample Code:
146  * @code
147  * @endcode
148  */
149 void convert_engine_errorcode(SE_ErrorType err, SyncProgress *process, SyncError *error);
150
151
152 /**
153  * @par Description: API to notify sync results for specific profile to UI
154  * This API can be used to notify sync results(SyncProgress, SyncError) to UI
155  * This API uses Notification which for notification module to send data using IPC
156  *
157  *
158  * @par Purpose:
159  * @par Typical use case:
160  * @par Method of function operation:
161  * @par Important notes:
162  * @param[in]           string type, syncDirName(identify profile in UI)
163  * @param[in]           enum type, SyncProgress
164  * @param[in]           enum type, SyncError
165  *
166  * @return                      SE_INTERNAL_OK on success
167  *                                              SE_INTERNAL_NOT_DEFINED, SE_INTERNAL_NO_MEMORY, SE_INTERNAL_EVENT_ERROR  on error
168  *
169  * @par Errors:
170  *
171  * @pre None.
172  * @post
173  * @see
174  * @remarks None.
175  *
176  * @par Sample Code:
177  * @code
178  * @endcode
179  */
180 SE_ErrorType session_process(char *profileDirName, SyncProgress process, SyncError error);
181
182
183 /**
184  * @par Description: API to reset all synchronizing profiles(off) & construct item_tbl from service for in case
185  *
186  * @par Purpose:
187  * @par Typical use case:
188  * @par Method of function operation:
189  * @par Important notes:
190  *
191  * @return                      SE_INTERNAL_OK on success
192  *                                              SE_INTERNAL_DA_ERROR  on error
193  *
194  * @par Errors:
195  *
196  * @pre None.
197  * @post
198  * @see
199  * @remarks None.
200  *
201  * @par Sample Code:
202  * @code
203  * @endcode
204  */
205 SE_ErrorType reset_synchronizing_profiles();
206
207
208 /**
209  * @par Description: API to refresh from service for all contents type
210  *
211  * @par Purpose:
212  * @par Typical use case:
213  * @par Method of function operation:
214  * @par Important notes:
215  * @param[in]           int type, account id
216  *
217  * @return                              true on success,
218  *                                                      false on error
219  *
220  * @par Errors:
221  *
222  * @pre None.
223  * @post
224  * @see
225  * @remarks None.
226  *
227  * @par Sample Code:
228  * @code
229  * @endcode
230  */
231 bool refresh_from_service_all(int accountId);
232
233
234 /*FIXME cancel request to NA */
235 /*SE_ErrorType cancel_sync_request();*/
236
237 #endif /* SYNCENGINE_H_ */