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